Class: Magicspec::CLI
- Inherits:
-
Thor
- Object
- Thor
- Magicspec::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/magicspec/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #c ⇒ Object
- #new(name) ⇒ Object
- #new_page(name) ⇒ Object
-
#new_spec(name) ⇒ Object
Could probably stand to DRY this up a bit, but it works fine.
- #start ⇒ Object
Class Method Details
.source_paths ⇒ Object
11 12 13 |
# File 'lib/magicspec/cli.rb', line 11 def self.source_paths [source_root + '/generators', source_root + '/templates'] end |
.source_root ⇒ Object
7 8 9 |
# File 'lib/magicspec/cli.rb', line 7 def self.source_root File.join File.dirname(__FILE__) end |
Instance Method Details
#c ⇒ Object
34 35 36 |
# File 'lib/magicspec/cli.rb', line 34 def c run 'bin/console' end |
#new(name) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/magicspec/cli.rb', line 16 def new(name) @name = name if name directory 'magicspec', name else say 'no app name' end end |
#new_page(name) ⇒ Object
39 40 41 42 |
# File 'lib/magicspec/cli.rb', line 39 def new_page(name) @name = name template('template_page.rb.tt', "./app/pages/#{name}_page.rb") end |
#new_spec(name) ⇒ Object
Could probably stand to DRY this up a bit, but it works fine.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/magicspec/cli.rb', line 53 def new_spec(name) @name = name case ["type"].downcase when "browser" template('browser_spec_template.rb.tt', "./app/spec/#{name}_spec.rb") when "webservice" template('web_service_template.rb.tt', "./app/spec/#{name}_spec.rb") when "plain" template('plain_template.rb.tt', "./app/spec/#{name}_spec.rb") when "mobile" template('mobile_template.rb.tt', "./app/spec/#{name}_spec.rb") else say "Sorry :(. I'm not sure what you're trying to do?" end end |
#start ⇒ Object
26 27 28 29 30 |
# File 'lib/magicspec/cli.rb', line 26 def start ARGV.shift puts "rspec #{ARGV.join('')}" if $debug run "LOCAL=true rspec" end |