buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: Trying to get Buildr and LockJar to hold hands
Date Fri, 13 Apr 2012 16:40:46 GMT
Hi Michael,

Just make your lock_jar an instance methods instead of class method.  The
buildfile object (self) includes all instance methods from the Buildr
module during bootstrapping.

alex


module Buildr

  class << self # <--- Remove this
    attr_reader :global_lockjar_dsl
    def lock_jar( &blk )
        @global_lockjar_dsl = LockJar::DSL.evaluate(&blk)
    end
  end


On Fri, Apr 13, 2012 at 7:40 AM, Michael Guymon <michael.guymon@gmail.com>wrote:

> Hello Buildrians,
>
> I am slowly working my on dependency resolution addon and am stuck on how
> to tweak the buildr buildfile dsl. I want to add a lock_jar block to define
> repositories and artifacts at a root level and per project. The root level
> lock_jar definition will be merged into the lock_jar calls in the projects.
> These lock_jar definitions will get resolved and locked into a file,
> similar to how bundler works, when the task <project>:lock_jar:lock is run.
> Then when compile is called on a project, the lock file is loaded to the
> classpath. This is an example what I am trying to do with the buildfile:
>
>   require 'lock_jar'
>   lock_jar do
>        repository = 'http://repo1.maven.org/maven2**'
>
>        scope 'test' do
>          jar 'junit:junit:jar:4.10'
>        end
>   end
>
>   define 'app' do
>
>      def 'project1' do
>        lock_jar do
>          jar "org.apache.mina:mina-core:**jar:2.0.4"
>        end
>      end
>
>      def 'project2' do
>         lock_jar do
>           pom 'pom.xml'
>         end
>      end
>
>   end
>
>
> The problem I have is setting the root 'lock_jar' method for the
> buildfile. The non working version I have now: https://github.com/mguymon/
> **lock_jar/blob/master/lib/lock_**jar/buildr.rb<https://github.com/mguymon/lock_jar/blob/master/lib/lock_jar/buildr.rb>which
complains of a NoMethodError : undefined method `lock_jar' for
> main:Object
>
> Any help is greatly appreciated.
>
> thanks,
> Michael
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message