@@ -194,27 +194,15 @@ fn install_source(c: cargo, path: str) {
194
194
}
195
195
}
196
196
197
- fn install_git ( c : cargo , _path : str ) {
198
- let wd = tempfile:: mkdtemp ( c. workdir + fs:: path_sep ( ) , "" ) ;
199
- alt wd {
200
- some( p) {
201
- run:: run_program ( "git" , [ "clone" , _path, p] ) ;
202
- install_source ( c, p) ;
203
- }
204
- _ { fail "needed temp dir" ; }
205
- }
197
+ fn install_git ( c : cargo , wd : str , _path : str ) {
198
+ run:: run_program ( "git" , [ "clone" , _path, wd] ) ;
199
+ install_source ( c, wd) ;
206
200
}
207
201
208
- fn install_file ( c : cargo , _path : str ) {
209
- let wd = tempfile:: mkdtemp ( c. workdir + fs:: path_sep ( ) , "" ) ;
210
- alt wd {
211
- some( p) {
212
- run:: run_program ( "tar" , [ "-x" , "--strip-components=1" ,
213
- "-C" , p, "-f" , _path] ) ;
214
- install_source ( c, p) ;
215
- }
216
- _ { fail "needed temp dir" ; }
217
- }
202
+ fn install_file ( c : cargo , wd : str , _path : str ) {
203
+ run:: run_program ( "tar" , [ "-x" , "--strip-components=1" ,
204
+ "-C" , wd, "-f" , _path] ) ;
205
+ install_source ( c, wd) ;
218
206
}
219
207
220
208
fn cmd_install ( c : cargo , argv : [ str ] ) {
@@ -224,12 +212,19 @@ fn cmd_install(c: cargo, argv: [str]) {
224
212
ret;
225
213
}
226
214
215
+ let wd = alt tempfile:: mkdtemp ( c. workdir + fs:: path_sep ( ) , "" ) {
216
+ some ( _wd) { _wd }
217
+ none. { fail "needed temp dir" ; }
218
+ } ;
219
+
227
220
if str:: starts_with ( argv[ 2 ] , "git:" ) {
228
- install_git ( c, argv[ 2 ] ) ;
229
- }
230
- if str:: starts_with ( argv[ 2 ] , "file:" ) {
221
+ install_git ( c, wd, argv[ 2 ] ) ;
222
+ } else if str:: starts_with ( argv[ 2 ] , "github:" ) {
223
+ let path = rest ( argv[ 2 ] , 7 u) ;
224
+ install_git ( c, wd, "git://github.com/" + path) ;
225
+ } else if str:: starts_with ( argv[ 2 ] , "file:" ) {
231
226
let path = rest ( argv[ 2 ] , 5 u) ;
232
- install_file ( c, path) ;
227
+ install_file ( c, wd , path) ;
233
228
}
234
229
}
235
230
0 commit comments