ittayd-buildr 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +915 -0
- data/DISCLAIMER +7 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +146 -0
- data/Rakefile +64 -0
- data/_buildr +28 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/cobertura.rb +22 -0
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +22 -0
- data/addon/buildr/hibernate.rb +142 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jdepend.rb +60 -0
- data/addon/buildr/jetty.rb +248 -0
- data/addon/buildr/jibx.rb +86 -0
- data/addon/buildr/nailgun.rb +221 -0
- data/addon/buildr/openjpa.rb +90 -0
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/addon/buildr/path.rb +136 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +53 -0
- data/buildr.gemspec +58 -0
- data/doc/css/default.css +228 -0
- data/doc/css/print.css +100 -0
- data/doc/css/syntax.css +52 -0
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +207 -0
- data/doc/pages/building.textile +240 -0
- data/doc/pages/contributing.textile +208 -0
- data/doc/pages/download.textile +62 -0
- data/doc/pages/extending.textile +175 -0
- data/doc/pages/getting_started.textile +273 -0
- data/doc/pages/index.textile +42 -0
- data/doc/pages/languages.textile +407 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +314 -0
- data/doc/pages/packaging.textile +427 -0
- data/doc/pages/projects.textile +274 -0
- data/doc/pages/recipes.textile +103 -0
- data/doc/pages/settings_profiles.textile +274 -0
- data/doc/pages/testing.textile +212 -0
- data/doc/pages/troubleshooting.textile +103 -0
- data/doc/pages/whats_new.textile +323 -0
- data/doc/print.haml +51 -0
- data/doc/print.toc.yaml +29 -0
- data/doc/scripts/buildr-git.rb +412 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +64 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/site.haml +56 -0
- data/doc/site.toc.yaml +47 -0
- data/etc/KEYS +151 -0
- data/etc/git-svn-authors +16 -0
- data/lib/buildr/core/application.rb +665 -0
- data/lib/buildr/core/build.rb +311 -0
- data/lib/buildr/core/checks.rb +254 -0
- data/lib/buildr/core/common.rb +150 -0
- data/lib/buildr/core/compile.rb +590 -0
- data/lib/buildr/core/environment.rb +117 -0
- data/lib/buildr/core/filter.rb +366 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/osx.rb +49 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +923 -0
- data/lib/buildr/core/test.rb +715 -0
- data/lib/buildr/core/transports.rb +560 -0
- data/lib/buildr/core/util.rb +294 -0
- data/lib/buildr/core.rb +29 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/groovy.rb +18 -0
- data/lib/buildr/ide/eclipse.rb +222 -0
- data/lib/buildr/ide/idea.ipr.template +300 -0
- data/lib/buildr/ide/idea.rb +190 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +212 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/java/ant.rb +92 -0
- data/lib/buildr/java/bdd.rb +451 -0
- data/lib/buildr/java/cobertura.rb +236 -0
- data/lib/buildr/java/commands.rb +211 -0
- data/lib/buildr/java/compiler.rb +348 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/emma.rb +238 -0
- data/lib/buildr/java/jruby.rb +117 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
- data/lib/buildr/java/packaging.rb +717 -0
- data/lib/buildr/java/pom.rb +174 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +307 -0
- data/lib/buildr/java/tests.rb +329 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/java.rb +23 -0
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +759 -0
- data/lib/buildr/packaging/artifact_namespace.rb +972 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +233 -0
- data/lib/buildr/packaging/tar.rb +186 -0
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +64 -0
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/packaging.rb +24 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala/compiler.rb +109 -0
- data/lib/buildr/scala/tests.rb +203 -0
- data/lib/buildr/scala.rb +19 -0
- data/lib/buildr.rb +33 -0
- data/rakelib/apache.rake +191 -0
- data/rakelib/changelog.rake +57 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +76 -0
- data/rakelib/release.rake +65 -0
- data/rakelib/rspec.rake +83 -0
- data/rakelib/rubyforge.rake +56 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +81 -0
- data/rakelib/stage.rake +48 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +419 -0
- data/spec/core/build_spec.rb +423 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +670 -0
- data/spec/core/compile_spec.rb +582 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +776 -0
- data/spec/core/test_spec.rb +1098 -0
- data/spec/core/transport_spec.rb +500 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +239 -0
- data/spec/ide/eclipse_spec.rb +311 -0
- data/spec/java/ant.rb +33 -0
- data/spec/java/bdd_spec.rb +358 -0
- data/spec/java/cobertura_spec.rb +77 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/emma_spec.rb +120 -0
- data/spec/java/java_spec.rb +96 -0
- data/spec/java/packaging_spec.rb +1120 -0
- data/spec/java/test_coverage_spec.rb +255 -0
- data/spec/java/tests_spec.rb +471 -0
- data/spec/packaging/archive_spec.rb +503 -0
- data/spec/packaging/artifact_namespace_spec.rb +646 -0
- data/spec/packaging/artifact_spec.rb +795 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +589 -0
- data/spec/sandbox.rb +139 -0
- data/spec/scala/compiler_spec.rb +228 -0
- data/spec/scala/tests_spec.rb +215 -0
- data/spec/spec_helpers.rb +327 -0
- data/spec/version_requirement_spec.rb +123 -0
- metadata +377 -0
@@ -0,0 +1,65 @@
|
|
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
|
+
# Released files are placed in this directory first, and from there published to various servers.
|
17
|
+
file 'published' do |task, args|
|
18
|
+
mkpath task.name
|
19
|
+
puts "Populating published directory from #{args.staging} ..."
|
20
|
+
sh 'rsync', '--progress', '--recursive', "#{args.staging}/", 'published'
|
21
|
+
puts 'Done'
|
22
|
+
end
|
23
|
+
|
24
|
+
task 'clobber' do
|
25
|
+
rm_rf 'published'
|
26
|
+
end
|
27
|
+
|
28
|
+
namespace 'release' do
|
29
|
+
task 'prepare'=>['setup', 'clobber', 'published']
|
30
|
+
|
31
|
+
task 'publish'
|
32
|
+
|
33
|
+
task 'wrapup'
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Make a release using previously staged files"
|
37
|
+
task 'release'=>['release:prepare', 'release:publish', 'release:wrapup']
|
38
|
+
|
39
|
+
|
40
|
+
task 'next_version' do
|
41
|
+
next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
|
42
|
+
zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
|
43
|
+
|
44
|
+
ver_file = "lib/#{spec.name}.rb"
|
45
|
+
if File.exist?(ver_file)
|
46
|
+
print "Updating #{ver_file} to next version number (#{next_version}) ... "
|
47
|
+
modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
|
48
|
+
File.open ver_file, 'w' do |file|
|
49
|
+
file.write modified
|
50
|
+
end
|
51
|
+
puts 'Done'
|
52
|
+
end
|
53
|
+
|
54
|
+
spec_file = "#{spec.name}.gemspec"
|
55
|
+
if File.exist?(spec_file)
|
56
|
+
print "Updating #{spec_file} to next version number (#{next_version}) ... "
|
57
|
+
modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
|
58
|
+
File.open spec_file, 'w' do |file|
|
59
|
+
file.write modified
|
60
|
+
end
|
61
|
+
puts 'Done'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
task 'release:wrapup'=>'next_version'
|
data/rakelib/rspec.rake
ADDED
@@ -0,0 +1,83 @@
|
|
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
|
+
|
20
|
+
directory 'reports'
|
21
|
+
task 'clobber' do
|
22
|
+
rm_f 'failed'
|
23
|
+
rm_rf 'reports'
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Run all specs'
|
27
|
+
Spec::Rake::SpecTask.new('spec'=>'reports') do |task|
|
28
|
+
task.spec_files = Dir['spec/**/*_spec.rb']
|
29
|
+
task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:reports/specs.html --loadby mtime --backtrace}
|
30
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
31
|
+
end
|
32
|
+
file 'reports/specs.html'=>'spec'
|
33
|
+
|
34
|
+
desc 'Run all failed examples from previous run'
|
35
|
+
Spec::Rake::SpecTask.new('failed') do |task|
|
36
|
+
task.spec_files = Dir['spec/**/*_spec.rb']
|
37
|
+
task.spec_opts = %w{--format specdoc --format failing_examples:failed --example failed --backtrace}
|
38
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
39
|
+
end
|
40
|
+
|
41
|
+
# TODO: Horribly broken! Fix some other time.
|
42
|
+
desc 'Run RSpec and generate Spec and coverage reports (slow)'
|
43
|
+
Spec::Rake::SpecTask.new('coverage'=>'reports') do |task|
|
44
|
+
task.spec_files = Dir['spec/**/*_spec.rb']
|
45
|
+
task.spec_opts = %W{--format progress --format failing_examples:failed --format html:reports/specs.html --backtrace}
|
46
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
47
|
+
task.rcov = true
|
48
|
+
task.rcov_dir = 'reports/coverage'
|
49
|
+
task.rcov_opts << '--exclude / --include-file ^lib --text-summary'
|
50
|
+
end
|
51
|
+
file 'reports/coverage'=>'coverage'
|
52
|
+
|
53
|
+
# Useful for testing with JRuby when using Ruby and vice versa.
|
54
|
+
namespace 'spec' do
|
55
|
+
|
56
|
+
desc 'Run all specs specifically with Ruby'
|
57
|
+
task 'ruby' do
|
58
|
+
puts 'Running test suite using Ruby ...'
|
59
|
+
sh 'ruby -S rake spec'
|
60
|
+
end
|
61
|
+
|
62
|
+
desc 'Run all specs specifically with JRuby'
|
63
|
+
task 'jruby' do
|
64
|
+
puts 'Running test suite using JRuby ...'
|
65
|
+
sh 'jruby -S rake spec'
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
task 'setup' do
|
71
|
+
install_gem 'win32console' if windows? && !RUBY_PLATFORM[/java/] # Colors for RSpec, only on Windows platform.
|
72
|
+
end
|
73
|
+
|
74
|
+
rescue LoadError
|
75
|
+
puts 'Please run rake setup to install RSpec'
|
76
|
+
task 'stage:check' do
|
77
|
+
fail 'Please run rake setup to install RSpec'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
task 'stage:prepare'=>'spec'
|
83
|
+
task 'stage:prepare'=>RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby' # Test the *other* platform
|
@@ -0,0 +1,56 @@
|
|
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 'rubyforge'
|
19
|
+
rescue LoadError
|
20
|
+
puts 'Please run rake setup to install the RubyForge gem'
|
21
|
+
task 'setup' do
|
22
|
+
install_gem 'rubyforge'
|
23
|
+
end
|
24
|
+
task 'release:check' do
|
25
|
+
fail 'Please run rake setup to install the RubyForge gem'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
namespace 'rubyforge' do
|
31
|
+
|
32
|
+
file 'published/rubyforge'=>'published' do
|
33
|
+
mkdir 'published/rubyforge'
|
34
|
+
FileList['published/distro/*.{gem,tgz,zip}'].each do |pkg|
|
35
|
+
cp pkg, 'published/rubyforge/' + File.basename(pkg).sub(/-incubating/, '')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
task 'release'=>'published/rubyforge' do |task|
|
40
|
+
changes = FileList['published/CHANGES'].first
|
41
|
+
files = FileList['published/rubyforge/*.{gem,tgz,zip}'].exclude(changes).existing
|
42
|
+
print "Uploading #{spec.version} to RubyForge ... "
|
43
|
+
rubyforge = RubyForge.new.configure
|
44
|
+
rubyforge.login
|
45
|
+
rubyforge.userconfig.merge!('release_changes'=>changes, 'preformatted' => true) if changes
|
46
|
+
rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version.to_s, *files
|
47
|
+
puts "Done"
|
48
|
+
print "Posting news to RubyForge ... "
|
49
|
+
rubyforge.post_news spec.rubyforge_project.downcase, "Buildr #{spec.versions} released",
|
50
|
+
"New in Buildr #{spec.version}:\n\n#{changes}"
|
51
|
+
puts "Done"
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
task 'release:publish'=>'rubyforge:release'
|
data/rakelib/scm.rake
ADDED
@@ -0,0 +1,49 @@
|
|
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
|
+
# Handling of source control.
|
18
|
+
namespace 'scm' do
|
19
|
+
|
20
|
+
task 'check' do
|
21
|
+
print 'Checking there are no local changes ... '
|
22
|
+
svn = `svn status`
|
23
|
+
fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
|
24
|
+
git = `git status`
|
25
|
+
fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^#\t/]
|
26
|
+
puts 'OK'
|
27
|
+
end
|
28
|
+
|
29
|
+
task 'tag' do
|
30
|
+
info = `svn info` + `git svn info` # Using either svn or git-svn
|
31
|
+
url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
|
32
|
+
break unless url
|
33
|
+
new_url = url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version}")
|
34
|
+
break if url == new_url
|
35
|
+
print "Tagging release as tags/#{spec.version} ... "
|
36
|
+
sh 'svn', 'copy', url, new_url, '-m', "Release #{spec.version}", :verbose=>false do |ok, res|
|
37
|
+
if ok
|
38
|
+
puts 'Done'
|
39
|
+
else
|
40
|
+
puts 'Could not create tag, please do it yourself!'
|
41
|
+
puts %{ svn copy #{url} #{new_url} -m "Release #{spec.version}"}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
task 'stage:check'=>'scm:check'
|
49
|
+
task 'release:wrapup'=>'scm:tag'
|
data/rakelib/setup.rake
ADDED
@@ -0,0 +1,81 @@
|
|
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 'rubygems/source_info_cache'
|
18
|
+
require 'stringio' # for Gem::RemoteFetcher
|
19
|
+
require 'jruby' if RUBY_PLATFORM[/java/]
|
20
|
+
|
21
|
+
# True if running on the Windows operating sytem. Different from Gem.win_platform?
|
22
|
+
# which returns true if running on the Windows platform of MRI, false when using JRuby.
|
23
|
+
def windows?
|
24
|
+
Config::CONFIG['host_os'] =~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_java_home
|
28
|
+
if !ENV['JAVA_HOME'] && RUBY_PLATFORM[/java/]
|
29
|
+
ENV['JAVA_HOME'] = java.lang.System.getProperty('java.home')
|
30
|
+
end
|
31
|
+
fail "Please set JAVA_HOME first #{'(no need to run as sudo)' if ENV['USER'] == 'root'}" unless ENV['JAVA_HOME']
|
32
|
+
end
|
33
|
+
|
34
|
+
def sudo_needed?
|
35
|
+
!( windows? || ENV['GEM_HOME'] )
|
36
|
+
end
|
37
|
+
|
38
|
+
# Finds and returns path to executable. Consults PATH environment variable.
|
39
|
+
# Returns nil if executable not found.
|
40
|
+
def which(name)
|
41
|
+
if windows?
|
42
|
+
path = ENV['PATH'].split(File::PATH_SEPARATOR).map { |path| path.gsub('\\', '/') }.map { |path| "#{path}/#{name}.{exe,bat,com}" }
|
43
|
+
else
|
44
|
+
path = ENV['PATH'].split(File::PATH_SEPARATOR).map { |path| "#{path}/#{name}" }
|
45
|
+
end
|
46
|
+
FileList[path].existing.first
|
47
|
+
end
|
48
|
+
|
49
|
+
# Execute a GemRunner command
|
50
|
+
def gem_run(*args)
|
51
|
+
rb_bin = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
52
|
+
args.unshift rb_bin, '-S', 'gem'
|
53
|
+
args.unshift 'sudo', 'env', 'JAVA_HOME=' + ENV['JAVA_HOME'] if sudo_needed?
|
54
|
+
sh *args.map{ |a| a.inspect }.join(' ')
|
55
|
+
end
|
56
|
+
|
57
|
+
def install_gem(name, ver_requirement = ['> 0'])
|
58
|
+
dep = Gem::Dependency.new(name, ver_requirement)
|
59
|
+
@load_cache = true
|
60
|
+
if Gem::SourceIndex.from_installed_gems.search(dep).empty?
|
61
|
+
spec = Gem::SourceInfoCache.search(dep, true, @load_cache).last
|
62
|
+
fail "#{dep} not found in local or remote repository!" unless spec
|
63
|
+
puts "Installing #{spec.full_name} ..."
|
64
|
+
args = ['install']
|
65
|
+
args.push '--install-dir', ENV['GEM_HOME'] if ENV['GEM_HOME']
|
66
|
+
args.push spec.name, '-v', spec.version.to_s
|
67
|
+
gem_run *args
|
68
|
+
@load_cache = false # Just update the Gem cache once
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Setup environment for running this Rakefile (RSpec, Docter, etc).
|
73
|
+
desc "If you're building from sources, run this task first to setup the necessary dependencies."
|
74
|
+
missing = spec.dependencies.select { |dep| Gem::SourceIndex.from_installed_gems.search(dep).empty? }
|
75
|
+
task 'setup' do
|
76
|
+
set_java_home
|
77
|
+
missing.each do |dep|
|
78
|
+
install_gem dep.name, dep.version_requirements
|
79
|
+
end
|
80
|
+
end
|
81
|
+
puts "Missing Gems #{missing.join(', ')}, please run rake setup first!" unless missing.empty?
|
data/rakelib/stage.rake
ADDED
@@ -0,0 +1,48 @@
|
|
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
|
+
# Staged files are copied to this directory first, and from there uploaded to the staging server.
|
18
|
+
directory 'staged'
|
19
|
+
|
20
|
+
task 'clobber' do
|
21
|
+
rm_rf 'staged'
|
22
|
+
end
|
23
|
+
|
24
|
+
namespace 'stage' do
|
25
|
+
# stage:check verifies that we're able to stage a release: check for a changelog,
|
26
|
+
# local changes, run all the test cases, etc. You can add more actions, e.g.
|
27
|
+
# checking license files, spell checking documentation.
|
28
|
+
task 'check'=>['setup', 'clobber']
|
29
|
+
|
30
|
+
# stage:prepare prepares all the files necessary for making a successful release:
|
31
|
+
# binary and source packages, documentation, Web site, change file, checksums, etc.
|
32
|
+
# This task depends on stage:check, and also performs its own verification of the
|
33
|
+
# produced artifacts. Staged files are placed in the staged directory.
|
34
|
+
task 'prepare'=>'staged'
|
35
|
+
|
36
|
+
# stage:upload moves the stage directory to the staging server.
|
37
|
+
task 'upload' do |task, args|
|
38
|
+
puts "Uploading staged directory to #{args.staging} ..."
|
39
|
+
sh 'rsync', '--progress', '--recursive', 'staged/', args.staging
|
40
|
+
puts 'Done'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Put anything that happens post staging here, e.g. release vote email template.
|
44
|
+
task 'wrapup'
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Stage files for the release, upload them to staging server'
|
48
|
+
task 'stage'=>['stage:check', 'stage:prepare', 'stage:upload', 'stage:wrapup']
|