Skip to content

Commit

Permalink
Merge pull request #6 from evo-lua/5-builtin-path-module
Browse files Browse the repository at this point in the history
Add ``path`` module as a global Lua extension (ported from NodeJS)
  • Loading branch information
rdw-software authored Oct 17, 2021
2 parents 9e70441 + 5b0d181 commit f41cb01
Show file tree
Hide file tree
Showing 22 changed files with 2,378 additions and 6 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci-unix-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
build_type: [tiny, regular-asm]
lua_engine: [LuaJIT, Lua]
build_type: [regular-asm]
lua_engine: [LuaJIT]
env:
BUILD_TYPE: ${{ matrix.build_type }}
WITH_LUA_ENGINE: ${{ matrix.lua_engine }}
Expand All @@ -24,11 +24,14 @@ jobs:
run: WITHOUT_AMALG=1 make ${BUILD_TYPE} WITH_LUA_ENGINE=${WITH_LUA_ENGINE}

- name: Build
run: make
run: make && cd build && cp luvi ../luvi

- name: Test
run: make test

- name: Test Extensions and Primitives
run: ./luvi test

deploy-linux:
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/ci-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ jobs:

steps:
- name: Check out Git repository
run: git clone --recursive https://github.com/evo-lua/evo-luvi.git
uses: actions/checkout@v2
with:
submodules: recursive

- name: Make executable
# Adding in directory listings here to aid with debugging build issues in the future
run: cd evo-luvi && ./make.bat && dir && cp build/Release/luvi.exe ../evo-luvi.exe && cd .. && dir
run: ./make.bat && dir && cp build/Release/luvi.exe evo-luvi.exe && dir

# We don't want to deploy a faulty release, so this should fail if the executable is broken
- name: Verify the build
run: cd evo-luvi && ./make.bat test
run: ./make.bat test

- name: Test Extensions and Primitives
run: ./luvi.exe test

- name: Publish new release
# Truly "continuous" releases may be overkill here, so better only release tagged versions
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ lua_add_executable(luvi
src/lua/init.lua
src/lua/luvipath.lua
src/lua/luvibundle.lua
src/lua/primitives.lua
src/lua/primitives/v8_string_helpers.lua
src/lua/extensions.lua
src/lua/extensions/path.lua
${lpeg_re_lua}
)

Expand Down
10 changes: 10 additions & 0 deletions src/lua/extensions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Lua doesn't automatically search subdirectories, so we have to teach it where to find the modules
package.path = package.path .. ";extensions/?.lua;"

-- Since they may depend on primitives that aren't yet preloaded, defer the loading process
local extensionLoaders = {
-- Nonstandard libraries
path = function() return require("path") end,
}

return extensionLoaders
Loading

0 comments on commit f41cb01

Please sign in to comment.