Quote paths in shell commands
This commit is contained in:
parent
358c5c8b8a
commit
1b5d1c16ac
@ -14,10 +14,10 @@ case ARGV[0]
|
||||
when 'ln' then
|
||||
abort "#{ARGV[1]} is not a directory" unless File.directory? ARGV[1]
|
||||
|
||||
#TODO check is under +/ with name AND version
|
||||
#TODO if user specifies just name and not version dir, do latest version
|
||||
#TODO you should mkdirs as you find them and symlink files otherwise
|
||||
#TODO consider using hardlinks
|
||||
|
||||
|
||||
target=Pathname.new(ARGV[1]).realpath
|
||||
target.find do |from|
|
||||
next if from == ARGV[1] #rubysucks
|
||||
@ -28,7 +28,7 @@ case ARGV[0]
|
||||
to.mkpath unless to.exist?
|
||||
elsif from.file?
|
||||
tod=to.dirname
|
||||
Dir.chdir(tod) { `ln -s #{from.relative_path_from tod}` }
|
||||
Dir.chdir(tod) { `ln -s "#{from.relative_path_from tod}"` }
|
||||
end
|
||||
end
|
||||
|
||||
@ -43,5 +43,5 @@ case ARGV[0]
|
||||
end
|
||||
|
||||
else
|
||||
puts "usage: #{$0} [prune] [ln path]"
|
||||
puts "usage: #{$0} [prune] [ln path] [install pkg]"
|
||||
end
|
||||
@ -20,7 +20,7 @@ end
|
||||
class Formula
|
||||
require 'find'
|
||||
require 'fileutils'
|
||||
|
||||
|
||||
# if you reimplement, assign @name, @version, @url and @md5
|
||||
def initialize(url, md5)
|
||||
@name = File.basename $0, '.rb' #original script that the interpreter started
|
||||
@ -44,7 +44,7 @@ class Formula
|
||||
def brew
|
||||
raise "@name.nil?" if @name.nil?
|
||||
raise "@version.nil?" if @version.nil?
|
||||
|
||||
|
||||
# disabled until the regexp makes sense :P
|
||||
#raise "@name does not validate to our regexp" unless /^\w+$/ =~ @name
|
||||
|
||||
@ -86,7 +86,7 @@ class Formula
|
||||
|
||||
# stay in appsupport in case any odd files gets created etc.
|
||||
`#{$cellar}/homebrew/brew ln #{prefix}` if prefix.exist?
|
||||
|
||||
|
||||
puts "#{prefix}: "+`find #{prefix} -type f | wc -l`.strip+' files, '+`du -hd0 #{prefix} | cut -d"\t" -f1`.strip+", built in #{Time.now - beginning} seconds"
|
||||
end
|
||||
end
|
||||
@ -102,7 +102,7 @@ protected
|
||||
def fetch
|
||||
tgz=File.expand_path File.basename(@url)
|
||||
unless File.exists? tgz
|
||||
`curl -LOA "#{$agent}" "#{@url}"`
|
||||
`curl -LOA "#{$agent}" "#{@url}"`
|
||||
raise "Download failed" unless $? == 0
|
||||
end
|
||||
return tgz
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user