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(hooks = []) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/githooks/cli.rb', line 90 def execute(hooks = []) GitHooks.verbose = ['verbose'] GitHooks.debug = ['debug'] opts = .dup if opts['tracked'] || opts['untracked'] || opts['unstaged'] opts['staged'] = false end opts['skip-bundler'] ||= !!ENV['GITHOOKS_SKIP_BUNDLER'] opts['hook'] = hooks unless hooks.empty? 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 |