buildr 1.4.7.pre2-java → 1.4.8-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/CHANGELOG +65 -2
  2. data/Rakefile +3 -6
  3. data/addon/buildr/bnd.rb +13 -3
  4. data/addon/buildr/{checkstyle.rake → checkstyle.rb} +1 -1
  5. data/addon/buildr/{findbugs.rake → findbugs.rb} +0 -0
  6. data/addon/buildr/git_auto_version.rb +33 -0
  7. data/addon/buildr/gwt.rb +82 -0
  8. data/addon/buildr/jacoco.rb +194 -0
  9. data/addon/buildr/{javancss.rake → javancss.rb} +0 -0
  10. data/addon/buildr/nailgun.rb +2 -2
  11. data/addon/buildr/{pmd.rake → pmd.rb} +3 -1
  12. data/addon/buildr/sonar.rb +142 -0
  13. data/buildr.buildfile +1 -1
  14. data/buildr.gemspec +37 -26
  15. data/doc/_layouts/default.html +0 -2
  16. data/doc/contributing.textile +47 -0
  17. data/doc/download.textile +24 -0
  18. data/doc/index.textile +43 -23
  19. data/doc/languages.textile +65 -6
  20. data/doc/more_stuff.textile +43 -0
  21. data/doc/packaging.textile +2 -0
  22. data/doc/settings_profiles.textile +1 -1
  23. data/etc/KEYS +44 -0
  24. data/lib/buildr.rb +3 -7
  25. data/lib/buildr/core/application.rb +41 -8
  26. data/lib/buildr/core/build.rb +102 -1
  27. data/lib/buildr/core/cc.rb +14 -8
  28. data/lib/buildr/core/doc.rb +9 -3
  29. data/lib/buildr/core/generate.rb +150 -9
  30. data/lib/buildr/core/run.rb +1 -1
  31. data/lib/buildr/core/shell.rb +1 -1
  32. data/lib/buildr/core/test.rb +1 -1
  33. data/lib/buildr/core/util.rb +5 -5
  34. data/lib/buildr/ide/eclipse.rb +118 -4
  35. data/lib/buildr/ide/idea.rb +278 -1
  36. data/lib/buildr/java/ant.rb +2 -3
  37. data/lib/buildr/java/bdd.rb +4 -4
  38. data/lib/buildr/java/commands.rb +1 -1
  39. data/lib/buildr/java/pom.rb +5 -4
  40. data/lib/buildr/java/rjb.rb +5 -4
  41. data/lib/buildr/java/test_result.rb +4 -0
  42. data/lib/buildr/packaging/artifact.rb +1 -1
  43. data/lib/buildr/packaging/version_requirement.rb +1 -1
  44. data/lib/buildr/packaging/zip.rb +1 -1
  45. data/lib/buildr/packaging/ziptask.rb +2 -2
  46. data/lib/buildr/run.rb +3 -2
  47. data/lib/buildr/scala.rb +1 -1
  48. data/lib/buildr/scala/bdd.rb +9 -2
  49. data/lib/buildr/scala/compiler.rb +94 -4
  50. data/lib/buildr/scala/doc.rb +17 -5
  51. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
  52. data/lib/buildr/scala/tests.rb +15 -4
  53. data/lib/buildr/version.rb +1 -1
  54. data/rakelib/all-in-one.rake +50 -47
  55. data/rakelib/checks.rake +4 -4
  56. data/rakelib/doc.rake +84 -87
  57. data/rakelib/metrics.rake +9 -9
  58. data/rakelib/package.rake +14 -35
  59. data/rakelib/release.rake +11 -12
  60. data/rakelib/rspec.rake +73 -60
  61. data/rakelib/stage.rake +32 -54
  62. data/spec/addon/bnd_spec.rb +61 -7
  63. data/spec/core/application_spec.rb +1 -1
  64. data/spec/core/build_spec.rb +117 -0
  65. data/spec/core/cc_spec.rb +37 -15
  66. data/spec/core/common_spec.rb +3 -2
  67. data/spec/core/compile_spec.rb +3 -3
  68. data/spec/core/doc_spec.rb +1 -1
  69. data/spec/core/generate_from_eclipse_spec.rb +280 -0
  70. data/spec/core/run_spec.rb +17 -4
  71. data/spec/core/test_spec.rb +5 -3
  72. data/spec/ide/idea_spec.rb +2 -2
  73. data/spec/java/bdd_spec.rb +2 -2
  74. data/spec/java/cobertura_spec.rb +4 -0
  75. data/spec/java/emma_spec.rb +4 -1
  76. data/spec/java/java_spec.rb +1 -1
  77. data/spec/java/packaging_spec.rb +2 -1
  78. data/spec/java/pom_spec.rb +125 -0
  79. data/spec/packaging/archive_spec.rb +25 -2
  80. data/spec/packaging/artifact_spec.rb +3 -3
  81. data/spec/sandbox.rb +7 -2
  82. data/spec/scala/compiler_spec.rb +41 -0
  83. data/spec/scala/doc_spec.rb +22 -3
  84. data/spec/scala/scala.rb +2 -2
  85. data/spec/scala/tests_spec.rb +2 -2
  86. data/spec/spec_helpers.rb +6 -1
  87. data/spec/version_requirement_spec.rb +2 -0
  88. metadata +651 -480
  89. data/lib/buildr/ide/eclipse/java.rb +0 -49
  90. data/lib/buildr/ide/eclipse/plugin.rb +0 -67
  91. data/lib/buildr/ide/eclipse/scala.rb +0 -64
data/rakelib/checks.rake CHANGED
@@ -14,9 +14,9 @@
14
14
  # the License.
15
15
 
16
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 ... "
17
+ desc 'Check that source files contain the Apache license'
18
+ task 'license' => FileList['{addond,lib,doc,rakelib}/**/*.{rb,rake,java}', 'buildr.gemspec', 'Rakefile'] do |task|
19
+ puts 'Checking that files contain the Apache license ... '
20
20
  required = task.prerequisites.select { |fn| File.file?(fn) }
21
21
  missing = required.reject { |fn|
22
22
  comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
@@ -24,5 +24,5 @@ task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do
24
24
  comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
25
25
  }
26
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"
27
+ puts '[x] Source files contain the Apache license'
28
28
  end
data/rakelib/doc.rake CHANGED
@@ -13,111 +13,108 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
- if !RUBY_PLATFORM[/java/]
17
- require 'rdoc/task'
16
+ begin
18
17
 
19
- desc "Creates a symlink to rake's lib directory to support combined rdoc generation"
20
- file "rake/lib" do
21
- rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, "rake.rb") }
22
- mkdir_p "rake"
23
- File.symlink(rake_path, "rake/lib")
24
- end
18
+ gem 'rdoc'
19
+ require 'rdoc/task'
20
+ desc 'Creates a symlink to rake' 's lib directory to support combined rdoc generation'
21
+ file 'rake/lib' do
22
+ rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, 'rake.rb') }
23
+ mkdir_p 'rake'
24
+ File.symlink(rake_path, 'rake/lib')
25
+ end
25
26
 
26
- desc "Generate RDoc documentation in rdoc/"
27
- Rake::RDocTask.new :rdoc do |rdoc|
28
- rdoc.rdoc_dir = 'rdoc'
29
- rdoc.title = spec.name
30
- rdoc.options = spec.rdoc_options.clone
31
- rdoc.rdoc_files.include('lib/**/*.rb')
32
- rdoc.rdoc_files.include spec.extra_rdoc_files
27
+ desc 'Generate RDoc documentation in rdoc/'
28
+ RDoc::Task.new :rdoc do |rdoc|
29
+ rdoc.rdoc_dir = 'rdoc'
30
+ rdoc.title = spec.name
31
+ rdoc.options = spec.rdoc_options.clone
32
+ rdoc.rdoc_files.include('lib/**/*.rb')
33
+ rdoc.rdoc_files.include spec.extra_rdoc_files
33
34
 
34
- # include rake source for better inheritance rdoc
35
- rdoc.rdoc_files.include('rake/lib/**.rb')
36
- end
37
- task :rdoc => ["rake/lib"]
35
+ # include rake source for better inheritance rdoc
36
+ rdoc.rdoc_files.include('rake/lib/**.rb')
37
+ end
38
+ task 'rdoc' => %w(rake/lib)
38
39
 
39
- begin
40
- require 'jekylltask'
41
- module TocFilter
42
- def toc(input)
43
- output = "<ol class=\"toc\">"
44
- input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).each do |entry|
45
- id = (entry[1][/^id=(['"])(.*)\1$/, 2] rescue nil)
46
- title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
47
- if id
48
- output << %{<li><a href="##{id}">#{title}</a></li>}
49
- else
50
- output << %{<li>#{title}</li>}
51
- end
52
- end
53
- output << "</ol>"
54
- output
40
+ require 'jekylltask'
41
+ module TocFilter
42
+ def toc(input)
43
+ output = "<ol class=\"toc\">"
44
+ input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).each do |entry|
45
+ id = (entry[1][/^id=(['"])(.*)\1$/, 2] rescue nil)
46
+ title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
47
+ if id
48
+ output << %{<li><a href="##{id}">#{title}</a></li>}
49
+ else
50
+ output << %{<li>#{title}</li>}
55
51
  end
56
52
  end
57
- Liquid::Template.register_filter(TocFilter)
58
-
59
- desc "Generate Buildr documentation in _site/"
60
- JekyllTask.new :jekyll do |task|
61
- task.source = 'doc'
62
- task.target = '_site'
63
- end
64
-
65
- rescue LoadError
66
- puts "Buildr uses the jekyll gem to generate the Web site. You can install it by running bundler"
53
+ output << '</ol>'
54
+ output
67
55
  end
56
+ end
57
+ Liquid::Template.register_filter(TocFilter)
68
58
 
69
- if `pygmentize -V`.empty?
70
- puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install Pygments'"
71
- end
59
+ desc 'Generate Buildr documentation in _site/'
60
+ JekyllTask.new 'jekyll' do |task|
61
+ task.source = 'doc'
62
+ task.target = '_site'
63
+ end
72
64
 
73
- desc "Generate Buildr documentation as buildr.pdf"
74
- file 'buildr.pdf'=>'_site' do |task|
75
- pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
76
- sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
77
- end
65
+ if 0 == system('pygmentize -V > /dev/null 2> /dev/null')
66
+ puts 'Buildr uses the Pygments python library. You can install it by running ' 'sudo easy_install Pygments' ' or ' 'sudo apt-get install python-pygments' ''
67
+ end
68
+
69
+ desc 'Generate Buildr documentation as buildr.pdf'
70
+ file 'buildr.pdf' => '_site' do |task|
71
+ pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
72
+ sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
73
+ end
78
74
 
79
- desc "Build a copy of the Web site in the ./_site"
80
- task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf'] do
81
- cp_r 'rdoc', '_site'
82
- fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/files/lib/buildr_rb.html')
83
- cp '_reports/specs.html', '_site'
84
- cp_r '_reports/coverage', '_site'
85
- fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
86
- cp 'CHANGELOG', '_site'
87
- open("_site/.htaccess", "w") do |htaccess|
88
- htaccess << %Q{
75
+ desc 'Build a copy of the Web site in the ./_site'
76
+ task 'site' => ['_site', :rdoc, 'buildr.pdf'] do
77
+ cp_r 'rdoc', '_site'
78
+ fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/Buildr.html')
79
+ cp 'CHANGELOG', '_site'
80
+ open('_site/.htaccess', 'w') do |htaccess|
81
+ htaccess << %Q{
89
82
  <FilesMatch "CHANGELOG">
90
83
  ForceType 'text/plain; charset=UTF-8'
91
84
  </FilesMatch>
92
85
  }
93
- end
94
- cp 'buildr.pdf', '_site'
95
- fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
96
- puts 'OK'
97
86
  end
87
+ cp 'buildr.pdf', '_site'
88
+ fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
89
+ puts 'OK'
90
+ end
98
91
 
99
92
  # Publish prerequisites to Web site.
100
- task 'publish'=>:site do
101
- target = "people.apache.org:/www/#{spec.name}.apache.org/"
102
- puts "Uploading new site to #{target} ..."
103
- sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
104
- sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
105
- puts "Done"
106
- end
93
+ task 'publish' => 'site' do
94
+ target = "people.apache.org:/www/#{spec.name}.apache.org/"
95
+ puts "Uploading new site to #{target} ..."
96
+ sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
97
+ sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
98
+ puts 'Done'
99
+ end
107
100
 
108
101
  # Update HTML + PDF documentation (but not entire site; no specs, coverage, etc.)
109
- task 'publish-doc' => ['buildr.pdf', '_site'] do
110
- cp 'buildr.pdf', '_site'
111
- target = "people.apache.org:/www/#{spec.name}.apache.org/"
112
- puts "Uploading new site to #{target} ..."
113
- sh 'rsync', '--progress', '--recursive', '_site/', target # Note: no --delete
114
- sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
115
- puts "Done"
116
- end
102
+ task 'publish-doc' => %w(buildr.pdf _site) do
103
+ cp 'buildr.pdf', '_site'
104
+ target = "people.apache.org:/www/#{spec.name}.apache.org/"
105
+ puts "Uploading new site to #{target} ..."
106
+ sh 'rsync', '--progress', '--recursive', '_site/', target # Note: no --delete
107
+ sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
108
+ puts 'Done'
109
+ end
117
110
 
118
- task :clobber do
119
- rm_rf '_site'
120
- rm_f 'buildr.pdf'
121
- rm_f 'prince_errors.log'
122
- end
111
+ task 'clobber' do
112
+ rm_rf '_site'
113
+ rm_f 'buildr.pdf'
114
+ rm_f 'prince_errors.log'
123
115
  end
116
+
117
+ rescue Exception => e
118
+ # The doc tasks do not work on our CI infrastructure with jruby as the native libraries
119
+ # are not compatible with version of the C++ library we are running there
120
+ end
data/rakelib/metrics.rake CHANGED
@@ -13,15 +13,15 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
- namespace :metrics do
16
+ namespace 'metrics' do
17
17
  desc 'run Saikuro reports'
18
- task :saikuro do
18
+ task 'saikuro' do
19
19
  gem 'atoulme-Saikuro'
20
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"))]
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 = %w(lib addon).collect { |folder|
24
+ FileList[File.expand_path(File.join(File.dirname(__FILE__), '..', folder, '**', '*.rb'))]
25
25
  }.flatten.collect {|path|
26
26
  Pathname.new(path).relative_path_from(base_dir).to_s
27
27
  }
@@ -29,11 +29,11 @@ namespace :metrics do
29
29
  end
30
30
 
31
31
  desc 'generate ccn treemap'
32
- task :ccn_treemap do
32
+ task 'ccn_treemap' do
33
33
  require 'saikuro_treemap'
34
- SaikuroTreemap.generate_treemap :code_dirs => ['lib', 'addon'], :output_file => "_reports/saikuro_treemap.html"
34
+ SaikuroTreemap.generate_treemap :code_dirs => %w(lib addon), :output_file => '_reports/saikuro_treemap.html'
35
35
  end
36
36
  end
37
37
 
38
38
  desc 'Run all metrics tools'
39
- task :metrics => ["metrics:saikuro", "metrics:ccn_treemap"]
39
+ task 'metrics' => %w(metrics:saikuro metrics:ccn_treemap)
data/rakelib/package.rake CHANGED
@@ -13,43 +13,22 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
16
  require 'rubygems/package_task'
18
17
 
19
-
20
18
  package = Gem::PackageTask.new(spec) do |pkg|
21
19
  pkg.need_tar = true
22
20
  pkg.need_zip = true
23
21
  end
24
22
 
25
- desc "Install Buildr from source"
26
- task :install=>["#{package.package_dir}/#{package.gem_spec.file_name}"] do |task|
27
- print "Installing #{spec.name} ... "
28
- args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_spec.file_name}"
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'
23
+ desc 'Compile Java libraries used by Buildr'
24
+ task 'compile' do
25
+ puts 'Compiling Java libraries ...'
26
+ args = RbConfig::CONFIG['ruby_install_name'], File.expand_path(RUBY_PLATFORM[/java/] ? '_jbuildr' : '_buildr'), '--buildfile', 'buildr.buildfile', 'compile'
48
27
  args << '--trace' if Rake.application.options.trace
49
28
  sh *args
50
29
  end
51
- file Gem::PackageTask.new(spec).package_dir => :compile
52
- file Gem::PackageTask.new(spec).package_dir_path => :compile
30
+ file Gem::PackageTask.new(spec).package_dir => 'compile'
31
+ file Gem::PackageTask.new(spec).package_dir_path => 'compile'
53
32
 
54
33
  # We also need the other packages (JRuby if building on Ruby, and vice versa)
55
34
  # Must call new with block, even if block does nothing, otherwise bad things happen.
@@ -57,17 +36,17 @@ file Gem::PackageTask.new(spec).package_dir_path => :compile
57
36
  Gem::PackageTask.new(s) { |task| }
58
37
  end
59
38
 
60
-
61
- desc "Upload snapshot packages over to people.apache.org"
62
- task :snapshot=>[:package] do
39
+ desc 'Upload snapshot packages over to people.apache.org'
40
+ task 'snapshot' => %w(package) do
63
41
  rm_rf '_snapshot' # Always start with empty directory
64
- puts "Copying existing gems from Apache"
42
+ puts 'Copying existing gems from Apache'
65
43
  sh 'rsync', '--progress', '--recursive', 'people.apache.org:public_html/buildr/snapshot/', '_snapshot/'
66
- puts "Copying new gems over"
44
+ puts 'Copying new gems over'
67
45
  cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems'
68
- puts "Generating gem index ..."
46
+ puts 'Generating gem index ...'
69
47
  sh 'gem', 'generate_index', '--directory', '_snapshot'
70
- puts "Copying gem and index back to Apache"
48
+ puts 'Copying gem and index back to Apache'
71
49
  sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/'
72
50
  end
73
- task(:clobber) { rm_rf '_snapshot' }
51
+ task('clobber') { rm_rf 'target' }
52
+ task('clobber') { rm_rf '_snapshot' }
data/rakelib/release.rake CHANGED
@@ -14,26 +14,26 @@
14
14
  # the License.
15
15
 
16
16
 
17
- task :release do
17
+ task 'release' do
18
18
  # First, we need to get all the staged files from Apache to _release.
19
19
  mkpath '_release'
20
20
  lambda do
21
21
  url = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
22
22
  puts "Populating _release directory from #{url} ..."
23
23
  sh 'rsync', '--progress', '--recursive', url, '_release'
24
- puts "[X] Staged files are now in _release"
24
+ puts '[X] Staged files are now in _release'
25
25
  end.call
26
26
 
27
27
 
28
28
  # Upload binary and source packages and new Web site
29
29
  lambda do
30
30
  target = "people.apache.org:/www/www.apache.org/dist/#{spec.name}/#{spec.version}"
31
- puts "Uploading packages to www.apache.org/dist ..."
31
+ puts 'Uploading packages to www.apache.org/dist ...'
32
32
  host, remote_dir = target.split(':')
33
33
  sh 'ssh', host, 'rm', '-rf', remote_dir rescue nil
34
34
  sh 'ssh', host, 'mkdir', remote_dir
35
35
  sh 'rsync', '--progress', '--recursive', "_release/#{spec.version}/dist/", target
36
- puts "[X] Uploaded packages to www.apache.org/dist"
36
+ puts '[X] Uploaded packages to www.apache.org/dist'
37
37
 
38
38
  target = "people.apache.org:/www/#{spec.name}.apache.org/"
39
39
  puts "Uploading new site to #{spec.name}.apache.org ..."
@@ -54,7 +54,7 @@ task :release do
54
54
  rubyforge.userconfig.merge!('release_changes'=>"_release/#{spec.version}/CHANGES", 'preformatted' => true)
55
55
  rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version.to_s, *files
56
56
 
57
- puts "Posting news to RubyForge ... "
57
+ puts 'Posting news to RubyForge ...'
58
58
  changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
59
59
  rubyforge.post_news spec.rubyforge_project.downcase, "Buildr #{spec.version} released",
60
60
  "#{spec.description}\n\nNew in Buildr #{spec.version}:\n#{changes.gsub(/^/, ' ')}\n"
@@ -68,8 +68,8 @@ task :release do
68
68
  puts "Push gem #{f} to RubyForge.org / Gemcutter ... "
69
69
  `gem push #{f}`
70
70
  end
71
- puts "[X] Pushed gems to Rubyforge.org / Gemcutter"
72
- end
71
+ puts '[X] Pushed gems to Rubyforge.org / Gemcutter'
72
+ end.call
73
73
 
74
74
  # Create an SVN tag for this release.
75
75
  lambda do
@@ -81,7 +81,7 @@ task :release do
81
81
  if ok
82
82
  puts "[X] Tagged this release as tags/#{spec.version} ... "
83
83
  else
84
- puts "Could not create tag, please do it yourself!"
84
+ puts 'Could not create tag, please do it yourself!'
85
85
  puts %{ svn copy #{url} #{new_url} -m "Release #{spec.version}"}
86
86
  end
87
87
  end
@@ -98,7 +98,7 @@ task :release do
98
98
  File.open 'CHANGELOG', 'w' do |file|
99
99
  file.write modified
100
100
  end
101
- puts "[X] Updated CHANGELOG and added entry for next release"
101
+ puts '[X] Updated CHANGELOG and added entry for next release'
102
102
  end.call
103
103
 
104
104
 
@@ -150,11 +150,10 @@ The Apache Buildr Team
150
150
  File.open 'announce-email.txt', 'w' do |file|
151
151
  file.write email
152
152
  end
153
- puts "[X] Created release announce email template in 'announce-email.txt'"
153
+ puts '[X] Created release announce email template in ''announce-email.txt'''
154
154
  puts email
155
155
  end
156
156
 
157
157
  end
158
158
 
159
-
160
- task(:clobber) { rm_rf '_release' }
159
+ task('clobber') { rm_rf '_release' }
data/rakelib/rspec.rake CHANGED
@@ -13,78 +13,91 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
- begin
17
- require 'rspec/core/rake_task'
18
- directory '_reports'
16
+ require 'rspec/core/rake_task'
17
+ directory '_reports'
19
18
 
20
- def default_spec_opts
21
- default = %w{--format documentation --out _reports/specs.txt --backtrace}
22
- default << '--colour' if $stdout.isatty && !(Config::CONFIG['host_os'] =~ /mswin|win32|dos/i)
23
- default
24
- end
19
+ def default_spec_opts
20
+ default = %w{--format documentation --out _reports/specs.txt --backtrace}
21
+ default << '--colour' if $stdout.isatty && !(RbConfig::CONFIG['host_os'] =~ /mswin|win32|dos/i)
22
+ default
23
+ end
25
24
 
26
- # RSpec doesn't support file exclusion, so hack our own.
27
- class RSpec::Core::RakeTask
28
- attr_accessor :rspec_files
25
+ # RSpec doesn't support file exclusion, so hack our own.
26
+ class RSpec::Core::RakeTask
27
+ attr_accessor :rspec_files
29
28
  private
30
- def files_to_run
31
- @rspec_files
32
- end
29
+ def files_to_run
30
+ @rspec_files
33
31
  end
32
+ end
34
33
 
35
- desc "Run all specs"
36
- RSpec::Core::RakeTask.new :spec=>['_reports', :compile] do |task|
37
- ENV['USE_FSC'] = 'no'
38
- task.rspec_files = FileList['spec/**/*_spec.rb']
39
- task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
40
- task.rspec_opts = default_spec_opts
41
- task.rspec_opts = %w{--format html --out _reports/specs.html --backtrace}
42
- end
43
- file('_reports/specs.html') { task(:spec).invoke }
34
+ desc 'Run all specs'
35
+ RSpec::Core::RakeTask.new :spec => ['_reports', :compile] do |task|
36
+ ENV['USE_FSC'] = 'no'
37
+ task.rspec_files = FileList['spec/**/*_spec.rb']
38
+ task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
39
+ task.rspec_opts = default_spec_opts
40
+ task.rspec_opts = %w{--format html --out _reports/specs.html --backtrace}
41
+ end
42
+ file('_reports/specs.html') { task(:spec).invoke }
44
43
 
45
- desc 'Run RSpec and generate Spec and coverage reports (slow)'
46
- RSpec::Core::RakeTask.new :coverage=>['_reports', :compile] do |task|
47
- ENV['USE_FSC'] = 'no'
48
- task.rspec_files = FileList['spec/**/*_spec.rb']
49
- task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
50
- task.rspec_opts = default_spec_opts
51
- task.rcov = true
52
- task.rcov_opts = %w{-o _reports/coverage --exclude / --include-file ^lib --text-summary}
53
- end
54
- file('_reports/coverage') { task(:coverage).invoke }
44
+ desc 'Run RSpec and generate Spec and coverage reports (slow)'
45
+ RSpec::Core::RakeTask.new :coverage => ['_reports', :compile] do |task|
46
+ ENV['USE_FSC'] = 'no'
47
+ task.rspec_files = FileList['spec/**/*_spec.rb']
48
+ task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
49
+ task.rspec_opts = default_spec_opts
50
+ task.rcov = true
51
+ task.rcov_opts = %w{-o _reports/coverage --exclude / --include-file ^lib --text-summary}
52
+ end
53
+ file('_reports/coverage') { task(:coverage).invoke }
55
54
 
56
- task :load_ci_reporter do
57
- gem 'ci_reporter'
58
- ENV['CI_REPORTS'] = '_reports/ci'
59
- # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files.
60
- # However, newer versions of rspec don't like double quotes escaping as well, so removing them for now.
61
- ci_rep_path = Gem.loaded_specs['ci_reporter'].full_gem_path
62
- ENV["SPEC_OPTS"] = [ENV["SPEC_OPTS"], default_spec_opts, "--require", "#{ci_rep_path}/lib/ci/reporter/rake/rspec_loader.rb", "--format", "CI::Reporter::RSpec"].join(" ")
63
- end
55
+ task :load_ci_reporter do
56
+ gem 'ci_reporter'
57
+ ENV['CI_REPORTS'] = '_reports/ci'
58
+ # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files.
59
+ # However, newer versions of rspec don't like double quotes escaping as well, so removing them for now.
60
+ ci_rep_path = Gem.loaded_specs['ci_reporter'].full_gem_path
61
+ ENV['SPEC_OPTS'] = [ENV['SPEC_OPTS'], default_spec_opts, '--require', "#{ci_rep_path}/lib/ci/reporter/rake/rspec_loader.rb", '--format', 'CI::Reporter::RSpec'].join(" ")
62
+ end
64
63
 
65
- desc 'Run all specs with CI reporter'
66
- task :ci=>[:load_ci_reporter, :spec]
64
+ desc 'Run all specs with CI reporter'
65
+ task 'ci' => %w(clobber load_ci_reporter spec)
67
66
 
68
- # Useful for testing with JRuby when using Ruby and vice versa.
69
- namespace :spec do
70
- desc "Run all specs specifically with Ruby"
71
- task :ruby do
72
- puts "Running test suite using Ruby ..."
73
- sh 'ruby -S rake spec'
74
- end
67
+ def rvm_run_in(version, command)
68
+ if !(RbConfig::CONFIG['host_os'] =~ /mswin|win32|dos/i)
69
+ cmd_prefix = "rvm #{version} exec"
70
+ sh "rm -f Gemfile.lock; #{cmd_prefix} bundle install; #{cmd_prefix} bundle exec #{command}"
71
+ else
72
+ sh "#{version =~ /jruby/ ? "j" : ""}ruby -S #{command}"
73
+ end
74
+ end
75
75
 
76
- desc "Run all specs specifically with JRuby"
77
- task :jruby do
78
- puts "Running test suite using JRuby ..."
79
- sh 'jruby -S rake spec'
80
- end
76
+ # Useful for testing with JRuby when using Ruby and vice versa.
77
+ namespace 'spec' do
78
+ desc 'Run all specs specifically with Ruby 1.9'
79
+ task 'ruby_1_9' do
80
+ puts 'Running test suite using Ruby ...'
81
+ rvm_run_in('ruby-1.9.2-p320@buildr', 'rake spec')
81
82
  end
82
83
 
83
- task :clobber do
84
- rm_f 'failed'
85
- rm_rf '_reports'
84
+ desc 'Run all specs specifically with Ruby 1.8'
85
+ task 'ruby_1_8' do
86
+ puts 'Running test suite using Ruby ...'
87
+ rvm_run_in('ruby-1.8.7-p358@buildr', 'rake spec')
86
88
  end
87
89
 
88
- rescue LoadError => e
89
- puts "Buildr uses RSpec. You can install it by running bundler"
90
+ desc 'Run all specs specifically with JRuby'
91
+ task 'jruby' do
92
+ puts 'Running test suite using JRuby ...'
93
+ rvm_run_in('jruby-1.6.7@buildr', 'rake spec')
94
+ end
95
+
96
+ desc 'Run all specs across various rubies'
97
+ task 'all' => %w(jruby ruby_1_8 ruby_1_9)
98
+ end
99
+
100
+ task 'clobber' do
101
+ rm_f 'failed'
102
+ rm_rf '_reports'
90
103
  end