You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/04/11 07:39:36 UTC
svn commit: r647052 - in /incubator/buildr/trunk: lib/buildr/core/project.rb
spec/project_spec.rb
Author: assaf
Date: Thu Apr 10 22:39:35 2008
New Revision: 647052
URL: http://svn.apache.org/viewvc?rev=647052&view=rev
Log:
Simple change to make sure Project.define complains about existing project re-definition before complaining about conflict with existing task name.
Modified:
incubator/buildr/trunk/lib/buildr/core/project.rb
incubator/buildr/trunk/spec/project_spec.rb
Modified: incubator/buildr/trunk/lib/buildr/core/project.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/project.rb?rev=647052&r1=647051&r2=647052&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/project.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/project.rb Thu Apr 10 22:39:35 2008
@@ -198,12 +198,12 @@
Buildr.application.current_scope == name.split(':')[0...-1] or
raise "You can only define a sub project (#{name}) within the definition of its parent project"
+ @projects ||= {}
+ raise "You cannot define the same project (#{name}) more than once" if @projects[name]
# Projects with names like: compile, test, build are invalid, so we have
# to make sure the project has not the name of an already defined task
raise "Invalid project name: #{name.inspect} is already used for a task" if Buildr.application.lookup(name)
- @projects ||= {}
- raise "You cannot define the same project (#{name}) more than once" if @projects[name]
Project.define_task(name).tap do |project|
# Define the project to prevent duplicate definition.
@projects[name] = project
Modified: incubator/buildr/trunk/spec/project_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/project_spec.rb?rev=647052&r1=647051&r2=647052&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/project_spec.rb (original)
+++ incubator/buildr/trunk/spec/project_spec.rb Thu Apr 10 22:39:35 2008
@@ -29,8 +29,9 @@
it 'should fail to be defined if its name is already used for a task' do
lambda { define('test') }.should raise_error(RuntimeError, /Invalid project name/i)
- lambda { define('valid') { define('build') } }.should raise_error(RuntimeError, /Invalid project name/i)
- lambda { define('valid') { define('valid:compile') } }.should raise_error(RuntimeError, /Invalid project name/i)
+ define 'valid' do
+ lambda { define('build') }.should raise_error(RuntimeError, /Invalid project name/i)
+ end
end
it 'should exist once defined' do