lib/buildr/core/project.rb in assaf-buildr-1.3.3 vs lib/buildr/core/project.rb in assaf-buildr-1.3.4

- old
+ new

@@ -238,22 +238,23 @@ def project(*args) #:nodoc: options = args.pop if Hash === args.last rake_check_options options, :scope if options raise ArgumentError, 'Only one project name at a time' unless args.size == 1 @projects ||= {} - name = args.first + name = args.first.to_s + # Make sure parent project is evaluated (e.g. if looking for foo:bar, find foo first) + unless @projects[name] + parts = name.split(':') + project(parts.first, options || {}) if parts.size > 1 + end if options && options[:scope] # We assume parent project is evaluated. project = options[:scope].split(':').inject([[]]) { |scopes, scope| scopes << (scopes.last + [scope]) }. map { |scope| @projects[(scope + [name]).join(':')] }. select { |project| project }.last end - unless project - # Parent project not evaluated. - name.split(':').tap { |parts| @projects[parts.first].invoke if parts.size > 1 } - project = @projects[name] - end + project ||= @projects[name] # Not found in scope. raise "No such project #{name}" unless project project.invoke project end @@ -862,12 +863,9 @@ end # Forces all the projects to be evaluated before executing any other task. # If we don't do that, we don't get to have tasks available when running Rake. namespace 'buildr' do - task 'initialize' do - projects - end desc "Freeze the Buildfile so it always uses Buildr version #{Buildr::VERSION}" task 'freeze' do puts "Freezing the Buildfile so it always uses Buildr version #{Buildr::VERSION}" original = File.read(Buildr.application.buildfile)