Sha256: 43a5c98c0277628f93f8f3361ef0e6302499f2fba05c791c5ba9150e48b61989

Contents?: true

Size: 1.02 KB

Versions: 27

Compression:

Stored size: 1.02 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../active_wrapper")

module ActiveWrapper
  class Tasks
    
    def initialize(options={}, &block)
      
      task :environment do
        $db, $log = ActiveWrapper.setup(options)
        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
  end
end

Version data entries

27 entries across 27 versions & 4 rubygems

Version Path
winton-active_wrapper-0.2.0 lib/active_wrapper/tasks.rb
active_wrapper-solo-0.4.6 lib/active_wrapper/tasks.rb
active_wrapper-ar2-0.4.6 lib/active_wrapper/tasks.rb
active_wrapper-0.4.6 lib/active_wrapper/tasks.rb
active_wrapper-solo-0.4.5 lib/active_wrapper/tasks.rb
active_wrapper-ar2-0.4.5 lib/active_wrapper/tasks.rb
active_wrapper-0.4.5 lib/active_wrapper/tasks.rb
active_wrapper-solo-0.4.4 lib/active_wrapper/tasks.rb
active_wrapper-ar2-0.4.4 lib/active_wrapper/tasks.rb
active_wrapper-0.4.4 lib/active_wrapper/tasks.rb
active_wrapper-solo-0.4.3 lib/active_wrapper/tasks.rb
active_wrapper-ar2-0.4.3 lib/active_wrapper/tasks.rb
active_wrapper-0.4.3 lib/active_wrapper/tasks.rb
active_wrapper-0.4.0 lib/active_wrapper/tasks.rb
active_wrapper-0.3.4 lib/active_wrapper/tasks.rb
active_wrapper-0.3.3 lib/active_wrapper/tasks.rb
active_wrapper-0.3.2 lib/active_wrapper/tasks.rb
active_wrapper-0.3.1 lib/active_wrapper/tasks.rb
active_wrapper-0.3.0 lib/active_wrapper/tasks.rb
active_wrapper-0.2.7 lib/active_wrapper/tasks.rb