lib/sniff/rake_tasks.rb in sniff-0.11.12 vs lib/sniff/rake_tasks.rb in sniff-1.0.0
- old
+ new
@@ -1,22 +1,22 @@
require 'rake'
require 'rake/clean'
require 'rdoc/task'
require 'rake/tasklib'
+require 'earth'
-module Sniff
+class Sniff
class RakeTasks
include Rake::DSL
def self.define_tasks(&blk)
new(&blk).define_tasks
end
- attr_accessor :earth_domains, :cucumber, :rspec, :coverage, :rocco, :bueller, :watchr
+ attr_accessor :cucumber, :rspec, :coverage, :rocco, :bueller, :watchr
def initialize
- self.earth_domains = :all
self.cucumber = true
self.rspec = false
self.coverage = true
self.rocco = true
self.bueller = true
@@ -56,12 +56,12 @@
end
end
task :console do
require 'sniff'
- cwd = Dir.pwd
- Sniff.init cwd, :earth => earth_domains
+ sniff = Sniff.new Dir.pwd
+ sniff.connect
require 'irb'
ARGV.clear
IRB.start
end
@@ -223,8 +223,27 @@
script = Watchr::Script.new Pathname(path)
Watchr::Controller.new(script, Watchr.handler.new).run
end
end
end
+
+ require 'sniff'
+ sniff = Sniff.new Dir.pwd
+ namespace :sniff do
+ task :init do
+ sniff.connect
+ end
+ task :migrate => :init do
+ sniff.migrate!
+ end
+ task :seed => :init do
+ sniff.seed!
+ end
+ end
+
+ require 'earth/tasks'
+ Earth::Tasks.new
+ task 'db:migrate' => 'sniff:migrate'
+ task 'db:seed' => 'sniff:seed'
end
end
end