-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
51 lines (43 loc) · 1.76 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require(File.join(File.dirname(__FILE__), '../../../config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the click_heat_map plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
# this way the test cases will be run twice.
# t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the click_heat_map plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ClickHeatMap'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
namespace :db do
namespace :migrate do
description = "Migrate the database through scripts in vendor/plugins/click_heat_map/lib/db/migrate"
description << "and update db/schema.rb by invoking db:schema:dump."
description << "Target specific version with VERSION=x. Turn off output with VERBOSE=false."
desc description
task :click_heat_map => :environment do
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
ActiveRecord::Migrator.migrate("lib/db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
end
desc description
task :click_heat_map_rollback => :environment do
Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
ActiveRecord::Migrator.rollback("lib/db/migrate/")
Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
end
end
end