aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2013-04-09 13:11:55 +0200
committerThijs Schreijer <thijs@thijsschreijer.nl>2013-04-09 13:11:55 +0200
commitb974f6d3841b24596c4cbc2c27f9f6572afe52d5 (patch)
tree9226304a5d8ac0a756e85b6316219cd690ab3518
parentbaef212bf582e59421cca37e1e11167dc33f974a (diff)
downloadluarocks-b974f6d3841b24596c4cbc2c27f9f6572afe52d5.tar.gz
luarocks-b974f6d3841b24596c4cbc2c27f9f6572afe52d5.tar.bz2
luarocks-b974f6d3841b24596c4cbc2c27f9f6572afe52d5.zip
installer adds information for the registry, including icon and actions for .rockspec files when /R argument is provided.
includes the new luarocksw.bat batch file also: made the /P argument of the installer required
-rw-r--r--install.bat32
-rw-r--r--win32/bin/LuaRocks.reg.template53
-rw-r--r--win32/bin/create_reg_file.lua51
-rw-r--r--win32/bin/lua.icobin0 -> 22486 bytes
-rw-r--r--win32/bin/luarocksw.bat48
5 files changed, 180 insertions, 4 deletions
diff --git a/install.bat b/install.bat
index 3fdaafa0..1bc58bd0 100644
--- a/install.bat
+++ b/install.bat
@@ -21,6 +21,8 @@ SET FORCE_CONFIG=
21SET USE_MINGW= 21SET USE_MINGW=
22SET MKDIR=.\bin\mkdir -p 22SET MKDIR=.\bin\mkdir -p
23SET LUA_LIB_NAMES=lua5.1.lib lua51.dll liblua.dll.a 23SET LUA_LIB_NAMES=lua5.1.lib lua51.dll liblua.dll.a
24SET REGISTRY=OFF
25SET P_SET=FALSE
24 26
25REM *********************************************************** 27REM ***********************************************************
26REM Option parser 28REM Option parser
@@ -33,9 +35,9 @@ IF [%1]==[] GOTO DONE_PARSING
33IF [%1]==[/?] ( 35IF [%1]==[/?] (
34 ECHO Installs LuaRocks. 36 ECHO Installs LuaRocks.
35 ECHO. 37 ECHO.
36 ECHO /P [dir] Where to install. 38 ECHO /P [dir] ^(REQUIRED^) Where to install.
37 ECHO Default is %PREFIX% ^(version; %VERSION%, will be 39 ECHO Note that version; %VERSION%, will be
38 ECHO appended to this path^) 40 ECHO appended to this path.
39 ECHO /CONFIG [dir] Location where the config file should be installed. 41 ECHO /CONFIG [dir] Location where the config file should be installed.
40 ECHO Default is same place of installation 42 ECHO Default is same place of installation
41 ECHO /TREE [dir] Root of the local tree of installed rocks. 43 ECHO /TREE [dir] Root of the local tree of installed rocks.
@@ -66,12 +68,16 @@ IF [%1]==[/?] (
66 ECHO. 68 ECHO.
67 ECHO /F Remove installation directory if it already exists. 69 ECHO /F Remove installation directory if it already exists.
68 ECHO. 70 ECHO.
71 ECHO /R Load registry information to register '.rockspec'
72 ECHO extension with LuaRocks commands ^(right-click^).
73 ECHO.
69 GOTO QUIT 74 GOTO QUIT
70) 75)
71IF /I [%1]==[/P] ( 76IF /I [%1]==[/P] (
72 SET PREFIX=%~2 77 SET PREFIX=%~2
73 SET SYSCONFDIR=%~2 78 SET SYSCONFDIR=%~2
74 SET ROCKS_TREE=%~2 79 SET ROCKS_TREE=%~2
80 SET P_SET=TRUE
75 SHIFT /1 81 SHIFT /1
76 SHIFT /1 82 SHIFT /1
77 GOTO PARSE_LOOP 83 GOTO PARSE_LOOP
@@ -138,11 +144,20 @@ IF /I [%1]==[/F] (
138 SHIFT /1 144 SHIFT /1
139 GOTO PARSE_LOOP 145 GOTO PARSE_LOOP
140) 146)
147IF /I [%1]==[/R] (
148 SET REGISTRY=ON
149 SHIFT /1
150 GOTO PARSE_LOOP
151)
141ECHO Unrecognized option: %1 152ECHO Unrecognized option: %1
142GOTO ERROR 153GOTO ERROR
143:DONE_PARSING 154:DONE_PARSING
144 155
145REM check for combination flags 156REM check for combination/required flags
157IF NOT [%P_SET%]==[TRUE] (
158 Echo Missing required parameter /P
159 GOTO ERROR
160)
146IF [%INSTALL_LUA%]==[ON] ( 161IF [%INSTALL_LUA%]==[ON] (
147 IF NOT [%LUA_INCDIR%%LUA_BINDIR%%LUA_LIBDIR%%LUA_PREFIX%]==[] ( 162 IF NOT [%LUA_INCDIR%%LUA_BINDIR%%LUA_LIBDIR%%LUA_PREFIX%]==[] (
148 ECHO Cannot combine option /L with any of /LUA /BIN /LIB /INC 163 ECHO Cannot combine option /L with any of /LUA /BIN /LIB /INC
@@ -424,6 +439,15 @@ IF NOT EXIST "%APPDATA%/luarocks" (
424 ECHO Rocktree exists: "%APPDATA%\luarocks" 439 ECHO Rocktree exists: "%APPDATA%\luarocks"
425) 440)
426 441
442REM Load registry information
443IF [%REGISTRY%]==[ON] (
444 REM expand template with correct path information
445 ECHO.
446 ECHO Loading registry information for ".rockspec" files
447 lua5.1\bin\lua5.1.exe "%FULL_PREFIX%\create_reg_file.lua" "%FULL_PREFIX%\LuaRocks.reg.template"
448 %FULL_PREFIX%\LuaRocks.reg
449)
450
427REM *********************************************************** 451REM ***********************************************************
428REM Exit handlers 452REM Exit handlers
429REM *********************************************************** 453REM ***********************************************************
diff --git a/win32/bin/LuaRocks.reg.template b/win32/bin/LuaRocks.reg.template
new file mode 100644
index 00000000..3af1ff34
--- /dev/null
+++ b/win32/bin/LuaRocks.reg.template
@@ -0,0 +1,53 @@
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.Rockpsec\Shell]
28
29[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Fetch]
30@="Fetch and install"
31
32[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Fetch\Command]
33@="\"<LUAROCKSPATH>luarocksw.bat" install \"%1\"
34
35[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Install]
36@="Install Lua module"
37
38[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Install\Command]
39@="\"<LUAROCKSPATH>luarocksw.bat" make \"%1\"
40
41[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Uninstall]
42@="Install Lua module (this version)"
43
44[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\Uninstall\Command]
45@="\"<LUAROCKSPATH>luarocksw.bat" remove \"%1\"
46
47[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\UninstallAll]
48@="Install Lua module (all versions)"
49
50[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Lua.Rockspec\Shell\UninstallAll\Command]
51@="\"<LUAROCKSPATH>luarocksw.bat" removeall \"%1\"
52
53
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..a0144c44
--- /dev/null
+++ b/win32/bin/luarocksw.bat
@@ -0,0 +1,48 @@
1@echo off
2setlocal
3SET MYPATH=%~dp0
4
5
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
28
29
30
31REM if REMOVEALL command then info must be stripped from the parameter
32if [%1]==[removeall] goto REMOVEALL
33
34REM execute LuaRocks and wait for results
35echo executing: luarocks %*
36call %MYPATH%luarocks %*
37pause
38goto END
39
40:REMOVEALL
41for /f "delims=-" %%a in ("%~n2") do (
42 echo executing: luarocks remove %%a
43 %MYPATH%luarocks remove "%%a"
44 pause
45 goto END
46)
47
48:END \ No newline at end of file