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/02 07:05:00 UTC
svn commit: r917888 - in /buildr/trunk: CHANGELOG
lib/buildr/packaging/artifact.rb spec/packaging/artifact_spec.rb
Author: boisvert
Date: Tue Mar 2 06:05:00 2010
New Revision: 917888
URL: http://svn.apache.org/viewvc?rev=917888&view=rev
Log:
BUILDR-373 Package type specific implementations of install, uninstall and
upload are not invoked (Antoine Toulme)
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/packaging/artifact.rb
buildr/trunk/spec/packaging/artifact_spec.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=917888&r1=917887&r2=917888&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Mar 2 06:05:00 2010
@@ -65,6 +65,8 @@
* Fixed: BUILDR-365 test task should use test compile dependencies
* Fixed: BUILDR-366 Scala dependencies should be lazily loaded into
Java.classpath
+* Fixed: BUILDR-373 Package type specific implementations of install,
+ uninstall and upload are not invoked (Antoine Toulme)
* Fixed: BUILDR-379 Ant sql task abruptly terminates buildr
* Fixed: BUILDR-380 GitRelease: recursive search for root '/' does not work
under Windows (Antoine Toulme)
Modified: buildr/trunk/lib/buildr/packaging/artifact.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact.rb?rev=917888&r1=917887&r2=917888&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact.rb Tue Mar 2 06:05:00 2010
@@ -44,6 +44,20 @@
def included(mod)
mod.extend self
end
+
+ def extend_object(base)
+ base.instance_eval { alias :install_old :install } if base.respond_to? :install
+ base.instance_eval { alias :uninstall_old :uninstall } if base.respond_to? :uninstall
+ base.instance_eval { alias :upload_old :upload } if base.respond_to? :upload
+ super
+ end
+
+ def extended(base)
+ #We try to keep the previous instance methods defined on the base instance if there were ones.
+ base.instance_eval { alias :install :install_old } if base.respond_to? :install_old
+ base.instance_eval { alias :uninstall :uninstall_old } if base.respond_to? :uninstall_old
+ base.instance_eval { alias :upload :upload_old } if base.respond_to? :upload_old
+ end
end
# The artifact identifier.
Modified: buildr/trunk/spec/packaging/artifact_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/artifact_spec.rb?rev=917888&r1=917887&r2=917888&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ buildr/trunk/spec/packaging/artifact_spec.rb Tue Mar 2 06:05:00 2010
@@ -169,7 +169,24 @@
YAML
repositories.local.should eql(File.expand_path('my_repo'))
end
-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"
+ task.extend ActsAsArtifact
+ task.install
+ task.result.should be_true
+ end
+end
describe Repositories, 'remote' do