You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2010/03/05 06:48:51 UTC
svn commit: r919303 [3/3] - in /buildr/trunk: addon/buildr/ doc/scripts/
lib/buildr/ lib/buildr/core/ lib/buildr/groovy/ lib/buildr/ide/
lib/buildr/java/ lib/buildr/packaging/ lib/buildr/scala/ rakelib/ spec/
spec/addon/ spec/core/ spec/groovy/ spec/id...
Modified: buildr/trunk/spec/packaging/archive_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/archive_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/archive_spec.rb (original)
+++ buildr/trunk/spec/packaging/archive_spec.rb Fri Mar 5 05:48:49 2010
@@ -128,7 +128,7 @@
write "#{@dir}/sub/test"
archive(@archive).include(@dir).exclude("#{@dir}/sub").invoke
inspect_archive do |archive|
- archive.keys.select { |file| file =~ /sub/ }.should be_empty
+ archive.keys.select { |file| file =~ /sub/ }.should be_empty
end
end
@@ -230,19 +230,19 @@
create_for_merge do |src|
archive(@archive).merge(src).include(File.basename(@files.first))
archive(@archive).invoke
- inspect_archive do |archive|
+ inspect_archive do |archive|
archive[File.basename(@files.first)].should eql(content_for(@files.first))
archive[File.basename(@files.last)].should be_nil
end
end
end
-
+
it 'should expand another archive file with exclude pattern' do
create_for_merge do |src|
archive(@archive).merge(src).exclude(File.basename(@files.first))
archive(@archive).invoke
- inspect_archive do |archive|
- @files[1..-1].each { |f| archive[File.basename(f)].should eql(content_for(f)) }
+ inspect_archive do |archive|
+ @files[1..-1].each { |f| archive[File.basename(f)].should eql(content_for(f)) }
archive[File.basename(@files.first)].should be_nil
end
end
@@ -296,7 +296,7 @@
# all included files newer.
File.utime Time.now - 100, Time.now - 100, @archive
archive(@archive).include(@files).invoke
- File.stat(@archive).mtime.should be_close(Time.now, 10)
+ File.stat(@archive).mtime.should be_close(Time.now, 10)
end
it 'should do nothing if all files are uptodate' do
@@ -304,7 +304,7 @@
# By touching all files in the past, there's nothing new to update.
(@files + [@archive]).each { |f| File.utime Time.now - 100, Time.now - 100, f }
archive(@archive).include(@files).invoke
- File.stat(@archive).mtime.should be_close(Time.now - 100, 10)
+ File.stat(@archive).mtime.should be_close(Time.now - 100, 10)
end
it 'should update if one of the files is recent' do
@@ -353,7 +353,7 @@
def inspect_archive
entries = {}
- Zlib::GzipReader.open @archive do |gzip|
+ Zlib::GzipReader.open @archive do |gzip|
Archive::Tar::Minitar.open gzip, 'r' do |reader|
reader.each { |entry| entries[entry.directory ? "#{entry.name}/" : entry.name] = entry.read }
end
@@ -392,7 +392,7 @@
# http://jira.codehaus.org/browse/JRUBY-3300
hello = File.expand_path('src/main/bin/hello')
write hello, 'echo hi'
- File.chmod(0777, hello) ||
+ File.chmod(0777, hello) ||
fail("Failed to set permission on #{hello}") unless (File.stat(hello).mode & 0777) == 0777
zip('foo.zip').include('src/main/bin/*').invoke
@@ -424,17 +424,17 @@
tar(@targz).include(*args.empty? ? @files : args).invoke
yield
end
-
+
def with_tar_too(*args)
tar(@targz2).include(*args.empty? ? @files : args).invoke
yield
end
-
+
def with_zip(*args)
zip(@zip).include(*args.empty? ? @files : args).invoke
yield
end
-
+
it 'should touch target directory' do
with_zip do
mkdir @target
@@ -450,14 +450,14 @@
@files.each { |f| File.read(File.join(@target, File.basename(f))).should eql(content_for(f)) }
end
end
-
+
it 'should expand files from a tar.gz file' do
with_tar do
unzip(@target=>@targz).target.invoke
@files.each { |f| File.read(File.join(@target, File.basename(f))).should eql(content_for(f)) }
end
end
-
+
it 'should expand files from a .tgz file' do
with_tar_too do
unzip(@target=>@targz2).target.invoke
@@ -471,7 +471,7 @@
FileList[File.join(@target, '*')].size.should be(@files.size)
end
end
-
+
it 'should expand all files from a .tar.gz file' do
with_tar do
unzip(@target=>@targz).target.invoke
@@ -487,7 +487,7 @@
FileList[File.join(@target, '*')].size.should be(1)
end
end
-
+
it 'should expand only included files from a .tar.gz file' do
with_tar do
only = File.basename(@files.first)
@@ -505,7 +505,7 @@
FileList[File.join(@target, '*')].size.should be(@files.size - 1)
end
end
-
+
it 'should expand all but excluded files with a .tar.gz file' do
with_tar do
except = File.basename(@files.first)
@@ -530,7 +530,7 @@
FileList[File.join(@target, 'test/path/*')].size.should be(2)
end
end
-
+
it 'should include with nested path patterns with a .tar.gz file' do
with_tar @files, :path=>'test/path' do
only = File.basename(@files.first)
@@ -566,7 +566,7 @@
FileList[File.join(@target, 'path/*')].size.should be(2)
end
end
-
+
it 'should include with relative path with a .tar.gz file' do
with_tar @files, :path=>'test/path' do
only = File.basename(@files.first)
@@ -586,7 +586,7 @@
FileList[File.join(@target, 'path/*')].size.should be(2)
end
end
-
+
it 'should exclude with relative path' do
with_zip @files, :path=>'test' do
except = File.basename(@files.first)
@@ -595,7 +595,7 @@
FileList[File.join(@target, '*')].size.should be(@files.size - 1)
end
end
-
+
it 'should exclude with relative path on a tar.gz file' do
with_tar @files, :path=>'test' do
except = File.basename(@files.first)
@@ -614,7 +614,7 @@
unzip(@target=>@zip).tap { |unzip| unzip.from_path('lib') }.target.invoke
FileList[File.join(@target, '**/*')].should have(2).files
end
-
+
it "should handle relative paths without any includes or excludes with a tar.gz file" do
lib_files = %w{Test3.so Test4.rb}.
map { |file| File.join(@dir, file) }.
Modified: buildr/trunk/spec/packaging/artifact_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/artifact_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ buildr/trunk/spec/packaging/artifact_spec.rb Fri Mar 5 05:48:49 2010
@@ -169,16 +169,16 @@
YAML
repositories.local.should eql(File.expand_path('my_repo'))
end
-
+
it 'should not override custom install methods defined when extending an object' do
class MyOwnInstallTask
-
+
attr_accessor :result
-
+
def install
result = true
end
-
+
end
task = MyOwnInstallTask.new
task.result = "maybe"
@@ -186,7 +186,7 @@
task.install
task.result.should be_true
end
-end
+end
describe Repositories, 'remote' do
Modified: buildr/trunk/spec/scala/bdd_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/scala/bdd_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/scala/bdd_spec.rb (original)
+++ buildr/trunk/spec/scala/bdd_spec.rb Fri Mar 5 05:48:49 2010
@@ -33,13 +33,13 @@
define 'foo'
project('foo').test.framework.should eql(:specs)
end
-
+
it 'should include Specs dependencies' do
define('foo') { test.using(:specs) }
project('foo').test.compile.dependencies.should include(*artifacts(Scala::Specs.dependencies))
project('foo').test.dependencies.should include(*artifacts(Scala::Specs.dependencies))
end
-
+
it 'should include ScalaCheck dependencies' do
define('foo') { test.using(:specs) }
project('foo').test.compile.dependencies.should include(*artifacts(Scala::Check.dependencies))
@@ -98,12 +98,12 @@
SCALA
lambda { define('foo').test.invoke }.should_not raise_error
end
-
+
it 'should fail when spec fails' do
write 'src/spec/scala/StringSpecs.scala', <<-SCALA
import org.specs._
import org.specs.runner._
-
+
object StringSpecs extends Specification {
"empty string" should {
"have a zero length" in {
Modified: buildr/trunk/spec/scala/compiler_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/scala/compiler_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/scala/compiler_spec.rb (original)
+++ buildr/trunk/spec/scala/compiler_spec.rb Fri Mar 5 05:48:49 2010
@@ -20,7 +20,7 @@
# need to test both with and without SCALA_HOME
share_as :ScalacCompiler do
it 'should identify itself from source directories' do
- write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }'
+ write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }'
define('foo').compile.compiler.should eql(:scalac)
end
@@ -65,7 +65,7 @@
package(:jar)
end
end
-
+
it 'should compile a simple .scala file into a .class file' do
define_test1_project
task('test1:compile').invoke
@@ -115,24 +115,24 @@
it 'requires present SCALA_HOME' do
ENV['SCALA_HOME'].should_not be_nil
end
-
+
it_should_behave_like ScalacCompiler
end
describe 'scala compiler (downloaded from repository)' do
old_home = ENV['SCALA_HOME']
-
+
before :all do
ENV['SCALA_HOME'] = nil
end
-
+
it 'requires absent SCALA_HOME' do
ENV['SCALA_HOME'].should be_nil
end
-
+
it_should_behave_like ScalacCompiler
-
+
after :all do
ENV['SCALA_HOME'] = old_home
end
@@ -159,21 +159,21 @@
it 'should use -nowarn argument when warnings is false' do
compile_task.using(:warnings=>false)
- scalac_args.should include('-nowarn')
+ scalac_args.should include('-nowarn')
end
it 'should not use -nowarn argument when warnings is true' do
compile_task.using(:warnings=>true)
- scalac_args.should_not include('-nowarn')
+ scalac_args.should_not include('-nowarn')
end
it 'should not use -verbose argument by default' do
- scalac_args.should_not include('-verbose')
+ scalac_args.should_not include('-verbose')
end
it 'should use -verbose argument when running with --trace option' do
trace true
- scalac_args.should include('-verbose')
+ scalac_args.should include('-verbose')
end
it 'should set debug option to true by default' do
Modified: buildr/trunk/spec/scala/scala.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/scala/scala.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/scala/scala.rb (original)
+++ buildr/trunk/spec/scala/scala.rb Fri Mar 5 05:48:49 2010
@@ -20,7 +20,7 @@
# Specific version of Scala required for specs
required_version = '2.7.3'
scala_version_str = "version 2.7.3.final"
-
+
it 'should automatically add the remote scala-tools.org repository' do
# NOTE: the sandbox environment clears "repositories.remote" so we can't
# test for this spec right now.
Modified: buildr/trunk/spec/spec_helpers.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/spec_helpers.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/spec_helpers.rb (original)
+++ buildr/trunk/spec/spec_helpers.rb Fri Mar 5 05:48:49 2010
@@ -44,7 +44,7 @@
# Give a chance for plugins to do a few things before requiring the sandbox.
include SandboxHook if defined?(SandboxHook)
-
+
require File.expand_path('sandbox', File.dirname(__FILE__))
module SpecHelpers
@@ -60,7 +60,7 @@
end
end
end
-
+
class << Buildr.application
alias :deprecated_without_capture :deprecated
def deprecated(message)
@@ -121,20 +121,20 @@
def show(message)
MessageWithSeverityMatcher.new :puts, message
end
-
+
# Yields a block that should try exiting the application.
- # Accepts
+ # Accepts
#
# For example:
# test_exit(1) { puts "Hello" ; exit(1) }.should show("Hello")
- #
+ #
def test_exit(status = nil)
return lambda {
begin
yield
raise "Exit was not called!"
rescue SystemExit => e
- raise "Exit status incorrect! Expected: #{status}, got #{e.status}" if status && (e.status != status)
+ raise "Exit status incorrect! Expected: #{status}, got #{e.status}" if status && (e.status != status)
end
}
end
@@ -172,7 +172,7 @@
"Expected the tasks #{expected} to not run, but they all ran."
else
"Expected the tasks #{expected} to not run, and all but #{remaining} ran."
- end
+ end
end
def but_not(*tasks)
@@ -247,7 +247,7 @@
"URI with path matching #{@expression}"
end
end
-
+
# Matches a parsed URI's path against the given regular expression
def uri(re)
UriPathMatcher.new(re)
@@ -277,16 +277,16 @@
AbsolutePathMatcher.new(path)
end
-
+
# Value covered by range. For example:
# (1..5).should cover(3)
def cover(value)
simple_matcher :cover do |given|
- value >= given.min && value <= given.max
+ value >= given.min && value <= given.max
end
end
-
+
def suppress_stdout
stdout = $stdout
$stdout = StringIO.new
@@ -329,7 +329,7 @@
yield
ensure
Buildr.application.instance_eval { @original_dir = original_dir }
- end
+ end
end
Modified: buildr/trunk/spec/version_requirement_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/version_requirement_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/version_requirement_spec.rb (original)
+++ buildr/trunk/spec/version_requirement_spec.rb Fri Mar 5 05:48:49 2010
@@ -20,8 +20,8 @@
def create(str)
Buildr::VersionRequirement.create(str)
end
-
- it 'should complain on invalid input' do
+
+ it 'should complain on invalid input' do
lambda { create }.should raise_error(Exception)
lambda { create('%') }.should raise_error(Exception, /invalid character/)
lambda { create('1#{0}') }.should raise_error(Exception, /invalid character/)
@@ -30,16 +30,16 @@
lambda { create('1.0') }.should_not raise_error(Exception)
lambda { create('1.0rc3') }.should_not raise_error(Exception)
end
-
+
it 'should allow versions using hyphen' do
lambda { create('1.0-rc3') }.should_not raise_error(Exception)
end
- it 'should create a single version requirement' do
+ it 'should create a single version requirement' do
create('1.0').should_not be_composed
end
- it 'should create a composed version requirement' do
+ it 'should create a composed version requirement' do
create('1.0 | 2.1').should be_composed
end
end
@@ -61,13 +61,13 @@
should_satisfy '=1.0', %w(1 1.0), %w(1.1 0.1)
should_satisfy '= 1.0', %w(1 1.0), %w(1.1 0.1)
should_satisfy '!= 1.0', %w(0.9 1.1 2), %w(1 1.0 1.0.0)
-
+
should_satisfy '>1.0', %w(1.0.1), %w(1 1.0 0.1)
should_satisfy '>=1.0', %w(1.0.1 1 1.0), %w(0.9)
should_satisfy '<1.0', %w(0.9 0.9.9), %w(1 1.0 1.1 2)
should_satisfy '<=1.0', %w(0.9 0.9.9 1 1.0), %w(1.1 2)
-
+
should_satisfy '~> 1.2.3', %w(1.2.3 1.2.3.4 1.2.4), %w(1.2.1 0.9 1.4 2)
end
@@ -91,7 +91,7 @@
it 'should assume logic and if missing operator between expressions' do
should_satisfy '>1.5 <2.0', %w(1.6 1.9), %w(1.5 2 2.0)
end
-
+
it 'should allow combining logic operators' do
should_satisfy '>1.0 | <2.0 | =3.0', %w(1.5 3.0 1 2 4)
should_satisfy '>1.0 & <2.0 | =3.0', %w(1.3 3.0), %w(1 2)
@@ -99,7 +99,7 @@
should_satisfy '~>1.1 | ~>1.3 | ~>1.5 | 2.0', %w(2 1.5.6 1.1.2 1.1.3), %w(1.0.9 0.5 2.2.1)
should_satisfy 'not(2) | 1', %w(1 3), %w(2)
end
-
+
it 'should allow using parens to group logic expressions' do
should_satisfy '(1.0)', %w(1 1.0), %w(0.9 1.1)
should_satisfy '!( !(1.0) )', %w(1 1.0), %w(0.9 1.1)
@@ -110,13 +110,13 @@
=end
describe Buildr::VersionRequirement, '#default' do
- it 'should return nil if missing default requirement' do
+ it 'should return nil if missing default requirement' do
Buildr::VersionRequirement.create('>1').default.should be_nil
Buildr::VersionRequirement.create('<1').default.should be_nil
Buildr::VersionRequirement.create('!1').default.should be_nil
Buildr::VersionRequirement.create('!<=1').default.should be_nil
end
-
+
it 'should return the last version with a = requirement' do
Buildr::VersionRequirement.create('1').default.should == '1'
Buildr::VersionRequirement.create('=1').default.should == '1'
@@ -129,14 +129,14 @@
end
describe Buildr::VersionRequirement, '#version?' do
- it 'should identify valid versions' do
+ it 'should identify valid versions' do
Buildr::VersionRequirement.version?('1').should be_true
Buildr::VersionRequirement.version?('1a').should be_true
Buildr::VersionRequirement.version?('1.0').should be_true
Buildr::VersionRequirement.version?('11.0').should be_true
Buildr::VersionRequirement.version?(' 11.0 ').should be_true
Buildr::VersionRequirement.version?('11.0-alpha').should be_true
-
+
Buildr::VersionRequirement.version?('a').should be_false
Buildr::VersionRequirement.version?('a1').should be_false
end