Sha256: a55f1311dca7e0bee2f56f6d639fc7cad4c2c7a3a8523b67e9a5970b6fd8fa29

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

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

module ActiveWrapper
  class Tasks

    include Rake::DSL
    
    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

4 entries across 4 versions & 3 rubygems

Version Path
active_wrapper-solo-0.4.9 lib/active_wrapper/tasks.rb
active_wrapper-ar2-0.4.9 lib/active_wrapper/tasks.rb
active_wrapper-0.4.9 lib/active_wrapper/tasks.rb
active_wrapper-0.4.7 lib/active_wrapper/tasks.rb