0
class TextmateInstaller < Thor
0
@@ -15,22 +16,21 @@ class TextmateInstaller < Thor
0
results = %x[svn list #{svn_for("review")}]
0
puts results.map {|x| x.split(".")[0]}.select {|x| x =~ limit}.join("\n")
0
desc "installed", "lists all the bundles installed locally"
0
- puts "\nSystem\n------\n"
0
- puts Dir["/Library/Application Support/TextMate/Bundles/*.tmbundle"].map {|x| x.split("/").last.split(".").first}.join("\n")
0
- puts Dir["#{ENV["HOME"]}/Library/Application Support/TextMate/Bundles/*.tmbundle"].map {|x| x.split("/").last.split(".").first}.join("\n")
0
+ bundles_paths.each do |location,bundles_path|
0
+ puts location.to_s << " Bundles\n" << location.to_s.gsub(/./,'-') << '--------'
0
+ puts Dir["#{e_sh bundles_path}/*.tmbundle"].map {|x| x.split("/").last.split(".").first}.join("\n")
0
desc "install NAME", "install a bundle"
0
- FileUtils.mkdir_p "/Library/Application Support/TextMate/Bundles"
0
- quoted_name = name.gsub(" ", "\\ ")
0
+ FileUtils.mkdir_p install_bundles_path
0
puts "Checking out #{name}..."
0
- res = %x[svn co #{svn_for(type)}/#{quoted_name}.tmbundle /Library/Application\\ Support/TextMate/Bundles/#{quoted_name}.tmbundle]
0
+ res = %x[svn co #{svn_for(type)}/#{e_sh name}.tmbundle #{e_sh install_bundles_path}/#{e_sh name}.tmbundle]
0
puts "Reloading Bundles..."
0
@@ -39,8 +39,12 @@ class TextmateInstaller < Thor
0
desc "uninstall NAME", "uninstall a bundle"
0
puts "Removing bundle..."
0
- FileUtils.rm_rf("/Library/Application Support/TextMate/Bundles/#{name}.tmbundle")
0
- FileUtils.rm_rf("#{ENV["HOME"]}/Library/Application Support/TextMate/Bundles/#{name}.tmbundle")
0
+ # FIXME: Move deleted bundles to the trash instead of rm_rf-ing them?
0
+ bundles_paths.each do |location,bundles_path|
0
+ # When moving to the trash, maybe rename the bundle and add the bundles_path key to the name,
0
+ # just in case there are multiple versions of the same bundle in multiple bundle paths
0
+ FileUtils.rm_rf("#{bundles_path}/#{name}.tmbundle")
0
puts "Reloading bundles..."
0
@@ -66,6 +70,27 @@ class TextmateInstaller < Thor
0
+ { :User => "#{ENV["HOME"]}/Library/Application Support/TextMate/Bundles",
0
+ :System => '/Library/Application Support/TextMate/Bundles',
0
+ :'User Pristine' => "#{ENV["HOME"]}/Library/Application Support/TextMate/Pristine Copy",
0
+ :'System Pristine' => '/Library/Application Support/TextMate/Pristine Copy',
0
+ def install_bundles_path
0
+ #TODO: Add some way for the user to configure where they'd prefer to install bundles
0
+ bundles_paths[:'User Pristine']
0
+ # Copied from http://macromates.com/svn/Bundles/trunk/Support/lib/escape.rb
0
+ # escape text to make it useable in a shell script as one “word” (string)
0
+ str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/, '\\').gsub(/\n/, "'\n'").sub(/^$/, "''")
0
TextmateInstaller.start
0
+# FIXME: Rename methods to more closely match rubygems
Comments
No one has commented yet.