Class: GitHooks::CLI::Base
Overview
rubocop:disable AbcSize
Instance Method Summary collapse
Instance Method Details
#attach ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/githooks/cli.rb', line 36 def attach GitHooks.verbose = !!['verbose'] GitHooks.debug = !!['debug'] unless ['script'] || ['hooks-path'] fail ArgumentError, %q"Neither 'path' nor 'script' were specified - please provide at least one." end Runner.new(.dup).attach end |
#detach ⇒ Object
57 58 59 60 61 |
# File 'lib/githooks/cli.rb', line 57 def detach GitHooks.verbose = !!['verbose'] GitHooks.debug = !!['debug'] Runner.new(.dup).detach(['hooks']) end |
#execute ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/githooks/cli.rb', line 89 def execute GitHooks.verbose = ['verbose'] GitHooks.debug = ['debug'] opts = .dup opts['staged'] ||= !(opts['tracked'] || opts['untracked']) if opts['staged'] if opts['tracked'] warn '--tracked conflicts with --staged. Dropping --tracked...' opts['tracked'] = false elsif opts['untracked'] warn '--untracked conflicts with --staged. Dropping --untracked...' opts['untracked'] = false end end opts['skip-bundler'] ||= !!ENV['GITHOOKS_SKIP_BUNDLER'] Runner.new(opts).run end |
#list ⇒ Object
67 68 69 70 71 |
# File 'lib/githooks/cli.rb', line 67 def list GitHooks.verbose = !!['verbose'] GitHooks.debug = !!['debug'] Runner.new(.dup).list end |
#version ⇒ Object
15 16 17 18 19 20 |
# File 'lib/githooks/cli.rb', line 15 def version puts "GitHooks: #{GitHooks::VERSION}" puts "Git : #{%x{git --version | grep git}.split(/\s+/).last}" puts "Bundler : #{Bundler::VERSION}" puts "Ruby : #{RUBY_ENGINE} #{RUBY_VERSION}p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})" end |