Sha256: b56dff78a3edad630e59ea150c23c3c679b792e667cf2e99814f40750231b3df

Contents?: true

Size: 877 Bytes

Versions: 6

Compression:

Stored size: 877 Bytes

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)
        $db.establish_connection
        yield if block
      end
      
      namespace :db do
        desc "Migrate the database with optional VERSION"
        task :migrate => :environment do
          $db.migrate(ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
        end
      end
      
      namespace :generate do
        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

6 entries across 6 versions & 1 rubygems

Version Path
winton-active_wrapper-0.1.1 lib/active_wrapper/tasks.rb
winton-active_wrapper-0.1.2 lib/active_wrapper/tasks.rb
winton-active_wrapper-0.1.3 lib/active_wrapper/tasks.rb
winton-active_wrapper-0.1.4 lib/active_wrapper/tasks.rb
winton-active_wrapper-0.1.5 lib/active_wrapper/tasks.rb
winton-active_wrapper-0.1.6 lib/active_wrapper/tasks.rb