[PATCH] using File::SEPARATOR for project names

View: New views
1 Messages — Rating Filter:   Alert me  

[PATCH] using File::SEPARATOR for project names

by Ittay Dror :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Use File::SEPARATOR instead of colon for project names. This allows
command line completion of project names based on the underlying
directory structure. This is especially useful in windows (cmd.exe)
where programmatic completion is not available.

---
 lib/buildr/core/application_cli.rb |    2 +-
 lib/buildr/core/help.rb            |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/buildr/core/application_cli.rb
b/lib/buildr/core/application_cli.rb
index 3a19cf9..da15bae 100644
--- a/lib/buildr/core/application_cli.rb
+++ b/lib/buildr/core/application_cli.rb
@@ -68,7 +68,7 @@ module Buildr
         if arg =~ /^(\w+)=(.*)$/
           ENV[$1.upcase] = $2
         else
-          top_level_tasks << arg
+          top_level_tasks << arg.gsub(Regexp.quote(File::SEPARATOR), ':')
         end
       end
       top_level_tasks.push("default") if top_level_tasks.size == 0
diff --git a/lib/buildr/core/help.rb b/lib/buildr/core/help.rb
index cc192eb..00b2632 100644
--- a/lib/buildr/core/help.rb
+++ b/lib/buildr/core/help.rb
@@ -100,7 +100,7 @@ namespace 'help' do
   task 'projects' do
     width = projects.map(&:name).map(&:size).max
     projects.each do |project|
-      puts project.comment.to_s.empty? ? "  #{project.name}" : ("  
%-#{width}s  # %s" % [project.name, project.comment])
+      puts project.comment.to_s.empty? ? "  #{project.name.gsub(':',
File::SEPARATOR)}" : ("  %-#{width}s  # %s" % [project.name.gsub(':',
File::SEPARATOR), project.comment])
     end
   end
 
--
1.6.0.36.g3814c


--
--
Ittay Dror <ittay.dror@...>


LightInTheBox - Buy quality products at wholesale price!