aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2013-04-11 01:41:14 -0700
committerThijs Schreijer <thijs@thijsschreijer.nl>2013-04-11 01:41:14 -0700
commit6b3d15de3ea55a0e0a784bf9aec241b5f4f3ca0d (patch)
treeb0656f765a25acae5a3ae786f3cfd00cf889c814 /win32
parentc8522968cd449a7a42f0a7be72a5ab1dc396b8a5 (diff)
parenta893040988174d8bb126657c4790fa6e608ca85c (diff)
downloadluarocks-6b3d15de3ea55a0e0a784bf9aec241b5f4f3ca0d.tar.gz
luarocks-6b3d15de3ea55a0e0a784bf9aec241b5f4f3ca0d.tar.bz2
luarocks-6b3d15de3ea55a0e0a784bf9aec241b5f4f3ca0d.zip
Merge pull request #114 from Tieske/Regsitry_info_added
implements .rockspec file extension on windows
Diffstat (limited to 'win32')
-rw-r--r--win32/bin/LuaRocks.reg.template59
-rw-r--r--win32/bin/create_reg_file.lua51
-rw-r--r--win32/bin/lua.icobin0 -> 22486 bytes
-rw-r--r--win32/bin/luarocksw.bat49
4 files changed, 159 insertions, 0 deletions
diff --git a/win32/bin/LuaRocks.reg.template b/win32/bin/LuaRocks.reg.template
new file mode 100644
index 00000000..82cc180f
--- /dev/null
+++ b/win32/bin/LuaRocks.reg.template
@@ -0,0 +1,59 @@
1Windows Registry Editor Version 5.00
2
3[HKEY_CLASSES_ROOT\.rockspec]
4@="Lua.Rockspec"
5
6[HKEY_CLASSES_ROOT\.rockspec\Content Type]
7@="text/plain"
8
9[HKEY_CLASSES_ROOT\.rockspec\PerceivedType]
10@="text"
11
12[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.rockspec]
13@="Lua.Rockspec"
14
15[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.rockspec\Content Type]
16@="text/plain"
17
18[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.rockspec\PerceivedType]
19@="text"
20
21[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec]
22@="Lua Rockspec File"
23
24[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\DefaultIcon]
25@="<LUAROCKSPATH>lua.ico"
26
27[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell]
28@="Edit"
29
30[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Fetch]
31@="Fetch and install"
32
33[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Fetch\Command]
34@="\"<LUAROCKSPATH>luarocksw.bat\" install \"%1\""
35
36[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Install]
37@="Install Lua module"
38
39[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Install\Command]
40@="\"<LUAROCKSPATH>luarocksw.bat\" make \"%1\""
41
42[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Uninstall]
43@="Uninstall Lua module (this version)"
44
45[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Uninstall\Command]
46@="\"<LUAROCKSPATH>luarocksw.bat\" remove \"%1\""
47
48[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\UninstallAll]
49@="Uninstall Lua module (all versions)"
50
51[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\UninstallAll\Command]
52@="\"<LUAROCKSPATH>luarocksw.bat\" removeall \"%1\""
53
54[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Edit]
55@="Edit"
56
57[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Edit\command]
58@="notepad.exe \"%1\""
59
diff --git a/win32/bin/create_reg_file.lua b/win32/bin/create_reg_file.lua
new file mode 100644
index 00000000..df0b7491
--- /dev/null
+++ b/win32/bin/create_reg_file.lua
@@ -0,0 +1,51 @@
1-- Call this file using its full path and the template file as a parameter;
2--
3-- C:\> lua.exe "create_reg_file.lua" "c:\luarocks\2.0\LuaRocks.reg.template"
4--
5-- it will strip the ".template" extension and write to that file the
6-- template contents, where "<LUAROCKSPATH>" will be replaced by the path
7-- to LuaRocks (including the trailing backslash)
8
9
10
11-- Check argument
12local f = (arg or {})[1]
13if not f then
14 print("must provide template file on command line")
15 os.exit(1)
16end
17
18-- cleanup filepath, remove all double backslashes
19while f:match("\\\\") do
20 f:gsub("\\\\", "\\")
21end
22
23-- extract path and name from argument
24local p = ""
25local ni = f
26for i = #f, 1, -1 do
27 if f:sub(i,i) == "\\" then
28 ni = f:sub(i+1)
29 p = f:sub(1, i)
30 break
31 end
32end
33
34-- create output name
35local no = ni:gsub("%.template","")
36
37-- create path substitute; escape backslash by doubles
38local ps = p:gsub("\\", "\\\\")
39
40-- read template
41local fh = io.open(f)
42local content = fh:read("*a")
43fh:close()
44
45-- fill template
46content = content:gsub("%<LUAROCKSPATH%>", ps)
47
48-- write destination file
49fh = io.open(p..no, "w+")
50fh:write(content)
51fh:close()
diff --git a/win32/bin/lua.ico b/win32/bin/lua.ico
new file mode 100644
index 00000000..56dc4fe1
--- /dev/null
+++ b/win32/bin/lua.ico
Binary files differ
diff --git a/win32/bin/luarocksw.bat b/win32/bin/luarocksw.bat
new file mode 100644
index 00000000..313508d4
--- /dev/null
+++ b/win32/bin/luarocksw.bat
@@ -0,0 +1,49 @@
1@echo off
2setlocal
3SET MYPATH=%~dp0
4
5IF NOT [%1]==[] GOTO LETSGO
6ECHO Same as 'luarocks' command, except this
7ECHO command will pause after completion, allowing for
8ECHO examination of output.
9ECHO.
10ECHO For LuaRocks help use:
11ECHO LUAROCKS HELP
12ECHO.
13ECHO OPTIONS specific for LUAROCKSW:
14ECHO REMOVEALL is a command specific to this batch file
15ECHO the option takes a FULL ROCKSPEC filename and then
16ECHO it will strip path, version and extension info from
17ECHO it before executing the LUAROCKS REMOVE command
18ECHO Example:
19ECHO luarocksw remove "c:\somedir\modulename-1.0-1.rockspec"
20ECHO will execute:
21ECHO luarocks remove "c:\somedir\modulename-1.0-1.rockspec"
22ECHO and will only remove the specific version 1.0 from the
23ECHO system.
24ECHO luarocksw removeall "c:\somedir\modulename-1.0-1.rockspec"
25ECHO will execute:
26ECHO luarocks remove modulename
27ECHO and will remove all versions of this package
28ECHO.
29GOTO END
30
31:LETSGO
32REM if REMOVEALL command then info must be stripped from the parameter
33if [%1]==[removeall] goto REMOVEALL
34
35REM execute LuaRocks and wait for results
36echo executing: luarocks %*
37call %MYPATH%luarocks %*
38pause
39goto END
40
41:REMOVEALL
42for /f "delims=-" %%a in ("%~n2") do (
43 echo executing: luarocks remove %%a
44 %MYPATH%luarocks remove "%%a"
45 pause
46 goto END
47)
48
49:END \ No newline at end of file