Class: Hooky::CLI
- Inherits:
-
Thor
- Object
- Thor
- Hooky::CLI
- Defined in:
- lib/hooky/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
7 |
# File 'lib/hooky/cli.rb', line 7 def self.exit_on_failure?() true end |
Instance Method Details
#hook(hook) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/hooky/cli.rb', line 15 def hook(hook) h = Hooky::Hook.new(hook) puts "Running hook #{hook}..." puts h.send_request # puts h.config_file # puts h.data_file end |
#init ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hooky/cli.rb', line 26 def init require "fileutils" unless (example_dir = Pathname.new(File.(".hooky/example"))).exist? example_dir.mkpath Pathname.new(File.("templates/example_hook", __dir__)).each_child do |sample_hook| FileUtils.cp sample_hook, example_dir, preserve: true end puts "Created example hook in .hooky/example" end if (binstub = Pathname.new(File.("bin/hooky"))).exist? puts "Binstub already exists in bin/hooky (remove first to create a new one)" else puts "Adding hookyrb to Gemfile and bundle..." `bundle add hooky --group "development, test"` `bundle binstubs hooky` puts "Created binstub file in bin/hooky" end end |
#list ⇒ Object
10 11 12 |
# File 'lib/hooky/cli.rb', line 10 def list puts Hooky::Hook.all end |
#version ⇒ Object
50 51 52 |
# File 'lib/hooky/cli.rb', line 50 def version puts Hooky::VERSION end |