[
https://issues.apache.org/jira/browse/BUILDR-44?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567149#action_12567149
]
Victor Hugo Borja commented on BUILDR-44:
-----------------------------------------
Assaf, you are right, Project#package is handy when obtaining a reference to a
specific package, however, when a project produces many packages even of the
same type (say, two jars) we need an easier way to reference any/some of them:
define 'foo' do
package(:jar) # plain old jar package
package(:zip, :classifier => 'addons', :type => :jar) # using package(:jar)
again would add compiled classes, resources, We don't want that
# add content to our addons jar
end
Later, we try to reference those packages
define 'application' do
# Currently we have to specify the same package options we did when
defining the package in foo
package(:ear).add :war => project('foo').package(:zip, :classifier =>
'addons', :type => :jar)
# Users may expect as I did, that doing something like the following would
return a reference to our
# addons package. However this would unexpectedly create another package
foo-1.0-addons.zip, that
# would make final EAR not having the desired content.
package(:ear).add :war => project('foo').package(:classifier => 'addons')
# Package#packages doesn't create packages, it just returns all of them, or
a subset if you
# provide some selectors, in this case, we need foo packages with 'addons'
classifier
package(:ear).add :war => project('foo').packages(:classifier => 'addons')
end
Ingo's thread would be an example of this situation:
http://www.nabble.com/forum/ViewPost.jtp?post=15360474&framed=y
> Project#packages selector improvement
> -------------------------------------
>
> Key: BUILDR-44
> URL: https://issues.apache.org/jira/browse/BUILDR-44
> Project: Buildr
> Issue Type: Improvement
> Components: Packaging
> Affects Versions: 1.3
> Reporter: Victor Hugo Borja
> Priority: Minor
> Fix For: 1.3
>
> Attachments:
> 0001-Project-packages-can-now-take-a-selectors-argument.patch
>
>
> Currently, the Project#packages method returns all the packages defined for a
> project. However it would be useful to provide a way to easily narrow
> returned packages without having the user(mainly ruby newcomers) to use the
> select ruby idiom
> project.packages.select { |p| p.type == :war }
> It would be nicer to have something like:
>
> project.packages(:type => :war) # actually comparing :war with the type
> attribute of each package
> project.packages(JarTask) # select all Jar kind packages
> For more advanced stuff, users may still need to provide a Proc/Method or
> select the full packages array the ruby way.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.