module Orly::Installation

Constants

HOOK_CONTENT
HOOK_DIR
HOOK_PATH

Public Class Methods

install() click to toggle source
# File lib/orly/installation.rb, line 11
def self.install
    if not File.directory?(".git")
      puts "You don't appear to be in the base directory of a git project.".red
      exit 1
    end

    Dir.mkdir(HOOK_DIR) unless File.directory?(HOOK_DIR)

    if File.exists? HOOK_PATH
      puts "A post-merge hook already exists for this project.".red
      exit 1
    end

    File.open(HOOK_PATH, 'w') {|f| f.write(HOOK_CONTENT) }
    FileUtils.chmod 0755, HOOK_PATH
    puts "installed O RLY hook as:".green
    puts "  -> #{File.expand_path(HOOK_PATH)}".green
    puts "(to remove later, you can use: orly --uninstall)"
end
uninstall() click to toggle source
# File lib/orly/installation.rb, line 31
def self.uninstall
  if File.exists? HOOK_PATH
    FileUtils.rm HOOK_PATH
    puts "uninstalled #{HOOK_PATH}".green
  else
    puts "O RLY is not enabled for this directory, so there is nothing to uninstall.".yellow
  end
end