assaf-buildr 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/CHANGELOG +887 -0
  2. data/DISCLAIMER +7 -0
  3. data/LICENSE +176 -0
  4. data/NOTICE +26 -0
  5. data/README.rdoc +146 -0
  6. data/Rakefile +62 -0
  7. data/_buildr +38 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +236 -0
  10. data/addon/buildr/emma.rb +238 -0
  11. data/addon/buildr/hibernate.rb +142 -0
  12. data/addon/buildr/javacc.rb +85 -0
  13. data/addon/buildr/jdepend.rb +60 -0
  14. data/addon/buildr/jetty.rb +248 -0
  15. data/addon/buildr/jibx.rb +86 -0
  16. data/addon/buildr/nailgun.rb +817 -0
  17. data/addon/buildr/openjpa.rb +90 -0
  18. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  21. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  25. data/addon/buildr/xmlbeans.rb +93 -0
  26. data/bin/buildr +28 -0
  27. data/buildr.buildfile +53 -0
  28. data/buildr.gemspec +58 -0
  29. data/doc/css/default.css +228 -0
  30. data/doc/css/print.css +100 -0
  31. data/doc/css/syntax.css +52 -0
  32. data/doc/images/apache-incubator-logo.png +0 -0
  33. data/doc/images/buildr-hires.png +0 -0
  34. data/doc/images/buildr.png +0 -0
  35. data/doc/images/favicon.png +0 -0
  36. data/doc/images/growl-icon.tiff +0 -0
  37. data/doc/images/note.png +0 -0
  38. data/doc/images/project-structure.png +0 -0
  39. data/doc/images/tip.png +0 -0
  40. data/doc/images/zbuildr.tif +0 -0
  41. data/doc/pages/artifacts.textile +207 -0
  42. data/doc/pages/building.textile +240 -0
  43. data/doc/pages/contributing.textile +208 -0
  44. data/doc/pages/download.textile +62 -0
  45. data/doc/pages/extending.textile +175 -0
  46. data/doc/pages/getting_started.textile +273 -0
  47. data/doc/pages/index.textile +42 -0
  48. data/doc/pages/languages.textile +407 -0
  49. data/doc/pages/mailing_lists.textile +17 -0
  50. data/doc/pages/more_stuff.textile +286 -0
  51. data/doc/pages/packaging.textile +427 -0
  52. data/doc/pages/projects.textile +274 -0
  53. data/doc/pages/recipes.textile +103 -0
  54. data/doc/pages/settings_profiles.textile +274 -0
  55. data/doc/pages/testing.textile +212 -0
  56. data/doc/pages/troubleshooting.textile +103 -0
  57. data/doc/pages/whats_new.textile +323 -0
  58. data/doc/print.haml +51 -0
  59. data/doc/print.toc.yaml +29 -0
  60. data/doc/scripts/buildr-git.rb +412 -0
  61. data/doc/scripts/install-jruby.sh +44 -0
  62. data/doc/scripts/install-linux.sh +64 -0
  63. data/doc/scripts/install-osx.sh +52 -0
  64. data/doc/site.haml +56 -0
  65. data/doc/site.toc.yaml +47 -0
  66. data/etc/KEYS +151 -0
  67. data/etc/git-svn-authors +16 -0
  68. data/lib/buildr.rb +35 -0
  69. data/lib/buildr/core.rb +27 -0
  70. data/lib/buildr/core/application.rb +489 -0
  71. data/lib/buildr/core/application_cli.rb +139 -0
  72. data/lib/buildr/core/build.rb +311 -0
  73. data/lib/buildr/core/checks.rb +382 -0
  74. data/lib/buildr/core/common.rb +154 -0
  75. data/lib/buildr/core/compile.rb +596 -0
  76. data/lib/buildr/core/environment.rb +120 -0
  77. data/lib/buildr/core/filter.rb +362 -0
  78. data/lib/buildr/core/generate.rb +195 -0
  79. data/lib/buildr/core/help.rb +118 -0
  80. data/lib/buildr/core/progressbar.rb +156 -0
  81. data/lib/buildr/core/project.rb +892 -0
  82. data/lib/buildr/core/test.rb +715 -0
  83. data/lib/buildr/core/transports.rb +558 -0
  84. data/lib/buildr/core/util.rb +289 -0
  85. data/lib/buildr/groovy.rb +18 -0
  86. data/lib/buildr/groovy/bdd.rb +105 -0
  87. data/lib/buildr/groovy/compiler.rb +138 -0
  88. data/lib/buildr/ide.rb +19 -0
  89. data/lib/buildr/ide/eclipse.rb +212 -0
  90. data/lib/buildr/ide/idea.ipr.template +300 -0
  91. data/lib/buildr/ide/idea.rb +189 -0
  92. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  93. data/lib/buildr/ide/idea7x.rb +210 -0
  94. data/lib/buildr/java.rb +23 -0
  95. data/lib/buildr/java/ant.rb +92 -0
  96. data/lib/buildr/java/bdd.rb +449 -0
  97. data/lib/buildr/java/commands.rb +211 -0
  98. data/lib/buildr/java/compiler.rb +348 -0
  99. data/lib/buildr/java/deprecated.rb +141 -0
  100. data/lib/buildr/java/jruby.rb +117 -0
  101. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  102. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  103. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
  104. data/lib/buildr/java/packaging.rb +713 -0
  105. data/lib/buildr/java/pom.rb +178 -0
  106. data/lib/buildr/java/rjb.rb +155 -0
  107. data/lib/buildr/java/test_result.rb +308 -0
  108. data/lib/buildr/java/tests.rb +324 -0
  109. data/lib/buildr/java/version_requirement.rb +172 -0
  110. data/lib/buildr/packaging.rb +21 -0
  111. data/lib/buildr/packaging/artifact.rb +730 -0
  112. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  113. data/lib/buildr/packaging/artifact_search.rb +140 -0
  114. data/lib/buildr/packaging/gems.rb +102 -0
  115. data/lib/buildr/packaging/package.rb +233 -0
  116. data/lib/buildr/packaging/tar.rb +104 -0
  117. data/lib/buildr/packaging/zip.rb +722 -0
  118. data/lib/buildr/resources/buildr.icns +0 -0
  119. data/lib/buildr/scala.rb +19 -0
  120. data/lib/buildr/scala/compiler.rb +109 -0
  121. data/lib/buildr/scala/tests.rb +203 -0
  122. data/rakelib/apache.rake +191 -0
  123. data/rakelib/changelog.rake +57 -0
  124. data/rakelib/doc.rake +103 -0
  125. data/rakelib/package.rake +73 -0
  126. data/rakelib/release.rake +65 -0
  127. data/rakelib/rspec.rake +83 -0
  128. data/rakelib/rubyforge.rake +53 -0
  129. data/rakelib/scm.rake +49 -0
  130. data/rakelib/setup.rake +86 -0
  131. data/rakelib/stage.rake +48 -0
  132. data/spec/addon/cobertura_spec.rb +77 -0
  133. data/spec/addon/emma_spec.rb +120 -0
  134. data/spec/addon/test_coverage_spec.rb +255 -0
  135. data/spec/core/application_spec.rb +412 -0
  136. data/spec/core/artifact_namespace_spec.rb +646 -0
  137. data/spec/core/build_spec.rb +415 -0
  138. data/spec/core/checks_spec.rb +537 -0
  139. data/spec/core/common_spec.rb +664 -0
  140. data/spec/core/compile_spec.rb +566 -0
  141. data/spec/core/generate_spec.rb +33 -0
  142. data/spec/core/project_spec.rb +754 -0
  143. data/spec/core/test_spec.rb +1091 -0
  144. data/spec/core/transport_spec.rb +500 -0
  145. data/spec/groovy/bdd_spec.rb +80 -0
  146. data/spec/groovy/compiler_spec.rb +239 -0
  147. data/spec/ide/eclipse_spec.rb +243 -0
  148. data/spec/java/ant.rb +28 -0
  149. data/spec/java/bdd_spec.rb +358 -0
  150. data/spec/java/compiler_spec.rb +446 -0
  151. data/spec/java/java_spec.rb +88 -0
  152. data/spec/java/packaging_spec.rb +1103 -0
  153. data/spec/java/tests_spec.rb +466 -0
  154. data/spec/packaging/archive_spec.rb +503 -0
  155. data/spec/packaging/artifact_spec.rb +754 -0
  156. data/spec/packaging/packaging_helper.rb +63 -0
  157. data/spec/packaging/packaging_spec.rb +589 -0
  158. data/spec/sandbox.rb +137 -0
  159. data/spec/scala/compiler_spec.rb +228 -0
  160. data/spec/scala/tests_spec.rb +215 -0
  161. data/spec/spec_helpers.rb +304 -0
  162. data/spec/version_requirement_spec.rb +123 -0
  163. metadata +369 -0
@@ -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
+ # Handling of CHANGELOG.
18
+ namespace 'changelog' do
19
+
20
+ task 'check'=>'CHANGELOG' do
21
+ print 'Checking that CHANGELOG indicates most recent version and today\'s date ... '
22
+ expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
23
+ header = File.readlines('CHANGELOG').first.chomp
24
+ fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
25
+ puts 'OK'
26
+ end
27
+
28
+ file 'staged/CHANGES'=>'CHANGELOG' do |task|
29
+ # Read the changes for this release.
30
+ print 'Looking for changes between this release and previous one ... '
31
+ pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
32
+ changes = File.read('CHANGELOG').scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
33
+ current = changes[spec.version.to_s]
34
+ fail "No changeset found for version #{spec.version}" unless current
35
+ File.open task.name, 'w' do |file|
36
+ file.write "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})\n"
37
+ file.write current
38
+ end
39
+ puts 'OK'
40
+ end
41
+
42
+ task 'wrapup'=>'CHANGELOG' do
43
+ next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
44
+ zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
45
+ print 'Adding new entry to CHANGELOG ... '
46
+ modified = "#{next_version} (Pending)\n\n" + File.read('CHANGELOG')
47
+ File.open 'CHANGELOG', 'w' do |file|
48
+ file.write modified
49
+ end
50
+ puts 'Done'
51
+ end
52
+
53
+ end
54
+
55
+ task 'stage:check'=>'changelog:check'
56
+ task 'stage:prepare'=>'staged/CHANGES'
57
+ task 'release:wrapup'=>'changelog:wrapup'
@@ -0,0 +1,103 @@
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/rdoctask'
18
+
19
+ desc 'Generate RDoc documentation'
20
+ rdoc = Rake::RDocTask.new('rdoc') do |rdoc|
21
+ rdoc.rdoc_dir = 'rdoc'
22
+ rdoc.title = spec.name
23
+ rdoc.options = spec.rdoc_options + ['--promiscuous']
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ rdoc.rdoc_files.include spec.extra_rdoc_files
26
+ end
27
+
28
+
29
+ begin
30
+ gem 'allison'
31
+ rdoc.template = File.expand_path('lib/allison.rb', Gem.loaded_specs['allison'].full_gem_path)
32
+ rescue LoadError
33
+ puts 'Please run rake setup to install the Allison RDoc template'
34
+ task 'setup' do
35
+ install_gem 'allison'
36
+ end
37
+ task 'stage:check' do
38
+ fail 'Please run rake setup to install the Allison RDoc template'
39
+ end
40
+ end
41
+
42
+
43
+ begin
44
+ require 'docter'
45
+ require 'docter/server'
46
+
47
+ #Docter.filter_for(:footnote) do |html|
48
+ # html.gsub(/<p id="fn(\d+)">(.*?)<\/p>/, %{<p id="fn\\1" class="footnote">\\2</p>})
49
+ #end
50
+
51
+ collection = Docter.collection(spec.name).using('doc/site.toc.yaml').include('doc/pages', 'LICENSE', 'CHANGELOG')
52
+ # TODO: Add coverage reports when we get them to run.
53
+ template = Docter.template('doc/site.haml').
54
+ include('doc/css', 'doc/images', 'doc/scripts', 'reports/coverage', 'reports/specs.html', 'rdoc', 'print/buildr.pdf')
55
+
56
+ desc 'Run Docter server on port 3000'
57
+ Docter::Rake.serve 'docter', collection, template, :port=>3000
58
+
59
+ desc 'Generate Web site in directory site'
60
+ Docter::Rake.generate 'site', collection, template
61
+
62
+ Docter::Rake.generate 'print',
63
+ Docter.collection(spec.name).using('doc/print.toc.yaml').include('doc/pages'),
64
+ Docter.template('doc/print.haml').include('doc/css', 'doc/images'), :one_page
65
+
66
+ file('print/buildr.pdf'=>'print') do |task|
67
+ mkpath 'site'
68
+ sh 'prince', 'print/index.html', '-o', task.name, '--media=print' do |ok, res|
69
+ fail 'Failed to create PDF, see errors above' unless ok
70
+ end
71
+ end
72
+ task 'site'=>'print/buildr.pdf' do
73
+ cp 'print/buildr.pdf', 'site'
74
+ end
75
+
76
+ task 'site' do
77
+ print 'Checking that we have site documentation, RDoc and PDF ... '
78
+ fail 'No PDF generated, you need to install PrinceXML!' unless File.exist?('site/buildr.pdf')
79
+ fail 'No RDocs in site directory' unless File.exist?('site/rdoc/files/lib/buildr_rb.html')
80
+ fail 'No site documentation in site directory' unless File.exist?('site/index.html')
81
+ fail 'No specifications site directory' unless File.exist?('site/specs.html')
82
+ puts 'OK'
83
+ end
84
+
85
+ desc 'Produce PDF'
86
+ task 'pdf'=>'print/buildr.pdf' do |task|
87
+ sh 'open', 'print/buildr.pdf'
88
+ end
89
+
90
+ task 'clobber' do
91
+ rm_rf 'print'
92
+ rm_rf 'site'
93
+ end
94
+
95
+ rescue LoadError
96
+ puts 'Please run rake setup to install the Docter document generation library'
97
+ task 'setup' do
98
+ install_gem 'docter', '~>1.1.3'
99
+ end
100
+ task 'stage:check' do
101
+ fail 'Please run rake setup to install the Docter document generation library'
102
+ end
103
+ 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
+ desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
21
+ task 'clobber'
22
+
23
+ package = Rake::GemPackageTask.new(spec) do |pkg|
24
+ pkg.need_tar = true
25
+ pkg.need_zip = true
26
+ end
27
+
28
+ desc 'Install the package locally'
29
+ task 'install'=>['setup', "#{package.package_dir}/#{package.gem_file}"] do |task|
30
+ print "Installing #{spec.name} ... "
31
+ args = [Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_file}"]
32
+ args.unshift('sudo') if sudo_needed?
33
+ sh *args
34
+ puts 'Done'
35
+ end
36
+
37
+ desc 'Uninstall previously installed packaged'
38
+ task 'uninstall' do |task|
39
+ print "Uninstalling #{spec.name} ... "
40
+ args = [Config::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version.to_s]
41
+ args.unshift('sudo') if sudo_needed?
42
+ sh *args
43
+ puts 'Done'
44
+ end
45
+
46
+
47
+ desc 'Look for new dependencies, check transitive dependencies'
48
+ task 'dependency' do
49
+ puts "Checking that all dependencies are up to date ..."
50
+ # Find if anything has a more recent dependency. These are not errors, just reports.
51
+ for dep in spec.dependencies
52
+ current = Gem::SourceInfoCache.search(dep, true, true).last
53
+ latest = Gem::SourceInfoCache.search(Gem::Dependency.new(dep.name, '>0'), true, true).last
54
+ puts "A new version of #{dep.name} is available, #{latest.version} replaces #{current.version}" if latest.version > current.version
55
+ end
56
+
57
+ # Returns orderd list of transitive dependencies for the given dependency.
58
+ transitive = lambda { |depend|
59
+ dep_spec = Gem::SourceIndex.from_installed_gems.search(depend).last
60
+ dep_spec.dependencies.map { |trans| transitive[trans].push(trans) }.flatten.uniq }
61
+ # For each dependency, make sure *all* its transitive dependencies are listed
62
+ # as a Buildr dependency, and order is preserved.
63
+ spec.dependencies.each_with_index do |dep, index|
64
+ puts "checking #{dep.name}"
65
+ for trans in transitive[dep]
66
+ matching = spec.dependencies.find { |existing| trans =~ existing }
67
+ fail "#{trans} required by #{dep} and missing from spec" unless matching
68
+ fail "#{trans} must come before #{dep} in dependency list" unless spec.dependencies.index(matching) < index
69
+ end
70
+ end
71
+ end
72
+
73
+ task 'stage:check'=>'dependency'
@@ -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'
@@ -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 --include-file ^addon --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,53 @@
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
44
+ rubyforge.configure
45
+ rubyforge.login
46
+ rubyforge.userconfig.merge!('release_changes'=>changes, 'preformatted' => true) if changes
47
+ rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version.to_s, *files
48
+ puts 'Done'
49
+ end
50
+
51
+ end
52
+
53
+ task 'release:publish'=>'rubyforge:release'
@@ -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 "#{spec.version}"}
42
+ end
43
+ end
44
+ end
45
+
46
+ end
47
+
48
+ task 'stage:check'=>'scm:check'
49
+ task 'release:wrapup'=>'scm:tag'