Assaf Arkin wrote:
- Follow coding conventions.

where can i find the coding conventions?

In the same source file you're modifying.  The source code is self-documenting.

Assaf
Sorry, but I still can't see what I did wrong. I would appreciate it if you could point out my mistakes. Maybe it is also worth while explicitly documenting conventions.

Ittay

- return projects if projects: when is projects ever nil?

right. it can't. will fix.
- local_projects expects a block.

only if a block is given ('elsif block')

Assaf



---
lib/buildr/core/application_cli.rb |    6 +++++-
lib/buildr/core/project.rb         |    4 ++++
2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lib/buildr/core/application_cli.rb
b/lib/buildr/core/application_cli.rb
index 3a19cf9..3f826e8 100644
--- a/lib/buildr/core/application_cli.rb
+++ b/lib/buildr/core/application_cli.rb
@@ -59,7 +59,9 @@ module Buildr
      ['--version',  '-v', GetoptLong::NO_ARGUMENT,
        'Display the program version.'],
      ['--environment', '-e', GetoptLong::REQUIRED_ARGUMENT,
-          'Environment name (e.g. development, test, production).']
+          'Environment name (e.g. development, test, production).'],
+        ['--project',  '-p', GetoptLong::REQUIRED_ARGUMENT,
+          'Project name, can be relative to current directory']
    ]

  def collect_tasks
@@ -99,6 +101,8 @@ module Buildr
      options.show_task_pattern = Regexp.new(value || '.')
    when '--nosearch', '--quiet', '--trace'
      super
+      when '--project'
+         options.project = value
    end
  end

diff --git a/lib/buildr/core/project.rb b/lib/buildr/core/project.rb
index 6a37751..d5c511a 100644
--- a/lib/buildr/core/project.rb
+++ b/lib/buildr/core/project.rb
@@ -336,6 +336,10 @@ module Buildr
    end

    def local_projects(dir = nil, &block) #:nodoc:
+        if dir.nil? and Buildr.application.options.project
+          projects = local_projects('.').map{|p|
project("#{p}:#{Buildr.application.options.project}")}
+          return projects if projects
+        end
      dir = File.expand_path(dir || Buildr.application.original_dir)
      projects = Project.projects.select { |project| project.base_dir ==
dir }
      if projects.empty? && dir != Dir.pwd && File.dirname(dir) != dir
--
1.6.0.36.g3814c

--
Ittay Dror <[EMAIL PROTECTED]>
Tikal <http://www.tikalk.com>
Tikal Project <http://tikal.sourceforge.net>




--
--
Ittay Dror <[EMAIL PROTECTED]>



--
--
Ittay Dror <[EMAIL PROTECTED]>

Reply via email to