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 2009/10/02 16:10:25 UTC
svn commit: r821029 - in /buildr/trunk: CHANGELOG
lib/buildr/packaging/package.rb spec/packaging/packaging_spec.rb
Author: boisvert
Date: Fri Oct 2 14:10:25 2009
New Revision: 821029
URL: http://svn.apache.org/viewvc?rev=821029&view=rev
Log:
BUILDR-325: Overriding package spec with classifer doesn't work (Antoine Toulme)
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/packaging/package.rb
buildr/trunk/spec/packaging/packaging_spec.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=821029&r1=821028&r2=821029&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri Oct 2 14:10:25 2009
@@ -28,6 +28,7 @@
* Fixed: BUILDR-322 When specifying files (instead of directories) as sources for compile task,
Buildr uses target directory timestamp only (not compiled output timestamp)
* Fixed: BUILDR-324: Regression - baseDir system property is not set when executing tests [Alexis Midon]
+* Fixed: BUILDR-325: Overriding package spec with classifer doesn't work (Antoine Toulme)
1.3.4 (2009-04-21)
* Added: BUILDR-93 Add specs for ScalaCheck integration
Modified: buildr/trunk/lib/buildr/packaging/package.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/package.rb?rev=821029&r1=821028&r2=821029&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/package.rb (original)
+++ buildr/trunk/lib/buildr/packaging/package.rb Fri Oct 2 14:10:25 2009
@@ -148,8 +148,8 @@
spec = send("package_as_#{spec[:type]}_spec", spec) if respond_to?("package_as_#{spec[:type]}_spec")
file_name = path_to(:target, Artifact.hash_to_file_name(spec))
end
-
- package = (no_options && packages.detect { |pkg| pkg.type == spec[:type] }) ||
+ package = (no_options && packages.detect { |pkg| pkg.type == spec[:type] &&
+ (spec[:classifier].nil? || pkg.classifier == spec[:classifier])}) ||
packages.find { |pkg| pkg.name == file_name } ||
packager.call(file_name)
else
Modified: buildr/trunk/spec/packaging/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/packaging_spec.rb?rev=821029&r1=821028&r2=821029&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/packaging_spec.rb (original)
+++ buildr/trunk/spec/packaging/packaging_spec.rb Fri Oct 2 14:10:25 2009
@@ -195,6 +195,34 @@
package(:sources).classifier.should eql('sources')
end
end
+
+ it 'should produce different packages for different specs' do
+ class Buildr::Project
+ def package_as_foo(file_name)
+ file(file_name)
+ end
+
+ def package_as_foo_spec(spec)
+ spec.merge(:type => :zip)
+ end
+
+ def package_as_bar(file_name)
+ file(file_name)
+ end
+
+ def package_as_bar_spec(spec)
+ spec.merge(:type => :zip, :classifier => "foobar")
+ end
+
+ end
+ define('foo', :version => '1.0') do
+ package(:foo).type.should eql(:zip)
+ package(:foo).classifier.should be_nil
+ package(:bar).type.should eql(:zip)
+ package(:bar).classifier.should eql('foobar')
+ package(:foo).equal?(package(:bar)).should be_false
+ end
+ end
it 'should default to no classifier' do
define 'foo', :version=>'1.0' do