You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Sergey Konakov <sk...@gmail.com> on 2008/05/28 16:10:46 UTC

Passing parameters to buildr

I'm trying to use buildr 1.3 and am having trouble passing parameters to the
buildr script.
in 1.2.10 i use be able to do:

buildr build foo=bar

And then ENV["foo"] would be "bar" when i read it in my script. This doesn't
seem to be the case anymore.
Is there a new way to pass parameters or am i just missing something?

Sergey

Re: Passing parameters to buildr

Posted by Assaf Arkin <ar...@intalio.com>.
On Thu, May 29, 2008 at 6:41 AM, Steve Wall
<st...@primetimesoftware.com> wrote:
> Could it be inferior Operating Systems don't understand case? Read -
> Windoze... Sorry, couldn't resist.

This one feature is actually not part of our hidden agenda to promote
better operating systems all around :-)


Environment variables are unfortunately case sensitive, unfortunate
because if you set Path, all the code that looks up PATH would stop
working.  And this feature doesn't break that, Buildr is still case
sensitive, it understands JAVA_HOME but not Java_Home.

The problem was centered around:

buildr package test=no
buildr package TEST=no

I like the first one better, I don't like the mixed-case command line
arguments, when almost everything is lower case it's easier if
everything is lower case.

But if you want to turn testing off once and for all:

export test=no
export TEST=no

The second one is more appeasing if like me you keep all environment
variables upper case, again just a matter of convention.  So now we
have two cases to worry about.

So for Rake 0.7.x this required some code to make sure we always check
both values, and equal code to test that the code checks both values.
This was mostly a shortcut to get variable names upcased, and only for
those passed on the command line.  Actual environment variables are
not affected.

I think Rake 0.8.x has a better solution, you could do this:

task 'foobar' do |task, args|
  unless args.test == /no/i
    . . .
  end
end

It will pick the environment variable test, and if not defined, the
environment variable TEST.

Still would require testing both cases, but if you prefer to not touch
the casing of command line arguments passed as environment variables,
we can fix that for 1.3.2.

Assaf

>
> On Wed, May 28, 2008 at 7:10 PM, Daniel Spiewak <dj...@gmail.com> wrote:
>
>> Any particular reason for this?  Seems to me it would be "less surprising"
>> if the ENV['...'] kept the capitalization of the specified parameter.
>>
>> Daniel
>>
>>
>> Assaf Arkin wrote:
>>
>>> On Wed, May 28, 2008 at 7:10 AM, Sergey Konakov<sk...@gmail.com>
>>>  wrote:
>>>
>>>
>>>> I'm trying to use buildr 1.3 and am having trouble passing parameters to
>>>> the
>>>> buildr script.
>>>> in 1.2.10 i use be able to do:
>>>>
>>>> buildr build foo=bar
>>>>
>>>> And then ENV["foo"] would be "bar" when i read it in my script. This
>>>> doesn't
>>>> seem to be the case anymore.
>>>> Is there a new way to pass parameters or am i just missing something?
>>>>
>>>>
>>>
>>> Look for ENV['FOO'].
>>>
>>> The environment name gets capitalized.
>>>
>>> Assaf
>>>
>>>
>>>
>>>> Sergey
>>>>
>>>>
>>>>
>>>

Re: Passing parameters to buildr

Posted by Alex Boisvert <bo...@intalio.com>.
Capitalization of environment variables seems to be a convention rather than
a technical restriction.

Windows environment variables are not case-sensitive.

alex


On Thu, May 29, 2008 at 6:41 AM, Steve Wall <
steve.wall@primetimesoftware.com> wrote:

> Could it be inferior Operating Systems don't understand case? Read -
> Windoze... Sorry, couldn't resist.
>
> On Wed, May 28, 2008 at 7:10 PM, Daniel Spiewak <dj...@gmail.com>
> wrote:
>
> > Any particular reason for this?  Seems to me it would be "less
> surprising"
> > if the ENV['...'] kept the capitalization of the specified parameter.
> >
> > Daniel
> >
> >
> > Assaf Arkin wrote:
> >
> >> On Wed, May 28, 2008 at 7:10 AM, Sergey Konakov<sk...@gmail.com>
> >>  wrote:
> >>
> >>
> >>> I'm trying to use buildr 1.3 and am having trouble passing parameters
> to
> >>> the
> >>> buildr script.
> >>> in 1.2.10 i use be able to do:
> >>>
> >>> buildr build foo=bar
> >>>
> >>> And then ENV["foo"] would be "bar" when i read it in my script. This
> >>> doesn't
> >>> seem to be the case anymore.
> >>> Is there a new way to pass parameters or am i just missing something?
> >>>
> >>>
> >>
> >> Look for ENV['FOO'].
> >>
> >> The environment name gets capitalized.
> >>
> >> Assaf
> >>
> >>
> >>
> >>> Sergey
> >>>
> >>>
> >>>
> >>
>

Re: Passing parameters to buildr

Posted by Steve Wall <st...@primetimesoftware.com>.
Could it be inferior Operating Systems don't understand case? Read -
Windoze... Sorry, couldn't resist.

On Wed, May 28, 2008 at 7:10 PM, Daniel Spiewak <dj...@gmail.com> wrote:

> Any particular reason for this?  Seems to me it would be "less surprising"
> if the ENV['...'] kept the capitalization of the specified parameter.
>
> Daniel
>
>
> Assaf Arkin wrote:
>
>> On Wed, May 28, 2008 at 7:10 AM, Sergey Konakov<sk...@gmail.com>
>>  wrote:
>>
>>
>>> I'm trying to use buildr 1.3 and am having trouble passing parameters to
>>> the
>>> buildr script.
>>> in 1.2.10 i use be able to do:
>>>
>>> buildr build foo=bar
>>>
>>> And then ENV["foo"] would be "bar" when i read it in my script. This
>>> doesn't
>>> seem to be the case anymore.
>>> Is there a new way to pass parameters or am i just missing something?
>>>
>>>
>>
>> Look for ENV['FOO'].
>>
>> The environment name gets capitalized.
>>
>> Assaf
>>
>>
>>
>>> Sergey
>>>
>>>
>>>
>>

Re: Passing parameters to buildr

Posted by Daniel Spiewak <dj...@gmail.com>.
Any particular reason for this?  Seems to me it would be "less 
surprising" if the ENV['...'] kept the capitalization of the specified 
parameter.

Daniel

Assaf Arkin wrote:
> On Wed, May 28, 2008 at 7:10 AM, Sergey Konakov<sk...@gmail.com>  wrote:
>    
>> I'm trying to use buildr 1.3 and am having trouble passing parameters to the
>> buildr script.
>> in 1.2.10 i use be able to do:
>>
>> buildr build foo=bar
>>
>> And then ENV["foo"] would be "bar" when i read it in my script. This doesn't
>> seem to be the case anymore.
>> Is there a new way to pass parameters or am i just missing something?
>>      
>
> Look for ENV['FOO'].
>
> The environment name gets capitalized.
>
> Assaf
>
>    
>> Sergey
>>
>>      

Re: Passing parameters to buildr

Posted by Assaf Arkin <ar...@intalio.com>.
On Wed, May 28, 2008 at 7:10 AM, Sergey Konakov <sk...@gmail.com> wrote:
> I'm trying to use buildr 1.3 and am having trouble passing parameters to the
> buildr script.
> in 1.2.10 i use be able to do:
>
> buildr build foo=bar
>
> And then ENV["foo"] would be "bar" when i read it in my script. This doesn't
> seem to be the case anymore.
> Is there a new way to pass parameters or am i just missing something?

Look for ENV['FOO'].

The environment name gets capitalized.

Assaf

>
> Sergey
>