Sha256: 5e8e12fac5dcee28c2422923a2bf2b999b8f22fa06793d1b3e5dd963ba721dbe
Contents?: true
Size: 1.08 KB
Versions: 12
Compression:
Stored size: 1.08 KB
Contents
module Orly module Installation HOOK_PATH = File.join ".git", "hooks", "post-merge" HOOK_DIR = File.join ".git", "hooks" HOOK_CONTENT = <<END #!/bin/sh orly --run END 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 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 end end
Version data entries
12 entries across 12 versions & 1 rubygems