diff options
author | Alexey Melnichuk <alexeymelnichuck@gmail.com> | 2016-11-05 17:02:14 +0300 |
---|---|---|
committer | Alexey Melnichuk <alexeymelnichuck@gmail.com> | 2016-11-05 17:02:14 +0300 |
commit | 07221a6e2eb9ef08eaee026a7c132b15204413ab (patch) | |
tree | 5011651ec5e90a293c3c0c06f8f85291c20aa20f | |
parent | 3a1c8ab327cad1771664cc6e5ddb83706f22d93a (diff) |
Add. rockspec and appveyor.yml files.
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | appveyor.yml | 32 | ||||
-rw-r--r-- | lakeconfig.lua | 81 | ||||
-rw-r--r-- | rockspecs/winreg-scm-0.rockspec | 47 |
4 files changed, 109 insertions, 59 deletions
@@ -10,7 +10,9 @@ All Rights Deserved. Use at your own risk!. Shake well before using. #Introduction
-winreg is a Lua binary module to Access Microsoft(R) Windows(R) Registry. The registry is a system-defined database that applications and Microsoft(R) Windows(R) system components use to store and retrieve configuration data.
+winreg is a Lua binary module to Access Microsoft(R) Windows(R) Registry. The registry is a
+system-defined database that applications and Microsoft(R) Windows(R) system components use to
+store and retrieve configuration data.
Load the module via the require function (make sure Lua can find the module), for example:
```lua
@@ -21,8 +23,8 @@ hkey = winreg.openkey[[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVers skey = hkey:openkey([[Explorer\Shell Folders]])
for name in skey:enumvalue() do
- print("\nname: " .. name
- .. "\npath: " .. skey:getvalue(name))
+ print("\nname: " .. name
+ .. "\npath: " .. skey:getvalue(name))
end
```
diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..2a9d679 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,32 @@ +version: 0.1.0.{build} + +environment: + matrix: + - LUA: "lua 5.1" + - LUA: "lua 5.2" + - LUA: "lua 5.3" + +platform: + - x64 + - x86 + +before_build: + - set PATH=C:\Python27\Scripts;%PATH% + - pip install hererocks + - if /I "%platform%"=="x86" set HR_TARGET=vs_32 + - if /I "%platform%"=="x64" set HR_TARGET=vs_64 + - hererocks env --%LUA% --target %HR_TARGET% -rlatest + - call env\bin\activate + +build_script: + - luarocks make rockspecs\winreg-scm-0.rockspec + +test_script: + - cd test + - lua test_1.lua + - lua test_5_1_5.lua + - lua test_5_1_6.lua + - lua test_5_1_8.lua + - lua test_5_1_9.lua + - lua test_5_1_10.lua + - lua test_5_1_13.lua diff --git a/lakeconfig.lua b/lakeconfig.lua index 33ea7f6..b4b102b 100644 --- a/lakeconfig.lua +++ b/lakeconfig.lua @@ -1,3 +1,6 @@ +J = J or path.join +J = IF or choose + function vc_version() local VER = lake.compiler_version() MSVC_VER = ({ @@ -7,64 +10,12 @@ function vc_version() return MSVC_VER end -local function arkey(t) - assert(type(t) == 'table') - local keys = {} - for k in pairs(t) do - assert(type(k) == 'number') - table.insert(keys, k) - end - table.sort(keys) - return keys -end - -local function ikeys(t) - local keys = arkey(t) - local i = 0 - return function() - i = i + 1 - local k = keys[i] - if k == nil then return end - return k, t[k] - end -end - -local function expand(arr, t) - if t == nil then return arr end - - if type(t) ~= 'table' then - table.insert(arr, t) - return arr - end - - for _, v in ikeys(t) do - expand(arr, v) - end - - return arr -end - -function L(...) - return expand({}, {...}) -end - -J = J or path.join - -IF = IF or lake.choose or choose - function prequire(...) local ok, mod = pcall(require, ...) if ok then return mod end end -function each_join(dir, list) - for i, v in ipairs(list) do - list[i] = path.join(dir, v) - end - return list -end - -function run(file, cwd) +function run_lua(file, cwd) print() print("run " .. file) if not TESTING then @@ -78,14 +29,16 @@ function run(file, cwd) end function run_test(name, params) - local test_dir = J(ROOT, 'test') + local test_dir = TEST_DIR or J(ROOT, 'test') local cmd = J(test_dir, name) if params then cmd = cmd .. ' ' .. params end - local ok = run(cmd, test_dir) + local ok = run_lua(cmd, test_dir) print("TEST " .. cmd .. (ok and ' - pass!' or ' - fail!')) end -function spawn(file, cwd) +do -- spawn + +local function spawn_win(file, cwd) local winapi = prequire "winapi" if not winapi then print(file, ' error: Test needs winapi!') @@ -101,6 +54,22 @@ function spawn(file, cwd) return true end +local function spawn_nix(file, cwd) + print("spawn " .. file) + if not TESTING then + if cwd then lake.chdir(cwd) end + local status, code = utils.execute( LUA_RUNNER .. file .. ' &', true ) + if cwd then lake.chdir("<") end + print() + return status, code + end + return true +end + +spawn = WINDOWS and spawn_win or spawn_nix + +end + function as_bool(v,d) if v == nil then return not not d end local n = tonumber(v) diff --git a/rockspecs/winreg-scm-0.rockspec b/rockspecs/winreg-scm-0.rockspec new file mode 100644 index 0000000..42c56cf --- /dev/null +++ b/rockspecs/winreg-scm-0.rockspec @@ -0,0 +1,47 @@ +package = "winreg" +version = "scm-0" +source = { + url = "https://github.com/moteus/lua-winreg/archive/master.zip", + dir = "lua-winreg-master", +} + +description = { + summary = "Lua module to Access Microsoft(R) Windows(R) Registry", + homepage = "http://github.com/moteus/lua-winreg", + license = "MIT/X11", + detailed = [[ + ]], +} + +supported_platforms = { + "windows" +} + +dependencies = { + "lua >= 5.1, < 5.4", +} + +build = { + type = "builtin", + + copy_directories = {'doc', 'examples', 'test'}, + + modules = { + winreg = { + sources = { + "src/l52util.c", "src/lua_int64.c", "src/lua_mtutil.c", "src/lua_tstring.c", + "src/luawin_dllerror.c", "src/win_privileges.c", "src/win_registry.c", + "src/win_trace.c", "src/winreg.c", + }, + defines = { + "WIN32"; "_WIN32"; "_WINDOWS", + "WIN32_LEAN_AND_MEAN"; "WINDLL"; "USRDLL", + "NDEBUG", "_CRT_SECURE_NO_WARNINGS", + "CRTAPI1=_cdecl", "CRTAPI2=_cdecl", + "WINREG_EXPORTS", "WINREG_API=__declspec(dllexport)" + }, + libraries = {"advapi32", "kernel32", "user32"}, + } + } +} + |