[buildr] Lines 118-120 in checks.rb

View: New views
3 Messages — Rating Filter:   Alert me  

[buildr] Lines 118-120 in checks.rb

by lacton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm wondering what's the purpose of lines 118-120 in checks.rb.

#          context.class.instance_methods(false).each do |method|
#            define_method(method) { |*args| context.send(method, *args) }
#          end

I tried removing them to see what spec would fail, but there was none.

Is it an undocumented feature? Or an idea that was implemented but
later abandoned?

Lacton

Re: [buildr] Lines 118-120 in checks.rb

by Assaf Arkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Oct 19, 2008 at 1:24 PM, lacton <lacton@...> wrote:
> I'm wondering what's the purpose of lines 118-120 in checks.rb.
>
> #          context.class.instance_methods(false).each do |method|
> #            define_method(method) { |*args| context.send(method, *args) }
> #          end

"The context object will pass methods to the context argument, so you
can call any method, e.g. package(:jar)."

The context is typically project, which means you can write:

it.package(:jar).should contain(....)

or just:

package(:jar).should contain(....)

I added a spec for that and, obviously since untested code is
non-working code, a fix.

Assaf


>
> I tried removing them to see what spec would fail, but there was none.
>
> Is it an undocumented feature? Or an idea that was implemented but
> later abandoned?
>
> Lacton
>

Re: [buildr] Lines 118-120 in checks.rb

by lacton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Oct 20, 2008 at 6:52 PM, Assaf Arkin <arkin@...> wrote:

> On Sun, Oct 19, 2008 at 1:24 PM, lacton <lacton@...> wrote:
>> I'm wondering what's the purpose of lines 118-120 in checks.rb.
>>
>> #          context.class.instance_methods(false).each do |method|
>> #            define_method(method) { |*args| context.send(method, *args) }
>> #          end
>
> "The context object will pass methods to the context argument, so you
> can call any method, e.g. package(:jar)."
>
> The context is typically project, which means you can write:
>
> it.package(:jar).should contain(....)
>
> or just:
>
> package(:jar).should contain(....)

I see.  Thank you for the explanation.

> I added a spec for that and, obviously since untested code is
> non-working code, a fix.

Great! :-)

Lacton

> Assaf
>
>
>>
>> I tried removing them to see what spec would fail, but there was none.
>>
>> Is it an undocumented feature? Or an idea that was implemented but
>> later abandoned?
>>
>> Lacton
>>
>