buildrizpack 0.2-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,160 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ task :release do
18
+ # First, we need to get all the staged files from Apache to _release.
19
+ mkpath '_release'
20
+ lambda do
21
+ url = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
22
+ puts "Populating _release directory from #{url} ..."
23
+ sh 'rsync', '--progress', '--recursive', url, '_release'
24
+ puts "[X] Staged files are now in _release"
25
+ end.call
26
+
27
+
28
+ # Upload binary and source packages and new Web site
29
+ lambda do
30
+ target = "people.apache.org:/www/www.apache.org/dist/#{spec.name}/#{spec.version}"
31
+ puts "Uploading packages to www.apache.org/dist ..."
32
+ host, remote_dir = target.split(':')
33
+ sh 'ssh', host, 'rm', '-rf', remote_dir rescue nil
34
+ sh 'ssh', host, 'mkdir', remote_dir
35
+ sh 'rsync', '--progress', '--recursive', "_release/#{spec.version}/dist/", target
36
+ puts "[X] Uploaded packages to www.apache.org/dist"
37
+
38
+ target = "people.apache.org:/www/#{spec.name}.apache.org/"
39
+ puts "Uploading new site to #{spec.name}.apache.org ..."
40
+ sh 'rsync', '--progress', '--recursive', '--delete', "_release/#{spec.version}/site/", target
41
+ sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
42
+ puts "[X] Uploaded new site to #{spec.name}.apache.org"
43
+ end.call
44
+
45
+
46
+ # Upload binary and source packages to RubyForge.
47
+ lambda do
48
+ # update rubyforge projects, processors, etc. in local config
49
+ sh 'rubyforge', 'config'
50
+ files = FileList["_release/#{spec.version}/dist/*.{gem,tgz,zip}"]
51
+ puts "Uploading #{spec.version} to RubyForge ... "
52
+ rubyforge = RubyForge.new.configure
53
+ rubyforge.login
54
+ rubyforge.userconfig.merge!('release_changes'=>"_release/#{spec.version}/CHANGES", 'preformatted' => true)
55
+ rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version.to_s, *files
56
+
57
+ puts "Posting news to RubyForge ... "
58
+ changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
59
+ rubyforge.post_news spec.rubyforge_project.downcase, "Buildr #{spec.version} released",
60
+ "#{spec.description}\n\nNew in Buildr #{spec.version}:\n#{changes.gsub(/^/, ' ')}\n"
61
+ puts "[X] Uploaded gems and source files to #{spec.name}.rubyforge.org"
62
+ end.call
63
+
64
+ # Push gems to Rubyforge.org / Gemcutter
65
+ lambda do
66
+ files = FileList["_release/#{spec.version}/dist/*.{gem}"]
67
+ files.each do |f|
68
+ puts "Push gem #{f} to RubyForge.org / Gemcutter ... "
69
+ `gem push #{f}`
70
+ end
71
+ puts "[X] Pushed gems to Rubyforge.org / Gemcutter"
72
+ end
73
+
74
+ # Create an SVN tag for this release.
75
+ lambda do
76
+ info = `svn info` + `git svn info` # Using either svn or git-svn
77
+ if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
78
+ new_url = url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version}")
79
+ unless url == new_url
80
+ sh 'svn', 'copy', url, new_url, '-m', "Release #{spec.version}" do |ok, res|
81
+ if ok
82
+ puts "[X] Tagged this release as tags/#{spec.version} ... "
83
+ else
84
+ puts "Could not create tag, please do it yourself!"
85
+ puts %{ svn copy #{url} #{new_url} -m "Release #{spec.version}"}
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end.call
91
+
92
+
93
+ # Update CHANGELOG to next release number.
94
+ lambda do
95
+ next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
96
+ zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
97
+ modified = "#{next_version} (Pending)\n\n" + File.read('CHANGELOG')
98
+ File.open 'CHANGELOG', 'w' do |file|
99
+ file.write modified
100
+ end
101
+ puts "[X] Updated CHANGELOG and added entry for next release"
102
+ end.call
103
+
104
+
105
+ # Update source files to next release number.
106
+ lambda do
107
+ next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
108
+ zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
109
+
110
+ ver_file = "lib/#{spec.name}.rb"
111
+ if File.exist?(ver_file)
112
+ modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
113
+ File.open ver_file, 'w' do |file|
114
+ file.write modified
115
+ end
116
+ puts "[X] Updated #{ver_file} to next release"
117
+ end
118
+
119
+ spec_file = "#{spec.name}.gemspec"
120
+ if File.exist?(spec_file)
121
+ modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
122
+ File.open spec_file, 'w' do |file|
123
+ file.write modified
124
+ end
125
+ puts "[X] Updated #{spec_file} to next release"
126
+ end
127
+ end.call
128
+
129
+
130
+ # Prepare release announcement email.
131
+ lambda do
132
+ changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
133
+ email = <<-EMAIL
134
+ To: users@buildr.apache.org, announce@apache.org
135
+ Subject: [ANNOUNCE] Apache Buildr #{spec.version} released
136
+
137
+ #{spec.description}
138
+
139
+ New in this release:
140
+
141
+ #{changes.gsub(/^/, ' ')}
142
+
143
+ To learn more about Buildr and get started:
144
+ http://buildr.apache.org/
145
+
146
+ Thanks!
147
+ The Apache Buildr Team
148
+
149
+ EMAIL
150
+ File.open 'announce-email.txt', 'w' do |file|
151
+ file.write email
152
+ end
153
+ puts "[X] Created release announce email template in 'announce-email.txt'"
154
+ puts email
155
+ end
156
+
157
+ end
158
+
159
+
160
+ task(:clobber) { rm_rf '_release' }
@@ -0,0 +1,92 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ begin
17
+ require 'rspec/core/rake_task'
18
+ directory '_reports'
19
+
20
+ def default_spec_opts
21
+ default = %w{--format documentation --out _reports/specs.txt --backtrace}
22
+ default << '--colour' if $stdout.isatty && !(RbConfig::CONFIG['host_os'] =~ /mswin|win32|dos/i)
23
+ default
24
+ end
25
+
26
+ # RSpec doesn't support file exclusion, so hack our own.
27
+ class RSpec::Core::RakeTask
28
+ attr_accessor :rspec_files
29
+ private
30
+ def files_to_run
31
+ @rspec_files
32
+ end
33
+ end
34
+
35
+ desc "Run all specs"
36
+ RSpec::Core::RakeTask.new :spec=>['_reports'] do |task|
37
+ ENV['USE_FSC'] = 'no'
38
+ task.rspec_files = FileList['spec/**/*_spec.rb']
39
+ task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
40
+ task.rspec_opts = default_spec_opts
41
+ task.rspec_opts = %w{--format html --out _reports/specs.html --backtrace}
42
+ end
43
+ file('_reports/specs.html') { task(:spec).invoke }
44
+
45
+ desc 'Run RSpec and generate Spec and coverage reports (slow)'
46
+ RSpec::Core::RakeTask.new :coverage=>['_reports'] do |task|
47
+ ENV['USE_FSC'] = 'no'
48
+ task.rspec_files = FileList['spec/**/*_spec.rb']
49
+ task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
50
+ task.rspec_opts = default_spec_opts
51
+ task.rcov = true
52
+ task.rcov_opts = %w{-o _reports/coverage --exclude / --include-file ^lib --text-summary}
53
+ end
54
+ file('_reports/coverage') { task(:coverage).invoke }
55
+
56
+ task :load_ci_reporter do
57
+ gem 'ci_reporter'
58
+ ENV['CI_REPORTS'] = '_reports/ci'
59
+ # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files.
60
+ # However, newer versions of rspec don't like double quotes escaping as well, so removing them for now.
61
+ ci_rep_path = Gem.loaded_specs['ci_reporter'].full_gem_path
62
+ ENV["SPEC_OPTS"] = [ENV["SPEC_OPTS"], default_spec_opts, "--require", "#{ci_rep_path}/lib/ci/reporter/rake/rspec_loader.rb", "--format", "CI::Reporter::RSpec"].join(" ")
63
+ end
64
+
65
+ desc 'Run all specs with CI reporter'
66
+ task :ci=>[:load_ci_reporter, :spec]
67
+
68
+ # Useful for testing with JRuby when using Ruby and vice versa.
69
+ namespace :spec do
70
+ desc "Run all specs specifically with Ruby"
71
+ task :ruby do
72
+ puts "Running test suite using Ruby ..."
73
+ sh 'ruby -S rake spec'
74
+ end
75
+
76
+ desc "Run all specs specifically with JRuby"
77
+ task :jruby do
78
+ puts "Running test suite using JRuby ..."
79
+ sh 'jruby -S rake spec'
80
+ end
81
+ end
82
+
83
+ task :clobber do
84
+ rm_f 'failed'
85
+ rm_rf '_reports'
86
+ end
87
+
88
+ rescue LoadError => e
89
+ puts "Buildr uses RSpec. You can install it by running rake setup"
90
+ task(:setup) { install_gem 'rcov', :version=>'~>0.8' }
91
+ task(:setup) { install_gem 'win32console' if RUBY_PLATFORM[/win32/] } # Colors for RSpec, only on Windows platform.
92
+ end
@@ -0,0 +1,92 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ begin
17
+ require 'rspec/core/rake_task'
18
+ directory '_reports'
19
+
20
+ def default_spec_opts
21
+ default = %w{--format documentation --out _reports/specs.txt --backtrace}
22
+ default << '--colour' if $stdout.isatty && !(Config::CONFIG['host_os'] =~ /mswin|win32|dos/i)
23
+ default
24
+ end
25
+
26
+ # RSpec doesn't support file exclusion, so hack our own.
27
+ class RSpec::Core::RakeTask
28
+ attr_accessor :rspec_files
29
+ private
30
+ def files_to_run
31
+ @rspec_files
32
+ end
33
+ end
34
+
35
+ desc "Run all specs"
36
+ RSpec::Core::RakeTask.new :spec=>['_reports'] do |task|
37
+ ENV['USE_FSC'] = 'no'
38
+ task.rspec_files = FileList['spec/**/*_spec.rb']
39
+ task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
40
+ task.rspec_opts = default_spec_opts
41
+ task.rspec_opts = %w{--format html --out _reports/specs.html --backtrace}
42
+ end
43
+ file('_reports/specs.html') { task(:spec).invoke }
44
+
45
+ desc 'Run RSpec and generate Spec and coverage reports (slow)'
46
+ RSpec::Core::RakeTask.new :coverage=>['_reports'] do |task|
47
+ ENV['USE_FSC'] = 'no'
48
+ task.rspec_files = FileList['spec/**/*_spec.rb']
49
+ task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
50
+ task.rspec_opts = default_spec_opts
51
+ task.rcov = true
52
+ task.rcov_opts = %w{-o _reports/coverage --exclude / --include-file ^lib --text-summary}
53
+ end
54
+ file('_reports/coverage') { task(:coverage).invoke }
55
+
56
+ task :load_ci_reporter do
57
+ gem 'ci_reporter'
58
+ ENV['CI_REPORTS'] = '_reports/ci'
59
+ # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files.
60
+ # However, newer versions of rspec don't like double quotes escaping as well, so removing them for now.
61
+ ci_rep_path = Gem.loaded_specs['ci_reporter'].full_gem_path
62
+ ENV["SPEC_OPTS"] = [ENV["SPEC_OPTS"], default_spec_opts, "--require", "#{ci_rep_path}/lib/ci/reporter/rake/rspec_loader.rb", "--format", "CI::Reporter::RSpec"].join(" ")
63
+ end
64
+
65
+ desc 'Run all specs with CI reporter'
66
+ task :ci=>[:load_ci_reporter, :spec]
67
+
68
+ # Useful for testing with JRuby when using Ruby and vice versa.
69
+ namespace :spec do
70
+ desc "Run all specs specifically with Ruby"
71
+ task :ruby do
72
+ puts "Running test suite using Ruby ..."
73
+ sh 'ruby -S rake spec'
74
+ end
75
+
76
+ desc "Run all specs specifically with JRuby"
77
+ task :jruby do
78
+ puts "Running test suite using JRuby ..."
79
+ sh 'jruby -S rake spec'
80
+ end
81
+ end
82
+
83
+ task :clobber do
84
+ rm_f 'failed'
85
+ rm_rf '_reports'
86
+ end
87
+
88
+ rescue LoadError => e
89
+ puts "Buildr uses RSpec. You can install it by running rake setup"
90
+ task(:setup) { install_gem 'rcov', :version=>'~>0.8' }
91
+ task(:setup) { install_gem 'win32console' if RUBY_PLATFORM[/win32/] } # Colors for RSpec, only on Windows platform.
92
+ end
@@ -0,0 +1,217 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ require 'rubyforge'
17
+ require 'digest/md5'
18
+ require 'digest/sha1'
19
+
20
+ gpg_cmd = 'gpg2'
21
+
22
+ task :prepare do |task, args|
23
+ gpg_arg = args.gpg || ENV['gpg']
24
+
25
+ # Make sure we're doing a release from checked code.
26
+ lambda do
27
+ puts "Checking there are no local changes ... "
28
+ svn = `svn status`
29
+ fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
30
+ git = `git status -s`
31
+ fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^ M/] && ENV["IGNORE_GIT"].nil?
32
+ puts "[X] There are no local changes, everything is in source control"
33
+ end.call
34
+
35
+ # Make sure we have a valid CHANGELOG entry for this release.
36
+ lambda do
37
+ puts "Checking that CHANGELOG indicates most recent version and today's date ... "
38
+ expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
39
+ header = File.readlines('CHANGELOG').first.chomp
40
+ fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
41
+ puts "[x] CHANGELOG indicates most recent version and today's date"
42
+ end.call
43
+
44
+ # Need GPG to sign the packages.
45
+ lambda do
46
+ gpg_arg or fail "Please run with gpg=<argument for gpg --local-user>"
47
+ gpg_ok = `gpg2 --list-keys #{gpg_arg}` rescue nil
48
+ if !$?.success?
49
+ gpg_ok = `gpg --list-keys #{gpg_arg}`
50
+ gpg_cmd = 'gpg'
51
+ end
52
+ fail "No GPG user #{gpg_arg}" if gpg_ok.empty?
53
+ end.call
54
+
55
+ task(:license).invoke
56
+
57
+ # Need JRuby, Scala and Groovy installed to run all the specs.
58
+ lambda do
59
+ puts "Checking that we have JRuby, Scala and Groovy available ... "
60
+ sh 'jruby --version'
61
+ `scala -version`
62
+ $?.exitstatus == 1 or fail "Scala is not installed"
63
+ sh 'groovy -version'
64
+ puts "[X] We have JRuby, Scala and Groovy"
65
+ end.call
66
+
67
+ # Need Prince to generate PDF
68
+ lambda do
69
+ puts "Checking that we have prince available ... "
70
+ sh 'prince --version'
71
+ puts "[X] We have prince available"
72
+ end.call
73
+
74
+ # Need RubyForge to upload new release files.
75
+ lambda do
76
+ puts "[!] Make sure you have admin privileges to make a release on RubyForge"
77
+ rubyforge = RubyForge.new.configure
78
+ rubyforge.login
79
+ rubyforge.scrape_project(spec.name)
80
+ end.call
81
+
82
+ # We will be speccing in one platform, so also spec the other one.
83
+ task(RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby').invoke # Test the *other* platform
84
+ end
85
+
86
+
87
+ task :stage=>[:clobber, :prepare] do |task, args|
88
+ gpg_arg = args.gpg || ENV['gpg']
89
+ mkpath '_staged'
90
+
91
+ # Start by figuring out what has changed.
92
+ lambda do
93
+ puts "Looking for changes between this release and previous one ..."
94
+ pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
95
+ changes = File.read('CHANGELOG').scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
96
+ current = changes[spec.version.to_s]
97
+ fail "No changeset found for version #{spec.version}" unless current
98
+ File.open '_staged/CHANGES', 'w' do |file|
99
+ file.write "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})\n"
100
+ file.write current
101
+ end
102
+ puts "[X] Listed most recent changed in _staged/CHANGES"
103
+ end.call
104
+
105
+ # Create the packages (gem, tarball) and sign them. This requires user
106
+ # intervention so the earlier we do it the better.
107
+ lambda do
108
+ puts "Creating and signing release packages ..."
109
+ task(:package).invoke
110
+ mkpath '_staged/dist'
111
+ FileList['pkg/*.{gem,zip,tgz}'].each do |source|
112
+ pkg = source.pathmap('_staged/dist/%n%x')
113
+ cp source, pkg
114
+ bytes = File.open(pkg, 'rb') { |file| file.read }
115
+ File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
116
+ File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) << ' ' << File.basename(pkg) }
117
+ sh gpg_cmd, '--local-user', gpg_arg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
118
+ end
119
+ cp 'etc/KEYS', '_staged/dist'
120
+ puts "[X] Created and signed release packages in _staged/dist"
121
+ end.call
122
+
123
+ # The download page should link to the new binaries/sources, and we
124
+ # want to do that before generating the site/documentation.
125
+ lambda do
126
+ puts "Updating download page with links to release packages ... "
127
+ mirror = "http://www.apache.org/dyn/closer.cgi/#{spec.name}/#{spec.version}"
128
+ official = "http://www.apache.org/dist/#{spec.name}/#{spec.version}"
129
+ rows = FileList['_staged/dist/*.{gem,tgz,zip}'].map { |pkg|
130
+ name, md5 = File.basename(pkg), Digest::MD5.file(pkg).to_s
131
+ %{| "#{name}":#{mirror}/#{name} | "#{md5}":#{official}/#{name}.md5 | "Sig":#{official}/#{name}.asc |}
132
+ }
133
+ textile = <<-TEXTILE
134
+ h3. #{spec.name} #{spec.version} (#{Time.now.strftime('%Y-%m-%d')})
135
+
136
+ |_. Package |_. MD5 Checksum |_. PGP |
137
+ #{rows.join("\n")}
138
+
139
+ p>. ("Release signing keys":#{official}/KEYS)
140
+ TEXTILE
141
+ file_name = 'doc/download.textile'
142
+ print "Adding download links to #{file_name} ... "
143
+ modified = File.read(file_name).sub(/^h2\(#dist\).*$/) { |header| "#{header}\n\n#{textile}" }
144
+ File.open file_name, 'w' do |file|
145
+ file.write modified
146
+ end
147
+ puts "[X] Updated #{file_name}"
148
+ end.call
149
+
150
+
151
+ # Now we can create the Web site, this includes running specs, coverage report, etc.
152
+ # This will take a while, so we want to do it as last step before upload.
153
+ lambda do
154
+ puts "Creating new Web site"
155
+ task(:site).invoke
156
+ cp_r '_site', '_staged/site'
157
+ puts "[X] Created new Web site in _staged/site"
158
+ end.call
159
+
160
+
161
+ # Move everything over to people.apache.org so we can vote on it.
162
+ lambda do
163
+ url = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
164
+ puts "Uploading _staged directory to #{url} ..."
165
+ sh 'rsync', '--progress', '--recursive', '_staged/', url
166
+ puts "[X] Uploaded _staged directory to #{url}"
167
+ end.call
168
+
169
+
170
+ # Prepare a release vote email. In the distant future this will also send the
171
+ # email for you and vote on it.
172
+ lambda do
173
+ # Need to know who you are on Apache, local user may be different (see .ssh/config).
174
+ whoami = `ssh people.apache.org whoami`.strip
175
+ base_url = "http://people.apache.org/~#{whoami}/buildr/#{spec.version}"
176
+ # Need changes for this release only.
177
+ changelog = File.read('CHANGELOG').scan(/(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/)
178
+ changes = changelog[0][2]
179
+ previous_version = changelog[1][1]
180
+
181
+ email = <<-EMAIL
182
+ To: dev@buildr.apache.org
183
+ Subject: [VOTE] Buildr #{spec.version} release
184
+
185
+ We're voting on the source distributions available here:
186
+ #{base_url}/dist/
187
+
188
+ Specifically:
189
+ #{base_url}/dist/buildr-#{spec.version}.tgz
190
+ #{base_url}/dist/buildr-#{spec.version}.zip
191
+
192
+ The documentation generated for this release is available here:
193
+ #{base_url}/site/
194
+ #{base_url}/site/buildr.pdf
195
+
196
+ The official specification against which this release was tested:
197
+ #{base_url}/site/specs.html
198
+
199
+ Test coverage report:
200
+ #{base_url}/site/coverage/index.html
201
+
202
+
203
+ The following changes were made since #{previous_version}:
204
+
205
+ #{changes.gsub(/^/, ' ')}
206
+ EMAIL
207
+ File.open 'vote-email.txt', 'w' do |file|
208
+ file.write email
209
+ end
210
+ puts "[X] Created release vote email template in 'vote-email.txt'"
211
+ puts email
212
+ end.call
213
+
214
+ end
215
+
216
+
217
+ task(:clobber) { rm_rf '_staged' }