Sha256: e417ba5c534fef475b3692b4c17f6110e9f2ca5617b3aecdf22ab52538024414

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 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.new(options)
        yield
      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

1 entries across 1 versions & 1 rubygems

Version Path
winton-active_wrapper-0.1.0 lib/active_wrapper/tasks.rb