Class: Cardio::Commands
- Inherits:
-
Object
- Object
- Cardio::Commands
- Includes:
- Custom
- Defined in:
- lib/cardio/commands.rb,
lib/cardio/commands/custom.rb,
lib/cardio/commands/command.rb,
lib/cardio/commands/rake_command.rb,
lib/cardio/commands/rspec_command.rb,
lib/cardio/commands/rspec_command/parser.rb
Overview
manage different types of commands that can be run via bin/card (and bin/decko)
Defined Under Namespace
Modules: Custom Classes: Command, RakeCommand, RspecCommand
Class Attribute Summary collapse
-
.current ⇒ Object
Returns the value of attribute current.
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Class Method Summary collapse
Instance Method Summary collapse
- #gem ⇒ Object
-
#initialize(args) ⇒ Commands
constructor
TODO: review the following.
- #map ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Commands
TODO: review the following. see if any work well enough to include
application Generate the Rails application code
destroy Undo code generated with "generate" (short-cut alias: "d")
benchmarker See how fast a piece of code runs
profiler Get profile information from a piece of code
plugin Install a plugin
jasmine
47 48 49 50 51 52 53 |
# File 'lib/cardio/commands.rb', line 47 def initialize args @args = args @command = command_for_key args.first&.to_sym ENV["PRY_RESCUE_RAILS"] = "1" if rescue? @args.shift unless handler == :rails Commands.current = self end |
Class Attribute Details
.current ⇒ Object
Returns the value of attribute current.
13 14 15 |
# File 'lib/cardio/commands.rb', line 13 def current @current end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
10 11 12 |
# File 'lib/cardio/commands.rb', line 10 def args @args end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
10 11 12 |
# File 'lib/cardio/commands.rb', line 10 def command @command end |
Class Method Details
.gem ⇒ Object
15 16 17 |
# File 'lib/cardio/commands.rb', line 15 def gem current&.gem end |
Instance Method Details
#gem ⇒ Object
55 56 57 |
# File 'lib/cardio/commands.rb', line 55 def gem "card" end |
#map ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cardio/commands.rb', line 20 def map @map ||= { new: { desc: "create a new deck", group: :shark, via: :call }, seed: { desc: "populate a database", group: :shark, via: :rake }, update: { desc: "run data updates", group: :shark, alias: :u, via: :rake }, version: { desc: "#{gem} gem version", group: :shark, alias: :v, via: :call }, help: { desc: "show this text", group: :shark, alias: :h, via: :call}, console: { desc: "start a ruby console", group: :monkey, alias: :c }, dbconsole: { desc: "start a database console", group: :monkey, alias: :db }, runner: { desc: "run code in app environment", group: :monkey, alias: :r }, rspec: { desc: "run rspec tests", group: :monkey, alias: :rs, via: :call }, generate: { desc: "generate templated code", group: :monkey, alias: :g }, poop: { desc: "export card data to mod yaml", group: :monkey, via: :rake }, eat: { desc: "ingest card data from mod yaml", group: :monkey, via: :rake } } end |
#run ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/cardio/commands.rb', line 59 def run case handler when :rails run_rails when :rake run_rake when :call send "run_#{command}" when :unknown unknown_error end exit 0 end |