diff options
| author | Hisham <hisham@gobolinux.org> | 2016-06-07 03:37:07 -0300 |
|---|---|---|
| committer | Hisham <hisham@gobolinux.org> | 2016-06-07 03:37:07 -0300 |
| commit | a7aa85ce84912d817556f46dfe780e8961206ad0 (patch) | |
| tree | 7398b83a3a6faee821f39764c9176c15bf2c01f7 /src | |
| parent | 5f896c909c2c0bbe6bee2ab7577f632692c975d7 (diff) | |
| parent | d524b515c67ceded00a15c2617283f81a2f21f7c (diff) | |
| download | luarocks-a7aa85ce84912d817556f46dfe780e8961206ad0.tar.gz luarocks-a7aa85ce84912d817556f46dfe780e8961206ad0.tar.bz2 luarocks-a7aa85ce84912d817556f46dfe780e8961206ad0.zip | |
Merge branch 'master' of https://github.com/keplerproject/luarocks
Diffstat (limited to 'src')
52 files changed, 121 insertions, 117 deletions
diff --git a/src/luarocks/add.lua b/src/luarocks/add.lua index ccd303e6..bea2d861 100644 --- a/src/luarocks/add.lua +++ b/src/luarocks/add.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the luarocks-admin "add" command. | 2 | --- Module implementing the luarocks-admin "add" command. |
| 3 | -- Adds a rock or rockspec to a rocks server. | 3 | -- Adds a rock or rockspec to a rocks server. |
| 4 | --module("luarocks.add", package.seeall) | ||
| 5 | local add = {} | 4 | local add = {} |
| 6 | package.loaded["luarocks.add"] = add | 5 | package.loaded["luarocks.add"] = add |
| 7 | 6 | ||
diff --git a/src/luarocks/admin_remove.lua b/src/luarocks/admin_remove.lua index 5a1cf20b..59ca4975 100644 --- a/src/luarocks/admin_remove.lua +++ b/src/luarocks/admin_remove.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the luarocks-admin "remove" command. | 2 | --- Module implementing the luarocks-admin "remove" command. |
| 3 | -- Removes a rock or rockspec from a rocks server. | 3 | -- Removes a rock or rockspec from a rocks server. |
| 4 | --module("luarocks.admin_remove", package.seeall) | ||
| 5 | local admin_remove = {} | 4 | local admin_remove = {} |
| 6 | package.loaded["luarocks.admin_remove"] = admin_remove | 5 | package.loaded["luarocks.admin_remove"] = admin_remove |
| 7 | 6 | ||
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index c62e4694..edf4efb4 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "build" command. | 2 | --- Module implementing the LuaRocks "build" command. |
| 3 | -- Builds a rock, compiling its C parts if any. | 3 | -- Builds a rock, compiling its C parts if any. |
| 4 | --module("luarocks.build", package.seeall) | ||
| 5 | local build = {} | 4 | local build = {} |
| 6 | package.loaded["luarocks.build"] = build | 5 | package.loaded["luarocks.build"] = build |
| 7 | 6 | ||
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index b6062bd7..b6f53271 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- A builtin build system: back-end to provide a portable way of building C-based Lua modules. | 2 | --- A builtin build system: back-end to provide a portable way of building C-based Lua modules. |
| 3 | --module("luarocks.build.builtin", package.seeall) | ||
| 4 | local builtin = {} | 3 | local builtin = {} |
| 5 | 4 | ||
| 6 | local unpack = unpack or table.unpack | 5 | local unpack = unpack or table.unpack |
diff --git a/src/luarocks/build/cmake.lua b/src/luarocks/build/cmake.lua index 7b16fa51..da5a31f1 100644 --- a/src/luarocks/build/cmake.lua +++ b/src/luarocks/build/cmake.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Build back-end for CMake-based modules. | 2 | --- Build back-end for CMake-based modules. |
| 3 | --module("luarocks.build.cmake", package.seeall) | ||
| 4 | local cmake = {} | 3 | local cmake = {} |
| 5 | 4 | ||
| 6 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/build/command.lua b/src/luarocks/build/command.lua index 650e3236..62dbc282 100644 --- a/src/luarocks/build/command.lua +++ b/src/luarocks/build/command.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Build back-end for raw listing of commands in rockspec files. | 2 | --- Build back-end for raw listing of commands in rockspec files. |
| 3 | --module("luarocks.build.command", package.seeall) | ||
| 4 | local command = {} | 3 | local command = {} |
| 5 | 4 | ||
| 6 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/build/make.lua b/src/luarocks/build/make.lua index 0da183e9..69e73c2e 100644 --- a/src/luarocks/build/make.lua +++ b/src/luarocks/build/make.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Build back-end for using Makefile-based packages. | 2 | --- Build back-end for using Makefile-based packages. |
| 3 | --module("luarocks.build.make", package.seeall) | ||
| 4 | local make = {} | 3 | local make = {} |
| 5 | 4 | ||
| 6 | local unpack = unpack or table.unpack | 5 | local unpack = unpack or table.unpack |
diff --git a/src/luarocks/cache.lua b/src/luarocks/cache.lua index fb6344d8..4a95f70e 100644 --- a/src/luarocks/cache.lua +++ b/src/luarocks/cache.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module handling the LuaRocks local cache. | 2 | --- Module handling the LuaRocks local cache. |
| 3 | -- Adds a rock or rockspec to a rocks server. | 3 | -- Adds a rock or rockspec to a rocks server. |
| 4 | --module("luarocks.cache", package.seeall) | ||
| 5 | local cache = {} | 4 | local cache = {} |
| 6 | package.loaded["luarocks.cache"] = cache | 5 | package.loaded["luarocks.cache"] = cache |
| 7 | 6 | ||
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index a016fc72..b3284534 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Functions for command-line scripts. | 2 | --- Functions for command-line scripts. |
| 3 | --module("luarocks.command_line", package.seeall) | ||
| 4 | local command_line = {} | 3 | local command_line = {} |
| 5 | 4 | ||
| 6 | local unpack = unpack or table.unpack | 5 | local unpack = unpack or table.unpack |
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 536b6c51..44998220 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | -- comparison criteria is the source code of this module, but the | 11 | -- comparison criteria is the source code of this module, but the |
| 12 | -- test/test_deps.lua file included with LuaRocks provides some | 12 | -- test/test_deps.lua file included with LuaRocks provides some |
| 13 | -- insights on what these criteria are. | 13 | -- insights on what these criteria are. |
| 14 | --module("luarocks.deps", package.seeall) | ||
| 15 | local deps = {} | 14 | local deps = {} |
| 16 | package.loaded["luarocks.deps"] = deps | 15 | package.loaded["luarocks.deps"] = deps |
| 17 | 16 | ||
diff --git a/src/luarocks/dir.lua b/src/luarocks/dir.lua index 2ef9881e..f72ebd6c 100644 --- a/src/luarocks/dir.lua +++ b/src/luarocks/dir.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Generic utilities for handling pathnames. | 2 | --- Generic utilities for handling pathnames. |
| 3 | --module("luarocks.dir", package.seeall) | ||
| 4 | local dir = {} | 3 | local dir = {} |
| 5 | package.loaded["luarocks.dir"] = dir | 4 | package.loaded["luarocks.dir"] = dir |
| 6 | 5 | ||
diff --git a/src/luarocks/doc.lua b/src/luarocks/doc.lua index 53ed0116..62e80232 100644 --- a/src/luarocks/doc.lua +++ b/src/luarocks/doc.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "doc" command. | 2 | --- Module implementing the LuaRocks "doc" command. |
| 3 | -- Shows documentation for an installed rock. | 3 | -- Shows documentation for an installed rock. |
| 4 | --module("luarocks.doc", package.seeall) | ||
| 5 | local doc = {} | 4 | local doc = {} |
| 6 | package.loaded["luarocks.doc"] = doc | 5 | package.loaded["luarocks.doc"] = doc |
| 7 | 6 | ||
diff --git a/src/luarocks/download.lua b/src/luarocks/download.lua index 6d95d8fd..181aca75 100644 --- a/src/luarocks/download.lua +++ b/src/luarocks/download.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the luarocks "download" command. | 2 | --- Module implementing the luarocks "download" command. |
| 3 | -- Download a rock from the repository. | 3 | -- Download a rock from the repository. |
| 4 | --module("luarocks.download", package.seeall) | ||
| 5 | local download = {} | 4 | local download = {} |
| 6 | package.loaded["luarocks.download"] = download | 5 | package.loaded["luarocks.download"] = download |
| 7 | 6 | ||
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 2c028771..dfa6f191 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Functions related to fetching and loading local and remote files. | 2 | --- Functions related to fetching and loading local and remote files. |
| 3 | --module("luarocks.fetch", package.seeall) | ||
| 4 | local fetch = {} | 3 | local fetch = {} |
| 5 | package.loaded["luarocks.fetch"] = fetch | 4 | package.loaded["luarocks.fetch"] = fetch |
| 6 | 5 | ||
diff --git a/src/luarocks/fetch/cvs.lua b/src/luarocks/fetch/cvs.lua index ccf928c4..ece711b6 100644 --- a/src/luarocks/fetch/cvs.lua +++ b/src/luarocks/fetch/cvs.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Fetch back-end for retrieving sources from CVS. | 2 | --- Fetch back-end for retrieving sources from CVS. |
| 3 | --module("luarocks.fetch.cvs", package.seeall) | ||
| 4 | local cvs = {} | 3 | local cvs = {} |
| 5 | 4 | ||
| 6 | local unpack = unpack or table.unpack | 5 | local unpack = unpack or table.unpack |
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua index a635f190..f61d89e9 100644 --- a/src/luarocks/fetch/git.lua +++ b/src/luarocks/fetch/git.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Fetch back-end for retrieving sources from GIT. | 2 | --- Fetch back-end for retrieving sources from GIT. |
| 3 | --module("luarocks.fetch.git", package.seeall) | ||
| 4 | local git = {} | 3 | local git = {} |
| 5 | 4 | ||
| 6 | local unpack = unpack or table.unpack | 5 | local unpack = unpack or table.unpack |
diff --git a/src/luarocks/fetch/git_file.lua b/src/luarocks/fetch/git_file.lua index 0144bc2e..8d46bbca 100644 --- a/src/luarocks/fetch/git_file.lua +++ b/src/luarocks/fetch/git_file.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Fetch back-end for retrieving sources from local Git repositories. | 2 | --- Fetch back-end for retrieving sources from local Git repositories. |
| 3 | --module("luarocks.fetch.git_file", package.seeall) | ||
| 4 | local git_file = {} | 3 | local git_file = {} |
| 5 | 4 | ||
| 6 | local git = require("luarocks.fetch.git") | 5 | local git = require("luarocks.fetch.git") |
diff --git a/src/luarocks/fetch/git_http.lua b/src/luarocks/fetch/git_http.lua index 4ecd4816..d85e2572 100644 --- a/src/luarocks/fetch/git_http.lua +++ b/src/luarocks/fetch/git_http.lua | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | -- source = { url = "git+http://example.com/foo.git" } | 7 | -- source = { url = "git+http://example.com/foo.git" } |
| 8 | -- Prefer using the normal git:// fetch mode as it is more widely | 8 | -- Prefer using the normal git:// fetch mode as it is more widely |
| 9 | -- available in older versions of LuaRocks. | 9 | -- available in older versions of LuaRocks. |
| 10 | --module("luarocks.fetch.git_http", package.seeall) | ||
| 11 | local git_http = {} | 10 | local git_http = {} |
| 12 | 11 | ||
| 13 | local git = require("luarocks.fetch.git") | 12 | local git = require("luarocks.fetch.git") |
diff --git a/src/luarocks/fetch/hg.lua b/src/luarocks/fetch/hg.lua index 518130b4..4cf8d028 100644 --- a/src/luarocks/fetch/hg.lua +++ b/src/luarocks/fetch/hg.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Fetch back-end for retrieving sources from HG. | 2 | --- Fetch back-end for retrieving sources from HG. |
| 3 | --module("luarocks.fetch.hg", package.seeall) | ||
| 4 | local hg = {} | 3 | local hg = {} |
| 5 | 4 | ||
| 6 | local unpack = unpack or table.unpack | 5 | local unpack = unpack or table.unpack |
diff --git a/src/luarocks/fetch/sscm.lua b/src/luarocks/fetch/sscm.lua index 53ae86a3..5add10db 100644 --- a/src/luarocks/fetch/sscm.lua +++ b/src/luarocks/fetch/sscm.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Fetch back-end for retrieving sources from Surround SCM Server | 2 | --- Fetch back-end for retrieving sources from Surround SCM Server |
| 3 | --module("luarocks.fetch.sscm", package.seeall) | ||
| 4 | local sscm = {} | 3 | local sscm = {} |
| 5 | 4 | ||
| 6 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/fetch/svn.lua b/src/luarocks/fetch/svn.lua index 755e5e32..29bce1b5 100644 --- a/src/luarocks/fetch/svn.lua +++ b/src/luarocks/fetch/svn.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Fetch back-end for retrieving sources from Subversion. | 2 | --- Fetch back-end for retrieving sources from Subversion. |
| 3 | --module("luarocks.fetch.svn", package.seeall) | ||
| 4 | local svn = {} | 3 | local svn = {} |
| 5 | 4 | ||
| 6 | local unpack = unpack or table.unpack | 5 | local unpack = unpack or table.unpack |
diff --git a/src/luarocks/fs.lua b/src/luarocks/fs.lua index f3d86a13..54cc7d73 100644 --- a/src/luarocks/fs.lua +++ b/src/luarocks/fs.lua | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | local pairs = pairs | 8 | local pairs = pairs |
| 9 | 9 | ||
| 10 | --module("luarocks.fs", package.seeall) | ||
| 11 | local fs = {} | 10 | local fs = {} |
| 12 | package.loaded["luarocks.fs"] = fs | 11 | package.loaded["luarocks.fs"] = fs |
| 13 | 12 | ||
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua index 520b3e99..5c6b542c 100644 --- a/src/luarocks/fs/unix.lua +++ b/src/luarocks/fs/unix.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Unix implementation of filesystem and platform abstractions. | 2 | --- Unix implementation of filesystem and platform abstractions. |
| 3 | --module("luarocks.fs.unix", package.seeall) | ||
| 4 | local unix = {} | 3 | local unix = {} |
| 5 | 4 | ||
| 6 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index 84bd53fd..7a67fb22 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- fs operations implemented with third-party tools for Unix platform abstractions. | 2 | --- fs operations implemented with third-party tools for Unix platform abstractions. |
| 3 | --module("luarocks.fs.unix.tools", package.seeall) | ||
| 4 | local tools = {} | 3 | local tools = {} |
| 5 | 4 | ||
| 6 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 74f3ed69..8debaeef 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | --- Windows implementation of filesystem and platform abstractions. | 1 | --- Windows implementation of filesystem and platform abstractions. |
| 2 | -- Download http://unxutils.sourceforge.net/ for Windows GNU utilities | 2 | -- Download http://unxutils.sourceforge.net/ for Windows GNU utilities |
| 3 | -- used by this module. | 3 | -- used by this module. |
| 4 | --module("luarocks.fs.win32", package.seeall) | ||
| 5 | local win32 = {} | 4 | local win32 = {} |
| 6 | 5 | ||
| 7 | local fs = require("luarocks.fs") | 6 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index 9cb6d47a..1d47fa59 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | --- fs operations implemented with third-party tools for Windows platform abstractions. | 2 | --- fs operations implemented with third-party tools for Windows platform abstractions. |
| 3 | -- Download http://unxutils.sourceforge.net/ for Windows GNU utilities | 3 | -- Download http://unxutils.sourceforge.net/ for Windows GNU utilities |
| 4 | -- used by this module. | 4 | -- used by this module. |
| 5 | --module("luarocks.fs.win32.tools", package.seeall) | ||
| 6 | local tools = {} | 5 | local tools = {} |
| 7 | 6 | ||
| 8 | local fs = require("luarocks.fs") | 7 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 5a2681a3..0f66f64b 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | -- uses a global table called "commands" to find commands | 4 | -- uses a global table called "commands" to find commands |
| 5 | -- to show help for; each command should be represented by a | 5 | -- to show help for; each command should be represented by a |
| 6 | -- table containing "help" and "help_summary" fields. | 6 | -- table containing "help" and "help_summary" fields. |
| 7 | --module("luarocks.help", package.seeall) | ||
| 8 | local help = {} | 7 | local help = {} |
| 9 | 8 | ||
| 10 | local util = require("luarocks.util") | 9 | local util = require("luarocks.util") |
diff --git a/src/luarocks/index.lua b/src/luarocks/index.lua index 116bdfd2..e1f563ef 100644 --- a/src/luarocks/index.lua +++ b/src/luarocks/index.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Module which builds the index.html page to be used in rocks servers. | 2 | --- Module which builds the index.html page to be used in rocks servers. |
| 3 | --module("luarocks.index", package.seeall) | ||
| 4 | local index = {} | 3 | local index = {} |
| 5 | package.loaded["luarocks.index"] = index | 4 | package.loaded["luarocks.index"] = index |
| 6 | 5 | ||
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index e3ab6fac..f78c6a0d 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | --- Module implementing the LuaRocks "install" command. | 1 | --- Module implementing the LuaRocks "install" command. |
| 2 | -- Installs binary rocks. | 2 | -- Installs binary rocks. |
| 3 | --module("luarocks.install", package.seeall) | ||
| 4 | local install = {} | 3 | local install = {} |
| 5 | package.loaded["luarocks.install"] = install | 4 | package.loaded["luarocks.install"] = install |
| 6 | 5 | ||
diff --git a/src/luarocks/lint.lua b/src/luarocks/lint.lua index 091c8de4..81d8bab2 100644 --- a/src/luarocks/lint.lua +++ b/src/luarocks/lint.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "lint" command. | 2 | --- Module implementing the LuaRocks "lint" command. |
| 3 | -- Utility function that checks syntax of the rockspec. | 3 | -- Utility function that checks syntax of the rockspec. |
| 4 | --module("luarocks.lint", package.seeall) | ||
| 5 | local lint = {} | 4 | local lint = {} |
| 6 | package.loaded["luarocks.lint"] = lint | 5 | package.loaded["luarocks.lint"] = lint |
| 7 | 6 | ||
diff --git a/src/luarocks/list.lua b/src/luarocks/list.lua index 8affc52f..09fa9ad7 100644 --- a/src/luarocks/list.lua +++ b/src/luarocks/list.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "list" command. | 2 | --- Module implementing the LuaRocks "list" command. |
| 3 | -- Lists currently installed rocks. | 3 | -- Lists currently installed rocks. |
| 4 | --module("luarocks.list", package.seeall) | ||
| 5 | local list = {} | 4 | local list = {} |
| 6 | package.loaded["luarocks.list"] = list | 5 | package.loaded["luarocks.list"] = list |
| 7 | 6 | ||
diff --git a/src/luarocks/make.lua b/src/luarocks/make.lua index 78c43d91..9d675884 100644 --- a/src/luarocks/make.lua +++ b/src/luarocks/make.lua | |||
| @@ -3,14 +3,11 @@ | |||
| 3 | -- Builds sources in the current directory, but unlike "build", | 3 | -- Builds sources in the current directory, but unlike "build", |
| 4 | -- it does not fetch sources, etc., assuming everything is | 4 | -- it does not fetch sources, etc., assuming everything is |
| 5 | -- available in the current directory. | 5 | -- available in the current directory. |
| 6 | --module("luarocks.make", package.seeall) | ||
| 7 | local make = {} | 6 | local make = {} |
| 8 | package.loaded["luarocks.make"] = make | 7 | package.loaded["luarocks.make"] = make |
| 9 | 8 | ||
| 10 | local build = require("luarocks.build") | 9 | local build = require("luarocks.build") |
| 11 | local fs = require("luarocks.fs") | 10 | local fs = require("luarocks.fs") |
| 12 | local dir = require("luarocks.dir") | ||
| 13 | local path = require("luarocks.path") | ||
| 14 | local util = require("luarocks.util") | 11 | local util = require("luarocks.util") |
| 15 | local cfg = require("luarocks.cfg") | 12 | local cfg = require("luarocks.cfg") |
| 16 | local fetch = require("luarocks.fetch") | 13 | local fetch = require("luarocks.fetch") |
| @@ -49,33 +46,6 @@ To install rocks, you'll normally want to use the "install" and | |||
| 49 | 46 | ||
| 50 | ]] | 47 | ]] |
| 51 | 48 | ||
| 52 | --- Collect rockspecs located in a subdirectory. | ||
| 53 | -- @param versions table: A table mapping rock names to newest rockspec versions. | ||
| 54 | -- @param paths table: A table mapping rock names to newest rockspec paths. | ||
| 55 | -- @param unnamed_paths table: An array of rockspec paths that don't contain rock | ||
| 56 | -- name and version in regular format. | ||
| 57 | -- @param subdir string: path to subdirectory. | ||
| 58 | local function collect_rockspecs(versions, paths, unnamed_paths, subdir) | ||
| 59 | if fs.is_dir(subdir) then | ||
| 60 | for file in fs.dir(subdir) do | ||
| 61 | file = dir.path(subdir, file) | ||
| 62 | |||
| 63 | if file:match("rockspec$") and fs.is_file(file) then | ||
| 64 | local rock, version = path.parse_name(file) | ||
| 65 | |||
| 66 | if rock then | ||
| 67 | if not versions[rock] or deps.compare_versions(version, versions[rock]) then | ||
| 68 | versions[rock] = version | ||
| 69 | paths[rock] = file | ||
| 70 | end | ||
| 71 | else | ||
| 72 | table.insert(unnamed_paths, file) | ||
| 73 | end | ||
| 74 | end | ||
| 75 | end | ||
| 76 | end | ||
| 77 | end | ||
| 78 | |||
| 79 | --- Driver function for "make" command. | 49 | --- Driver function for "make" command. |
| 80 | -- @param name string: A local rockspec. | 50 | -- @param name string: A local rockspec. |
| 81 | -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an | 51 | -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an |
| @@ -85,34 +55,10 @@ function make.run(...) | |||
| 85 | assert(type(rockspec) == "string" or not rockspec) | 55 | assert(type(rockspec) == "string" or not rockspec) |
| 86 | 56 | ||
| 87 | if not rockspec then | 57 | if not rockspec then |
| 88 | -- Try to infer default rockspec name. | 58 | local err |
| 89 | local versions, paths, unnamed_paths = {}, {}, {} | 59 | rockspec, err = util.get_default_rockspec() |
| 90 | -- Look for rockspecs in some common locations. | 60 | if not rockspec then |
| 91 | collect_rockspecs(versions, paths, unnamed_paths, ".") | 61 | return nil, err |
| 92 | collect_rockspecs(versions, paths, unnamed_paths, "rockspec") | ||
| 93 | collect_rockspecs(versions, paths, unnamed_paths, "rockspecs") | ||
| 94 | |||
| 95 | if #unnamed_paths > 0 then | ||
| 96 | -- There are rockspecs not following "name-version.rockspec" format. | ||
| 97 | -- More than one are ambiguous. | ||
| 98 | if #unnamed_paths > 1 then | ||
| 99 | return nil, "Please specify which rockspec file to use." | ||
| 100 | else | ||
| 101 | rockspec = unnamed_paths[1] | ||
| 102 | end | ||
| 103 | else | ||
| 104 | local rock = next(versions) | ||
| 105 | |||
| 106 | if rock then | ||
| 107 | -- If there are rockspecs for multiple rocks it's ambiguous. | ||
| 108 | if next(versions, rock) then | ||
| 109 | return nil, "Please specify which rockspec file to use." | ||
| 110 | else | ||
| 111 | rockspec = paths[rock] | ||
| 112 | end | ||
| 113 | else | ||
| 114 | return nil, "Argument missing: please specify a rockspec to use on current directory." | ||
| 115 | end | ||
| 116 | end | 62 | end |
| 117 | end | 63 | end |
| 118 | if not rockspec:match("rockspec$") then | 64 | if not rockspec:match("rockspec$") then |
diff --git a/src/luarocks/make_manifest.lua b/src/luarocks/make_manifest.lua index b6e65bf8..3d9a6bac 100644 --- a/src/luarocks/make_manifest.lua +++ b/src/luarocks/make_manifest.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the luarocks-admin "make_manifest" command. | 2 | --- Module implementing the luarocks-admin "make_manifest" command. |
| 3 | -- Compile a manifest file for a repository. | 3 | -- Compile a manifest file for a repository. |
| 4 | --module("luarocks.make_manifest", package.seeall) | ||
| 5 | local make_manifest = {} | 4 | local make_manifest = {} |
| 6 | package.loaded["luarocks.make_manifest"] = make_manifest | 5 | package.loaded["luarocks.make_manifest"] = make_manifest |
| 7 | 6 | ||
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index bc202be3..e30c2a33 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | -- Manifest files describe the contents of a LuaRocks tree or server. | 2 | -- Manifest files describe the contents of a LuaRocks tree or server. |
| 3 | -- They are loaded into manifest tables, which are then used for | 3 | -- They are loaded into manifest tables, which are then used for |
| 4 | -- performing searches, matching dependencies, etc. | 4 | -- performing searches, matching dependencies, etc. |
| 5 | --module("luarocks.manif", package.seeall) | ||
| 6 | local manif = {} | 5 | local manif = {} |
| 7 | package.loaded["luarocks.manif"] = manif | 6 | package.loaded["luarocks.manif"] = manif |
| 8 | 7 | ||
diff --git a/src/luarocks/manif_core.lua b/src/luarocks/manif_core.lua index 610f9860..5c8928d4 100644 --- a/src/luarocks/manif_core.lua +++ b/src/luarocks/manif_core.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Core functions for querying manifest files. | 2 | --- Core functions for querying manifest files. |
| 3 | -- This module requires no specific 'fs' functionality. | 3 | -- This module requires no specific 'fs' functionality. |
| 4 | --module("luarocks.manif_core", package.seeall) | ||
| 5 | local manif_core = {} | 4 | local manif_core = {} |
| 6 | package.loaded["luarocks.manif_core"] = manif_core | 5 | package.loaded["luarocks.manif_core"] = manif_core |
| 7 | 6 | ||
diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index 6969d4b2..3382b85c 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua | |||
| @@ -11,13 +11,14 @@ local fs = require("luarocks.fs") | |||
| 11 | local type_check = require("luarocks.type_check") | 11 | local type_check = require("luarocks.type_check") |
| 12 | 12 | ||
| 13 | new_version.help_summary = "Auto-write a rockspec for a new version of a rock." | 13 | new_version.help_summary = "Auto-write a rockspec for a new version of a rock." |
| 14 | new_version.help_arguments = "[--tag=<tag>] {<package>|<rockspec>} [<new_version>] [<new_url>]" | 14 | new_version.help_arguments = "[--tag=<tag>] [<package>|<rockspec>] [<new_version>] [<new_url>]" |
| 15 | new_version.help = [[ | 15 | new_version.help = [[ |
| 16 | This is a utility function that writes a new rockspec, updating data | 16 | This is a utility function that writes a new rockspec, updating data |
| 17 | from a previous one. | 17 | from a previous one. |
| 18 | 18 | ||
| 19 | If a package name is given, it downloads the latest rockspec from the | 19 | If a package name is given, it downloads the latest rockspec from the |
| 20 | default server. If a rockspec is given, it uses it instead. | 20 | default server. If a rockspec is given, it uses it instead. If no argument |
| 21 | is given, it looks for a rockspec same way 'luarocks make' does. | ||
| 21 | 22 | ||
| 22 | If the version number is not given and tag is passed using --tag, | 23 | If the version number is not given and tag is passed using --tag, |
| 23 | it is used as the version, with 'v' removed from beginning. | 24 | it is used as the version, with 'v' removed from beginning. |
| @@ -125,12 +126,16 @@ end | |||
| 125 | function new_version.run(...) | 126 | function new_version.run(...) |
| 126 | local flags, input, version, url = util.parse_flags(...) | 127 | local flags, input, version, url = util.parse_flags(...) |
| 127 | if not input then | 128 | if not input then |
| 128 | return nil, "Missing argument: expected package or rockspec. "..util.see_help("new_version") | 129 | local err |
| 130 | input, err = util.get_default_rockspec() | ||
| 131 | if not input then | ||
| 132 | return nil, err | ||
| 133 | end | ||
| 129 | end | 134 | end |
| 130 | assert(type(input) == "string") | 135 | assert(type(input) == "string") |
| 131 | 136 | ||
| 132 | local filename = input | 137 | local filename = input |
| 133 | if not input:match(".rockspec$") then | 138 | if not input:match("rockspec$") then |
| 134 | local err | 139 | local err |
| 135 | filename, err = download.download("rockspec", input) | 140 | filename, err = download.download("rockspec", input) |
| 136 | if not filename then | 141 | if not filename then |
diff --git a/src/luarocks/pack.lua b/src/luarocks/pack.lua index e4498f5a..685b84bd 100644 --- a/src/luarocks/pack.lua +++ b/src/luarocks/pack.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "pack" command. | 2 | --- Module implementing the LuaRocks "pack" command. |
| 3 | -- Creates a rock, packing sources or binaries. | 3 | -- Creates a rock, packing sources or binaries. |
| 4 | --module("luarocks.pack", package.seeall) | ||
| 5 | local pack = {} | 4 | local pack = {} |
| 6 | package.loaded["luarocks.pack"] = pack | 5 | package.loaded["luarocks.pack"] = pack |
| 7 | 6 | ||
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua index bc7ab63b..dafc64e7 100644 --- a/src/luarocks/path.lua +++ b/src/luarocks/path.lua | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | --- LuaRocks-specific path handling functions. | 2 | --- LuaRocks-specific path handling functions. |
| 3 | -- All paths are configured in this module, making it a single | 3 | -- All paths are configured in this module, making it a single |
| 4 | -- point where the layout of the local installation is defined in LuaRocks. | 4 | -- point where the layout of the local installation is defined in LuaRocks. |
| 5 | --module("luarocks.path", package.seeall) | ||
| 6 | local path = {} | 5 | local path = {} |
| 7 | 6 | ||
| 8 | local dir = require("luarocks.dir") | 7 | local dir = require("luarocks.dir") |
diff --git a/src/luarocks/persist.lua b/src/luarocks/persist.lua index 354b17c3..c2adb570 100644 --- a/src/luarocks/persist.lua +++ b/src/luarocks/persist.lua | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | -- saving tables into files. | 3 | -- saving tables into files. |
| 4 | -- Implemented separately to avoid interdependencies, | 4 | -- Implemented separately to avoid interdependencies, |
| 5 | -- as it is used in the bootstrapping stage of the cfg module. | 5 | -- as it is used in the bootstrapping stage of the cfg module. |
| 6 | --module("luarocks.persist", package.seeall) | ||
| 7 | local persist = {} | 6 | local persist = {} |
| 8 | package.loaded["luarocks.persist"] = persist | 7 | package.loaded["luarocks.persist"] = persist |
| 9 | 8 | ||
| @@ -147,7 +146,7 @@ write_table = function(out, tbl, level, field_order) | |||
| 147 | end | 146 | end |
| 148 | 147 | ||
| 149 | write_value(out, v, level, sub_order) | 148 | write_value(out, v, level, sub_order) |
| 150 | if type(k) == "number" then | 149 | if type(v) == "number" then |
| 151 | sep = ", " | 150 | sep = ", " |
| 152 | indent = false | 151 | indent = false |
| 153 | else | 152 | else |
diff --git a/src/luarocks/purge.lua b/src/luarocks/purge.lua index bd5494f6..0be6ef21 100644 --- a/src/luarocks/purge.lua +++ b/src/luarocks/purge.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "purge" command. | 2 | --- Module implementing the LuaRocks "purge" command. |
| 3 | -- Remove all rocks from a given tree. | 3 | -- Remove all rocks from a given tree. |
| 4 | --module("luarocks.purge", package.seeall) | ||
| 5 | local purge = {} | 4 | local purge = {} |
| 6 | package.loaded["luarocks.purge"] = purge | 5 | package.loaded["luarocks.purge"] = purge |
| 7 | 6 | ||
diff --git a/src/luarocks/refresh_cache.lua b/src/luarocks/refresh_cache.lua index 193e5994..cc5b9c33 100644 --- a/src/luarocks/refresh_cache.lua +++ b/src/luarocks/refresh_cache.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the luarocks-admin "refresh_cache" command. | 2 | --- Module implementing the luarocks-admin "refresh_cache" command. |
| 3 | --module("luarocks.refresh_cache", package.seeall) | ||
| 4 | local refresh_cache = {} | 3 | local refresh_cache = {} |
| 5 | package.loaded["luarocks.refresh_cache"] = refresh_cache | 4 | package.loaded["luarocks.refresh_cache"] = refresh_cache |
| 6 | 5 | ||
diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index 4aff3946..7a559f8f 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "remove" command. | 2 | --- Module implementing the LuaRocks "remove" command. |
| 3 | -- Uninstalls rocks. | 3 | -- Uninstalls rocks. |
| 4 | --module("luarocks.remove", package.seeall) | ||
| 5 | local remove = {} | 4 | local remove = {} |
| 6 | package.loaded["luarocks.remove"] = remove | 5 | package.loaded["luarocks.remove"] = remove |
| 7 | 6 | ||
diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index b6d5825a..86126a13 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Functions for managing the repository on disk. | 2 | --- Functions for managing the repository on disk. |
| 3 | --module("luarocks.repos", package.seeall) | ||
| 4 | local repos = {} | 3 | local repos = {} |
| 5 | package.loaded["luarocks.repos"] = repos | 4 | package.loaded["luarocks.repos"] = repos |
| 6 | 5 | ||
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index 6c0020c0..4ec0c65e 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "search" command. | 2 | --- Module implementing the LuaRocks "search" command. |
| 3 | -- Queries LuaRocks servers. | 3 | -- Queries LuaRocks servers. |
| 4 | --module("luarocks.search", package.seeall) | ||
| 5 | local search = {} | 4 | local search = {} |
| 6 | package.loaded["luarocks.search"] = search | 5 | package.loaded["luarocks.search"] = search |
| 7 | 6 | ||
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index ae41a513..1dc01cc0 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | --- Module implementing the LuaRocks "show" command. | 1 | --- Module implementing the LuaRocks "show" command. |
| 2 | -- Shows information about an installed rock. | 2 | -- Shows information about an installed rock. |
| 3 | --module("luarocks.show", package.seeall) | ||
| 4 | local show = {} | 3 | local show = {} |
| 5 | package.loaded["luarocks.show"] = show | 4 | package.loaded["luarocks.show"] = show |
| 6 | 5 | ||
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua index debaf636..44d00ef8 100644 --- a/src/luarocks/tools/patch.lua +++ b/src/luarocks/tools/patch.lua | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | -- Project home: http://code.google.com/p/python-patch/ . | 8 | -- Project home: http://code.google.com/p/python-patch/ . |
| 9 | -- Version 0.1 | 9 | -- Version 0.1 |
| 10 | 10 | ||
| 11 | --module("luarocks.tools.patch", package.seeall) | ||
| 12 | local patch = {} | 11 | local patch = {} |
| 13 | 12 | ||
| 14 | local fs = require("luarocks.fs") | 13 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/tools/tar.lua b/src/luarocks/tools/tar.lua index b2bd930a..637a6c95 100644 --- a/src/luarocks/tools/tar.lua +++ b/src/luarocks/tools/tar.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- A pure-Lua implementation of untar (unpacking .tar archives) | 2 | --- A pure-Lua implementation of untar (unpacking .tar archives) |
| 3 | --module("luarocks.tools.tar", package.seeall) | ||
| 4 | local tar = {} | 3 | local tar = {} |
| 5 | 4 | ||
| 6 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua index 65b4fc15..82763401 100644 --- a/src/luarocks/type_check.lua +++ b/src/luarocks/type_check.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | --- Type-checking functions. | 1 | --- Type-checking functions. |
| 2 | -- Functions and definitions for doing a basic lint check on files | 2 | -- Functions and definitions for doing a basic lint check on files |
| 3 | -- loaded by LuaRocks. | 3 | -- loaded by LuaRocks. |
| 4 | --module("luarocks.type_check", package.seeall) | ||
| 5 | local type_check = {} | 4 | local type_check = {} |
| 6 | package.loaded["luarocks.type_check"] = type_check | 5 | package.loaded["luarocks.type_check"] = type_check |
| 7 | 6 | ||
diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index d90f0571..4afe4547 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "unpack" command. | 2 | --- Module implementing the LuaRocks "unpack" command. |
| 3 | -- Unpack the contents of a rock. | 3 | -- Unpack the contents of a rock. |
| 4 | --module("luarocks.unpack", package.seeall) | ||
| 5 | local unpack = {} | 4 | local unpack = {} |
| 6 | package.loaded["luarocks.unpack"] = unpack | 5 | package.loaded["luarocks.unpack"] = unpack |
| 7 | 6 | ||
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 520625c0..f7e9b1ae 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | -- inside specific functions) to avoid interdependencies, | 4 | -- inside specific functions) to avoid interdependencies, |
| 5 | -- as this is used in the bootstrapping stage of luarocks.cfg. | 5 | -- as this is used in the bootstrapping stage of luarocks.cfg. |
| 6 | 6 | ||
| 7 | --module("luarocks.util", package.seeall) | ||
| 8 | local util = {} | 7 | local util = {} |
| 9 | 8 | ||
| 10 | local unpack = unpack or table.unpack | 9 | local unpack = unpack or table.unpack |
| @@ -520,6 +519,71 @@ function util.announce_install(rockspec) | |||
| 520 | util.printout() | 519 | util.printout() |
| 521 | end | 520 | end |
| 522 | 521 | ||
| 522 | --- Collect rockspecs located in a subdirectory. | ||
| 523 | -- @param versions table: A table mapping rock names to newest rockspec versions. | ||
| 524 | -- @param paths table: A table mapping rock names to newest rockspec paths. | ||
| 525 | -- @param unnamed_paths table: An array of rockspec paths that don't contain rock | ||
| 526 | -- name and version in regular format. | ||
| 527 | -- @param subdir string: path to subdirectory. | ||
| 528 | local function collect_rockspecs(versions, paths, unnamed_paths, subdir) | ||
| 529 | local fs = require("luarocks.fs") | ||
| 530 | local dir = require("luarocks.dir") | ||
| 531 | local path = require("luarocks.path") | ||
| 532 | local deps = require("luarocks.deps") | ||
| 533 | |||
| 534 | if fs.is_dir(subdir) then | ||
| 535 | for file in fs.dir(subdir) do | ||
| 536 | file = dir.path(subdir, file) | ||
| 537 | |||
| 538 | if file:match("rockspec$") and fs.is_file(file) then | ||
| 539 | local rock, version = path.parse_name(file) | ||
| 540 | |||
| 541 | if rock then | ||
| 542 | if not versions[rock] or deps.compare_versions(version, versions[rock]) then | ||
| 543 | versions[rock] = version | ||
| 544 | paths[rock] = file | ||
| 545 | end | ||
| 546 | else | ||
| 547 | table.insert(unnamed_paths, file) | ||
| 548 | end | ||
| 549 | end | ||
| 550 | end | ||
| 551 | end | ||
| 552 | end | ||
| 553 | |||
| 554 | --- Get default rockspec name for commands that take optional rockspec name. | ||
| 555 | -- @return string or (nil, string): path to the rockspec or nil and error message. | ||
| 556 | function util.get_default_rockspec() | ||
| 557 | local versions, paths, unnamed_paths = {}, {}, {} | ||
| 558 | -- Look for rockspecs in some common locations. | ||
| 559 | collect_rockspecs(versions, paths, unnamed_paths, ".") | ||
| 560 | collect_rockspecs(versions, paths, unnamed_paths, "rockspec") | ||
| 561 | collect_rockspecs(versions, paths, unnamed_paths, "rockspecs") | ||
| 562 | |||
| 563 | if #unnamed_paths > 0 then | ||
| 564 | -- There are rockspecs not following "name-version.rockspec" format. | ||
| 565 | -- More than one are ambiguous. | ||
| 566 | if #unnamed_paths > 1 then | ||
| 567 | return nil, "Please specify which rockspec file to use." | ||
| 568 | else | ||
| 569 | return unnamed_paths[1] | ||
| 570 | end | ||
| 571 | else | ||
| 572 | local rock = next(versions) | ||
| 573 | |||
| 574 | if rock then | ||
| 575 | -- If there are rockspecs for multiple rocks it's ambiguous. | ||
| 576 | if next(versions, rock) then | ||
| 577 | return nil, "Please specify which rockspec file to use." | ||
| 578 | else | ||
| 579 | return paths[rock] | ||
| 580 | end | ||
| 581 | else | ||
| 582 | return nil, "Argument missing: please specify a rockspec to use on current directory." | ||
| 583 | end | ||
| 584 | end | ||
| 585 | end | ||
| 586 | |||
| 523 | -- from http://lua-users.org/wiki/SplitJoin | 587 | -- from http://lua-users.org/wiki/SplitJoin |
| 524 | -- by PhilippeLhoste | 588 | -- by PhilippeLhoste |
| 525 | function util.split_string(str, delim, maxNb) | 589 | function util.split_string(str, delim, maxNb) |
diff --git a/src/luarocks/validate.lua b/src/luarocks/validate.lua index e6e09c33..24c6f835 100644 --- a/src/luarocks/validate.lua +++ b/src/luarocks/validate.lua | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | --- Sandboxed test of build/install of all packages in a repository (unfinished and disabled). | 2 | --- Sandboxed test of build/install of all packages in a repository (unfinished and disabled). |
| 3 | --module("luarocks.validate", package.seeall) | ||
| 4 | local validate = {} | 3 | local validate = {} |
| 5 | package.loaded["luarocks.validate"] = validate | 4 | package.loaded["luarocks.validate"] = validate |
| 6 | 5 | ||
diff --git a/src/luarocks/write_rockspec.lua b/src/luarocks/write_rockspec.lua index abfca322..79902bb4 100644 --- a/src/luarocks/write_rockspec.lua +++ b/src/luarocks/write_rockspec.lua | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | 1 | ||
| 2 | --module("luarocks.write_rockspec", package.seeall) | ||
| 3 | local write_rockspec = {} | 2 | local write_rockspec = {} |
| 4 | package.loaded["luarocks.write_rockspec"] = write_rockspec | 3 | package.loaded["luarocks.write_rockspec"] = write_rockspec |
| 5 | 4 | ||
| 5 | local cfg = require("luarocks.cfg") | ||
| 6 | local dir = require("luarocks.dir") | 6 | local dir = require("luarocks.dir") |
| 7 | local fetch = require("luarocks.fetch") | 7 | local fetch = require("luarocks.fetch") |
| 8 | local fs = require("luarocks.fs") | 8 | local fs = require("luarocks.fs") |
| @@ -111,6 +111,32 @@ local function detect_mit_license(data) | |||
| 111 | return sum == 78656 | 111 | return sum == 78656 |
| 112 | end | 112 | end |
| 113 | 113 | ||
| 114 | local simple_scm_protocols = { | ||
| 115 | git = true, ["git+http"] = true, ["git+https"] = true, | ||
| 116 | hg = true, ["hg+http"] = true, ["hg+https"] = true | ||
| 117 | } | ||
| 118 | |||
| 119 | local function detect_url_from_command(program, args, directory) | ||
| 120 | local command = fs.Q(cfg.variables[program:upper()]).. " "..args | ||
| 121 | local pipe = io.popen(fs.command_at(directory, fs.quiet_stderr(command))) | ||
| 122 | if not pipe then return nil end | ||
| 123 | local url = pipe:read("*a"):match("^([^\r\n]+)") | ||
| 124 | pipe:close() | ||
| 125 | if not url then return nil end | ||
| 126 | if not util.starts_with(url, program.."://") then | ||
| 127 | url = program.."+"..url | ||
| 128 | end | ||
| 129 | |||
| 130 | if simple_scm_protocols[dir.split_url(url)] then | ||
| 131 | return url | ||
| 132 | end | ||
| 133 | end | ||
| 134 | |||
| 135 | local function detect_scm_url(directory) | ||
| 136 | return detect_url_from_command("git", "config --get remote.origin.url", directory) or | ||
| 137 | detect_url_from_command("hg", "paths default", directory) | ||
| 138 | end | ||
| 139 | |||
| 114 | local function show_license(rockspec) | 140 | local function show_license(rockspec) |
| 115 | local fd = open_file("COPYING") or open_file("LICENSE") or open_file("MIT-LICENSE.txt") | 141 | local fd = open_file("COPYING") or open_file("LICENSE") or open_file("MIT-LICENSE.txt") |
| 116 | if not fd then return nil end | 142 | if not fd then return nil end |
| @@ -239,10 +265,6 @@ function write_rockspec.run(...) | |||
| 239 | version = version or "scm" | 265 | version = version or "scm" |
| 240 | 266 | ||
| 241 | local filename = flags["output"] or dir.path(fs.current_dir(), name:lower().."-"..version.."-1.rockspec") | 267 | local filename = flags["output"] or dir.path(fs.current_dir(), name:lower().."-"..version.."-1.rockspec") |
| 242 | |||
| 243 | if not flags["homepage"] and url_or_dir:match("^git://github.com") then | ||
| 244 | flags["homepage"] = "http://"..url_or_dir:match("^[^:]+://(.*)") | ||
| 245 | end | ||
| 246 | 268 | ||
| 247 | local rockspec = { | 269 | local rockspec = { |
| 248 | rockspec_format = flags["rockspec-format"], | 270 | rockspec_format = flags["rockspec-format"], |
| @@ -290,11 +312,26 @@ function write_rockspec.run(...) | |||
| 290 | else | 312 | else |
| 291 | local_dir = nil | 313 | local_dir = nil |
| 292 | end | 314 | end |
| 315 | else | ||
| 316 | rockspec.source.url = detect_scm_url(local_dir) or rockspec.source.url | ||
| 293 | end | 317 | end |
| 294 | 318 | ||
| 295 | if not local_dir then | 319 | if not local_dir then |
| 296 | local_dir = "." | 320 | local_dir = "." |
| 297 | end | 321 | end |
| 322 | |||
| 323 | if not flags["homepage"] then | ||
| 324 | local url_protocol, url_path = dir.split_url(rockspec.source.url) | ||
| 325 | |||
| 326 | if simple_scm_protocols[url_protocol] then | ||
| 327 | for _, domain in ipairs({"github.com", "bitbucket.org", "gitlab.com"}) do | ||
| 328 | if util.starts_with(url_path, domain) then | ||
| 329 | rockspec.description.homepage = "https://"..url_path:gsub("%.git$", "") | ||
| 330 | break | ||
| 331 | end | ||
| 332 | end | ||
| 333 | end | ||
| 334 | end | ||
| 298 | 335 | ||
| 299 | local libs = nil | 336 | local libs = nil |
| 300 | if flags["lib"] then | 337 | if flags["lib"] then |
