forked from integrity/integrity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
109 lines (92 loc) · 2.32 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
$LOAD_PATH.unshift(File.expand_path(File.dirname(".")))
require "rake/testtask"
require "rake/clean"
require 'fileutils'
desc "Default: run all tests"
task :default => :test
desc "Run tests"
task :test => %w[test:unit test:acceptance]
namespace :test do
desc "Run unit tests"
Rake::TestTask.new(:unit) do |t|
t.libs << "test"
t.test_files = FileList["test/unit/*_test.rb"]
end
desc "Run acceptance tests"
Rake::TestTask.new(:acceptance) do |t|
t.libs << "test"
t.test_files = FileList["test/acceptance/*_test.rb"]
end
end
desc "Create the database"
task :db do
require "init"
DataMapper.auto_upgrade!
Integrity::Project.all(:last_build_id => nil).each do |project|
project.last_build = project.sorted_builds.first
project.raise_on_save_failure = true
project.save
end
end
desc "Clean-up build directory"
task :cleanup do
require "init"
Integrity::Build.all(:completed_at.not => nil).each { |build|
dir = Integrity.config.directory.join(build.id.to_s)
dir.rmtree if dir.directory?
}
end
namespace :jobs do
desc "Clear the delayed_job queue."
task :clear do
require "init"
require "integrity/delayed_builder"
Delayed::Job.delete_all
end
desc "Start a delayed_job worker."
task :work do
require "init"
require "integrity/delayed_builder"
Delayed::Worker.new.start
end
end
begin
namespace :resque do
require "init"
require "resque/tasks"
desc "Start a Resque worker for Integrity"
task :work do
ENV["QUEUE"] = "integrity"
Rake::Task["resque:resque:work"].invoke
end
end
rescue LoadError
end
desc "Generate HTML documentation."
task :html => %w(
doc/build
doc/build/index.html
)
file "doc/build/index.html" => ["doc/htmlize",
"doc/integrity.txt",
"doc/integrity.css"] do |f|
sh "cat doc/integrity.txt | doc/htmlize > #{f.name}"
end
task "doc/build" do
FileUtils.mkdir_p('doc/build')
end
doc_dependencies = %w(
integrity.css
screenshot.png
)
doc_dependencies.each do |file|
task "doc/build/#{file}" => "doc/#{file}" do
FileUtils.cp("doc/#{file}", "doc/build/#{file}")
end
task :html => "doc/build/#{file}"
end
desc "Re-generate stylesheet"
file "lib/app/public/integrity.css" => "lib/app/views/integrity.sass" do |f|
sh "sass lib/app/views/integrity.sass > #{f.name}"
end
CLOBBER.include("doc/build")