public
Fork of wycats/textmate
Description: Command-line package manager for textmate. Like rubygems for TextMate Bundles
Homepage: http://www.yehudakatz.com
Clone URL: git://github.com/subtleGradient/textmate.git
Workaround for a GitHub search bug. Some tmbundles aren't showing up when 
searching for "tmbundle".
Switched to searching GitHub for the bundle name and filtering by 
'tmbundle'
Another upshot of this is that you can search for bundles by the 
maintainers handle EG: `textmate install subtlegradient GitHub` now lists 
all bundles by subtleGradient.
Fri Jul 18 12:35:14 -0700 2008
commit  9e3902d9739687d905cd0301cfddd2893ed1c0ca
tree    3a48832b474cb83bfce5280c4cf0037df4c4b5c0
parent  3279816ae4dbc9cec4b9cf6278dda46b2612a59e
...
11
12
13
14
 
15
16
17
18
19
20
21
 
22
23
24
...
37
38
39
40
 
41
42
43
44
45
 
46
47
48
...
69
70
71
72
 
73
74
75
76
77
78
79
 
80
81
82
...
88
89
90
91
92
 
93
94
95
...
169
170
171
172
173
174
175
176
177
178
 
 
 
179
180
181
...
11
12
13
 
14
15
16
17
18
19
20
 
21
22
23
24
...
37
38
39
 
40
41
42
43
44
 
45
46
47
48
...
69
70
71
 
72
73
74
75
76
77
78
 
79
80
81
82
...
88
89
90
 
 
91
92
93
94
...
168
169
170
 
171
172
173
174
 
 
175
176
177
178
179
180
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
     
0
     remote_bundle_locations.each do |name,location|
0
       puts "\n" << name.to_s << " Remote Bundles\n" << name.to_s.gsub(/./,'-') << '---------------'
0
       
0
       results = case location[:scm]
0
                 when :svn
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
                 when :git
0
                   'git remotes not implemented yet'
0
                 when :github
0
@@ -37,12 +37,12 @@ class TextmateInstaller < Thor
0
   
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
     
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
     end
0
   end
0
   
0
@@ -69,14 +69,14 @@ class TextmateInstaller < Thor
0
               when 0
0
                 'echo "Sorry, no such bundle found"'
0
               when 1
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
               else
0
                 puts "Multiple bundles with that name found. Please choose which one you want to install:"
0
                 repos.each_with_index {|repo, idx|
0
                   puts "%d: %s by %s" %
0
                   [
0
                     idx + 1,
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
                   ]
0
                 }
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
                 end
0
-
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
               end
0
             end
0
       
0
@@ -169,13 +168,13 @@ class TextmateInstaller < Thor
0
   
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
   end
0
   
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
+ require 'cgi'
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']}
0
   end
0
   

Comments

    No one has commented yet.