rake tasks

This commit is contained in:
John Bintz 2012-02-14 09:28:28 -05:00
parent 755954f1bf
commit 9552d1d2c5
2 changed files with 27 additions and 0 deletions

View File

@ -35,6 +35,12 @@ In the consumer (Frontend):
``` ruby
require 'vegetable_glue/cucumber'
```
* Then add this to the `config/environments/<environment>.rb` file that Cucumbers runs under:
``` ruby
require 'vegetable_glue'
VegetableGlue.url = 'http://localhost:6161/' #=> include the port in here, too, that's where the app will run
VegetableGlue.path = '../path/to/the/app'
@ -44,6 +50,8 @@ The app will clean its database on each scenario. To restart the app, pass in th
REGLUE=true bundle exec cucumber
Or, use one of the Rake tasks: `vegetable:unglue` to shut down and `vegetable:reglue` to shutdown, then clean.
If you're using ActiveResource, a good source of the URL is `ActiveResource::Base.site`.
## Contributing

View File

@ -28,5 +28,24 @@ module VegetableGlue
{ :url => url, :path => path, :env => env }
end
end
if defined?(::Rails) && defined?(::Rails::Railtie)
class Railtie < ::Rails::Railtie
rake_tasks do
self.class.send(:include, Rake::DSL)
desc "Stop the dependent application"
task "vegetable:unglue" => :environment do
VegetableGlue.shutdown
end
desc "Restart the dependent application"
task "vegetable:reglue" => :environment do
VegetableGlue.shutdown
VegetableGlue.clean
end
end
end
end
end