Sha256: 4319c813be6b2b6602eb5e064082a04789f7a3de790bfa43ce0b4949c05ec337

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

require 'fileutils'

namespace :dm do
  namespace :db do
    desc "Perform automigration"
    task :automigrate => :merb_env do
      DataMapper::Base.auto_migrate!
    end
  end
  
  namespace :sessions do
    desc "Creates session migration"
    task :create => :merb_env do
      dest = File.join(MERB_ROOT, "schema", "migrations","001_add_sessions_table.rb")
      source = File.join(File.dirname(__FILE__), "merb", "session","001_add_sessions_table.rb")
      #FileUtils.cp source, dest unless File.exists?(dest)
    end
    
    desc "Clears sessions"
    task :clear => :merb_env do
      table_name = (Merb::Plugins.config[:data_mapper][:session_table_name] || "sessions")
      #Merb::Orms::DataMapper.connect.execute("DELETE FROM #{table_name}")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
merb_datamapper-0.4.3 lib/merb/orms/data_mapper/tasks/databases.rb
merb_datamapper-0.4.4 lib/merb/orms/data_mapper/tasks/databases.rb