buildr 1.3.5-java → 1.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr.rb +1 -1
  37. data/lib/buildr/core.rb +1 -0
  38. data/lib/buildr/core/application.rb +33 -27
  39. data/lib/buildr/core/build.rb +41 -28
  40. data/lib/buildr/core/cc.rb +172 -0
  41. data/lib/buildr/core/checks.rb +1 -1
  42. data/lib/buildr/core/common.rb +7 -6
  43. data/lib/buildr/core/compile.rb +7 -8
  44. data/lib/buildr/core/doc.rb +263 -0
  45. data/lib/buildr/core/environment.rb +6 -6
  46. data/lib/buildr/core/filter.rb +77 -35
  47. data/lib/buildr/core/generate.rb +7 -7
  48. data/lib/buildr/core/help.rb +1 -1
  49. data/lib/buildr/core/osx.rb +6 -6
  50. data/lib/buildr/core/progressbar.rb +4 -4
  51. data/lib/buildr/core/project.rb +144 -36
  52. data/lib/buildr/core/shell.rb +34 -34
  53. data/lib/buildr/core/test.rb +89 -20
  54. data/lib/buildr/core/transports.rb +8 -7
  55. data/lib/buildr/core/util.rb +77 -23
  56. data/lib/buildr/groovy/bdd.rb +5 -5
  57. data/lib/buildr/groovy/compiler.rb +19 -15
  58. data/lib/buildr/groovy/shell.rb +6 -6
  59. data/lib/buildr/ide/eclipse.rb +148 -75
  60. data/lib/buildr/ide/eclipse/java.rb +3 -3
  61. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  62. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  63. data/lib/buildr/ide/idea.rb +2 -2
  64. data/lib/buildr/ide/idea7x.rb +23 -4
  65. data/lib/buildr/java.rb +1 -0
  66. data/lib/buildr/java/ant.rb +4 -4
  67. data/lib/buildr/java/bdd.rb +51 -54
  68. data/lib/buildr/java/cobertura.rb +57 -35
  69. data/lib/buildr/java/commands.rb +14 -5
  70. data/lib/buildr/java/compiler.rb +3 -217
  71. data/lib/buildr/java/deprecated.rb +4 -4
  72. data/lib/buildr/java/doc.rb +70 -0
  73. data/lib/buildr/java/emma.rb +22 -22
  74. data/lib/buildr/java/jruby.rb +4 -4
  75. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  76. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  77. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  78. data/lib/buildr/java/packaging.rb +30 -29
  79. data/lib/buildr/java/pom.rb +4 -4
  80. data/lib/buildr/java/rjb.rb +6 -6
  81. data/lib/buildr/java/test_result.rb +61 -85
  82. data/lib/buildr/java/tests.rb +44 -27
  83. data/lib/buildr/java/version_requirement.rb +8 -8
  84. data/lib/buildr/packaging/archive.rb +55 -22
  85. data/lib/buildr/packaging/artifact.rb +75 -36
  86. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  87. data/lib/buildr/packaging/artifact_search.rb +5 -5
  88. data/lib/buildr/packaging/gems.rb +11 -7
  89. data/lib/buildr/packaging/package.rb +10 -7
  90. data/lib/buildr/packaging/tar.rb +14 -14
  91. data/lib/buildr/packaging/version_requirement.rb +30 -10
  92. data/lib/buildr/packaging/ziptask.rb +51 -13
  93. data/lib/buildr/scala.rb +1 -0
  94. data/lib/buildr/scala/bdd.rb +25 -20
  95. data/lib/buildr/scala/compiler.rb +87 -40
  96. data/lib/buildr/scala/doc.rb +106 -0
  97. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  98. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  99. data/lib/buildr/scala/shell.rb +14 -9
  100. data/lib/buildr/scala/tests.rb +33 -26
  101. data/lib/buildr/shell.rb +33 -33
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +148 -132
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
data/lib/buildr/shell.rb CHANGED
@@ -19,7 +19,7 @@ module Buildr
19
19
  class << self
20
20
  def add(p)
21
21
  @providers ||= {}
22
-
22
+
23
23
  if p.lang == :none
24
24
  @providers[:none] ||= []
25
25
  @providers[:none] << p
@@ -28,11 +28,11 @@ module Buildr
28
28
  end
29
29
  end
30
30
  alias :<< :add
31
-
31
+
32
32
  def providers
33
33
  @providers ||= {}
34
34
  end
35
-
35
+
36
36
  def each
37
37
  providers.each do |lang, p|
38
38
  if lang == :none
@@ -46,51 +46,51 @@ module Buildr
46
46
  end
47
47
  end
48
48
  end
49
-
49
+
50
50
  module Shell
51
51
  class Base
52
52
  attr_reader :project
53
-
53
+
54
54
  class << self
55
55
  def lang
56
56
  :none
57
57
  end
58
-
58
+
59
59
  def to_sym
60
60
  @symbol ||= name.split('::').last.downcase.to_sym
61
61
  end
62
62
  end
63
-
63
+
64
64
  def initialize(project)
65
65
  @project = project
66
66
  end
67
-
67
+
68
68
  def build?
69
69
  true
70
70
  end
71
-
71
+
72
72
  def launch
73
73
  fail 'Not implemented'
74
74
  end
75
75
  end
76
-
76
+
77
77
  module JavaRebel
78
78
  def rebel_home
79
79
  unless @rebel_home
80
- @rebel_home = ENV['REBEL_HOME'] or ENV['JAVA_REBEL'] or ENV['JAVAREBEL'] or ENV['JAVAREBEL_HOME']
81
-
80
+ @rebel_home = ENV['REBEL_HOME'] or ENV['JREBEL'] or ENV['JREBEL_HOME']
81
+
82
82
  if @rebel_home and File.directory? @rebel_home
83
- @rebel_home += File::SEPARATOR + 'javarebel.jar'
83
+ @rebel_home += File::SEPARATOR + 'jrebel.jar'
84
84
  end
85
85
  end
86
-
86
+
87
87
  if @rebel_home and File.exists? @rebel_home
88
88
  @rebel_home
89
89
  else
90
90
  nil
91
91
  end
92
92
  end
93
-
93
+
94
94
  def rebel_args
95
95
  if rebel_home
96
96
  [
@@ -101,44 +101,44 @@ module Buildr
101
101
  []
102
102
  end
103
103
  end
104
-
104
+
105
105
  def rebel_props(project)
106
106
  {}
107
107
  end
108
108
  end
109
109
  end
110
-
110
+
111
111
  module ShellExtension
112
112
  include Extension
113
-
113
+
114
114
  first_time do
115
115
  Project.local_task 'shell'
116
-
116
+
117
117
  ShellProviders.each { |p| Project.local_task "shell:#{p.to_sym}" } # TODO not working
118
118
  end
119
-
120
- before_define do |project|
119
+
120
+ before_define(:shell => :compile) do |project|
121
121
  ShellProviders.each do |p|
122
122
  name = p.to_sym
123
-
123
+
124
124
  trace "Defining task #{project.name}:shell:#{name}"
125
-
125
+
126
126
  p_inst = p.new project
127
127
  deps = if p_inst.build? then [:compile] else [] end
128
-
128
+
129
129
  project.task "shell:#{name}" => deps do
130
130
  trace "Launching #{name} shell"
131
131
  p_inst.launch
132
132
  end
133
133
  end
134
134
  end
135
-
136
- after_define do |project|
135
+
136
+ after_define(:shell => :compile) do |project|
137
137
  default_shell = project.shell.using
138
-
138
+
139
139
  if default_shell
140
140
  dep = "shell:#{default_shell.to_sym}"
141
-
141
+
142
142
  trace "Defining task shell based on #{dep}"
143
143
  project.task :shell => dep
144
144
  else
@@ -147,12 +147,12 @@ module Buildr
147
147
  end
148
148
  end
149
149
  end
150
-
150
+
151
151
  class ShellConfig
152
152
  def initialize(project)
153
153
  @project = project
154
154
  end
155
-
155
+
156
156
  def using(*args)
157
157
  if args.size > 0
158
158
  @using ||= args.first
@@ -160,20 +160,20 @@ module Buildr
160
160
  @using ||= find_shell_task
161
161
  end
162
162
  end
163
-
163
+
164
164
  private
165
165
  def find_shell_task
166
166
  lang = @project.compile.language
167
167
  ShellProviders.providers[lang]
168
168
  end
169
169
  end
170
-
170
+
171
171
  # TODO temporary hack
172
172
  def shell
173
173
  @shell ||= ShellConfig.new self
174
174
  end
175
175
  end
176
-
176
+
177
177
  class Project
178
178
  include ShellExtension
179
179
  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.1"
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' }
data/rakelib/checks.rake CHANGED
@@ -18,7 +18,7 @@ desc "Check that source files contain the Apache license"
18
18
  task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do |task|
19
19
  puts "Checking that files contain the Apache license ... "
20
20
  required = task.prerequisites.select { |fn| File.file?(fn) }
21
- missing = required.reject { |fn|
21
+ missing = required.reject { |fn|
22
22
  comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
23
23
  map { |match| match.compact }.flatten.join("\n")
24
24
  comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
data/rakelib/doc.rake CHANGED
@@ -71,6 +71,13 @@ task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr
71
71
  cp_r '_reports/coverage', '_site'
72
72
  fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
73
73
  cp 'CHANGELOG', '_site'
74
+ open("_site/.htaccess", "w") do |htaccess|
75
+ htaccess << %Q{
76
+ <FilesMatch "CHANGELOG">
77
+ ForceType 'text/plain; charset=UTF-8'
78
+ </FilesMatch>
79
+ }
80
+ end
74
81
  cp 'buildr.pdf', '_site'
75
82
  fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
76
83
  puts 'OK'
data/rakelib/package.rake CHANGED
@@ -67,7 +67,7 @@ task :snapshot=>[:package] do
67
67
  cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems'
68
68
  puts "Generating gem index ..."
69
69
  sh 'gem', 'generate_index', '--directory', '_snapshot'
70
- puts "Copying gem and index back to Apache"
70
+ puts "Copying gem and index back to Apache"
71
71
  sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/'
72
72
  end
73
73
  task(:clobber) { rm_rf '_snapshot' }
data/rakelib/release.rake CHANGED
@@ -45,6 +45,9 @@ task :release do
45
45
 
46
46
  # Upload binary and source packages to RubyForge.
47
47
  lambda do
48
+ sh 'rubyforge', 'login'
49
+ # update rubyforge projects, processors, etc. in local config
50
+ sh 'rubyforge', 'config'
48
51
  files = FileList["_release/#{spec.version}/dist/*.{gem,tgz,zip}"]
49
52
  puts "Uploading #{spec.version} to RubyForge ... "
50
53
  rubyforge = RubyForge.new.configure
@@ -63,7 +66,7 @@ task :release do
63
66
  # Create an SVN tag for this release.
64
67
  lambda do
65
68
  info = `svn info` + `git svn info` # Using either svn or git-svn
66
- if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
69
+ if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
67
70
  new_url = url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version}")
68
71
  unless url == new_url
69
72
  sh 'svn', 'copy', url, new_url, '-m', "Release #{spec.version}" do |ok, res|
@@ -80,7 +83,7 @@ task :release do
80
83
 
81
84
 
82
85
  # Update CHANGELOG to next release number.
83
- lambda do
86
+ lambda do
84
87
  next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
85
88
  zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
86
89
  modified = "#{next_version} (Pending)\n\n" + File.read('CHANGELOG')
@@ -89,7 +92,7 @@ task :release do
89
92
  end
90
93
  puts "[X] Updated CHANGELOG and added entry for next release"
91
94
  end.call
92
-
95
+
93
96
 
94
97
  # Update source files to next release number.
95
98
  lambda do
@@ -98,7 +101,7 @@ task :release do
98
101
 
99
102
  ver_file = "lib/#{spec.name}.rb"
100
103
  if File.exist?(ver_file)
101
- modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
104
+ modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
102
105
  File.open ver_file, 'w' do |file|
103
106
  file.write modified
104
107
  end
@@ -107,7 +110,7 @@ task :release do
107
110
 
108
111
  spec_file = "#{spec.name}.gemspec"
109
112
  if File.exist?(spec_file)
110
- modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
113
+ modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
111
114
  File.open spec_file, 'w' do |file|
112
115
  file.write modified
113
116
  end
@@ -115,7 +118,7 @@ task :release do
115
118
  end
116
119
  end.call
117
120
 
118
-
121
+
119
122
  # Prepare release announcement email.
120
123
  lambda do
121
124
  changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
data/rakelib/rspec.rake CHANGED
@@ -18,34 +18,53 @@ begin
18
18
  require 'spec/rake/spectask'
19
19
  directory '_reports'
20
20
 
21
+ def default_spec_opts
22
+ default = %w{--format failing_examples:failed --format html:_reports/specs.html --backtrace}
23
+ default << '--colour' if $stdout.isatty
24
+ default
25
+ end
26
+
21
27
  desc "Run all specs"
22
28
  Spec::Rake::SpecTask.new :spec=>['_reports', :compile] do |task|
29
+ ENV['USE_FSC'] = 'no'
23
30
  task.spec_files = FileList['spec/**/*_spec.rb']
24
31
  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
32
+ task.spec_opts = default_spec_opts
33
+ task.spec_opts << '--format specdoc'
27
34
  end
28
35
  file('_reports/specs.html') { task(:spec).invoke }
29
36
 
30
37
  desc 'Run all failed examples from previous run'
31
38
  Spec::Rake::SpecTask.new :failed do |task|
39
+ ENV['USE_FSC'] = 'no'
32
40
  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
41
+ task.spec_opts = default_spec_opts
42
+ task.spec_opts << '--format specdoc' << '--example failed'
35
43
  end
36
44
 
37
45
  desc 'Run RSpec and generate Spec and coverage reports (slow)'
38
46
  Spec::Rake::SpecTask.new :coverage=>['_reports', :compile] do |task|
47
+ ENV['USE_FSC'] = 'no'
39
48
  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
49
+ task.spec_opts = default_spec_opts
50
+ task.spec_opts << '--format progress'
42
51
  task.rcov = true
43
52
  task.rcov_dir = '_reports/coverage'
44
53
  task.rcov_opts = %w{--exclude / --include-file ^lib --text-summary}
45
54
  end
46
55
  file('_reports/coverage') { task(:coverage).invoke }
47
56
 
48
-
57
+ task :load_ci_reporter do
58
+ gem 'ci_reporter'
59
+ ENV['CI_REPORTS'] = '_reports/ci'
60
+ # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files
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
64
+
65
+ desc 'Run all specs with CI reporter'
66
+ task :ci=>[:load_ci_reporter, :spec]
67
+
49
68
  # Useful for testing with JRuby when using Ruby and vice versa.
50
69
  namespace :spec do
51
70
  desc "Run all specs specifically with Ruby"