Class: Boppers::CLI
- Inherits:
-
Thor
- Object
- Thor
- Boppers::CLI
- Defined in:
- lib/boppers/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
7 8 9 |
# File 'lib/boppers/cli.rb', line 7 def self.exit_on_failure? true end |
Instance Method Details
#app(name) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/boppers/cli.rb', line 57 def app(name) require "boppers/generator/app" base_path = File.(name) generator = Generator::App.new generator.destination_root = base_path generator.invoke_all end |
#plugin(name) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/boppers/cli.rb', line 36 def plugin(name) require "boppers/generator/plugin" unless %w[bopper notifier].include?([:type]) = "ERROR: --type needs to be either 'bopper' or 'notifier'" shell.error shell.set_color(, :red) exit 1 end suffix = "-notifier" if [:type] == "notifier" base_path = File.dirname(File.(name)) base_name = "boppers-#{File.basename(name)}#{suffix}" generator = Generator::Plugin.new generator.plugin_type = [:type] generator.destination_root = File.join(base_path, base_name) generator.invoke_all end |
#setup(name) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/boppers/cli.rb', line 69 def setup(name) file = File.("../../setup/#{name}.rb", __dir__) unless File.file?(file) = "ERROR: invalid setup name." shell.error shell.set_color(, :red) exit 1 end require file Setup.call(shell) end |
#start ⇒ Object
18 19 20 21 |
# File 'lib/boppers/cli.rb', line 18 def start require [:require] Runner.new.call end |
#version ⇒ Object
26 27 28 |
# File 'lib/boppers/cli.rb', line 26 def version say "Boppers v#{VERSION}" end |