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 = nil, *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_rake_tasks load_rails_generators end |
Instance Method Details
#destroy(argv = nil) ⇒ Object
56 57 58 |
# File 'lib/commands.rb', line 56 def destroy(argv = nil) generator :destroy, argv end |
#generate(argv = nil) ⇒ Object
48 49 50 |
# File 'lib/commands.rb', line 48 def generate(argv = nil) generator :generate, argv end |
#rake(task = nil, *args) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/commands.rb', line 20 def rake(task = nil, *args) task.nil? ? print_rake_tasks : invoke_rake_task(task, *args) "Completed" rescue SystemExit, RuntimeError "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.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/commands.rb', line 29 def test(what = nil) forking do case what when NilClass print_test_usage when "all" rake "test" when /^[^\/]+$/ # models rake "test:#{what}" when /[\/]+/ # models/person ENV['TEST'] = "test/#{what}_test.rb" rake "test:single" ENV['TEST'] = nil end end "Completed" end |
#update(argv = nil) ⇒ Object
52 53 54 |
# File 'lib/commands.rb', line 52 def update(argv = nil) generator :update, argv end |