You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by vb...@apache.org on 2008/09/08 20:22:59 UTC

svn commit: r693186 - in /incubator/buildr/trunk/lib/buildr/core: application.rb application_cli.rb

Author: vborja
Date: Mon Sep  8 11:22:58 2008
New Revision: 693186

URL: http://svn.apache.org/viewvc?rev=693186&view=rev
Log:
BUILDR-142. Reverted changes. This impl should be proposed first before commiting.

Modified:
    incubator/buildr/trunk/lib/buildr/core/application.rb
    incubator/buildr/trunk/lib/buildr/core/application_cli.rb

Modified: incubator/buildr/trunk/lib/buildr/core/application.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/application.rb?rev=693186&r1=693185&r2=693186&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/application.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/application.rb Mon Sep  8 11:22:58 2008
@@ -169,42 +169,14 @@
     end
     private :listed_gems
 
-    # :nodoc:
-    # Change directory to options.project if it is an existing directory.
-    # Use this method if user intends to run buildr on a different working dir.
-    # returns Dir.pwd if chdir was performed
-    def chdir_before_loading
-      if options.project && File.directory?(options.project)
-        Dir.chdir(options.project) # change dir before seaching buildfile
-        @original_dir = Dir.pwd
-      end
-    end
-    private :chdir_before_loading
-
-    # :nodo:
-    # Change directory to the basedir of project named in options.project
-    # returns Dir.pwd if chdir was performed
-    def chdir_before_tasks
-      if options.project && !File.directory?(options.project)
-        # if options.project was a project name, we chdir to it's base dir.
-        project_name = options.project.gsub(File::SEPARATOR, ':')
-        project = Buildr.project(project_name)
-        Dir.chdir(project.path_to(nil))
-        @original_dir = Dir.pwd
-      end
-    end
-    private :chdir_before_tasks
-
     def run
       standard_exception_handling do
-        chdir_before_loading
         find_buildfile
         load_gems
         load_artifacts
         load_tasks
         load_buildfile
         task('buildr:initialize').invoke
-        chdir_before_tasks
         top_level
       end
       title, message = 'Your build has completed', "#{Dir.pwd}\nbuildr #{@top_level_tasks.join(' ')}"
@@ -298,26 +270,6 @@
     end
     private :load_tasks
 
-    # :nodoc:
-    # Lookup for a task using the given task_name.
-    # This method extends Rake's functionality to obtain the task for a file path
-    # or the build task if given a project basedir.
-    def lookup(task_name, initial_scope=nil)
-      unless task = super
-        path = File.expand_path(task_name, Buildr.application.original_dir)
-        if !(task = @tasks[path]) && project = Buildr::Project.local_projects(path).first
-          project_path = project.path_to(nil)
-          if project_path == path
-            task = @tasks[project.name + ':build']
-          else
-            project_task = path.sub(/^#{project_path}\/?/, '').gsub('/',':')
-            task = @tasks[project.name + ':' + project_task] || @tasks[project_task]
-          end
-        end
-      end
-      task
-    end
-
     def display_prerequisites
       invoke_task('buildr:initialize')
       tasks.each do |task|

Modified: incubator/buildr/trunk/lib/buildr/core/application_cli.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/application_cli.rb?rev=693186&r1=693185&r2=693186&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/application_cli.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/application_cli.rb Mon Sep  8 11:22:58 2008
@@ -59,9 +59,7 @@
         ['--version',  '-v', GetoptLong::NO_ARGUMENT,
           'Display the program version.'],
         ['--environment', '-e', GetoptLong::REQUIRED_ARGUMENT,
-          'Environment name (e.g. development, test, production).'],
-        ['--project', '-p', GetoptLong::REQUIRED_ARGUMENT,
-          'Change to project directory before executing tasks.']
+          'Environment name (e.g. development, test, production).']
       ]
 
     def collect_tasks
@@ -99,8 +97,6 @@
       when '--prereqs'
         options.show_prereqs = true
         options.show_task_pattern = Regexp.new(value || '.')
-      when '--project'
-        options.project = value
       when '--nosearch', '--quiet', '--trace'
         super
       end