buildr 1.3.5-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGELOG +998 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +45 -0
  6. data/_buildr +29 -0
  7. data/_jbuildr +29 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +22 -0
  10. data/addon/buildr/drb.rb +281 -0
  11. data/addon/buildr/emma.rb +22 -0
  12. data/addon/buildr/hibernate.rb +142 -0
  13. data/addon/buildr/javacc.rb +85 -0
  14. data/addon/buildr/jdepend.rb +60 -0
  15. data/addon/buildr/jetty.rb +248 -0
  16. data/addon/buildr/jibx.rb +86 -0
  17. data/addon/buildr/nailgun.rb +221 -0
  18. data/addon/buildr/openjpa.rb +90 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  26. data/addon/buildr/xmlbeans.rb +93 -0
  27. data/bin/buildr +19 -0
  28. data/buildr.buildfile +58 -0
  29. data/buildr.gemspec +65 -0
  30. data/doc/_config.yml +1 -0
  31. data/doc/_layouts/default.html +88 -0
  32. data/doc/_layouts/preface.html +22 -0
  33. data/doc/artifacts.textile +211 -0
  34. data/doc/building.textile +244 -0
  35. data/doc/contributing.textile +252 -0
  36. data/doc/css/default.css +236 -0
  37. data/doc/css/print.css +101 -0
  38. data/doc/css/syntax.css +23 -0
  39. data/doc/download.textile +79 -0
  40. data/doc/extending.textile +186 -0
  41. data/doc/images/1442160941-frontcover.jpg +0 -0
  42. data/doc/images/asf-logo.gif +0 -0
  43. data/doc/images/asf-logo.png +0 -0
  44. data/doc/images/buildr-hires.png +0 -0
  45. data/doc/images/buildr.png +0 -0
  46. data/doc/images/favicon.png +0 -0
  47. data/doc/images/growl-icon.tiff +0 -0
  48. data/doc/images/note.png +0 -0
  49. data/doc/images/project-structure.png +0 -0
  50. data/doc/images/tip.png +0 -0
  51. data/doc/images/zbuildr.png +0 -0
  52. data/doc/images/zbuildr.tif +0 -0
  53. data/doc/index.textile +69 -0
  54. data/doc/installing.textile +266 -0
  55. data/doc/languages.textile +459 -0
  56. data/doc/mailing_lists.textile +25 -0
  57. data/doc/more_stuff.textile +457 -0
  58. data/doc/packaging.textile +430 -0
  59. data/doc/preface.textile +54 -0
  60. data/doc/projects.textile +271 -0
  61. data/doc/quick_start.textile +210 -0
  62. data/doc/scripts/buildr-git.rb +512 -0
  63. data/doc/scripts/gitflow.rb +296 -0
  64. data/doc/scripts/install-jruby.sh +44 -0
  65. data/doc/scripts/install-linux.sh +72 -0
  66. data/doc/scripts/install-osx.sh +52 -0
  67. data/doc/settings_profiles.textile +280 -0
  68. data/doc/testing.textile +222 -0
  69. data/etc/KEYS +151 -0
  70. data/lib/buildr.rb +36 -0
  71. data/lib/buildr/core.rb +35 -0
  72. data/lib/buildr/core/application.rb +656 -0
  73. data/lib/buildr/core/build.rb +452 -0
  74. data/lib/buildr/core/checks.rb +254 -0
  75. data/lib/buildr/core/common.rb +150 -0
  76. data/lib/buildr/core/compile.rb +608 -0
  77. data/lib/buildr/core/environment.rb +129 -0
  78. data/lib/buildr/core/filter.rb +362 -0
  79. data/lib/buildr/core/generate.rb +195 -0
  80. data/lib/buildr/core/help.rb +119 -0
  81. data/lib/buildr/core/osx.rb +46 -0
  82. data/lib/buildr/core/progressbar.rb +156 -0
  83. data/lib/buildr/core/project.rb +866 -0
  84. data/lib/buildr/core/shell.rb +198 -0
  85. data/lib/buildr/core/test.rb +723 -0
  86. data/lib/buildr/core/transports.rb +559 -0
  87. data/lib/buildr/core/util.rb +449 -0
  88. data/lib/buildr/groovy.rb +19 -0
  89. data/lib/buildr/groovy/bdd.rb +106 -0
  90. data/lib/buildr/groovy/compiler.rb +138 -0
  91. data/lib/buildr/groovy/shell.rb +48 -0
  92. data/lib/buildr/ide.rb +19 -0
  93. data/lib/buildr/ide/eclipse.rb +334 -0
  94. data/lib/buildr/ide/eclipse/java.rb +53 -0
  95. data/lib/buildr/ide/eclipse/plugin.rb +68 -0
  96. data/lib/buildr/ide/eclipse/scala.rb +66 -0
  97. data/lib/buildr/ide/idea.ipr.template +300 -0
  98. data/lib/buildr/ide/idea.rb +190 -0
  99. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  100. data/lib/buildr/ide/idea7x.rb +212 -0
  101. data/lib/buildr/java.rb +23 -0
  102. data/lib/buildr/java/ant.rb +94 -0
  103. data/lib/buildr/java/bdd.rb +459 -0
  104. data/lib/buildr/java/cobertura.rb +274 -0
  105. data/lib/buildr/java/commands.rb +213 -0
  106. data/lib/buildr/java/compiler.rb +349 -0
  107. data/lib/buildr/java/deprecated.rb +141 -0
  108. data/lib/buildr/java/emma.rb +244 -0
  109. data/lib/buildr/java/jruby.rb +117 -0
  110. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  111. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  112. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +137 -0
  113. data/lib/buildr/java/packaging.rb +716 -0
  114. data/lib/buildr/java/pom.rb +174 -0
  115. data/lib/buildr/java/rjb.rb +155 -0
  116. data/lib/buildr/java/test_result.rb +353 -0
  117. data/lib/buildr/java/tests.rb +333 -0
  118. data/lib/buildr/java/version_requirement.rb +172 -0
  119. data/lib/buildr/packaging.rb +24 -0
  120. data/lib/buildr/packaging/archive.rb +488 -0
  121. data/lib/buildr/packaging/artifact.rb +749 -0
  122. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  123. data/lib/buildr/packaging/artifact_search.rb +140 -0
  124. data/lib/buildr/packaging/gems.rb +102 -0
  125. data/lib/buildr/packaging/package.rb +238 -0
  126. data/lib/buildr/packaging/tar.rb +186 -0
  127. data/lib/buildr/packaging/version_requirement.rb +172 -0
  128. data/lib/buildr/packaging/zip.rb +73 -0
  129. data/lib/buildr/packaging/ziptask.rb +316 -0
  130. data/lib/buildr/resources/buildr.icns +0 -0
  131. data/lib/buildr/scala.rb +25 -0
  132. data/lib/buildr/scala/bdd.rb +109 -0
  133. data/lib/buildr/scala/compiler.rb +195 -0
  134. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  135. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  136. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
  137. data/lib/buildr/scala/shell.rb +55 -0
  138. data/lib/buildr/scala/tests.rb +157 -0
  139. data/lib/buildr/shell.rb +180 -0
  140. data/rakelib/checks.rake +57 -0
  141. data/rakelib/doc.rake +92 -0
  142. data/rakelib/jekylltask.rb +120 -0
  143. data/rakelib/package.rake +73 -0
  144. data/rakelib/release.rake +149 -0
  145. data/rakelib/rspec.rake +73 -0
  146. data/rakelib/setup.rake +54 -0
  147. data/rakelib/stage.rake +213 -0
  148. data/rakelib/stage.rake~ +213 -0
  149. data/spec/addon/drb_spec.rb +328 -0
  150. data/spec/core/application_spec.rb +502 -0
  151. data/spec/core/build_spec.rb +677 -0
  152. data/spec/core/checks_spec.rb +519 -0
  153. data/spec/core/common_spec.rb +670 -0
  154. data/spec/core/compile_spec.rb +583 -0
  155. data/spec/core/extension_spec.rb +93 -0
  156. data/spec/core/generate_spec.rb +33 -0
  157. data/spec/core/project_spec.rb +762 -0
  158. data/spec/core/test_spec.rb +1098 -0
  159. data/spec/core/transport_spec.rb +537 -0
  160. data/spec/core/util_spec.rb +67 -0
  161. data/spec/groovy/bdd_spec.rb +80 -0
  162. data/spec/groovy/compiler_spec.rb +240 -0
  163. data/spec/ide/eclipse_spec.rb +501 -0
  164. data/spec/ide/idea7x_spec.rb +84 -0
  165. data/spec/java/ant_spec.rb +33 -0
  166. data/spec/java/bdd_spec.rb +382 -0
  167. data/spec/java/cobertura_spec.rb +85 -0
  168. data/spec/java/compiler_spec.rb +446 -0
  169. data/spec/java/emma_spec.rb +119 -0
  170. data/spec/java/java_spec.rb +124 -0
  171. data/spec/java/packaging_spec.rb +1134 -0
  172. data/spec/java/test_coverage_helper.rb +257 -0
  173. data/spec/java/tests_spec.rb +493 -0
  174. data/spec/packaging/archive_spec.rb +527 -0
  175. data/spec/packaging/artifact_namespace_spec.rb +654 -0
  176. data/spec/packaging/artifact_spec.rb +795 -0
  177. data/spec/packaging/packaging_helper.rb +63 -0
  178. data/spec/packaging/packaging_spec.rb +684 -0
  179. data/spec/sandbox.rb +142 -0
  180. data/spec/scala/bdd_spec.rb +119 -0
  181. data/spec/scala/compiler_spec.rb +284 -0
  182. data/spec/scala/scala.rb +38 -0
  183. data/spec/scala/tests_spec.rb +261 -0
  184. data/spec/spec_helpers.rb +340 -0
  185. data/spec/version_requirement_spec.rb +129 -0
  186. metadata +383 -0
@@ -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' }
@@ -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', :compile] 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 --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', :compile] 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
@@ -0,0 +1,54 @@
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 'jruby' if RUBY_PLATFORM[/java/]
18
+ require 'rubygems/source_info_cache'
19
+
20
+ RAKE_SUDO = case (ENV['RAKE_SUDO'] or 'yes').strip.downcase
21
+ when 'yes', 'true'
22
+ true
23
+ else
24
+ false
25
+ end
26
+
27
+ # Install the specified gem. Options include:
28
+ # - :version -- Version requirement, e.g. '1.2' or '~> 1.2'
29
+ # - :source -- Gem repository, e.g. 'http://gems.github.com'
30
+ def install_gem(name, options = {})
31
+ dep = Gem::Dependency.new(name, options[:version] || '>0')
32
+ if Gem::SourceIndex.from_installed_gems.search(dep).empty?
33
+ puts "Installing #{name} ..."
34
+ rb_bin = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
35
+ args = []
36
+ args << 'sudo' << 'env' << "JAVA_HOME=#{ENV['JAVA_HOME']}" if sudo_needed? and RAKE_SUDO
37
+ args << rb_bin << '-S' << 'gem' << 'install' << name
38
+ args << '--version' << dep.version_requirements.to_s
39
+ args << '--source' << options[:source] if options[:source]
40
+ args << '--source' << 'http://gems.rubyforge.org'
41
+ args << '--install-dir' << ENV['GEM_HOME'] if ENV['GEM_HOME']
42
+ sh *args
43
+ end
44
+ end
45
+
46
+
47
+ # Setup environment for running this Rakefile (RSpec, Jekyll, etc).
48
+ desc "If you're building from sources, run this task first to setup the necessary dependencies."
49
+ task :setup do
50
+ missing = spec.dependencies.select { |dep| Gem::SourceIndex.from_installed_gems.search(dep).empty? }
51
+ missing.each do |dep|
52
+ install_gem dep.name, :version=>dep.version_requirements
53
+ end
54
+ end
@@ -0,0 +1,213 @@
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 'digest/md5'
18
+ require 'digest/sha1'
19
+
20
+ begin # Releases upload Gems to RubyForge.
21
+ require 'rubyforge'
22
+ rescue LoadError
23
+ task(:setup) { install_gem 'rubyforge' }
24
+ end
25
+
26
+
27
+ task :prepare do |task, args|
28
+ # Make sure we're doing a release from checked code.
29
+ lambda do
30
+ puts "Checking there are no local changes ... "
31
+ svn = `svn status`
32
+ #fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
33
+ git = `git status`
34
+ fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^#\t/]
35
+ puts "[X] There are no local changes, everything is in source control"
36
+ end.call
37
+
38
+ # Make sure we have a valid CHANGELOG entry for this release.
39
+ lambda do
40
+ puts "Checking that CHANGELOG indicates most recent version and today's date ... "
41
+ expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
42
+ header = File.readlines('CHANGELOG').first.chomp
43
+ #fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
44
+ puts "[x] CHANGELOG indicates most recent version and today's date"
45
+ end.call
46
+
47
+ # Need GPG to sign the packages.
48
+ lambda do
49
+ args.gpg or fail "Please run with gpg=<argument for gpg --local-user>"
50
+ fail "No GPG user #{args.gpg}" if `gpg2 --list-keys #{args.gpg}`.empty?
51
+ end.call
52
+
53
+ task(:license).invoke
54
+ task(:dependency).invoke
55
+
56
+ # Need JRuby, Scala and Groovy installed to run all the specs.
57
+ lambda do
58
+ puts "Checking that we have JRuby, Scala and Groovy available ... "
59
+ sh 'jruby --version'
60
+ sh 'scala -version'
61
+ sh 'groovy -version'
62
+ puts "[X] We have JRuby, Scala and Groovy"
63
+ end.call
64
+
65
+ # Need Prince to generate PDF
66
+ lambda do
67
+ puts "Checking that we have prince available ... "
68
+ sh 'prince --version'
69
+ puts "[X] We have prince available"
70
+ end.call
71
+
72
+ # Need RubyForge to upload new release files.
73
+ lambda do
74
+ puts "[!] Make sure you have admin privileges to make a release on RubyForge"
75
+ rubyforge = RubyForge.new.configure
76
+ rubyforge.login
77
+ rubyforge.scrape_project(spec.name)
78
+ end.call
79
+
80
+ # We will be speccing in one platform, so also spec the other one.
81
+ task(RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby').invoke # Test the *other* platform
82
+ end
83
+
84
+
85
+ task :stage=>['setup', 'doc:setup', :clobber, :prepare] do |task, args|
86
+ mkpath '_staged'
87
+
88
+ # Start by figuring out what has changed.
89
+ lambda do
90
+ puts "Looking for changes between this release and previous one ..."
91
+ pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
92
+ changes = File.read('CHANGELOG').scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
93
+ current = changes[spec.version.to_s]
94
+ fail "No changeset found for version #{spec.version}" unless current
95
+ File.open '_staged/CHANGES', 'w' do |file|
96
+ file.write "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})\n"
97
+ file.write current
98
+ end
99
+ puts "[X] Listed most recent changed in _staged/CHANGES"
100
+ end.call
101
+
102
+ # Create the packages (gem, tarball) and sign them. This requires user
103
+ # intervention so the earlier we do it the better.
104
+ lambda do
105
+ puts "Creating and signing release packages ..."
106
+ task(:package).invoke
107
+ mkpath '_staged/dist'
108
+ FileList['pkg/*.{gem,zip,tgz}'].each do |source|
109
+ pkg = source.pathmap('_staged/dist/%n%x')
110
+ cp source, pkg
111
+ bytes = File.open(pkg, 'rb') { |file| file.read }
112
+ File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
113
+ File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) << ' ' << File.basename(pkg) }
114
+ sh 'gpg2', '--local-user', args.gpg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
115
+ end
116
+ cp 'etc/KEYS', '_staged'
117
+ puts "[X] Created and signed release packages in _staged/dist"
118
+ end.call
119
+
120
+ # The download page should link to the new binaries/sources, and we
121
+ # want to do that before generating the site/documentation.
122
+ lambda do
123
+ puts "Updating download page with links to release packages ... "
124
+ url = "http://www.apache.org/dist/#{spec.name}/#{spec.version}"
125
+ rows = FileList['_staged/dist/*.{gem,tgz,zip}'].map { |pkg|
126
+ name, md5 = File.basename(pkg), Digest::MD5.file(pkg).to_s
127
+ %{| "#{name}":#{url}/#{name} | "#{md5}":#{url}/#{name}.md5 | "Sig":#{url}/#{name}.asc |}
128
+ }
129
+ textile = <<-TEXTILE
130
+ h3. #{spec.name} #{spec.version} (#{Time.now.strftime('%Y-%m-%d')})
131
+
132
+ |_. Package |_. MD5 Checksum |_. PGP |
133
+ #{rows.join("\n")}
134
+
135
+ p>. ("Release signing keys":#{url}/KEYS)
136
+ TEXTILE
137
+ file_name = 'doc/download.textile'
138
+ print "Adding download links to #{file_name} ... "
139
+ modified = File.read(file_name).sub(/^h2\(#dist\).*$/) { |header| "#{header}\n\n#{textile}" }
140
+ File.open file_name, 'w' do |file|
141
+ file.write modified
142
+ end
143
+ puts "[X] Updated #{file_name}"
144
+ end.call
145
+
146
+
147
+ # Now we can create the Web site, this includes running specs, coverage report, etc.
148
+ # This will take a while, so we want to do it as last step before upload.
149
+ lambda do
150
+ puts "Creating new Web site"
151
+ task(:site).invoke
152
+ cp_r '_site', '_staged/site'
153
+ puts "[X] Created new Web site in _staged/site"
154
+ end.call
155
+
156
+
157
+ # Move everything over to people.apache.org so we can vote on it.
158
+ lambda do
159
+ url = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
160
+ puts "Uploading _staged directory to #{url} ..."
161
+ sh 'rsync', '--progress', '--recursive', '_staged/', url
162
+ puts "[X] Uploaded _staged directory to #{url}"
163
+ end.call
164
+
165
+
166
+ # Prepare a release vote email. In the distant future this will also send the
167
+ # email for you and vote on it.
168
+ lambda do
169
+ # Need to know who you are on Apache, local user may be different (see .ssh/config).
170
+ whoami = `ssh people.apache.org whoami`.strip
171
+ base_url = "http://people.apache.org/~#{whoami}/buildr/#{spec.version}"
172
+ # Need changes for this release only.
173
+ changelog = File.read('CHANGELOG').scan(/(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/)
174
+ changes = changelog[0][2]
175
+ previous_version = changelog[1][1]
176
+
177
+ email = <<-EMAIL
178
+ To: dev@buildr.apache.org
179
+ Subject: [VOTE] Buildr #{spec.version} release
180
+
181
+ We're voting on the source distributions available here:
182
+ #{base_url}/dist/
183
+
184
+ Specifically:
185
+ #{base_url}/dist/buildr-#{spec.version}.tgz
186
+ #{base_url}/dist/buildr-#{spec.version}.zip
187
+
188
+ The documentation generated for this release is available here:
189
+ #{base_url}/site/
190
+ #{base_url}/site/buildr.pdf
191
+
192
+ The official specification against which this release was tested:
193
+ #{base_url}/site/specs.html
194
+
195
+ Test coverage report:
196
+ #{base_url}/site/coverage/index.html
197
+
198
+
199
+ The following changes were made since #{previous_version}:
200
+
201
+ #{changes.gsub(/^/, ' ')}
202
+ EMAIL
203
+ File.open 'vote-email.txt', 'w' do |file|
204
+ file.write email
205
+ end
206
+ puts "[X] Created release vote email template in 'vote-email.txt'"
207
+ puts email
208
+ end.call
209
+
210
+ end
211
+
212
+
213
+ task(:clobber) { rm_rf '_staged' }