0
@@ -11,14 +11,14 @@ class TextmateInstaller < Thor
0
# CHANGED: renamed list to remote. Could there be a better name?
0
desc "remote [SEARCH]", "Lists all the matching remote bundles"
0
def remote(search_term = "")
0
- search_term
= Regexp.new(".*#{search_term}.*", "i")
0
+ search_term
_regex = Regexp.new(".*#{search_term}.*", "i")
0
remote_bundle_locations.each do |name,location|
0
puts "\n" << name.to_s << " Remote Bundles\n" << name.to_s.gsub(/./,'-') << '---------------'
0
results = case location[:scm]
0
- %x[svn list #{e_sh location[:url]}].map {|x| x.split(".")[0]}.select {|x| x =~ search_term
}.join("\n")
0
+ %x[svn list #{e_sh location[:url]}].map {|x| x.split(".")[0]}.select {|x| x =~ search_term
_regex}.join("\n")
0
'git remotes not implemented yet'
0
@@ -37,12 +37,12 @@ class TextmateInstaller < Thor
0
desc "list [SEARCH]", "lists all the bundles installed locally"
0
def list(search_term = "")
0
- search_term
= Regexp.new(".*#{search_term}.*", "i")
0
+ search_term
_regex = Regexp.new(".*#{search_term}.*", "i")
0
local_bundle_paths.each do |name,bundles_path|
0
puts "\n" << name.to_s << " Bundles\n" << name.to_s.gsub(/./,'-') << '--------'
0
puts Dir["#{e_sh bundles_path}/*.tmbundle"].map {|x| x.split("/").last.split(".").first}.
0
- select {|x| x =~ search_term
}.join("\n")
0
+ select {|x| x =~ search_term
_regex}.join("\n")
0
@@ -69,14 +69,14 @@ class TextmateInstaller < Thor
0
'echo "Sorry, no such bundle found"'
0
- %[git clone #{e_sh repos.first['url'].sub('http', 'git') + '.git'} #{e_sh install_bundles_path}/#{e_sh
bundle_name}.tmbundle 2>&1]
0
+ %[git clone #{e_sh repos.first['url'].sub('http', 'git') + '.git'} #{e_sh install_bundles_path}/#{e_sh
normalize_github_repo_name(repos.first['name'])} 2>&1]
0
puts "Multiple bundles with that name found. Please choose which one you want to install:"
0
repos.each_with_index {|repo, idx|
0
- normalize_github_repo_name(repo['name'])
,
0
+ normalize_github_repo_name(repo['name'])
.ljust(40),
0
repo['url'][/github\.com\/([a-zA-Z0-9]+)\//, 1]
0
@@ -88,8 +88,7 @@ class TextmateInstaller < Thor
0
print "Sorry, invalid choice. Please enter a valid number or Ctrl+C to stop: "
0
choice = Integer(STDIN.gets.chomp) rescue nil
0
- %[git clone #{e_sh repos[choice - 1]['url'].sub('http', 'git') + '.git'} #{e_sh install_bundles_path}/#{e_sh bundle_name}.tmbundle 2>&1]
0
+ %[git clone #{e_sh repos[choice - 1]['url'].sub('http', 'git') + '.git'} #{e_sh install_bundles_path}/#{e_sh normalize_github_repo_name(repos[choice - 1]['name'])} 2>&1]
0
@@ -169,13 +168,13 @@ class TextmateInstaller < Thor
0
# Does the opposite of normalize_github_repo_name
0
def denormalize_github_repo_name(name)
0
- name += " tmbundle" unless name =~ / tmbundle$/
0
name.split(' ').each{|part| part.downcase!}.join(' ').gsub(' ', '-')
0
def find_github_bundles(search_term)
0
- YAML.load(open('http://github.com/api/v1/yaml/search/tmbundle'))['repositories'].
0
- find_all{|result| result['name'].match(search_term)}.
0
+ YAML.load(open("http://github.com/api/v1/yaml/search/#{CGI::escape search_term}"))['repositories'].
0
+ find_all{|result| result['name'].match('tmbundle')}.
0
sort{|a,b| a['name'] <=> b['name']}
Comments
No one has commented yet.