You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Peter Schröder <ps...@blau.de> on 2009/11/19 21:54:51 UTC

combining filters

is it possible to combine a filter from the profiles.yaml with a filter defined in the project?

if i use a filter like this:

  resources.filter.using 'date'=>Time.new

the filter defined in the yaml (which are static) wont get applied

Re: combining filters

Posted by Alex Boisvert <al...@gmail.com>.
On Fri, Nov 20, 2009 at 10:21 AM, Alex Boisvert <al...@gmail.com>wrote:

> On Fri, Nov 20, 2009 at 12:20 AM, Peter Schröder <ps...@blau.de> wrote:
>
>> see building > resources :
>>
>> ...
>>
>> You can also use profiles<
>> http://buildr.apache.org/settings_profiles.html#profiles> to supply a
>> name/value map that all resources task should default to, by adding a filter
>> element to each of the profiles. The following examples shows a
>> profiles.yaml file that applies the same filter in development and test
>> environments:
>>
>
> Totally missed this earlier.  Learn something every day ;)
>
> I think the issue here is how the default is applied.  Right now, the
> values in profiles.yaml are used as default if you don't specify anything
> manually.   The filter values aren't merged if you provide any other value.
>
> So right now you can have both by writing,
>
>   resources.filter.using( { 'date' => Time.new }.merge(
> Buildr.settings.profile['filter'] ))
>
> I'll see if I can make it behave as you expected -- and as I would have
> had.
>

Fixed now. https://issues.apache.org/jira/browse/BUILDR-349

alex

Re: combining filters

Posted by Alex Boisvert <al...@gmail.com>.
On Fri, Nov 20, 2009 at 12:20 AM, Peter Schröder <ps...@blau.de> wrote:

> see building > resources :
>
> ...
>
> You can also use profiles<
> http://buildr.apache.org/settings_profiles.html#profiles> to supply a
> name/value map that all resources task should default to, by adding a filter
> element to each of the profiles. The following examples shows a
> profiles.yaml file that applies the same filter in development and test
> environments:
>

Totally missed this earlier.  Learn something every day ;)

I think the issue here is how the default is applied.  Right now, the values
in profiles.yaml are used as default if you don't specify anything
manually.   The filter values aren't merged if you provide any other value.

So right now you can have both by writing,

  resources.filter.using( { 'date' => Time.new }.merge(
Buildr.settings.profile['filter'] ))

I'll see if I can make it behave as you expected -- and as I would have had.

alex

Re: combining filters

Posted by Peter Schröder <ps...@blau.de>.
see building > resources :

...

You can also use profiles<http://buildr.apache.org/settings_profiles.html#profiles> to supply a name/value map that all resources task should default to, by adding a filter element to each of the profiles. The following examples shows a profiles.yaml file that applies the same filter in development and test environments:

...

or here:

http://github.com/phoet/buildr-examples/tree/master/building/resources/

kind regards,
peter


Am 20.11.2009 um 00:20 schrieb Alex Boisvert:

On Thu, Nov 19, 2009 at 12:54 PM, Peter Schröder <ps...@blau.de>> wrote:

is it possible to combine a filter from the profiles.yaml with a filter
defined in the project?

if i use a filter like this:

resources.filter.using 'date'=>Time.new

the filter defined in the yaml (which are static) wont get applied


I'm not sure I understand what you mean by 'the filter defined in the yaml
won't get applied' -- I don't see any code/documentation connecting filters
and yaml files.

Did you try something along the lines of,

 resources.filter.using({ :date => Time.new }.merge(
settings.profile('filters') )

(assuming you have a 'filters' section in profiles.yaml)

alex


Re: combining filters

Posted by Alex Boisvert <al...@gmail.com>.
On Thu, Nov 19, 2009 at 12:54 PM, Peter Schröder <ps...@blau.de> wrote:

> is it possible to combine a filter from the profiles.yaml with a filter
> defined in the project?
>
> if i use a filter like this:
>
>  resources.filter.using 'date'=>Time.new
>
> the filter defined in the yaml (which are static) wont get applied


I'm not sure I understand what you mean by 'the filter defined in the yaml
won't get applied' -- I don't see any code/documentation connecting filters
and yaml files.

Did you try something along the lines of,

  resources.filter.using({ :date => Time.new }.merge(
settings.profile('filters') )

(assuming you have a 'filters' section in profiles.yaml)

alex