You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Ittay Dror <it...@gmail.com> on 2008/08/07 09:14:22 UTC

using groups with artifact namespace

Hi,

I'm trying to use namespaces where one of the artifacts is a group:
    ns.openframe = Buildr.group('core', 'util', :under => 
'com.tikalknowledge.openframe', :version => '2004.1.0', :type => 'jar')

In my buildfile I use ':openframe' (minus the quotes). The thing is that 
'Buildr#artifact' then gets an array from artifact_ns.fetch(spec), and 
can't handle it.

To enable this, I changed artifact to:
def artifact(spec, &block) #:yields:task
    spec = artifact_ns.fetch(spec) if spec.kind_of?(Symbol)
    case spec
    when Array
       spec.map{|s| artifact(s)}
    else
      spec = Artifact.to_hash(spec)
      unless task = Artifact.lookup(spec)
        task = Artifact.define_task(repositories.locate(spec))
        task.send :apply_spec, spec
        Rake::Task['rake:artifacts'].enhance [task]
        Artifact.register(task)
      end
      task.enhance &block
    end
  end

Btw, I'm seeing more problems trying to access a sub namespace 
':commons_pool' (minus the quotes)

Ittay

-- 
--
Ittay Dror <it...@gmail.com>



Re: using groups with artifact namespace

Posted by Ittay Dror <it...@gmail.com>.

Ittay Dror wrote:
> Hi,
>
> I'm trying to use namespaces where one of the artifacts is a group:
>    ns.openframe = Buildr.group('core', 'util', :under => 
> 'com.tikalknowledge.openframe', :version => '2004.1.0', :type => 'jar')
>
> In my buildfile I use ':openframe' (minus the quotes). The thing is 
> that 'Buildr#artifact' then gets an array from 
> artifact_ns.fetch(spec), and can't handle it.
>
> To enable this, I changed artifact to:
> def artifact(spec, &block) #:yields:task
>    spec = artifact_ns.fetch(spec) if spec.kind_of?(Symbol)
>    case spec
>    when Array
>       spec.map{|s| artifact(s)}
>    else
>      spec = Artifact.to_hash(spec)
>      unless task = Artifact.lookup(spec)
>        task = Artifact.define_task(repositories.locate(spec))
>        task.send :apply_spec, spec
>        Rake::Task['rake:artifacts'].enhance [task]
>        Artifact.register(task)
>      end
>      task.enhance &block
>    end
>  end
this doesn't work quite well (as i've learned after fixing the namespace 
issues), since this will add an array to the array created in 
#artifacts. so i just added '.flatten' at the end of 'inject' in #artifacts.

ittay
>
> Btw, I'm seeing more problems trying to access a sub namespace 
> ':commons_pool' (minus the quotes)
>
> Ittay
>

-- 
--
Ittay Dror <it...@gmail.com>