aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2016-10-26 14:36:51 -0200
committerGitHub <noreply@github.com>2016-10-26 14:36:51 -0200
commit716d54d72f562efe944478496e217695c44dc90f (patch)
tree2b43342b41a08e99255d5ec1295e9369a49f362b
parent478fc5517c686c080797f840cc000cc9828ffcb4 (diff)
parent6a72d843a7bb3dc9f5e133f9a9d614af46f92daa (diff)
downloadluarocks-716d54d72f562efe944478496e217695c44dc90f.tar.gz
luarocks-716d54d72f562efe944478496e217695c44dc90f.tar.bz2
luarocks-716d54d72f562efe944478496e217695c44dc90f.zip
Merge pull request #635 from mpeterv/rock-name-case
Make rock name arguments case insensitive
-rw-r--r--spec/remove_spec.lua9
-rw-r--r--spec/show_spec.lua5
-rw-r--r--src/luarocks/doc.lua2
-rw-r--r--src/luarocks/download.lua2
-rw-r--r--src/luarocks/lint.lua2
-rw-r--r--src/luarocks/new_version.lua2
-rw-r--r--src/luarocks/pack.lua2
-rw-r--r--src/luarocks/remove.lua1
-rw-r--r--src/luarocks/show.lua2
-rw-r--r--src/luarocks/unpack.lua2
10 files changed, 22 insertions, 7 deletions
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua
index 3d321e30..03b3681e 100644
--- a/spec/remove_spec.lua
+++ b/spec/remove_spec.lua
@@ -35,12 +35,19 @@ describe("LuaRocks remove tests #blackbox #b_remove", function()
35 assert.is_false(run.luarocks_bool("remove luacov --deps-mode")) 35 assert.is_false(run.luarocks_bool("remove luacov --deps-mode"))
36 end) 36 end)
37 37
38 it("LuaRocks remove builded abelhas", function() 38 it("LuaRocks remove built abelhas", function()
39 assert.is_true(run.luarocks_bool("build abelhas 1.0")) 39 assert.is_true(run.luarocks_bool("build abelhas 1.0"))
40 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) 40 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
41 assert.is_true(run.luarocks_bool("remove abelhas 1.0")) 41 assert.is_true(run.luarocks_bool("remove abelhas 1.0"))
42 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) 42 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
43 end) 43 end)
44
45 it("LuaRocks remove built abelhas with uppercase name", function()
46 assert.is_true(run.luarocks_bool("build abelhas 1.0"))
47 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
48 assert.is_true(run.luarocks_bool("remove Abelhas 1.0"))
49 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
50 end)
44 end) 51 end)
45 52
46 describe("LuaRocks remove more complex tests", function() 53 describe("LuaRocks remove more complex tests", function()
diff --git a/spec/show_spec.lua b/spec/show_spec.lua
index b2cdc07e..d07fdc31 100644
--- a/spec/show_spec.lua
+++ b/spec/show_spec.lua
@@ -22,6 +22,11 @@ describe("LuaRocks show tests #blackbox #b_show", function()
22 local output = run.luarocks("show luacov") 22 local output = run.luarocks("show luacov")
23 assert.is.truthy(output:match("LuaCov")) 23 assert.is.truthy(output:match("LuaCov"))
24 end) 24 end)
25
26 it("LuaRocks show luacov with uppercase name", function()
27 local output = run.luarocks("show LuaCov")
28 assert.is.truthy(output:match("LuaCov"))
29 end)
25 30
26 it("LuaRocks show modules of luacov", function() 31 it("LuaRocks show modules of luacov", function()
27 local output = run.luarocks("show --modules luacov") 32 local output = run.luarocks("show --modules luacov")
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
107end 107end
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
164end 164end
165 165