Class: ActiveWrapper::Tasks
- Inherits:
-
Object
- Object
- ActiveWrapper::Tasks
- Defined in:
- lib/active_wrapper/tasks.rb
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ Tasks
constructor
A new instance of Tasks.
Constructor Details
#initialize(options = {}, &block) ⇒ Tasks
Returns a new instance of Tasks.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/active_wrapper/tasks.rb', line 6 def initialize(={}, &block) task :environment do $db, $log = ActiveWrapper.setup() yield if block end namespace :db do desc "Create the database" task :create => :environment do $db.create_db end desc "Drop the database" task :drop => :environment do $db.drop_db end desc "Migrate the database with optional VERSION" task :migrate => :environment do $db.migrate(ENV["VERSION"] ? ENV["VERSION"].to_i : nil) end desc "Generate a migration with given NAME" task :migration => :environment do $db.generate_migration(ENV['NAME']) end end namespace :log do desc "Clear all logs" task :clear => :environment do $log.clear end end end |