Sha256: 2ddc1a3bf4f70d3014c7f8245dd9939c2eaeeb1d8aa07bba3373065bb2dba019
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require "fileutils" namespace :sequel do task :merb_start do Merb.start :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'development' end namespace :db do desc "Perform migration using migrations in schema/migrations" task :migrate => :merb_start do Sequel::Migrator.apply(Merb::Orms::Sequel.connect, "schema/migrations", ENV["VERSION"] ? ENV["VERSION"].to_i : nil) end end namespace :sessions do desc "Creates session migration" task :create => :merb_start do migration_exists = Dir[File.join(Merb.root,"schema", "migrations", "*.rb")].detect{ |f| f =~ /database_sessions\.rb/ } if migration_exists puts "\nThe Session Migration File already exists\n\n" else sh %{merb-gen database_sessions_migration} end end desc "Clears sessions" task :clear => :merb_start do table_name = ((Merb::Plugins.config[:sequel] || {})[:session_table_name] || "sessions") Merb::Orms::Sequel.connect.execute("DELETE FROM #{table_name}") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
merb_sequel-0.9.2 | lib/merb_sequel/merbtasks.rb |