mguymon-buildr 1.4.5-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. data/CHANGELOG +1291 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +44 -0
  6. data/_buildr +35 -0
  7. data/_jbuildr +35 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/bnd.rb +147 -0
  10. data/addon/buildr/cobertura.rb +22 -0
  11. data/addon/buildr/drb.rb +281 -0
  12. data/addon/buildr/emma.rb +22 -0
  13. data/addon/buildr/hibernate.rb +149 -0
  14. data/addon/buildr/javacc.rb +85 -0
  15. data/addon/buildr/jaxb_xjc.rb +72 -0
  16. data/addon/buildr/jdepend.rb +60 -0
  17. data/addon/buildr/jetty.rb +248 -0
  18. data/addon/buildr/jibx.rb +86 -0
  19. data/addon/buildr/nailgun.rb +221 -0
  20. data/addon/buildr/openjpa.rb +88 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  23. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  27. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  28. data/addon/buildr/protobuf.rb +88 -0
  29. data/addon/buildr/xmlbeans.rb +93 -0
  30. data/bin/buildr +19 -0
  31. data/buildr.buildfile +58 -0
  32. data/buildr.gemspec +78 -0
  33. data/doc/_config.yml +1 -0
  34. data/doc/_layouts/default.html +90 -0
  35. data/doc/_layouts/preface.html +22 -0
  36. data/doc/artifacts.textile +217 -0
  37. data/doc/building.textile +276 -0
  38. data/doc/contributing.textile +268 -0
  39. data/doc/css/default.css +236 -0
  40. data/doc/css/print.css +101 -0
  41. data/doc/css/syntax.css +23 -0
  42. data/doc/download.textile +151 -0
  43. data/doc/extending.textile +212 -0
  44. data/doc/images/1442160941-frontcover.jpg +0 -0
  45. data/doc/images/asf-logo.gif +0 -0
  46. data/doc/images/asf-logo.png +0 -0
  47. data/doc/images/buildr-hires.png +0 -0
  48. data/doc/images/buildr.png +0 -0
  49. data/doc/images/favicon.png +0 -0
  50. data/doc/images/growl-icon.tiff +0 -0
  51. data/doc/images/note.png +0 -0
  52. data/doc/images/project-structure.png +0 -0
  53. data/doc/images/tip.png +0 -0
  54. data/doc/images/zbuildr.png +0 -0
  55. data/doc/images/zbuildr.tif +0 -0
  56. data/doc/index.textile +109 -0
  57. data/doc/installing.textile +284 -0
  58. data/doc/languages.textile +599 -0
  59. data/doc/mailing_lists.textile +29 -0
  60. data/doc/more_stuff.textile +845 -0
  61. data/doc/packaging.textile +618 -0
  62. data/doc/preface.textile +54 -0
  63. data/doc/projects.textile +276 -0
  64. data/doc/quick_start.textile +210 -0
  65. data/doc/releasing.textile +117 -0
  66. data/doc/scripts/buildr-git.rb +512 -0
  67. data/doc/scripts/gitflow.rb +296 -0
  68. data/doc/scripts/install-jruby.sh +44 -0
  69. data/doc/scripts/install-linux.sh +73 -0
  70. data/doc/scripts/install-osx.sh +52 -0
  71. data/doc/settings_profiles.textile +287 -0
  72. data/doc/testing.textile +247 -0
  73. data/etc/KEYS +189 -0
  74. data/lib/buildr.rb +44 -0
  75. data/lib/buildr/clojure.rb +34 -0
  76. data/lib/buildr/clojure/shell.rb +52 -0
  77. data/lib/buildr/core.rb +34 -0
  78. data/lib/buildr/core/application.rb +700 -0
  79. data/lib/buildr/core/build.rb +516 -0
  80. data/lib/buildr/core/cc.rb +166 -0
  81. data/lib/buildr/core/checks.rb +253 -0
  82. data/lib/buildr/core/common.rb +151 -0
  83. data/lib/buildr/core/compile.rb +622 -0
  84. data/lib/buildr/core/doc.rb +276 -0
  85. data/lib/buildr/core/environment.rb +129 -0
  86. data/lib/buildr/core/filter.rb +404 -0
  87. data/lib/buildr/core/generate.rb +197 -0
  88. data/lib/buildr/core/help.rb +119 -0
  89. data/lib/buildr/core/jrebel.rb +42 -0
  90. data/lib/buildr/core/linux.rb +30 -0
  91. data/lib/buildr/core/osx.rb +46 -0
  92. data/lib/buildr/core/progressbar.rb +161 -0
  93. data/lib/buildr/core/project.rb +975 -0
  94. data/lib/buildr/core/run.rb +43 -0
  95. data/lib/buildr/core/shell.rb +137 -0
  96. data/lib/buildr/core/test.rb +843 -0
  97. data/lib/buildr/core/transports.rb +575 -0
  98. data/lib/buildr/core/util.rb +537 -0
  99. data/lib/buildr/groovy.rb +20 -0
  100. data/lib/buildr/groovy/bdd.rb +106 -0
  101. data/lib/buildr/groovy/compiler.rb +153 -0
  102. data/lib/buildr/groovy/doc.rb +76 -0
  103. data/lib/buildr/groovy/shell.rb +57 -0
  104. data/lib/buildr/ide.rb +19 -0
  105. data/lib/buildr/ide/eclipse.rb +427 -0
  106. data/lib/buildr/ide/eclipse/java.rb +53 -0
  107. data/lib/buildr/ide/eclipse/plugin.rb +71 -0
  108. data/lib/buildr/ide/eclipse/scala.rb +68 -0
  109. data/lib/buildr/ide/idea.rb +576 -0
  110. data/lib/buildr/java.rb +25 -0
  111. data/lib/buildr/java/ant.rb +94 -0
  112. data/lib/buildr/java/bdd.rb +460 -0
  113. data/lib/buildr/java/cobertura.rb +297 -0
  114. data/lib/buildr/java/commands.rb +223 -0
  115. data/lib/buildr/java/compiler.rb +135 -0
  116. data/lib/buildr/java/deprecated.rb +141 -0
  117. data/lib/buildr/java/doc.rb +86 -0
  118. data/lib/buildr/java/ecj.rb +69 -0
  119. data/lib/buildr/java/emma.rb +244 -0
  120. data/lib/buildr/java/external.rb +73 -0
  121. data/lib/buildr/java/jruby.rb +122 -0
  122. data/lib/buildr/java/jtestr_result.rb +295 -0
  123. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  124. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  125. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
  126. data/lib/buildr/java/packaging.rb +734 -0
  127. data/lib/buildr/java/pom.rb +178 -0
  128. data/lib/buildr/java/rjb.rb +154 -0
  129. data/lib/buildr/java/test_result.rb +101 -0
  130. data/lib/buildr/java/tests.rb +362 -0
  131. data/lib/buildr/java/version_requirement.rb +172 -0
  132. data/lib/buildr/packaging.rb +25 -0
  133. data/lib/buildr/packaging/archive.rb +535 -0
  134. data/lib/buildr/packaging/artifact.rb +904 -0
  135. data/lib/buildr/packaging/artifact_namespace.rb +984 -0
  136. data/lib/buildr/packaging/artifact_search.rb +140 -0
  137. data/lib/buildr/packaging/gems.rb +105 -0
  138. data/lib/buildr/packaging/package.rb +249 -0
  139. data/lib/buildr/packaging/repository_array.rb +108 -0
  140. data/lib/buildr/packaging/tar.rb +189 -0
  141. data/lib/buildr/packaging/version_requirement.rb +192 -0
  142. data/lib/buildr/packaging/zip.rb +178 -0
  143. data/lib/buildr/packaging/ziptask.rb +356 -0
  144. data/lib/buildr/resources/buildr.icns +0 -0
  145. data/lib/buildr/resources/completed.png +0 -0
  146. data/lib/buildr/resources/failed.png +0 -0
  147. data/lib/buildr/resources/icons-license.txt +17 -0
  148. data/lib/buildr/run.rb +195 -0
  149. data/lib/buildr/scala.rb +26 -0
  150. data/lib/buildr/scala/bdd.rb +118 -0
  151. data/lib/buildr/scala/compiler.rb +242 -0
  152. data/lib/buildr/scala/doc.rb +142 -0
  153. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  154. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  155. data/lib/buildr/scala/shell.rb +52 -0
  156. data/lib/buildr/scala/tests.rb +171 -0
  157. data/lib/buildr/shell.rb +185 -0
  158. data/lib/buildr/version.rb +18 -0
  159. data/rakelib/all-in-one.rake +113 -0
  160. data/rakelib/checks.rake +57 -0
  161. data/rakelib/doc.rake +137 -0
  162. data/rakelib/metrics.rake +39 -0
  163. data/rakelib/package.rake +73 -0
  164. data/rakelib/release.rake +160 -0
  165. data/rakelib/rspec.rake +91 -0
  166. data/rakelib/setup.rake +66 -0
  167. data/rakelib/stage.rake +220 -0
  168. data/spec/addon/bnd_spec.rb +330 -0
  169. data/spec/addon/drb_spec.rb +328 -0
  170. data/spec/addon/jaxb_xjc_spec.rb +125 -0
  171. data/spec/core/application_spec.rb +631 -0
  172. data/spec/core/build_spec.rb +837 -0
  173. data/spec/core/cc_spec.rb +224 -0
  174. data/spec/core/checks_spec.rb +519 -0
  175. data/spec/core/common_spec.rb +725 -0
  176. data/spec/core/compile_spec.rb +658 -0
  177. data/spec/core/doc_spec.rb +195 -0
  178. data/spec/core/extension_spec.rb +201 -0
  179. data/spec/core/generate_spec.rb +33 -0
  180. data/spec/core/project_spec.rb +772 -0
  181. data/spec/core/run_spec.rb +93 -0
  182. data/spec/core/shell_spec.rb +146 -0
  183. data/spec/core/test_spec.rb +1320 -0
  184. data/spec/core/transport_spec.rb +544 -0
  185. data/spec/core/util_spec.rb +141 -0
  186. data/spec/groovy/bdd_spec.rb +80 -0
  187. data/spec/groovy/compiler_spec.rb +251 -0
  188. data/spec/groovy/doc_spec.rb +65 -0
  189. data/spec/ide/eclipse_spec.rb +739 -0
  190. data/spec/ide/idea_spec.rb +1145 -0
  191. data/spec/java/ant_spec.rb +37 -0
  192. data/spec/java/bdd_spec.rb +374 -0
  193. data/spec/java/cobertura_spec.rb +112 -0
  194. data/spec/java/commands_spec.rb +93 -0
  195. data/spec/java/compiler_spec.rb +252 -0
  196. data/spec/java/doc_spec.rb +56 -0
  197. data/spec/java/ecj_spec.rb +115 -0
  198. data/spec/java/emma_spec.rb +121 -0
  199. data/spec/java/external_spec.rb +56 -0
  200. data/spec/java/java_spec.rb +132 -0
  201. data/spec/java/packaging_spec.rb +1266 -0
  202. data/spec/java/run_spec.rb +78 -0
  203. data/spec/java/test_coverage_helper.rb +257 -0
  204. data/spec/java/tests_spec.rb +497 -0
  205. data/spec/packaging/archive_spec.rb +775 -0
  206. data/spec/packaging/artifact_namespace_spec.rb +743 -0
  207. data/spec/packaging/artifact_spec.rb +1074 -0
  208. data/spec/packaging/packaging_helper.rb +63 -0
  209. data/spec/packaging/packaging_spec.rb +719 -0
  210. data/spec/packaging/repository_array_spec.rb +109 -0
  211. data/spec/sandbox.rb +165 -0
  212. data/spec/scala/bdd_spec.rb +124 -0
  213. data/spec/scala/compiler_spec.rb +289 -0
  214. data/spec/scala/doc_spec.rb +88 -0
  215. data/spec/scala/scala.rb +38 -0
  216. data/spec/scala/tests_spec.rb +283 -0
  217. data/spec/spec_helpers.rb +369 -0
  218. data/spec/version_requirement_spec.rb +143 -0
  219. data/spec/xpath_matchers.rb +121 -0
  220. metadata +600 -0
@@ -0,0 +1,18 @@
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
+ module Buildr
17
+ VERSION = '1.4.5'.freeze
18
+ end
@@ -0,0 +1,113 @@
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
+ desc "Create JRuby all-in-one distribution"
17
+ task "all-in-one" => 'all-in-one:all-in-one'
18
+
19
+ namespace :'all-in-one' do
20
+
21
+ version = "1.5.2"
22
+ jruby_distro = "jruby-bin-#{version}.tar.gz"
23
+ url = "http://jruby.org.s3.amazonaws.com/downloads/#{version}/#{jruby_distro}"
24
+ dir = "jruby-#{version}"
25
+
26
+ task "all-in-one" => [:gem,
27
+ # Prepare to run
28
+ :prepare,
29
+ # Download and extract JRuby
30
+ :download_and_extract,
31
+ # Cleanup JRuby distribution
32
+ :clean_dist,
33
+ # Install Buildr gem and dependencies
34
+ :install_dependencies,
35
+ # Add Buildr executables/scripts
36
+ :add_execs,
37
+ # Package distribution
38
+ :package
39
+ ]
40
+
41
+ desc 'Prepare to run'
42
+ task :prepare do
43
+ mkpath '_all-in-one'
44
+ cd '_all-in-one'
45
+ end
46
+
47
+ desc 'Download and extract JRuby'
48
+ task :download_and_extract do
49
+ unless File.exist? jruby_distro
50
+ puts "Downloading JRuby from #{url} ..."
51
+ sh 'wget', url
52
+ puts "[X] Downloaded JRuby"
53
+ end
54
+
55
+ rm_rf dir if File.exist? dir
56
+
57
+ puts "Extracting JRuby to #{dir} ..."
58
+ sh 'tar', 'xzf', jruby_distro
59
+ puts "[X] Extracted JRuby"
60
+ cd dir
61
+ end
62
+
63
+ desc 'Cleanup JRuby distribution'
64
+ task :clean_dist do
65
+ puts 'Cleaning...'
66
+ rm_rf 'docs'
67
+ mkpath 'jruby-docs'
68
+ mv Dir["COPYING*"], 'jruby-docs'
69
+ mv Dir["LICENSE*"], 'jruby-docs'
70
+ mv 'README', 'jruby-docs'
71
+ rm_rf 'lib/ruby/1.9'
72
+ rm_rf 'lib/ruby/gems/1.8/doc'
73
+ rm_rf 'samples'
74
+ rm_rf 'share'
75
+ end
76
+
77
+ desc 'Install Buildr gem and dependencies'
78
+ task :install_dependencies do
79
+ puts "Install Buildr gem ..."
80
+ sh "bin/jruby", '-S', 'gem', 'install', FileList['../../pkg/*-java.gem'].first,
81
+ '--no-rdoc', '--no-ri'
82
+ puts "[X] Install Buildr gem"
83
+ end
84
+
85
+ desc 'Add Buildr executables/scripts'
86
+ task :add_execs do
87
+ cp 'bin/jruby.exe', 'bin/_buildr.exe'
88
+ cp Dir["../../all-in-one/*"], 'bin'
89
+ end
90
+
91
+ desc 'Package distribution'
92
+ task :package do
93
+ puts "Zipping distribution ..."
94
+ cd '..'
95
+ new_dir = "#{spec.name}-#{spec.version}"
96
+ mv dir, new_dir
97
+ zip = "#{new_dir}.zip"
98
+ rm zip if File.exist? zip
99
+ sh 'zip', '-q', '-r', zip, new_dir
100
+ puts "[X] Zipped distribution"
101
+
102
+ puts "Tarring distribution ..."
103
+ tar = "#{new_dir}.tar.gz"
104
+ rm tar if File.exist? tar
105
+ sh 'tar', 'czf', tar, new_dir
106
+ puts "[X] Tarred distribution"
107
+
108
+ rm_rf new_dir
109
+ end
110
+
111
+ end
112
+
113
+ task(:clobber) { rm_rf '_all-in-one' }
@@ -0,0 +1,57 @@
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
+ desc "Check that source files contain the Apache license"
18
+ task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do |task|
19
+ puts "Checking that files contain the Apache license ... "
20
+ required = task.prerequisites.select { |fn| File.file?(fn) }
21
+ missing = required.reject { |fn|
22
+ comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
23
+ map { |match| match.compact }.flatten.join("\n")
24
+ comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
25
+ }
26
+ fail "#{missing.join(', ')} missing Apache License, please add it before making a release!" unless missing.empty?
27
+ puts "[x] Source files contain the Apache license"
28
+ end
29
+
30
+
31
+ desc "Look for new dependencies, check transitive dependencies"
32
+ task :dependency do
33
+ puts "Checking that all dependencies are up to date ..."
34
+ # Find if anything has a more recent dependency. These are not errors, just reports.
35
+ spec.dependencies.each do |dep|
36
+ current = Gem::SourceInfoCache.search(dep).last
37
+ latest = Gem::SourceInfoCache.search(Gem::Dependency.new(dep.name, '>0')).last
38
+ puts "A new version of #{dep.name} is available, #{latest.version} replaces #{current.version}" if (current && latest && latest.version > current.version)
39
+ end
40
+
41
+ # Returns orderd list of transitive dependencies for the given dependency.
42
+ transitive = lambda { |depend|
43
+ dep_spec = Gem::SourceIndex.from_installed_gems.search(depend).last
44
+ fail "No specification for dependency #{depend}" unless dep_spec
45
+ dep_spec.runtime_dependencies.map { |trans| transitive[trans].push(trans) }.flatten.uniq }
46
+ # For each dependency, make sure *all* its transitive dependencies are listed
47
+ # as a Buildr dependency, and order is preserved.
48
+ spec.dependencies.select {|dep| dep.type == :runtime }.each_with_index do |dep, index|
49
+ puts "checking #{dep.name}"
50
+ transitive[dep].each do |trans|
51
+ matching = spec.dependencies.find { |existing| trans =~ existing }
52
+ fail "#{trans} required by #{dep} and missing from spec" unless matching
53
+ fail "#{trans} must come before #{dep} in dependency list" unless spec.dependencies.index(matching) < index
54
+ end
55
+ end
56
+ puts "[X] Checked all dependencies are up to date and transitive dependencies are correctly ordered"
57
+ end
data/rakelib/doc.rake ADDED
@@ -0,0 +1,137 @@
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 "Creates a symlink to rake's lib directory to support combined rdoc generation"
29
+ file "rake/lib" do
30
+ rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, "rake.rb") }
31
+ mkdir_p "rake"
32
+ File.symlink(rake_path, "rake/lib")
33
+ end
34
+
35
+ desc "Generate RDoc documentation in rdoc/"
36
+ Rake::RDocTask.new :rdoc do |rdoc|
37
+ rdoc.rdoc_dir = 'rdoc'
38
+ rdoc.title = spec.name
39
+ rdoc.options = spec.rdoc_options.clone
40
+ rdoc.rdoc_files.include('lib/**/*.rb')
41
+ rdoc.rdoc_files.include spec.extra_rdoc_files
42
+
43
+ # include rake source for better inheritance rdoc
44
+ rdoc.rdoc_files.include('rake/lib/**.rb')
45
+ end
46
+ task :rdoc => ["rake/lib"]
47
+
48
+ begin
49
+ require 'jekylltask'
50
+ module TocFilter
51
+ def toc(input)
52
+ output = "<ol class=\"toc\">"
53
+ input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).each do |entry|
54
+ id = (entry[1][/^id=(['"])(.*)\1$/, 2] rescue nil)
55
+ title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
56
+ if id
57
+ output << %{<li><a href="##{id}">#{title}</a></li>}
58
+ else
59
+ output << %{<li>#{title}</li>}
60
+ end
61
+ end
62
+ output << "</ol>"
63
+ output
64
+ end
65
+ end
66
+ Liquid::Template.register_filter(TocFilter)
67
+
68
+ desc "Generate Buildr documentation in _site/"
69
+ JekyllTask.new :jekyll do |task|
70
+ task.source = 'doc'
71
+ task.target = '_site'
72
+ end
73
+
74
+ rescue LoadError
75
+ puts "Buildr uses the jekyll gem to generate the Web site. You can install it by running rake doc:setup"
76
+ task 'doc:setup' do
77
+ install_gem 'jekyll', :version=>'0.6.2'
78
+ install_gem 'jekylltask', :version=>'1.0.2'
79
+ if `pygmentize -V`.empty?
80
+ args = %w{easy_install Pygments}
81
+ args.unshift 'sudo' unless Config::CONFIG['host_os'] =~ /windows/
82
+ sh *args
83
+ end
84
+ end
85
+ end
86
+
87
+
88
+ desc "Generate Buildr documentation as buildr.pdf"
89
+ file 'buildr.pdf'=>'_site' do |task|
90
+ pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
91
+ sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
92
+ end
93
+
94
+ desc "Build a copy of the Web site in the ./_site"
95
+ task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf'] do
96
+ cp_r 'rdoc', '_site'
97
+ fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/files/lib/buildr_rb.html')
98
+ cp '_reports/specs.html', '_site'
99
+ cp_r '_reports/coverage', '_site'
100
+ fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
101
+ cp 'CHANGELOG', '_site'
102
+ open("_site/.htaccess", "w") do |htaccess|
103
+ htaccess << %Q{
104
+ <FilesMatch "CHANGELOG">
105
+ ForceType 'text/plain; charset=UTF-8'
106
+ </FilesMatch>
107
+ }
108
+ end
109
+ cp 'buildr.pdf', '_site'
110
+ fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
111
+ puts 'OK'
112
+ end
113
+
114
+ # Publish prerequisites to Web site.
115
+ task 'publish'=>:site do
116
+ target = "people.apache.org:/www/#{spec.name}.apache.org/"
117
+ puts "Uploading new site to #{target} ..."
118
+ sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
119
+ sh 'ssh', 'people.apache.org', 'chmod', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
120
+ puts "Done"
121
+ end
122
+
123
+ # Update HTML + PDF documentation (but not entire site; no specs, coverage, etc.)
124
+ task 'publish-doc' => ['buildr.pdf', '_site'] do
125
+ cp 'buildr.pdf', '_site'
126
+ target = "people.apache.org:/www/#{spec.name}.apache.org/"
127
+ puts "Uploading new site to #{target} ..."
128
+ sh 'rsync', '--progress', '--recursive', '_site/', target # Note: no --delete
129
+ sh 'ssh', 'people.apache.org', 'chmod', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
130
+ puts "Done"
131
+ end
132
+
133
+ task :clobber do
134
+ rm_rf '_site'
135
+ rm_f 'buildr.pdf'
136
+ rm_f 'prince_errors.log'
137
+ end
@@ -0,0 +1,39 @@
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
+ namespace :metrics do
17
+ desc 'run Saikuro reports'
18
+ task :saikuro do
19
+ gem 'atoulme-Saikuro'
20
+ require 'saikuro'
21
+ output_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "_reports", "saikuro"))
22
+ base_dir = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), "..")))
23
+ rb_files = ["lib", "addon"].collect { |folder|
24
+ FileList[File.expand_path(File.join(File.dirname(__FILE__), "..", folder, "**", "*.rb"))]
25
+ }.flatten.collect {|path|
26
+ Pathname.new(path).relative_path_from(base_dir).to_s
27
+ }
28
+ SaikuroRunner.new.run(rb_files, output_dir)
29
+ end
30
+
31
+ desc 'generate ccn treemap'
32
+ task :ccn_treemap do
33
+ require 'saikuro_treemap'
34
+ SaikuroTreemap.generate_treemap :code_dirs => ['lib', 'addon'], :output_file => "_reports/saikuro_treemap.html"
35
+ end
36
+ end
37
+
38
+ desc 'Run all metrics tools'
39
+ task :metrics => ["metrics:saikuro", "metrics:ccn_treemap"]
@@ -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,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', '-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' }