buildr 1.4.1-x86-mswin32 → 1.4.2-x86-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +68 -11
- data/_buildr +2 -0
- data/addon/buildr/hibernate.rb +8 -5
- data/addon/buildr/jetty.rb +1 -1
- data/addon/buildr/openjpa.rb +0 -2
- data/addon/buildr/xmlbeans.rb +1 -1
- data/buildr.gemspec +13 -9
- data/doc/_layouts/default.html +3 -1
- data/doc/contributing.textile +10 -2
- data/doc/css/default.css +6 -6
- data/doc/download.textile +7 -7
- data/doc/languages.textile +2 -2
- data/doc/more_stuff.textile +41 -33
- data/doc/packaging.textile +6 -3
- data/doc/releasing.textile +116 -0
- data/doc/scripts/install-linux.sh +7 -6
- data/doc/testing.textile +14 -0
- data/lib/buildr.rb +2 -2
- data/lib/buildr/core.rb +0 -6
- data/lib/buildr/core/application.rb +25 -2
- data/lib/buildr/core/build.rb +66 -15
- data/lib/buildr/core/compile.rb +10 -1
- data/lib/buildr/core/filter.rb +1 -1
- data/lib/buildr/core/progressbar.rb +8 -3
- data/lib/buildr/core/test.rb +57 -6
- data/lib/buildr/core/transports.rb +18 -13
- data/lib/buildr/core/util.rb +19 -3
- data/lib/buildr/groovy/compiler.rb +2 -2
- data/lib/buildr/ide/eclipse.rb +32 -12
- data/lib/buildr/java/ant.rb +3 -3
- data/lib/buildr/java/bdd.rb +1 -2
- data/lib/buildr/java/cobertura.rb +10 -9
- data/lib/buildr/java/commands.rb +22 -21
- data/lib/buildr/java/compiler.rb +2 -2
- data/lib/buildr/java/doc.rb +1 -1
- data/lib/buildr/java/ecj.rb +71 -0
- data/lib/buildr/java/emma.rb +1 -1
- data/lib/buildr/java/external.rb +9 -9
- data/lib/buildr/java/jruby.rb +5 -0
- data/lib/buildr/java/packaging.rb +4 -3
- data/lib/buildr/java/rjb.rb +4 -6
- data/lib/buildr/java/tests.rb +9 -4
- data/lib/buildr/packaging/archive.rb +7 -3
- data/lib/buildr/packaging/artifact.rb +153 -38
- data/lib/buildr/packaging/gems.rb +2 -3
- data/lib/buildr/packaging/package.rb +19 -12
- data/lib/buildr/packaging/tar.rb +1 -1
- data/lib/buildr/packaging/ziptask.rb +1 -1
- data/lib/buildr/scala/bdd.rb +7 -3
- data/lib/buildr/scala/compiler.rb +2 -2
- data/lib/buildr/scala/doc.rb +3 -3
- data/lib/buildr/scala/tests.rb +7 -3
- data/lib/buildr/version.rb +18 -0
- data/rakelib/all-in-one.rake +1 -1
- data/rakelib/doc.rake +13 -3
- data/rakelib/metrics.rake +39 -0
- data/spec/core/application_spec.rb +13 -12
- data/spec/core/build_spec.rb +166 -7
- data/spec/core/cc_spec.rb +1 -1
- data/spec/core/checks_spec.rb +1 -1
- data/spec/core/common_spec.rb +10 -1
- data/spec/core/compile_spec.rb +1 -1
- data/spec/core/extension_spec.rb +1 -1
- data/spec/core/generate_spec.rb +1 -1
- data/spec/core/project_spec.rb +1 -1
- data/spec/core/test_spec.rb +124 -11
- data/spec/core/transport_spec.rb +10 -3
- data/spec/core/util_spec.rb +18 -2
- data/spec/groovy/bdd_spec.rb +1 -1
- data/spec/groovy/compiler_spec.rb +3 -3
- data/spec/ide/eclipse_spec.rb +63 -1
- data/spec/ide/idea7x_spec.rb +1 -1
- data/spec/java/ant_spec.rb +1 -1
- data/spec/java/bdd_spec.rb +1 -1
- data/spec/java/cobertura_spec.rb +29 -2
- data/spec/java/commands_spec.rb +61 -2
- data/spec/java/compiler_spec.rb +3 -3
- data/spec/java/ecj_spec.rb +115 -0
- data/spec/java/emma_spec.rb +1 -1
- data/spec/java/external_spec.rb +10 -8
- data/spec/java/java_spec.rb +14 -6
- data/spec/java/packaging_spec.rb +41 -15
- data/spec/java/test_coverage_helper.rb +1 -1
- data/spec/java/tests_spec.rb +1 -1
- data/spec/packaging/archive_spec.rb +12 -1
- data/spec/packaging/artifact_namespace_spec.rb +1 -1
- data/spec/packaging/artifact_spec.rb +197 -7
- data/spec/packaging/packaging_spec.rb +12 -12
- data/spec/sandbox.rb +8 -3
- data/spec/scala/bdd_spec.rb +3 -3
- data/spec/scala/compiler_spec.rb +7 -7
- data/spec/scala/scala.rb +3 -3
- data/spec/scala/tests_spec.rb +3 -3
- data/spec/spec_helpers.rb +11 -1
- data/spec/version_requirement_spec.rb +1 -1
- metadata +220 -85
- data/rakelib/jekylltask.rb +0 -120
@@ -60,11 +60,10 @@ module Buildr
|
|
60
60
|
spec.mark_version
|
61
61
|
spec.validate
|
62
62
|
|
63
|
-
File.open(name, '
|
63
|
+
File.open(name, 'wb') do |io|
|
64
64
|
Gem::Package.open(io, 'w', nil) do |pkg|
|
65
65
|
pkg.metadata = spec.to_yaml
|
66
66
|
file_map.each do |path, content|
|
67
|
-
p "path #{path} content #{content}"
|
68
67
|
next if content.nil? || File.directory?(content.to_s)
|
69
68
|
pkg.add_file_simple(path, File.stat(content.to_s).mode & 0777, File.size(content.to_s)) do |os|
|
70
69
|
File.open(content.to_s, "rb") do |file|
|
@@ -88,7 +87,7 @@ module Buildr
|
|
88
87
|
end
|
89
88
|
gem.spec do |spec|
|
90
89
|
spec.name = id
|
91
|
-
spec.version = version
|
90
|
+
spec.version = version.gsub('-','.') # RubyGems doesn't like '-' in version numbers
|
92
91
|
spec.summary = full_comment
|
93
92
|
spec.has_rdoc = true
|
94
93
|
spec.rdoc_options << '--title' << comment
|
@@ -106,7 +106,7 @@ module Buildr
|
|
106
106
|
# end
|
107
107
|
#
|
108
108
|
# Two other packaging types are:
|
109
|
-
# * package :sources -- Creates a
|
109
|
+
# * package :sources -- Creates a JAR file with the source code and classifier 'sources', for use by IDEs.
|
110
110
|
# * package :javadoc -- Creates a ZIP file with the Javadocs and classifier 'javadoc'. You can use the
|
111
111
|
# javadoc method to further customize it.
|
112
112
|
#
|
@@ -124,11 +124,11 @@ module Buildr
|
|
124
124
|
#
|
125
125
|
# The file name is determined from the specification passed to the package method, however, some
|
126
126
|
# packagers need to override this. For example, package(:sources) produces a file with the extension
|
127
|
-
# '
|
127
|
+
# 'jar' and the classifier 'sources'. If you need to overwrite the default implementation, you should
|
128
128
|
# also include a method named package_as_[type]_spec. For example:
|
129
129
|
# def package_as_sources_spec(spec) #:nodoc:
|
130
|
-
# # Change the source distribution to .
|
131
|
-
# spec.merge({ :type=>:
|
130
|
+
# # Change the source distribution to .zip extension
|
131
|
+
# spec.merge({ :type=>:zip, :classifier=>'sources' })
|
132
132
|
# end
|
133
133
|
def package(*args)
|
134
134
|
spec = Hash === args.last ? args.pop.dup : {}
|
@@ -168,7 +168,6 @@ module Buildr
|
|
168
168
|
task 'package'=>package
|
169
169
|
package.enhance [task('build')]
|
170
170
|
package.enhance { info "Packaging #{File.basename(file_name)}" }
|
171
|
-
|
172
171
|
if spec[:file]
|
173
172
|
class << package ; self ; end.send(:define_method, :type) { spec[:type] }
|
174
173
|
class << package ; self ; end.send(:define_method, :id) { nil }
|
@@ -176,19 +175,27 @@ module Buildr
|
|
176
175
|
# Make it an artifact using the specifications, and tell it how to create a POM.
|
177
176
|
package.extend ActsAsArtifact
|
178
177
|
package.send :apply_spec, spec.only(*Artifact::ARTIFACT_ATTRIBUTES)
|
179
|
-
|
180
|
-
pom
|
181
|
-
|
182
|
-
|
183
|
-
|
178
|
+
|
179
|
+
# Create pom associated with package
|
180
|
+
class << package
|
181
|
+
def pom
|
182
|
+
unless @pom
|
183
|
+
pom_filename = Util.replace_extension(self.name, 'pom')
|
184
|
+
spec = {:group=>group, :id=>id, :version=>version, :type=>:pom}
|
185
|
+
@pom = Buildr.artifact(spec, pom_filename)
|
186
|
+
@pom.content @pom.pom_xml
|
187
|
+
end
|
188
|
+
@pom
|
189
|
+
end
|
184
190
|
end
|
191
|
+
|
185
192
|
file(Buildr.repositories.locate(package)=>package) { package.install }
|
186
193
|
|
187
194
|
# Add the package to the list of packages created by this project, and
|
188
195
|
# register it as an artifact. The later is required so if we look up the spec
|
189
196
|
# we find the package in the project's target directory, instead of finding it
|
190
197
|
# in the local repository and attempting to install it.
|
191
|
-
Artifact.register package, pom
|
198
|
+
Artifact.register package, package.pom
|
192
199
|
end
|
193
200
|
|
194
201
|
task('install') { package.install if package.respond_to?(:install) }
|
@@ -225,7 +232,7 @@ module Buildr
|
|
225
232
|
alias :package_as_tgz :package_as_tar
|
226
233
|
|
227
234
|
def package_as_sources_spec(spec) #:nodoc:
|
228
|
-
spec.merge(:type=>:
|
235
|
+
spec.merge(:type=>:jar, :classifier=>'sources')
|
229
236
|
end
|
230
237
|
|
231
238
|
def package_as_sources(file_name) #:nodoc:
|
data/lib/buildr/packaging/tar.rb
CHANGED
data/lib/buildr/scala/bdd.rb
CHANGED
@@ -32,19 +32,23 @@ module Buildr::Scala
|
|
32
32
|
@lang = :scala
|
33
33
|
@bdd_dir = :spec
|
34
34
|
|
35
|
-
VERSION = '1.6.
|
35
|
+
VERSION = '1.6.5'
|
36
36
|
|
37
37
|
class << self
|
38
38
|
def version
|
39
39
|
Buildr.settings.build['scala.specs'] || VERSION
|
40
40
|
end
|
41
41
|
|
42
|
+
def artifact
|
43
|
+
Buildr.settings.build['scala.specs.artifact'] || "specs_#{Buildr::Scala.version}"
|
44
|
+
end
|
45
|
+
|
42
46
|
def dependencies
|
43
47
|
unless @dependencies
|
44
48
|
super
|
49
|
+
specs = (version =~ /:/) ? [version] : ["org.scala-tools.testing:#{artifact}:jar:#{version}"]
|
45
50
|
# Add utility classes (e.g. SpecsSingletonRunner) and other dependencies
|
46
|
-
@dependencies |= [ File.join(File.dirname(__FILE__)) ] +
|
47
|
-
["org.scala-tools.testing:specs:jar:#{version}"] +
|
51
|
+
@dependencies |= [ File.join(File.dirname(__FILE__)) ] + specs +
|
48
52
|
Check.dependencies + JUnit.dependencies + Scalac.dependencies
|
49
53
|
end
|
50
54
|
@dependencies
|
@@ -19,7 +19,7 @@ require 'buildr/core/compile'
|
|
19
19
|
require 'buildr/packaging'
|
20
20
|
|
21
21
|
module Buildr::Scala
|
22
|
-
DEFAULT_VERSION = '2.
|
22
|
+
DEFAULT_VERSION = '2.8.0'
|
23
23
|
|
24
24
|
class << self
|
25
25
|
|
@@ -225,7 +225,7 @@ module Buildr::Scala
|
|
225
225
|
def scalac_args #:nodoc:
|
226
226
|
args = []
|
227
227
|
args << "-nowarn" unless options[:warnings]
|
228
|
-
args << "-verbose" if
|
228
|
+
args << "-verbose" if trace?(:scalac)
|
229
229
|
args << "-g" if options[:debug]
|
230
230
|
args << "-deprecation" if options[:deprecation]
|
231
231
|
args << "-optimise" if options[:optimise]
|
data/lib/buildr/scala/doc.rb
CHANGED
@@ -22,7 +22,7 @@ module Buildr
|
|
22
22
|
specify :language => :scala, :source_ext => 'scala'
|
23
23
|
|
24
24
|
def generate(sources, target, options = {})
|
25
|
-
cmd_args = [ '-d', target,
|
25
|
+
cmd_args = [ '-d', target, trace?(:scaladoc) ? '-verbose' : '' ]
|
26
26
|
options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
|
27
27
|
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
|
28
28
|
each do |key, value|
|
@@ -54,7 +54,7 @@ module Buildr
|
|
54
54
|
end
|
55
55
|
|
56
56
|
class VScaladoc < Base
|
57
|
-
VERSION = '1.2-
|
57
|
+
VERSION = '1.2-m1'
|
58
58
|
Buildr.repositories.remote << 'http://scala-tools.org/repo-snapshots'
|
59
59
|
|
60
60
|
class << self
|
@@ -68,7 +68,7 @@ module Buildr
|
|
68
68
|
specify :language => :scala, :source_ext => 'scala'
|
69
69
|
|
70
70
|
def generate(sources, target, options = {})
|
71
|
-
cmd_args = [ '-d', target, (
|
71
|
+
cmd_args = [ '-d', target, (trace?(:vscaladoc) ? '-verbose' : ''),
|
72
72
|
'-sourcepath', project.compile.sources.join(File::PATH_SEPARATOR) ]
|
73
73
|
options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
|
74
74
|
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
|
data/lib/buildr/scala/tests.rb
CHANGED
@@ -23,7 +23,7 @@ require 'buildr/java/tests'
|
|
23
23
|
module Buildr::Scala
|
24
24
|
# Scala::Check is available when using Scala::Test or Scala::Specs
|
25
25
|
module Check
|
26
|
-
VERSION = '1.
|
26
|
+
VERSION = '1.7'
|
27
27
|
|
28
28
|
class << self
|
29
29
|
def version
|
@@ -34,8 +34,12 @@ module Buildr::Scala
|
|
34
34
|
Buildr.settings.build['scala.check.classifier'] || ""
|
35
35
|
end
|
36
36
|
|
37
|
+
def artifact
|
38
|
+
Buildr.settings.build['scala.check.artifact'] || "scalacheck_#{Buildr::Scala.version}"
|
39
|
+
end
|
40
|
+
|
37
41
|
def dependencies
|
38
|
-
["org.scala-tools.testing:
|
42
|
+
(version =~ /:/) ? [version] : ["org.scala-tools.testing:#{artifact}:jar:#{classifier}:#{version}"]
|
39
43
|
end
|
40
44
|
|
41
45
|
private
|
@@ -56,7 +60,7 @@ module Buildr::Scala
|
|
56
60
|
# * :java_args -- Arguments passed as is to the JVM.
|
57
61
|
class ScalaTest < Buildr::TestFramework::Java
|
58
62
|
|
59
|
-
VERSION = '1.
|
63
|
+
VERSION = '1.2'
|
60
64
|
|
61
65
|
class << self
|
62
66
|
def version
|
@@ -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.2'.freeze
|
18
|
+
end
|
data/rakelib/all-in-one.rake
CHANGED
@@ -18,7 +18,7 @@ task "all-in-one" => 'all-in-one:all-in-one'
|
|
18
18
|
|
19
19
|
namespace :'all-in-one' do
|
20
20
|
|
21
|
-
version = "1.5.
|
21
|
+
version = "1.5.2"
|
22
22
|
jruby_distro = "jruby-bin-#{version}.tar.gz"
|
23
23
|
url = "http://jruby.org.s3.amazonaws.com/downloads/#{version}/#{jruby_distro}"
|
24
24
|
dir = "jruby-#{version}"
|
data/rakelib/doc.rake
CHANGED
@@ -36,7 +36,17 @@ end
|
|
36
36
|
|
37
37
|
|
38
38
|
begin
|
39
|
-
require '
|
39
|
+
require 'jekylltask'
|
40
|
+
module TocFilter
|
41
|
+
def toc(input)
|
42
|
+
input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).inject(%{<ol class="toc">}) { |toc, entry|
|
43
|
+
id = entry[1][/^id=(['"])(.*)\1$/, 2]
|
44
|
+
title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
|
45
|
+
toc << %{<li><a href="##{id}">#{title}</a></li>}
|
46
|
+
} << "</ol>"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
Liquid::Template.register_filter(TocFilter)
|
40
50
|
|
41
51
|
desc "Generate Buildr documentation in _site/"
|
42
52
|
JekyllTask.new :jekyll do |task|
|
@@ -45,9 +55,9 @@ begin
|
|
45
55
|
end
|
46
56
|
|
47
57
|
rescue LoadError
|
48
|
-
puts "Buildr uses the
|
58
|
+
puts "Buildr uses the jekyll gem to generate the Web site. You can install it by running rake doc:setup"
|
49
59
|
task 'doc:setup' do
|
50
|
-
install_gem '
|
60
|
+
install_gem 'jekyll', :version=>'0.6.2'
|
51
61
|
if `pygmentize -V`.empty?
|
52
62
|
args = %w{easy_install Pygments}
|
53
63
|
args.unshift 'sudo' unless Config::CONFIG['host_os'] =~ /windows/
|
@@ -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"]
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# the License.
|
15
15
|
|
16
16
|
|
17
|
-
require File.join(File.dirname(__FILE__), '
|
17
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
18
|
|
19
19
|
|
20
20
|
describe Buildr::Application do
|
@@ -164,34 +164,34 @@ describe Buildr::Application do
|
|
164
164
|
|
165
165
|
it 'should fail if required gem not found in remote repository' do
|
166
166
|
Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
|
167
|
-
Gem
|
167
|
+
Gem.source_index.should_receive(:search).at_least(:once).and_return([])
|
168
168
|
lambda { Buildr.application.load_gems }.should raise_error(LoadError, /cannot be found/i)
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'should fail if need to install gem and not running in interactive mode' do
|
172
172
|
Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
|
173
|
-
Gem
|
173
|
+
Gem.source_index.should_receive(:search).and_return([@spec])
|
174
174
|
$stdout.should_receive(:isatty).and_return(false)
|
175
175
|
lambda { Buildr.application.load_gems }.should raise_error(LoadError, /this build requires the gems/i)
|
176
176
|
end
|
177
177
|
|
178
178
|
it 'should ask permission before installing required gems' do
|
179
179
|
Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
|
180
|
-
Gem
|
180
|
+
Gem.source_index.should_receive(:search).and_return([@spec])
|
181
181
|
$terminal.should_receive(:agree).with(/install/, true)
|
182
182
|
lambda { Buildr.application.load_gems }.should raise_error
|
183
183
|
end
|
184
184
|
|
185
185
|
it 'should fail if permission not granted to install gem' do
|
186
186
|
Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
|
187
|
-
Gem
|
187
|
+
Gem.source_index.should_receive(:search).and_return([@spec])
|
188
188
|
$terminal.should_receive(:agree).and_return(false)
|
189
189
|
lambda { Buildr.application.load_gems }.should raise_error(LoadError, /cannot build without/i)
|
190
190
|
end
|
191
191
|
|
192
192
|
it 'should install gem if permission granted' do
|
193
193
|
Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
|
194
|
-
Gem
|
194
|
+
Gem.source_index.should_receive(:search).and_return([@spec])
|
195
195
|
$terminal.should_receive(:agree).and_return(true)
|
196
196
|
Util.should_receive(:ruby) do |*args|
|
197
197
|
args.should include('install', 'foo', '-v', '1.2')
|
@@ -202,7 +202,7 @@ describe Buildr::Application do
|
|
202
202
|
|
203
203
|
it 'should reload gem cache after installing required gems' do
|
204
204
|
Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
|
205
|
-
Gem
|
205
|
+
Gem.source_index.should_receive(:search).and_return([@spec])
|
206
206
|
$terminal.should_receive(:agree).and_return(true)
|
207
207
|
Util.should_receive(:ruby)
|
208
208
|
Gem.source_index.should_receive(:load_gems_in).with(Gem::SourceIndex.installed_spec_directories)
|
@@ -218,7 +218,7 @@ describe Buildr::Application do
|
|
218
218
|
|
219
219
|
it 'should load newly installed gems' do
|
220
220
|
Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
|
221
|
-
Gem
|
221
|
+
Gem.source_index.should_receive(:search).and_return([@spec])
|
222
222
|
$terminal.should_receive(:agree).and_return(true)
|
223
223
|
Util.should_receive(:ruby)
|
224
224
|
Buildr.application.should_receive(:gem).with('foo', @spec.version.to_s)
|
@@ -227,25 +227,26 @@ describe Buildr::Application do
|
|
227
227
|
|
228
228
|
it 'should default to >=0 version requirement if not specified' do
|
229
229
|
write 'build.yaml', 'gems: foo'
|
230
|
-
|
230
|
+
$terminal.should_receive(:agree).and_return(true)
|
231
|
+
Gem.source_index.should_receive(:search).with(Gem::Dependency.new('foo', '>=0')).and_return([])
|
231
232
|
lambda { Buildr.application.load_gems }.should raise_error
|
232
233
|
end
|
233
234
|
|
234
235
|
it 'should parse exact version requirement' do
|
235
236
|
write 'build.yaml', 'gems: foo 2.5'
|
236
|
-
Gem
|
237
|
+
Gem.source_index.should_receive(:search).with(Gem::Dependency.new('foo', '=2.5')).and_return([])
|
237
238
|
lambda { Buildr.application.load_gems }.should raise_error
|
238
239
|
end
|
239
240
|
|
240
241
|
it 'should parse range version requirement' do
|
241
242
|
write 'build.yaml', 'gems: foo ~>2.3'
|
242
|
-
|
243
|
+
Gem.source_index.should_receive(:search).with(Gem::Dependency.new('foo', '~>2.3')).and_return([])
|
243
244
|
lambda { Buildr.application.load_gems }.should raise_error
|
244
245
|
end
|
245
246
|
|
246
247
|
it 'should parse multiple version requirements' do
|
247
248
|
write 'build.yaml', 'gems: foo >=2.0 !=2.1'
|
248
|
-
Gem
|
249
|
+
Gem.source_index.should_receive(:search).with(Gem::Dependency.new('foo', ['>=2.0', '!=2.1'])).and_return([])
|
249
250
|
lambda { Buildr.application.load_gems }.should raise_error
|
250
251
|
end
|
251
252
|
end
|
data/spec/core/build_spec.rb
CHANGED
@@ -14,8 +14,7 @@
|
|
14
14
|
# the License.
|
15
15
|
|
16
16
|
|
17
|
-
require File.join(File.dirname(__FILE__), '
|
18
|
-
|
17
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
19
18
|
|
20
19
|
describe 'local task', :shared=>true do
|
21
20
|
it "should execute task for project in current directory" do
|
@@ -407,12 +406,158 @@ describe 'a release process', :shared=>true do
|
|
407
406
|
@release.make
|
408
407
|
file('buildfile').should contain('VERSION_NUMBER = "1.0.002-SNAPSHOT"')
|
409
408
|
end
|
410
|
-
|
409
|
+
|
411
410
|
it 'should commit the updated buildfile' do
|
412
411
|
@release.stub!(:tag_release)
|
413
412
|
@release.make
|
414
413
|
file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
|
415
414
|
end
|
415
|
+
|
416
|
+
it 'should not consider "-rc" as "-SNAPSHOT"' do
|
417
|
+
write 'buildfile', "VERSION_NUMBER = '1.0.0-rc1'"
|
418
|
+
@release.stub!(:tag_release)
|
419
|
+
@release.make
|
420
|
+
file('buildfile').should contain('VERSION_NUMBER = "1.0.0-rc1"')
|
421
|
+
end
|
422
|
+
|
423
|
+
it 'should only commit the updated buildfile if the version changed' do
|
424
|
+
write 'buildfile', "VERSION_NUMBER = '1.0.0-rc1'"
|
425
|
+
@release.should_not_receive(:update_version_to_next)
|
426
|
+
@release.stub!(:tag_release)
|
427
|
+
@release.make
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
describe '#resolve_next_version' do
|
432
|
+
|
433
|
+
it 'should increment the version number if SNAPSHOT' do
|
434
|
+
@release.send(:resolve_next_version, "1.0.0-SNAPSHOT").should == '1.0.1-SNAPSHOT'
|
435
|
+
end
|
436
|
+
|
437
|
+
it 'should NOT increment the version number if no SNAPSHOT' do
|
438
|
+
@release.send(:resolve_next_version, "1.0.0").should == '1.0.0'
|
439
|
+
end
|
440
|
+
|
441
|
+
it 'should return the version specified by NEXT_VERSION env var' do
|
442
|
+
ENV['NEXT_VERSION'] = "version_from_env"
|
443
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'version_from_env'
|
444
|
+
end
|
445
|
+
|
446
|
+
it 'should return the version specified by next_version' do
|
447
|
+
Release.next_version = "ze_next_version"
|
448
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_next_version'
|
449
|
+
end
|
450
|
+
|
451
|
+
it 'should return the version specified by next_version if next_version is a proc' do
|
452
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
453
|
+
@release.send(:resolve_next_version, "1.0.0").should == '1.0.0++'
|
454
|
+
end
|
455
|
+
|
456
|
+
it "should return the version specified by 'NEXT_VERSION' env var even if next_version is non nil" do
|
457
|
+
ENV['NEXT_VERSION'] = "ze_version_from_env"
|
458
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
459
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env'
|
460
|
+
end
|
461
|
+
|
462
|
+
it "should return the version specified by 'next_version' env var even if next_version is non nil" do
|
463
|
+
ENV['NEXT_VERSION'] = nil
|
464
|
+
ENV['next_version'] = "ze_version_from_env_lowercase"
|
465
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
466
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env_lowercase'
|
467
|
+
end
|
468
|
+
after {
|
469
|
+
Release.next_version = nil
|
470
|
+
ENV['NEXT_VERSION'] = nil
|
471
|
+
ENV['next_version'] = nil
|
472
|
+
}
|
473
|
+
end
|
474
|
+
|
475
|
+
describe '#resolve_next_version' do
|
476
|
+
|
477
|
+
it 'should increment the version number if SNAPSHOT' do
|
478
|
+
@release.send(:resolve_next_version, "1.0.0-SNAPSHOT").should == '1.0.1-SNAPSHOT'
|
479
|
+
end
|
480
|
+
|
481
|
+
it 'should NOT increment the version number if no SNAPSHOT' do
|
482
|
+
@release.send(:resolve_next_version, "1.0.0").should == '1.0.0'
|
483
|
+
end
|
484
|
+
|
485
|
+
it 'should return the version specified by NEXT_VERSION env var' do
|
486
|
+
ENV['NEXT_VERSION'] = "version_from_env"
|
487
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'version_from_env'
|
488
|
+
end
|
489
|
+
|
490
|
+
it 'should return the version specified by next_version' do
|
491
|
+
Release.next_version = "ze_next_version"
|
492
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_next_version'
|
493
|
+
end
|
494
|
+
|
495
|
+
it 'should return the version specified by next_version if next_version is a proc' do
|
496
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
497
|
+
@release.send(:resolve_next_version, "1.0.0").should == '1.0.0++'
|
498
|
+
end
|
499
|
+
|
500
|
+
it "should return the version specified by 'NEXT_VERSION' env var even if next_version is non nil" do
|
501
|
+
ENV['NEXT_VERSION'] = "ze_version_from_env"
|
502
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
503
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env'
|
504
|
+
end
|
505
|
+
|
506
|
+
it "should return the version specified by 'next_version' env var even if next_version is non nil" do
|
507
|
+
ENV['NEXT_VERSION'] = nil
|
508
|
+
ENV['next_version'] = "ze_version_from_env_lowercase"
|
509
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
510
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env_lowercase'
|
511
|
+
end
|
512
|
+
after {
|
513
|
+
Release.next_version = nil
|
514
|
+
ENV['NEXT_VERSION'] = nil
|
515
|
+
ENV['next_version'] = nil
|
516
|
+
}
|
517
|
+
end
|
518
|
+
|
519
|
+
describe '#resolve_next_version' do
|
520
|
+
|
521
|
+
it 'should increment the version number if SNAPSHOT' do
|
522
|
+
@release.send(:resolve_next_version, "1.0.0-SNAPSHOT").should == '1.0.1-SNAPSHOT'
|
523
|
+
end
|
524
|
+
|
525
|
+
it 'should NOT increment the version number if no SNAPSHOT' do
|
526
|
+
@release.send(:resolve_next_version, "1.0.0").should == '1.0.0'
|
527
|
+
end
|
528
|
+
|
529
|
+
it 'should return the version specified by NEXT_VERSION env var' do
|
530
|
+
ENV['NEXT_VERSION'] = "version_from_env"
|
531
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'version_from_env'
|
532
|
+
end
|
533
|
+
|
534
|
+
it 'should return the version specified by next_version' do
|
535
|
+
Release.next_version = "ze_next_version"
|
536
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_next_version'
|
537
|
+
end
|
538
|
+
|
539
|
+
it 'should return the version specified by next_version if next_version is a proc' do
|
540
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
541
|
+
@release.send(:resolve_next_version, "1.0.0").should == '1.0.0++'
|
542
|
+
end
|
543
|
+
|
544
|
+
it "should return the version specified by 'NEXT_VERSION' env var even if next_version is non nil" do
|
545
|
+
ENV['NEXT_VERSION'] = "ze_version_from_env"
|
546
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
547
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env'
|
548
|
+
end
|
549
|
+
|
550
|
+
it "should return the version specified by 'next_version' env var even if next_version is non nil" do
|
551
|
+
ENV['NEXT_VERSION'] = nil
|
552
|
+
ENV['next_version'] = "ze_version_from_env_lowercase"
|
553
|
+
Release.next_version = lambda {|version| "#{version}++"}
|
554
|
+
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env_lowercase'
|
555
|
+
end
|
556
|
+
after {
|
557
|
+
Release.next_version = nil
|
558
|
+
ENV['NEXT_VERSION'] = nil
|
559
|
+
ENV['next_version'] = nil
|
560
|
+
}
|
416
561
|
end
|
417
562
|
|
418
563
|
describe '#resolve_tag' do
|
@@ -487,12 +632,14 @@ describe 'a release process', :shared=>true do
|
|
487
632
|
|
488
633
|
describe '#update_version_to_next' do
|
489
634
|
before do
|
490
|
-
write 'buildfile',
|
635
|
+
write 'buildfile', "VERSION_NUMBER = '1.0.5-SNAPSHOT'"
|
636
|
+
@release.send(:this_version=, "1.0.5-SNAPSHOT")
|
491
637
|
end
|
492
638
|
|
493
639
|
it 'should update the buildfile with a new version number' do
|
494
640
|
@release.send :update_version_to_next
|
495
|
-
|
641
|
+
`cp buildfile /tmp/out`
|
642
|
+
file('buildfile').should contain('VERSION_NUMBER = "1.0.6-SNAPSHOT"')
|
496
643
|
end
|
497
644
|
|
498
645
|
it 'should commit the new buildfile on the trunk' do
|
@@ -516,11 +663,19 @@ describe 'a release process', :shared=>true do
|
|
516
663
|
end
|
517
664
|
|
518
665
|
it 'should inform the user of the new version' do
|
519
|
-
lambda { @release.update_version_to_next }.should show_info('Current version is now 1.0.
|
666
|
+
lambda { @release.update_version_to_next }.should show_info('Current version is now 1.0.6-SNAPSHOT')
|
520
667
|
end
|
521
668
|
after { Release.commit_message = nil }
|
522
669
|
end
|
523
670
|
|
671
|
+
|
672
|
+
describe '#check' do
|
673
|
+
before { @release.send(:this_version=, "1.0.0-SNAPSHOT") }
|
674
|
+
it 'should fail if THIS_VERSION equals the next_version' do
|
675
|
+
@release.stub!(:resolve_next_version).and_return('1.0.0-SNAPSHOT')
|
676
|
+
lambda { @release.check }.should raise_error("The next version can't be equal to the current version 1.0.0-SNAPSHOT.\nUpdate THIS_VERSION/VERSION_NUMBER, specify Release.next_version or use NEXT_VERSION env var")
|
677
|
+
end
|
678
|
+
end
|
524
679
|
end
|
525
680
|
|
526
681
|
|
@@ -528,6 +683,7 @@ describe GitRelease do
|
|
528
683
|
it_should_behave_like 'a release process'
|
529
684
|
|
530
685
|
before do
|
686
|
+
write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
|
531
687
|
@release = GitRelease.new
|
532
688
|
Git.stub!(:git)
|
533
689
|
Git.stub!(:current_branch).and_return('master')
|
@@ -547,9 +703,10 @@ describe GitRelease do
|
|
547
703
|
end
|
548
704
|
end
|
549
705
|
|
550
|
-
describe '#
|
706
|
+
describe '#check' do
|
551
707
|
before do
|
552
708
|
@release = GitRelease.new
|
709
|
+
@release.send(:this_version=, '1.0.0-SNAPSHOT')
|
553
710
|
end
|
554
711
|
|
555
712
|
it 'should accept a clean repository' do
|
@@ -624,6 +781,7 @@ describe SvnRelease do
|
|
624
781
|
it_should_behave_like 'a release process'
|
625
782
|
|
626
783
|
before do
|
784
|
+
write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
|
627
785
|
@release = SvnRelease.new
|
628
786
|
Svn.stub!(:svn)
|
629
787
|
Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
|
@@ -645,6 +803,7 @@ describe SvnRelease do
|
|
645
803
|
before do
|
646
804
|
Svn.stub!(:uncommitted_files).and_return([])
|
647
805
|
@release = SvnRelease.new
|
806
|
+
@release.send(:this_version=, "1.0.0-SNAPSHOT")
|
648
807
|
end
|
649
808
|
|
650
809
|
it 'should accept to release from the trunk' do
|