-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
237 lines (195 loc) · 7.84 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# WontoMedia - a wontology web application
# Copyright (C) 2011 - Glen E. Ivey
# www.wontology.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version
# 3 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program in the file COPYING and/or LICENSE. If not,
# see <http://www.gnu.org/licenses/>.
have_jeweler = false
begin
require 'rubygems'
require 'jeweler'
have_jeweler = true
rescue LoadError
unless ENV['NO_RAKE_WARN']
puts <<-MESSAGE
WARNING: Missing development dependency(ies):
'Jeweler', and/or 'rubygems' are not available.
Install an individual missing gem with:
'sudo gem install [gem name]'
('sudo' may not be necessary on your system)
Or install all of Wontomedia's development dependencies with:
'bundle install'
MESSAGE
end
end
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
if ENV["RAILS_ENV"].nil?
ENV["RAILS_ENV"] = RAILS_ENV = "test"
end
############################################################
# block to use Jeweler to generate our gemspec, gem, etc.
if have_jeweler
Jeweler::Tasks.new do |s|
s.name = "wontomedia"
s.rubyforge_project = "wontomedia"
s.summary = "WontoMedia is a Ruby-on-Rails web app for community creation of an information classification scheme"
s.description = <<-ENDOSTRING
WontoMedia is a Ruby-on-Rails web app for community creation of
an information classification scheme. WontoMedia is free
software (licensed under the AGPL v3), and is being developed by
a dispersed volunteer team using agile methods.
ENDOSTRING
s.email = "[email protected]"
s.homepage = "http://wontomedia.rubyforge.org"
s.authors = ["Glen E. Ivey"]
s.has_rdoc = true
s.extra_rdoc_files = ["README"]
s.files = FileList["[A-Z]*", "assets/wontomedia-sample.rb",
"vendor/plugins/asset_packager/**/*",
"vendor/plugins/redirect_routing/**/*",
"wontomedia.gemspec",
"doc/*", "doc/scripts/*",
"{app,config,bin,db,default-custom,generators,lib,public,script}/**/*"].
exclude("database.yml", "**/*_packaged.js", "**/*_packaged.css") do |maybe_exclude|
File.symlink?( maybe_exclude )
end
s.test_files = []
# Note: 1) Explicitly add any other non-testing packages under 'vendor'
# 2) Exclude all of our symbolic links
# 3)
# .autotest cucumber.yml .gitignore
# the testing directories
# deploy doc features policy test
# and the working/transitory directories
# log pkg tmp
# aren't included because developers are expected to pull from Git
s.required_ruby_version = '~>1.8.7'
s.add_dependency 'rake', '=0.8.7'
s.add_dependency 'rails', '=2.3.11'
# eventually move to an optional group for people who don't deploy this way
s.add_dependency 'mysql', '=2.8.1'
s.add_dependency 'mongrel'
s.add_development_dependency 'bundler'
s.add_development_dependency 'capistrano'
s.add_development_dependency 'rspec-rails', '=1.3.3' # gets rspec
s.add_development_dependency 'webrat'
s.add_development_dependency 'cucumber', '=0.10.0'
s.add_development_dependency 'cucumber-rails' # gets cucumber, nokogiri
s.add_development_dependency 'database_cleaner'
s.add_development_dependency 'selenium-client'
s.add_development_dependency 'technicalpickles-jeweler' # gets rubyforge
s.add_development_dependency 'gemcutter'
s.add_development_dependency 'ZenTest'
s.add_development_dependency 'migration_test_helper'
end
task :build => :gemspec # don't build a gem from a stale spec
Jeweler::RubyforgeTasks.new do |rubyforge|
rubyforge.doc_task = "doc:app"
end
Jeweler::GemcutterTasks.new
end
# documented rake_task.clear method missing?
class Rake::Task
def clear!
@actions.clear
@prerequisites.clear
end
end
############################################################
# update default rake tasks for our test directory structure
namespace :test do
# make test:units mean what it normally means
Rake::Task[:units].clear!
Rake::TestTask.new(:units => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = 'test/unit/app/models/**/*_test.rb'
t.verbose = true
end
Rake::Task['test:units'].comment =
"Run the model tests in test/unit/app/models"
# but it's still a stupid naming convention:
task :models => :units
end
############################################################
# new rake tasks for our unit-like tests
namespace :test do
Rake::TestTask.new(:views => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = 'test/unit/app/views/**/*_test.rb'
t.verbose = true
end
Rake::Task['test:views'].comment =
"Run the view unit tests (test/unit/app/views/**/*_test.rb)"
Rake::TestTask.new(:helpers => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = 'test/unit/app/helpers/**/*_test.rb'
t.verbose = true
end
Rake::Task['test:helpers'].comment =
"Run the view-helper unit tests (test/unit/app/helpers/**/*_test.rb)"
Rake::TestTask.new(:dbunits => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = 'test/unit/db/**/*_test.rb'
t.verbose = true
end
Rake::Task['test:dbunits'].comment =
"Run the database unit tests (test/unit/db/**/*_test.rb)"
# Note: migration tests using migration_test_helper disrupts
# loaded fixtures, so can't run in same Ruby process as other unit
# tests, which breaking into separate rake task accomplishes
Rake::TestTask.new(:dbmigrations => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = 'test/db_migrations_test.rb'
t.verbose = true
end
Rake::Task['test:dbmigrations'].comment =
"Run the database migration unit test (test/db_migrations_test.rb)"
task :db => [ "test:dbunits", "test:dbmigrations" ]
Rake::Task['test:db'].comment =
"Run database tests (test:dbunits, test:dbmigrations)"
############################################################
# now some new "umbrella" test tasks
desc "Execute all development tests in test/unit."
Rake::TestTask.new(:devs => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = 'test/unit/**/*_test.rb'
t.verbose = true
end
desc "Execute all project-policy audit tests."
task :policies do
ruby File.join( "policy", "ckFilesUtils", "buildLinksIgnoreFile.rb" )
ruby File.join( "policy", "ckFilesUtils", "ckForTabs.rb" )
ruby File.join( "policy", "ckFilesUtils", "ckCopyrightNotices.rb" )
ruby File.join( "policy", "ckFilesUtils", "ckCustomizationFilesPresent.rb" )
end
# aliases
task :integrations => :integration # multiple tests -> plural task name
task :controllers => :functionals # Rails naming convention #fail
desc "Execute all the tests for Ruby code."
task :ruby_tests => [ "test:devs", "test:db", "test:controllers",
"test:integrations", "build", "cucumber:static_ok"]
end # namespace :test
# replace Rail's basic test task so that we get a reasonable execution order
Rake::Task[:test].clear!
desc 'Run all unit, integration, and policy checks'
task :tests => [ "test:policies", "asset:packager:build_all",
# above two have side effects necessary for setup
"test:devs", "test:db", "test:controllers",
"test:javascripts", "test:integrations", "build",
"cucumber:ok" ]
# alias
task :test => :tests