tools/concat.lua -> tools/build.lua;
The first argument is now a build type instead of a destination file. The build type can either be "base" or "luvit" and defaults to "base".
This commit is contained in:
parent
951705d4c8
commit
c599ac6d19
@ -11,9 +11,10 @@ Tooling
|
||||
|
||||
There are a number of scripts in the `tools` folder that automate certain tasks. In general, they are run using `lua tools/<file>.lua` from the project root and take no arguments.
|
||||
|
||||
- Everything in the `src` directory is concatenated into a single `rx.lua` file in the project root. The file `tools/concat.lua` does this concatenation. It strips out both the requires at the top of files and the return values at the bottom.
|
||||
- Everything in the `src` directory is concatenated into a single `rx.lua` file in the project root. The file `tools/build.lua` does this concatenation. It strips out both the requires at the top of files and the return values at the bottom.
|
||||
- If you want to create a luvit build with additional features, you can run `lua tools/build.lua luvit`.
|
||||
- The documentation in `doc/README.md` is automatically generated based on comments in the source. The file `tools/update_documentation.lua` performs this generation. Internally it uses `docroc`, which is a library that parses Lua comments and returns them in a table. From here, `update_documentation` converts the table to markdown and writes it to the `doc` directory.
|
||||
- Currently, you should run both of these scripts and include an updated `rx.lua` and `doc/README.md` as part of a pull request. If you've added a new file you'll have to add it (alphabetized) to the file list in `tools/concat.lua`.
|
||||
- Currently, you should run both of these scripts and include an updated `rx.lua` and `doc/README.md` as part of a pull request. If you've added a new file you'll have to add it (alphabetized) to the file list in `tools/build.lua`.
|
||||
|
||||
Tests
|
||||
---
|
||||
|
@ -1,5 +1,6 @@
|
||||
-- Horrible script to concatenate everything in /src into a single rx.lua file.
|
||||
-- Usage: lua tools/concat.lua [dest=rx.lua]
|
||||
--- Horrible script to concatenate everything in /src into a single rx.lua file.
|
||||
-- @usage lua tools/build.lua [distribution=base]
|
||||
-- @arg {string='base'} distribution - Type of distribution to build, either 'base' or 'luvit'.
|
||||
|
||||
local files = {
|
||||
'src/util.lua',
|
||||
@ -66,12 +67,22 @@ local files = {
|
||||
}
|
||||
|
||||
local header = [[
|
||||
-- RxLua v0.0.1
|
||||
-- RxLua v0.0.2
|
||||
-- https://github.com/bjornbytes/rxlua
|
||||
-- MIT License
|
||||
|
||||
]]
|
||||
|
||||
local exports = [[
|
||||
exports.name = 'bjornbytes/rx'
|
||||
exports.version = '0.0.2'
|
||||
exports.description = 'Reactive Extensions for Lua'
|
||||
exports.license = 'MIT'
|
||||
exports.author = { url = 'https://github.com/bjornbytes' }
|
||||
exports.homepage = 'https://github.com/bjornbytes/rxlua'
|
||||
|
||||
]]
|
||||
|
||||
local footer = [[return {
|
||||
util = util,
|
||||
Subscription = Subscription,
|
||||
@ -104,8 +115,22 @@ for _, filename in ipairs(files) do
|
||||
output = output .. str .. '\n\n'
|
||||
end
|
||||
|
||||
local outputFile = arg[1] or 'rx.lua'
|
||||
local file = io.open(outputFile, 'w')
|
||||
if file then
|
||||
file:write(header .. output .. footer)
|
||||
local distribution = arg[1] or 'base'
|
||||
local destination, components
|
||||
|
||||
if distribution == 'base' then
|
||||
destination = 'rx.lua'
|
||||
components = { header, output, footer }
|
||||
elseif distribution == 'luvit' then
|
||||
destination = 'rx-luvit.lua'
|
||||
components = { header, exports, output, footer }
|
||||
else
|
||||
error('Invalid distribution specified.')
|
||||
end
|
||||
|
||||
local file = io.open(destination, 'w')
|
||||
|
||||
if file then
|
||||
file:write(table.concat(components, ''))
|
||||
file:close()
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user