buildrdeb 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +176 -0
- data/NOTICE +6 -0
- data/README.rdoc +35 -0
- data/Rakefile +45 -0
- data/buildrdeb.gemspec +39 -0
- data/lib/buildrdeb.rb +16 -0
- data/lib/buildrdeb/package.rb +93 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +92 -0
- data/rakelib/jekylltask.rb +120 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +149 -0
- data/rakelib/rspec.rake +73 -0
- data/rakelib/setup.rake +54 -0
- data/rakelib/stage.rake +206 -0
- data/spec/buildrdeb/package_spec.rb +114 -0
- data/spec/spec_helpers.rb +24 -0
- metadata +92 -0
data/rakelib/doc.rake
ADDED
@@ -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
|
+
|
17
|
+
task 'doc:setup'
|
18
|
+
begin # For the Web site, we use the SDoc RDoc generator/theme (http://github.com/voloko/sdoc/)
|
19
|
+
require 'sdoc'
|
20
|
+
rescue LoadError
|
21
|
+
puts "Buildr uses the SDoc RDoc generator/theme. You can install it by running rake doc:setup"
|
22
|
+
task('doc:setup') { install_gem 'voloko-sdoc', :source=>'http://gems.github.com' }
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
require 'rake/rdoctask'
|
27
|
+
|
28
|
+
desc "Generate RDoc documentation in rdoc/"
|
29
|
+
Rake::RDocTask.new :rdoc do |rdoc|
|
30
|
+
rdoc.rdoc_dir = 'rdoc'
|
31
|
+
rdoc.title = spec.name
|
32
|
+
rdoc.options = spec.rdoc_options.clone
|
33
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
34
|
+
rdoc.rdoc_files.include spec.extra_rdoc_files
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
begin
|
39
|
+
require 'rakelib/jekylltask'
|
40
|
+
|
41
|
+
desc "Generate Buildr documentation in _site/"
|
42
|
+
JekyllTask.new :jekyll do |task|
|
43
|
+
task.source = 'doc'
|
44
|
+
task.target = '_site'
|
45
|
+
end
|
46
|
+
|
47
|
+
rescue LoadError
|
48
|
+
puts "Buildr uses the mojombo-jekyll to generate the Web site. You can install it by running rake doc:setup"
|
49
|
+
task 'doc:setup' do
|
50
|
+
install_gem 'mojombo-jekyll', :source=>'http://gems.github.com', :version=>'0.5.4'
|
51
|
+
if `pygmentize -V`.empty?
|
52
|
+
args = %w{easy_install Pygments}
|
53
|
+
args.unshift 'sudo' unless Config::CONFIG['host_os'] =~ /windows/
|
54
|
+
sh *args
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
desc "Generate Buildr documentation as buildr.pdf"
|
61
|
+
file 'buildr.pdf'=>'_site' do |task|
|
62
|
+
pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
|
63
|
+
sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "Build a copy of the Web site in the ./_site"
|
67
|
+
task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf'] do
|
68
|
+
cp_r 'rdoc', '_site'
|
69
|
+
fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/files/lib/buildr_rb.html')
|
70
|
+
cp '_reports/specs.html', '_site'
|
71
|
+
cp_r '_reports/coverage', '_site'
|
72
|
+
fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
|
73
|
+
cp 'CHANGELOG', '_site'
|
74
|
+
cp 'buildr.pdf', '_site'
|
75
|
+
fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
|
76
|
+
puts 'OK'
|
77
|
+
end
|
78
|
+
|
79
|
+
# Publish prerequisites to Web site.
|
80
|
+
task 'publish'=>:site do
|
81
|
+
target = "people.apache.org:/www/#{spec.name}.apache.org/"
|
82
|
+
puts "Uploading new site to #{target} ..."
|
83
|
+
sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
|
84
|
+
sh 'ssh', 'people.apache.org', 'chmod', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
|
85
|
+
puts "Done"
|
86
|
+
end
|
87
|
+
|
88
|
+
task :clobber do
|
89
|
+
rm_rf '_site'
|
90
|
+
rm_f 'buildr.pdf'
|
91
|
+
rm_f 'prince_errors.log'
|
92
|
+
end
|
@@ -0,0 +1,120 @@
|
|
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
|
+
gem 'mojombo-jekyll', '~> 0.5.2' # skip past some buggy versions
|
18
|
+
require 'rake/tasklib'
|
19
|
+
require 'jekyll'
|
20
|
+
|
21
|
+
|
22
|
+
class JekyllTask < Rake::TaskLib
|
23
|
+
def initialize(name=:jekyll) # :yield: self
|
24
|
+
@name = name
|
25
|
+
@source = name
|
26
|
+
@target = name
|
27
|
+
yield self if block_given?
|
28
|
+
task name, :auto, :needs=>[@source] do |task, args|
|
29
|
+
generate args.auto
|
30
|
+
end
|
31
|
+
if @source != @target
|
32
|
+
file @target=>FileList["#{@source}/**/*"] do
|
33
|
+
generate
|
34
|
+
end
|
35
|
+
task 'clobber' do
|
36
|
+
rm_rf @target
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_accessor :source
|
42
|
+
attr_accessor :target
|
43
|
+
|
44
|
+
def generate(auto = false)
|
45
|
+
options = { 'source'=>source, 'destination'=>target }
|
46
|
+
options = Jekyll.configuration(options)
|
47
|
+
site = Jekyll::Site.new(options)
|
48
|
+
|
49
|
+
if auto
|
50
|
+
require 'directory_watcher'
|
51
|
+
puts "Auto generating: just edit a page and save, watch the console to see when we're done regenerating pages"
|
52
|
+
dw = DirectoryWatcher.new(source)
|
53
|
+
dw.interval = 1
|
54
|
+
dw.glob = Dir.chdir(source) do
|
55
|
+
dirs = Dir['*'].select { |x| File.directory?(x) }
|
56
|
+
dirs -= [target]
|
57
|
+
dirs = dirs.map { |x| "#{x}/**/*" }
|
58
|
+
dirs += ['*']
|
59
|
+
end
|
60
|
+
dw.start
|
61
|
+
dw.add_observer do |*args|
|
62
|
+
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
63
|
+
puts "[#{t}] regeneration: #{args.size} files changed"
|
64
|
+
site.process
|
65
|
+
puts "Done"
|
66
|
+
end
|
67
|
+
loop { sleep 1 }
|
68
|
+
else
|
69
|
+
puts "Generating documentation in #{target}"
|
70
|
+
site.process
|
71
|
+
touch target
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
module TocFilter
|
78
|
+
def toc(input)
|
79
|
+
input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).inject(%{<ol class="toc">}) { |toc, entry|
|
80
|
+
id = entry[1][/^id=(['"])(.*)\1$/, 2]
|
81
|
+
title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
|
82
|
+
toc << %{<li><a href="##{id}">#{title}</a></li>}
|
83
|
+
} << "</ol>"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
Liquid::Template.register_filter(TocFilter)
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
# Under Ruby 1.9 [a,b,c].to_s doesn't join the array first. (Jekyll 0.5.2 requires this)
|
91
|
+
module Jekyll
|
92
|
+
class HighlightBlock < Liquid::Block
|
93
|
+
def render(context)
|
94
|
+
if context.registers[:site].pygments
|
95
|
+
render_pygments(context, super.join)
|
96
|
+
else
|
97
|
+
render_codehighlighter(context, super.join)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Ruby 1.9 has sane closure scoping which manages to mess Liquid filters. (Liquid 2.0.0 requires this)
|
104
|
+
module Liquid
|
105
|
+
class Variable
|
106
|
+
def render(context)
|
107
|
+
return '' if @name.nil?
|
108
|
+
@filters.inject(context[@name]) do |output, filter|
|
109
|
+
filterargs = filter[1].to_a.collect do |a|
|
110
|
+
context[a]
|
111
|
+
end
|
112
|
+
begin
|
113
|
+
context.invoke(filter[0], output, *filterargs)
|
114
|
+
rescue FilterNotFound
|
115
|
+
raise FilterNotFound, "Error - filter '#{filter[0]}' in '#{@markup.strip}' could not be found."
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,73 @@
|
|
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
|
+
require 'rake/gempackagetask'
|
18
|
+
|
19
|
+
|
20
|
+
package = Rake::GemPackageTask.new(spec) do |pkg|
|
21
|
+
pkg.need_tar = true
|
22
|
+
pkg.need_zip = true
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Install Buildr from source"
|
26
|
+
task :install=>["#{package.package_dir}/#{package.gem_file}"] do |task|
|
27
|
+
print "Installing #{spec.name} ... "
|
28
|
+
args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_file}"
|
29
|
+
args.unshift('sudo') if sudo_needed?
|
30
|
+
sh *args
|
31
|
+
puts "[x] Installed Buildr #{spec.version}"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Uninstall previous rake install"
|
35
|
+
task :uninstall do |task|
|
36
|
+
puts "Uninstalling #{spec.name} ... "
|
37
|
+
args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version.to_s
|
38
|
+
args.unshift('sudo') if sudo_needed?
|
39
|
+
sh *args
|
40
|
+
puts "[x] Uninstalled Buildr #{spec.version}"
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
desc "Compile Java libraries used by Buildr"
|
45
|
+
task :compile do
|
46
|
+
puts "Compiling Java libraries ..."
|
47
|
+
args = Config::CONFIG['ruby_install_name'], File.expand_path(RUBY_PLATFORM[/java/] ? '_jbuildr' : '_buildr'), '--buildfile', 'buildr.buildfile', 'compile'
|
48
|
+
args << '--trace' if Rake.application.options.trace
|
49
|
+
sh *args
|
50
|
+
end
|
51
|
+
file Rake::GemPackageTask.new(spec).package_dir=>:compile
|
52
|
+
file Rake::GemPackageTask.new(spec).package_dir_path=>:compile
|
53
|
+
|
54
|
+
# We also need the other packages (JRuby if building on Ruby, and vice versa)
|
55
|
+
# Must call new with block, even if block does nothing, otherwise bad things happen.
|
56
|
+
@specs.values.each do |s|
|
57
|
+
Rake::GemPackageTask.new(s) { |task| }
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
desc "Upload snapshot packages over to people.apache.org"
|
62
|
+
task :snapshot=>[:package] do
|
63
|
+
rm_rf '_snapshot' # Always start with empty directory
|
64
|
+
puts "Copying existing gems from Apache"
|
65
|
+
sh 'rsync', '--progress', '--recursive', 'people.apache.org:public_html/buildr/snapshot/', '_snapshot/'
|
66
|
+
puts "Copying new gems over"
|
67
|
+
cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems'
|
68
|
+
puts "Generating gem index ..."
|
69
|
+
sh 'gem', 'generate_index', '--directory', '_snapshot'
|
70
|
+
puts "Copying gem and index back to Apache"
|
71
|
+
sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/'
|
72
|
+
end
|
73
|
+
task(:clobber) { rm_rf '_snapshot' }
|
@@ -0,0 +1,149 @@
|
|
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', '-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
|
+
files = FileList["_release/#{spec.version}/dist/*.{gem,tgz,zip}"]
|
49
|
+
puts "Uploading #{spec.version} to RubyForge ... "
|
50
|
+
rubyforge = RubyForge.new.configure
|
51
|
+
rubyforge.login
|
52
|
+
rubyforge.userconfig.merge!('release_changes'=>"_release/#{spec.version}/CHANGES", 'preformatted' => true)
|
53
|
+
rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version.to_s, *files
|
54
|
+
|
55
|
+
puts "Posting news to RubyForge ... "
|
56
|
+
changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
|
57
|
+
rubyforge.post_news spec.rubyforge_project.downcase, "Buildr #{spec.version} released",
|
58
|
+
"#{spec.description}\n\nNew in Buildr #{spec.version}:\n#{changes.gsub(/^/, ' ')}\n"
|
59
|
+
puts "[X] Uploaded gems and source files to #{spec.name}.rubyforge.org"
|
60
|
+
end.call
|
61
|
+
|
62
|
+
|
63
|
+
# Create an SVN tag for this release.
|
64
|
+
lambda do
|
65
|
+
info = `svn info` + `git svn info` # Using either svn or git-svn
|
66
|
+
if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
|
67
|
+
new_url = url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version}")
|
68
|
+
unless url == new_url
|
69
|
+
sh 'svn', 'copy', url, new_url, '-m', "Release #{spec.version}" do |ok, res|
|
70
|
+
if ok
|
71
|
+
puts "[X] Tagged this release as tags/#{spec.version} ... "
|
72
|
+
else
|
73
|
+
puts "Could not create tag, please do it yourself!"
|
74
|
+
puts %{ svn copy #{url} #{new_url} -m "Release #{spec.version}"}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end.call
|
80
|
+
|
81
|
+
|
82
|
+
# Update CHANGELOG to next release number.
|
83
|
+
lambda do
|
84
|
+
next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
|
85
|
+
zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
|
86
|
+
modified = "#{next_version} (Pending)\n\n" + File.read('CHANGELOG')
|
87
|
+
File.open 'CHANGELOG', 'w' do |file|
|
88
|
+
file.write modified
|
89
|
+
end
|
90
|
+
puts "[X] Updated CHANGELOG and added entry for next release"
|
91
|
+
end.call
|
92
|
+
|
93
|
+
|
94
|
+
# Update source files to next release number.
|
95
|
+
lambda do
|
96
|
+
next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
|
97
|
+
zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
|
98
|
+
|
99
|
+
ver_file = "lib/#{spec.name}.rb"
|
100
|
+
if File.exist?(ver_file)
|
101
|
+
modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
|
102
|
+
File.open ver_file, 'w' do |file|
|
103
|
+
file.write modified
|
104
|
+
end
|
105
|
+
puts "[X] Updated #{ver_file} to next release"
|
106
|
+
end
|
107
|
+
|
108
|
+
spec_file = "#{spec.name}.gemspec"
|
109
|
+
if File.exist?(spec_file)
|
110
|
+
modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
|
111
|
+
File.open spec_file, 'w' do |file|
|
112
|
+
file.write modified
|
113
|
+
end
|
114
|
+
puts "[X] Updated #{spec_file} to next release"
|
115
|
+
end
|
116
|
+
end.call
|
117
|
+
|
118
|
+
|
119
|
+
# Prepare release announcement email.
|
120
|
+
lambda do
|
121
|
+
changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
|
122
|
+
email = <<-EMAIL
|
123
|
+
To: users@buildr.apache.org, announce@apache.org
|
124
|
+
Subject: [ANNOUNCE] Apache Buildr #{spec.version} released
|
125
|
+
|
126
|
+
#{spec.description}
|
127
|
+
|
128
|
+
New in this release:
|
129
|
+
|
130
|
+
#{changes.gsub(/^/, ' ')}
|
131
|
+
|
132
|
+
To learn more about Buildr and get started:
|
133
|
+
http://buildr.apache.org/
|
134
|
+
|
135
|
+
Thanks!
|
136
|
+
The Apache Buildr Team
|
137
|
+
|
138
|
+
EMAIL
|
139
|
+
File.open 'announce-email.txt', 'w' do |file|
|
140
|
+
file.write email
|
141
|
+
end
|
142
|
+
puts "[X] Created release announce email template in 'announce-email.txt'"
|
143
|
+
puts email
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
task(:clobber) { rm_rf '_release' }
|
data/rakelib/rspec.rake
ADDED
@@ -0,0 +1,73 @@
|
|
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
|
+
begin
|
18
|
+
require 'spec/rake/spectask'
|
19
|
+
directory '_reports'
|
20
|
+
|
21
|
+
desc "Run all specs"
|
22
|
+
Spec::Rake::SpecTask.new :spec=>'_reports' do |task|
|
23
|
+
task.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
+
task.spec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
|
25
|
+
task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --loadby mtime --backtrace}
|
26
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
27
|
+
end
|
28
|
+
file('_reports/specs.html') { task(:spec).invoke }
|
29
|
+
|
30
|
+
desc 'Run all failed examples from previous run'
|
31
|
+
Spec::Rake::SpecTask.new :failed do |task|
|
32
|
+
task.spec_files = FileList['spec/**/*_spec.rb']
|
33
|
+
task.spec_opts = %w{--format specdoc --format failing_examples:failed --example failed --backtrace}
|
34
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Run RSpec and generate Spec and coverage reports (slow)'
|
38
|
+
Spec::Rake::SpecTask.new :coverage=>'_reports' do |task|
|
39
|
+
task.spec_files = FileList['spec/**/*_spec.rb']
|
40
|
+
task.spec_opts = %W{--format progress --format failing_examples:failed --format html:_reports/specs.html --backtrace}
|
41
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
42
|
+
task.rcov = true
|
43
|
+
task.rcov_dir = '_reports/coverage'
|
44
|
+
task.rcov_opts = %w{--exclude / --include-file ^lib --text-summary}
|
45
|
+
end
|
46
|
+
file('_reports/coverage') { task(:coverage).invoke }
|
47
|
+
|
48
|
+
|
49
|
+
# Useful for testing with JRuby when using Ruby and vice versa.
|
50
|
+
namespace :spec do
|
51
|
+
desc "Run all specs specifically with Ruby"
|
52
|
+
task :ruby do
|
53
|
+
puts "Running test suite using Ruby ..."
|
54
|
+
sh 'ruby -S rake spec'
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Run all specs specifically with JRuby"
|
58
|
+
task :jruby do
|
59
|
+
puts "Running test suite using JRuby ..."
|
60
|
+
sh 'jruby -S rake spec'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
task :clobber do
|
65
|
+
rm_f 'failed'
|
66
|
+
rm_rf '_reports'
|
67
|
+
end
|
68
|
+
|
69
|
+
rescue LoadError
|
70
|
+
puts "Buildr uses RSpec. You can install it by running rake setup"
|
71
|
+
task(:setup) { install_gem 'rcov', :version=>'~>0.8' }
|
72
|
+
task(:setup) { install_gem 'win32console' if RUBY_PLATFORM[/win32/] } # Colors for RSpec, only on Windows platform.
|
73
|
+
end
|