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
Ask the user which GitHub bundle he wants to install when there are 
multiple repos with the same name
cypher (author)
Wed Jun 04 06:26:32 -0700 2008
commit  f5bad1cd05ee670da5ac23aefbd6cbb71342a573
tree    02186b2fcb3e0048c80ffc352ad3bcd3317c8510
parent  72dab757e96f0cc66b6bc3f59f608b3b7c72d408
0
...
9
10
11
 
...
9
10
11
12
0
@@ -9,3 +9,4 @@
0
 * Add Git support to remote_bundle_locations. Define some sort of standard way of listing git repos, checkout how rubygems does it
0
 * Add some way for the user to configure where they'd prefer to install bundles
0
 * Add some way to add more custom remotes
0
+* Clean up installing from GitHub
...
62
63
64
65
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
68
69
...
62
63
64
 
 
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
0
@@ -62,8 +62,35 @@ class TextmateInstaller < Thor
0
             when :svn
0
               %[svn co #{e_sh location[:url]}/#{e_sh bundle_name}.tmbundle #{e_sh install_bundles_path}/#{e_sh bundle_name}.tmbundle 2>&1]
0
             when :github
0
- repo = find_github_bundles(denormalize_github_repo_name(bundle_name)).first
0
- %[git clone #{e_sh repo['url'].sub('http', 'git') + '.git'} #{e_sh install_bundles_path}/#{e_sh bundle_name}.tmbundle 2>&1]
0
+ repos = find_github_bundles(denormalize_github_repo_name(bundle_name))
0
+
0
+ # Handle possible multiple Repos with the same name
0
+ case repos.size
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
+ 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
+ repo['url'][/github\.com\/([a-zA-Z0-9]+)\//, 1]
0
+ ]
0
+ }
0
+ print "Your choice: "
0
+
0
+ # Since to_i defaults to 0, we have to use Integer
0
+ choice = Integer(STDIN.gets.chomp) rescue nil
0
+ until choice && (0...repos.size).include?( choice - 1 ) do
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
+ end
0
             end
0
       
0
       res = %x{#{cmd}}

Comments

    No one has commented yet.