On Mon, Jan 12, 2015 at 3:55 PM, Thijs Schreijer
<[email protected]> wrote:
>
>> -----Original Message-----
>> From: Andrew Starks [mailto:[email protected]]
>> Sent: vrijdag 9 januari 2015 18:24
>> To: LuaRocks developers list
>> Subject: [Luarocks-developers] *.bat wrappers
>>
>> In windows, i think it is necessary to create a bat version of a lua
>> file, if you wish to execute it from the command line. This is used
>> for things like busted and luacheck and perhaps others.
>>
>> It appears that there is a facility to wrap a lua file in this way. I
>> believe that it happens in `win32.wrap_script` in `/fs/win32.lua`.
>>
>> I am curious about how this is accomplished. In looking at the file,
>> it appears that you set the luafile variable to the file name at the
>> top, but I can't grok how you are making this work with the path.
>>
>> When I've done this, I make sure that the 'myutil.lua' file and the
>> 'myutil.bat' file are sitting next to each other and I writhe the
>> following:
>> (assuming that lua.exe is in the path)
>> ```
>> @echo off
>> lua.exe %~dp0\myutil.lua %0
>> ```
>> `%~dp0` expands to the path of the `myutil.bat` file, which would be
>> the wrapper.
>>
>> I don't see where you've done that. Did you do it differently and if so,
>> why?
>>
>> -Andrew
>>
>
> Not sure I understand your question... your question is about the inner 
> workings of the generated batch file?
>
> Thijs
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> www.gigenet.com
> _______________________________________________
> Luarocks-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luarocks-developers


Very sorry about that rushed email and my question was mostly driven
by curiosity, so it isn't very important. That said...

Some packages include a command line script. Examples include `busted`
and `luacheck`. Making these scripts run from the command line
(without prefixing the script name with `lua`)  is different on
different shells / operating systems. It's very different on Windows.

LuaRocks appears to have built-in support for making this file on
supported platforms, including Windows. I can't use LuaRocks for work,
so I make these files by hand.

I was curious about the approach that it took, so I peeked at the
files that i mentioned. The script was far more involved than I had
expected it to be and that made me wonder about the issues that it was
solving (and whether I should worry about any of them). As two
examples, it always inserts the LR module paths and it inserts a
literal path in front of name of the script file, instead of
calculating that path at run time. Both of these decisions make
portable installations harder, but perhaps it's done that way to make
sure that the file runs, even if other environment elements change?

It appears that there are many places where paths are generated and
saved as literal values and that this is done on purpose. It's not
what I would have expected and it prompted me to toss out a hasty
email. :)

-Andrew

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
www.gigenet.com
_______________________________________________
Luarocks-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to