diff options
author | Peter Melnichenko <mpeterval@gmail.com> | 2016-10-26 16:22:10 +0300 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-10-26 16:22:10 +0300 |
commit | a9c34fc0c92a5931eb73d867d18fbad410683ea0 (patch) | |
tree | 5f43813181ebc6185b9f18d5742a3701cb4ea459 /src | |
parent | 478fc5517c686c080797f840cc000cc9828ffcb4 (diff) | |
download | luarocks-a9c34fc0c92a5931eb73d867d18fbad410683ea0.tar.gz luarocks-a9c34fc0c92a5931eb73d867d18fbad410683ea0.tar.bz2 luarocks-a9c34fc0c92a5931eb73d867d18fbad410683ea0.zip |
Treat rock name arguments in case insensitive way
Internally package names are lowercased, however, rockspec may contain
a name with uppercase letters, which will be displayed by `luarocks show`.
Some commands, like `luarocks search`, `luarocks install` and `luarocks
build`, support this and convert input name to lowercase before passing
it to interanl functions.
Do the same thing in other commands accepting rock names.
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/doc.lua | 2 | ||||
-rw-r--r-- | src/luarocks/download.lua | 2 | ||||
-rw-r--r-- | src/luarocks/lint.lua | 2 | ||||
-rw-r--r-- | src/luarocks/new_version.lua | 2 | ||||
-rw-r--r-- | src/luarocks/pack.lua | 2 | ||||
-rw-r--r-- | src/luarocks/remove.lua | 1 | ||||
-rw-r--r-- | src/luarocks/show.lua | 2 | ||||
-rw-r--r-- | src/luarocks/unpack.lua | 2 |
8 files changed, 9 insertions, 6 deletions
diff --git a/src/luarocks/doc.lua b/src/luarocks/doc.lua index 15460b31..423ebe02 100644 --- a/src/luarocks/doc.lua +++ b/src/luarocks/doc.lua | |||
@@ -63,6 +63,8 @@ function doc.command(flags, name, version) | |||
63 | return nil, "Argument missing. "..util.see_help("doc") | 63 | return nil, "Argument missing. "..util.see_help("doc") |
64 | end | 64 | end |
65 | 65 | ||
66 | name = name:lower() | ||
67 | |||
66 | local iname, iversion, repo = search.pick_installed_rock(name, version, flags["tree"]) | 68 | local iname, iversion, repo = search.pick_installed_rock(name, version, flags["tree"]) |
67 | if not iname then | 69 | if not iname then |
68 | util.printout(name..(version and " "..version or "").." is not installed. Looking for it in the rocks servers...") | 70 | util.printout(name..(version and " "..version or "").." is not installed. Looking for it in the rocks servers...") |
diff --git a/src/luarocks/download.lua b/src/luarocks/download.lua index 18573ae4..e434cdbb 100644 --- a/src/luarocks/download.lua +++ b/src/luarocks/download.lua | |||
@@ -102,7 +102,7 @@ function download.command(flags, name, version) | |||
102 | arch = flags["arch"] | 102 | arch = flags["arch"] |
103 | end | 103 | end |
104 | 104 | ||
105 | local dl, err = download.download(arch, name, version, flags["all"]) | 105 | local dl, err = download.download(arch, name:lower(), version, flags["all"]) |
106 | return dl and true, err | 106 | return dl and true, err |
107 | end | 107 | end |
108 | 108 | ||
diff --git a/src/luarocks/lint.lua b/src/luarocks/lint.lua index d5cc48d0..0fd81a20 100644 --- a/src/luarocks/lint.lua +++ b/src/luarocks/lint.lua | |||
@@ -26,7 +26,7 @@ function lint.command(flags, input) | |||
26 | local filename = input | 26 | local filename = input |
27 | if not input:match(".rockspec$") then | 27 | if not input:match(".rockspec$") then |
28 | local err | 28 | local err |
29 | filename, err = download.download("rockspec", input) | 29 | filename, err = download.download("rockspec", input:lower()) |
30 | if not filename then | 30 | if not filename then |
31 | return nil, err | 31 | return nil, err |
32 | end | 32 | end |
diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index 8fc00a86..91f7607c 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua | |||
@@ -141,7 +141,7 @@ function new_version.command(flags, input, version, url) | |||
141 | return nil, err | 141 | return nil, err |
142 | end | 142 | end |
143 | else | 143 | else |
144 | filename, err = download.download("rockspec", input) | 144 | filename, err = download.download("rockspec", input:lower()) |
145 | if not filename then | 145 | if not filename then |
146 | return nil, err | 146 | return nil, err |
147 | end | 147 | end |
diff --git a/src/luarocks/pack.lua b/src/luarocks/pack.lua index 932ff0d5..35bbe838 100644 --- a/src/luarocks/pack.lua +++ b/src/luarocks/pack.lua | |||
@@ -184,7 +184,7 @@ function pack.command(flags, arg, version) | |||
184 | if arg:match(".*%.rockspec") then | 184 | if arg:match(".*%.rockspec") then |
185 | file, err = pack.pack_source_rock(arg) | 185 | file, err = pack.pack_source_rock(arg) |
186 | else | 186 | else |
187 | file, err = do_pack_binary_rock(arg, version, flags["tree"]) | 187 | file, err = do_pack_binary_rock(arg:lower(), version, flags["tree"]) |
188 | end | 188 | end |
189 | if err then | 189 | if err then |
190 | return nil, err | 190 | return nil, err |
diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index 54756388..601eedcf 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua | |||
@@ -155,6 +155,7 @@ function remove.command(flags, name, version) | |||
155 | end | 155 | end |
156 | 156 | ||
157 | local results = {} | 157 | local results = {} |
158 | name = name:lower() | ||
158 | search.manifest_search(results, cfg.rocks_dir, search.make_query(name, version)) | 159 | search.manifest_search(results, cfg.rocks_dir, search.make_query(name, version)) |
159 | if not results[name] then | 160 | if not results[name] then |
160 | return nil, "Could not find rock '"..name..(version and " "..version or "").."' in "..path.rocks_tree_to_string(cfg.root_dir) | 161 | return nil, "Could not find rock '"..name..(version and " "..version or "").."' in "..path.rocks_tree_to_string(cfg.root_dir) |
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 88f9512d..85c7edcb 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua | |||
@@ -78,7 +78,7 @@ function show.command(flags, name, version) | |||
78 | end | 78 | end |
79 | 79 | ||
80 | local repo, repo_url | 80 | local repo, repo_url |
81 | name, version, repo, repo_url = search.pick_installed_rock(name, version, flags["tree"]) | 81 | name, version, repo, repo_url = search.pick_installed_rock(name:lower(), version, flags["tree"]) |
82 | if not name then | 82 | if not name then |
83 | return nil, version | 83 | return nil, version |
84 | end | 84 | end |
diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index c3dc9a4c..0922f9b9 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua | |||
@@ -159,7 +159,7 @@ function unpack.command(flags, name, version) | |||
159 | return run_unpacker(name, flags["force"]) | 159 | return run_unpacker(name, flags["force"]) |
160 | else | 160 | else |
161 | local search = require("luarocks.search") | 161 | local search = require("luarocks.search") |
162 | return search.act_on_src_or_rockspec(run_unpacker, name, version) | 162 | return search.act_on_src_or_rockspec(run_unpacker, name:lower(), version) |
163 | end | 163 | end |
164 | end | 164 | end |
165 | 165 | ||