forked from Agilefreaks/Aquarium
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
executable file
·267 lines (229 loc) · 7.64 KB
/
Rakefile
File metadata and controls
executable file
·267 lines (229 loc) · 7.64 KB
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
$:.unshift('lib')
require 'rubygems'
require 'rake'
require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'
require 'rake/clean'
require 'rdoc/task'
require 'aquarium/version'
# Use RSpec's files.
require 'rspec/core/rake_task'
# Some of the tasks are in separate files since they are also part of the website documentation
#load File.dirname(__FILE__) + '/rake_tasks/examples.rake'
# TODO: Replace rcov with simplecov and restore this feature.
#load File.dirname(__FILE__) + '/rake_tasks/verify_rcov.rake'
PKG_NAME = "aquarium"
PKG_VERSION = Aquarium::VERSION::STRING
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_FILES = FileList[
'[A-Z]*',
'lib/**/*.rb',
'spec/**/*.rb',
'examples/**/*.rb',
'rake_tasks/**/*.rake'
]
FileUtils.touch(File.dirname(__FILE__) + '/previous_failures.txt')
IS_WINDOWS = (RUBY_VERSION == "1.8.7" ? PLATFORM : RUBY_PLATFORM) =~ /mswin/
task :default => :spec
desc "Run all specs"
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = ['--color', '--format progress', '--profile']
end
# desc "Run all specs and store html output in doc/aquarium/out/report.html"
# RSpec::Core::RakeTask.new('spec_html') do |t|
# t.rspec_opts = ['--format html:../doc/aquarium/out/report.html','--backtrace']
# end
desc 'Generate HTML documentation for website'
task :webgen do
Dir.chdir '../doc/aquarium' do
output = nil
IO.popen('rake webgen 2>&1') do |io|
output = io.read
end
raise "ERROR while running webgen: #{output}" if output =~ /ERROR/n || $? != 0
end
end
desc 'Generate RDoc'
rd = Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = '../doc/aquarium/out/rdoc'
rdoc.options << '--title' << 'Aquarium' << '--line-numbers' << '--inline-source' << '--main' << 'README'
rdoc.rdoc_files.include('README', 'CHANGES', 'MIT_LICENSE', 'examples/**/*.rb', 'UPGRADE', 'lib/**/*.rb') # 'EXAMPLES.rd'
end
# desc "Generate EXAMPLES.rb"
# task :rdoc do
# core.rdoc
# end
aquarium = Gem::Specification.new do |s|
s.name = PKG_NAME
s.version = PKG_VERSION
s.summary = Aquarium::VERSION::DESCRIPTION
s.description = <<-EOF
Aquarium is a full-featured Aspect-Oriented Programming (AOP) framework for Ruby that is
designed to provide an intuitive syntax and support for large-scale, dynamic aspects.
EOF
s.files = PKG_FILES.to_a
s.require_path = 'lib'
s.has_rdoc = true
s.rdoc_options = rd.options
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$|^EXAMPLES.rd$/ }.to_a
s.autorequire = 'aquarium'
s.bindir = 'bin'
s.executables = []
s.default_executable = ''
s.authors = ["Aquarium Development Team"]
s.email = "aquarium-devel@rubyforge.org"
s.homepage = "http://aquarium.rubyforge.org"
s.rubyforge_project = "aquarium"
end
Rake::GemPackageTask.new(aquarium) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
def egrep(pattern)
Dir['**/*.rb'].each do |fn|
count = 0
open(fn) do |f|
while line = f.gets
count += 1
if line =~ pattern
puts "#{fn}:#{count}:#{line}"
end
end
end
end
end
desc "Look for TODO and FIXME tags in the code"
task :todo do
egrep /(FIXME|TODO|TBD)/
end
task :clobber do
rm_rf '../doc/aquarium/out'
rm_rf '../doc/aquarium/webgen.cache'
rm_rf 'translated_specs'
end
task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_website, :publish_news]
# TODO!
desc "Verifies that there is no uncommitted code"
task :verify_committed do
IO.popen('git status') do |io|
io.each_line do |line|
raise "\n!!! Do a git commit first !!!\n\n" if line =~ /^\s*M\s*/
end
end
end
# TODO!
desc "Creates a tag in git"
task :tag do
end
desc "Creates a tag in svn (obsolete)"
task :svntag do
from = `svn info #{File.dirname(__FILE__)}`.match(/URL: (.*)\/aquarium/n)[1]
to = from.gsub(/trunk/, "tags/#{Aquarium::VERSION::TAG}")
tag_cmd = "svn cp #{from} #{to} -m \"Tag release #{Aquarium::VERSION::FULL_VERSION}\""
raise "Can't tag to the same place: #{tag_cmd}" if to == from
puts "Creating tag in SVN"
`#{tag_cmd}`
raise "Tagging failed" unless $? == 0
end
# TODO: adapt from rspec.
# desc "Run this task before you commit. You should see 'OK TO COMMIT'"
# task :pre_commit => [
# :website,
# :examples
# ]
desc "Build the website, but do not publish it"
task :website => [:clobber, :rdoc, :webgen] # :spec_html, :verify_jruby, :verify_rcov,
task :rdoc_rails do
Dir.chdir '../aquarium_on_rails' do
rake = IS_WINDOWS ? "rake.cmd" : "rake"
`#{rake} rdoc`
end
end
desc "Verify that the Aquarium specs run under JRuby and that JRuby can advise Java types. If this task fails, try running 'jruby -S rake' separately."
task :verify_jruby do
puts "Verifying JRuby Support"
Dir.chdir 'jruby' do
rake = IS_WINDOWS ? "rake.cmd" : "rake"
sh "jruby -S #{rake}"
end
end
task :verify_user do
raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
end
desc "Upload Website to RubyForge"
task :publish_website => [:verify_user, :website, :do_publish_website]
task :do_publish_website do
unless Aquarium::VERSION::RELEASE_CANDIDATE
# host = "aquarium-website@rubyforge.org"
host = "#{ENV['RUBYFORGE_USER']}@rubyforge.org"
publisher = Rake::SshDirPublisher.new(
"#{host}",
"/var/www/gforge-projects/#{PKG_NAME}",
"../doc/aquarium/out"
)
publisher.upload
else
puts "** Not publishing packages to RubyForge - this is a prerelease"
end
end
desc "Upload Website archive to RubyForge"
task :archive_website => [:verify_user, :website] do
# host = "aquarium-website@rubyforge.org"
host = "#{ENV['RUBYFORGE_USER']}@rubyforge.org"
publisher = Rake::SshDirPublisher.new(
"#{host}",
"/var/www/gforge-projects/#{PKG_NAME}/#{Spec::VERSION::TAG}",
"../doc/aquarium/out"
)
publisher.upload
end
desc "Publish gem+tgz+zip on RubyForge. You must make sure lib/version.rb is aligned with the CHANGELOG file"
task :publish_packages => [:verify_user, :package] do
release_files = FileList[
"pkg/#{PKG_FILE_NAME}.gem",
"pkg/#{PKG_FILE_NAME}.tgz",
"pkg/#{PKG_FILE_NAME}.zip"
]
unless Aquarium::VERSION::RELEASE_CANDIDATE
require 'meta_project'
require 'rake/contrib/xforge'
Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |xf|
# Never hardcode user name and password in the Rakefile!
xf.user_name = ENV['RUBYFORGE_USER']
xf.files = release_files.to_a
xf.release_name = "Aquarium #{PKG_VERSION}"
end
else
puts "SINCE THIS IS A PRERELEASE, FILES ARE UPLOADED WITH SSH, NOT TO THE RUBYFORGE FILE SECTION"
puts "YOU MUST TYPE THE PASSWORD #{release_files.length} TIMES..."
# host = "aquarium-website@rubyforge.org"
host = "#{ENV['RUBYFORGE_USER']}@rubyforge.org"
remote_dir = "/var/www/gforge-projects/#{PKG_NAME}"
publisher = Rake::SshFilePublisher.new(
host,
remote_dir,
File.dirname(__FILE__),
*release_files
)
publisher.upload
puts "UPLADED THE FOLLOWING FILES:"
release_files.each do |file|
name = file.match(/pkg\/(.*)/)[1]
puts "* http://aquarium.rubyforge.org/#{name}"
end
puts "They are not linked to anywhere, so don't forget to tell people!"
end
end
desc "Publish news on RubyForge"
task :publish_news => [:verify_user] do
unless Aquarium::VERSION::RELEASE_CANDIDATE
require 'meta_project'
require 'rake/contrib/xforge'
Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |news|
# Never hardcode user name and password in the Rakefile!
news.user_name = ENV['RUBYFORGE_USER']
end
else
puts "** Not publishing news to RubyForge - this is a prerelease"
end
end