diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/admin/cache.lua | 8 | ||||
-rw-r--r-- | src/luarocks/admin/cmd/add.lua | 9 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/luarocks/admin/cache.lua b/src/luarocks/admin/cache.lua index 16a4f5c8..5b54203b 100644 --- a/src/luarocks/admin/cache.lua +++ b/src/luarocks/admin/cache.lua | |||
@@ -34,7 +34,9 @@ end | |||
34 | 34 | ||
35 | function cache.split_server_url(server, url, user, password) | 35 | function cache.split_server_url(server, url, user, password) |
36 | local protocol, server_path = dir.split_url(url) | 36 | local protocol, server_path = dir.split_url(url) |
37 | if server_path:match("@") then | 37 | if protocol == "file" then |
38 | server_path = fs.absolute_name(server_path) | ||
39 | elseif server_path:match("@") then | ||
38 | local credentials | 40 | local credentials |
39 | credentials, server_path = server_path:match("([^@]*)@(.*)") | 41 | credentials, server_path = server_path:match("([^@]*)@(.*)") |
40 | if credentials:match(":") then | 42 | if credentials:match(":") then |
@@ -43,7 +45,7 @@ function cache.split_server_url(server, url, user, password) | |||
43 | user = credentials | 45 | user = credentials |
44 | end | 46 | end |
45 | end | 47 | end |
46 | local local_cache = cfg.local_cache .. "/" .. server | 48 | local local_cache = cfg.local_cache .. "/" .. server_path:gsub("[\\/]", "_") |
47 | return local_cache, protocol, server_path, user, password | 49 | return local_cache, protocol, server_path, user, password |
48 | end | 50 | end |
49 | 51 | ||
@@ -52,6 +54,8 @@ local function download_cache(protocol, server_path, user, password) | |||
52 | if protocol == "rsync" then | 54 | if protocol == "rsync" then |
53 | local srv, path = server_path:match("([^/]+)(/.+)") | 55 | local srv, path = server_path:match("([^/]+)(/.+)") |
54 | return fs.execute(cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." -e ssh "..user.."@"..srv..":"..path.."/ ./") | 56 | return fs.execute(cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." -e ssh "..user.."@"..srv..":"..path.."/ ./") |
57 | elseif protocol == "file" then | ||
58 | return fs.copy_contents(server_path, ".") | ||
55 | else | 59 | else |
56 | local login_info = "" | 60 | local login_info = "" |
57 | if user then login_info = " --user="..user end | 61 | if user then login_info = " --user="..user end |
diff --git a/src/luarocks/admin/cmd/add.lua b/src/luarocks/admin/cmd/add.lua index 6a6f7224..b6c817c6 100644 --- a/src/luarocks/admin/cmd/add.lua +++ b/src/luarocks/admin/cmd/add.lua | |||
@@ -45,9 +45,6 @@ local function add_files_to_server(refresh, rockfiles, server, upload_server) | |||
45 | if not local_cache then | 45 | if not local_cache then |
46 | return nil, protocol | 46 | return nil, protocol |
47 | end | 47 | end |
48 | if protocol == "file" then | ||
49 | return nil, "Server "..server.." is not recognized, check your configuration." | ||
50 | end | ||
51 | 48 | ||
52 | if not login_url then | 49 | if not login_url then |
53 | login_url = protocol.."://"..server_path | 50 | login_url = protocol.."://"..server_path |
@@ -102,6 +99,8 @@ local function add_files_to_server(refresh, rockfiles, server, upload_server) | |||
102 | if protocol == "rsync" then | 99 | if protocol == "rsync" then |
103 | local srv, path = server_path:match("([^/]+)(/.+)") | 100 | local srv, path = server_path:match("([^/]+)(/.+)") |
104 | cmd = cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." -e ssh "..local_cache.."/ "..user.."@"..srv..":"..path.."/" | 101 | cmd = cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." -e ssh "..local_cache.."/ "..user.."@"..srv..":"..path.."/" |
102 | elseif protocol == "file" then | ||
103 | return fs.copy_contents(local_cache, server_path) | ||
105 | elseif upload_server and upload_server.sftp then | 104 | elseif upload_server and upload_server.sftp then |
106 | local part1, part2 = upload_server.sftp:match("^([^/]*)/(.*)$") | 105 | local part1, part2 = upload_server.sftp:match("^([^/]*)/(.*)$") |
107 | cmd = cfg.variables.SCP.." "..table.concat(files, " ").." "..user.."@"..part1..":/"..part2 | 106 | cmd = cfg.variables.SCP.." "..table.concat(files, " ").." "..user.."@"..part1..":/"..part2 |
@@ -110,9 +109,7 @@ local function add_files_to_server(refresh, rockfiles, server, upload_server) | |||
110 | end | 109 | end |
111 | 110 | ||
112 | util.printout(cmd) | 111 | util.printout(cmd) |
113 | fs.execute(cmd) | 112 | return fs.execute(cmd) |
114 | |||
115 | return true | ||
116 | end | 113 | end |
117 | 114 | ||
118 | function add.command(flags, ...) | 115 | function add.command(flags, ...) |