Class: Commands
Defined Under Namespace
Modules: ConsoleMethods
Instance Method Summary collapse
- #destroy(argv = nil) ⇒ Object
- #generate(argv = nil) ⇒ Object
-
#initialize ⇒ Commands
constructor
A new instance of Commands.
- #rake(task, *args) ⇒ Object
-
#test(what = nil) ⇒ Object
FIXME: Turn this into calls directly to the test classes, so we don’t have to load environment again.
- #update(argv = nil) ⇒ Object
Constructor Details
#initialize ⇒ Commands
Returns a new instance of Commands.
15 16 17 18 |
# File 'lib/commands.rb', line 15 def initialize load Rails.root.join('Rakefile') Rails.application.load_generators end |
Instance Method Details
#destroy(argv = nil) ⇒ Object
53 54 55 |
# File 'lib/commands.rb', line 53 def destroy(argv = nil) generator :destroy, argv end |
#generate(argv = nil) ⇒ Object
45 46 47 |
# File 'lib/commands.rb', line 45 def generate(argv = nil) generator :generate, argv end |
#rake(task, *args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/commands.rb', line 20 def rake(task, *args) silence_active_record_logger { Rake::Task[task].invoke(*args) } # Rake by default only allows tasks to be run once per session Rake.application.tasks.each(&:reenable) "Completed" rescue SystemExit # Swallow exit/abort calls as we'll never want to exit the IRB session "Failed" end |
#test(what = nil) ⇒ Object
FIXME: Turn this into calls directly to the test classes, so we don’t have to load environment again. Also need to toggle the environment to test and back to dev after running.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/commands.rb', line 34 def test(what = nil) case what when NilClass, :all rake "test:units" when String ENV['TEST'] = "test/#{what}_test.rb" rake "test:single" ENV['TEST'] = nil end end |
#update(argv = nil) ⇒ Object
49 50 51 |
# File 'lib/commands.rb', line 49 def update(argv = nil) generator :update, argv end |