├── spec
├── files
│ ├── invalid
│ │ ├── foo
│ │ │ ├── z
│ │ │ ├── bar.lua
│ │ │ ├── bar_abc.lua
│ │ │ └── barabc.lua
│ │ ├── foo.lua
│ │ ├── Liftfile.lua
│ │ ├── foo_bar.lua
│ │ ├── init.lua
│ │ ├── init_abc.lua
│ │ ├── initabc.lua
│ │ ├── init_abc_def.lua
│ │ └── init_abcdef.lua
│ ├── project1
│ │ └── .lift
│ │ │ └── init.lua
│ ├── system
│ │ └── init.lua
│ ├── user
│ │ └── init.lua
│ ├── init.lua
│ ├── templates
│ │ ├── file.lua
│ │ ├── table.lua
│ │ ├── row.lua
│ │ └── sub
│ │ │ └── invalid.lua
│ └── project2
│ │ └── Liftfile.lua
├── Liftfile.lua
├── util.lua
├── color_spec.lua
├── request_spec.lua
├── util_spec.lua
├── template_spec.lua
├── loader_spec.lua
├── config_spec.lua
├── string_spec.lua
├── path_spec.lua
├── diagnostics_spec.lua
├── os_spec.lua
├── task_spec.lua
├── stream_spec.lua
└── fs_spec.lua
├── .gitignore
├── doc
├── static
│ ├── CNAME
│ ├── robots.txt
│ ├── media
│ │ ├── favicon.ico
│ │ ├── octicons.woff
│ │ ├── lift-logo.svg
│ │ ├── luarocks-mark.svg
│ │ └── lift-mark.svg
│ └── js
│ │ ├── main.js
│ │ └── prism.js
├── content
│ ├── api
│ │ ├── string.md
│ │ └── index.md
│ ├── examples.md
│ ├── index.md
│ └── quickstart.md
├── assets
│ ├── templates
│ │ ├── footer.html
│ │ ├── nav.html
│ │ ├── header.html
│ │ └── page.html
│ └── sass
│ │ └── _code.scss
└── doc_vars.lua
├── bin
├── lift.bat
└── lift
├── .luacheckrc
├── .ci
├── setenv_lua.sh
├── platform.sh
├── appveyor.yml
├── set_compiler_env.bat
├── setup_lua.sh
└── install.bat
├── .luacov
├── examples
├── tasks
│ └── Liftfile.lua
├── downloads
│ └── Liftfile.lua
├── lua-logo
│ └── Liftfile.lua
├── count-cmd
│ └── .lift
│ │ └── cli.lua
└── build-lua
│ └── Liftfile.lua
├── .lift
├── lift.rockspec
└── init.lua
├── LICENSE
├── .travis.yml
├── lift-scm-0.rockspec
├── lift
├── files
│ ├── cli.lua
│ ├── cli_config.lua
│ ├── init.lua
│ └── lift
│ │ └── cli_task.lua
├── request.lua
├── color.lua
├── loader.lua
├── string.lua
├── template.lua
├── util.lua
├── path.lua
├── config.lua
├── task.lua
└── os.lua
├── CONTRIBUTING.md
└── README.md
/spec/files/invalid/foo/z:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/spec/files/project1/.lift/init.lua:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.rockspec
2 | doc/output
3 |
--------------------------------------------------------------------------------
/doc/static/CNAME:
--------------------------------------------------------------------------------
1 | lift.run
2 | www.lift.run
3 |
--------------------------------------------------------------------------------
/spec/files/invalid/foo.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/Liftfile.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/foo/bar.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/foo_bar.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/init.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/init_abc.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/initabc.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/foo/bar_abc.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/foo/barabc.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/init_abc_def.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/spec/files/invalid/init_abcdef.lua:
--------------------------------------------------------------------------------
1 | if end then error
2 |
--------------------------------------------------------------------------------
/bin/lift.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | lua .\bin\lift %*
3 | exit /b %ERRORLEVEL%
4 |
--------------------------------------------------------------------------------
/doc/static/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow: /404
3 | Disallow: /500
--------------------------------------------------------------------------------
/spec/files/system/init.lua:
--------------------------------------------------------------------------------
1 | local scope = ...
2 | scope.list = 'a;b'
3 | scope.opt1 = 'system'
4 |
--------------------------------------------------------------------------------
/doc/static/media/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tbastos/lift/HEAD/doc/static/media/favicon.ico
--------------------------------------------------------------------------------
/doc/static/media/octicons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tbastos/lift/HEAD/doc/static/media/octicons.woff
--------------------------------------------------------------------------------
/spec/files/user/init.lua:
--------------------------------------------------------------------------------
1 | local scope = ...
2 | scope:insert('list', 'c')
3 | scope.opt1 = 'user'
4 |
5 |
--------------------------------------------------------------------------------
/.luacheckrc:
--------------------------------------------------------------------------------
1 | std = "lua51+lua52+lua53"
2 | files["spec"].std = "+busted"
3 | files["spec/data"].global = false
4 |
--------------------------------------------------------------------------------
/spec/Liftfile.lua:
--------------------------------------------------------------------------------
1 | -- The purpose of this file is to make lift detect this directory
2 | -- as the ${project_dir} in most tests.
3 |
--------------------------------------------------------------------------------
/doc/content/api/string.md:
--------------------------------------------------------------------------------
1 | {
2 | module = 'lift.string',
3 | title = 'String Module',
4 | title_short = 'String',
5 | }
6 |
7 | Under construction.
8 |
--------------------------------------------------------------------------------
/spec/files/init.lua:
--------------------------------------------------------------------------------
1 | local scope = ...
2 | scope.pi = 3.14
3 | scope.path = scope:get_list'PATH'
4 | scope:insert('list', 'd')
5 | scope:insert('list', 'A', 1)
6 |
--------------------------------------------------------------------------------
/doc/content/api/index.md:
--------------------------------------------------------------------------------
1 | {
2 | module = 'lift',
3 | title = 'API Reference Overview',
4 | title_short = 'Introduction',
5 | }
6 |
7 | Under construction.
8 |
--------------------------------------------------------------------------------
/.ci/setenv_lua.sh:
--------------------------------------------------------------------------------
1 | export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin
2 | bash .ci/setup_lua.sh
3 | eval `$HOME/.lua/luarocks path`
4 |
--------------------------------------------------------------------------------
/spec/files/templates/file.lua:
--------------------------------------------------------------------------------
1 | pi = {: tostring(math.pi):sub(1,6) :}
2 | {? Use templates to pretty print an acyclic table ?}
3 | {! 'table.lua' !! {t = {a = 1, b = true, c = {d = 'e'}}} !}
4 |
--------------------------------------------------------------------------------
/spec/files/project2/Liftfile.lua:
--------------------------------------------------------------------------------
1 | local task = require 'lift.task'
2 |
3 | function task.passthrough(...)
4 | return ...
5 | end
6 |
7 | function task.default()
8 | return task.passthrough(42)
9 | end
10 |
--------------------------------------------------------------------------------
/doc/assets/templates/footer.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/doc/content/examples.md:
--------------------------------------------------------------------------------
1 | {
2 | title = 'Examples',
3 | title_short = 'Examples',
4 | weight = 10,
5 | }
6 |
7 | For examples, please check out Lift's [examples directory on GitHub](https://github.com/tbastos/lift/tree/master/examples).
8 |
--------------------------------------------------------------------------------
/spec/files/templates/table.lua:
--------------------------------------------------------------------------------
1 | {
2 | {%
3 | -- traverse table in sorted order
4 | local keys = {}
5 | for k in pairs(t) do keys[#keys+1] = k end
6 | table.sort(keys)
7 | for i, k in ipairs(keys) do
8 | %}
9 | {! 'row.lua' !! {k = k, v = t[k]} !},
10 | {% end %}
11 | }
12 |
--------------------------------------------------------------------------------
/spec/files/templates/row.lua:
--------------------------------------------------------------------------------
1 | {:k:} = {% local tp = type(v) %}
2 | {% if tp == 'table' then %}{! 'table.lua' !! {t = v} !}
3 | {% elseif tp == 'string' then %}'{:v:}'
4 | {% elseif tp == 'number' then %}{:v:}
5 | {% elseif tp == 'boolean' then %}{: v and 'true' or 'false' :}
6 | {% else error('unsupported type') end %}
7 |
--------------------------------------------------------------------------------
/.ci/platform.sh:
--------------------------------------------------------------------------------
1 | if [ -z "${PLATFORM:-}" ]; then
2 | PLATFORM=$TRAVIS_OS_NAME;
3 | fi
4 |
5 | if [ "$PLATFORM" == "osx" ]; then
6 | PLATFORM="macosx";
7 | fi
8 |
9 | if [ -z "$PLATFORM" ]; then
10 | if [ "$(uname)" == "Linux" ]; then
11 | PLATFORM="linux";
12 | else
13 | PLATFORM="macosx";
14 | fi;
15 | fi
16 |
--------------------------------------------------------------------------------
/spec/files/templates/sub/invalid.lua:
--------------------------------------------------------------------------------
1 | This template file contains invalid Lua code
2 |
16 |
17 |
--------------------------------------------------------------------------------
/.luacov:
--------------------------------------------------------------------------------
1 | return {
2 | -- Patterns for files to include when reporting
3 | -- all will be included if nothing is listed
4 | -- (exclude overrules include, do not include
5 | -- the .lua extension)
6 | include = {
7 | "^%./lift",
8 | },
9 |
10 | -- Patterns for files to exclude when reporting
11 | -- all will be included if nothing is listed
12 | -- (exclude overrules include, do not include
13 | -- the .lua extension)
14 | exclude = {
15 | },
16 | }
17 |
--------------------------------------------------------------------------------
/doc/assets/templates/nav.html:
--------------------------------------------------------------------------------
1 |
20 |
--------------------------------------------------------------------------------
/spec/util.lua:
--------------------------------------------------------------------------------
1 | ------------------------------------------------------------------------------
2 | -- Helper functions for writing tests
3 | ------------------------------------------------------------------------------
4 |
5 | local async = require 'lift.async'
6 |
7 | -- Make it() function run in an async thread.
8 | local function async_it_function(f)
9 | return function()
10 | local future = async(f)
11 | future:on_ready(function() async.abort() end)
12 | async.run()
13 | future:check_error()
14 | async.check_errors()
15 | end
16 | end
17 |
18 | return {
19 | async = async_it_function,
20 | }
21 |
--------------------------------------------------------------------------------
/doc/static/js/main.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Replace all SVG images with inline SVG
3 | */
4 | jQuery('img.svg').each(function(){
5 | var $img = jQuery(this);
6 | var imgID = $img.attr('id');
7 | var imgClass = $img.attr('class');
8 | var imgURL = $img.attr('src');
9 | jQuery.get(imgURL, function(data) {
10 | // Get the SVG tag, ignore the rest
11 | var $svg = jQuery(data).find('svg');
12 | // Add replaced image's ID to the new SVG
13 | if(typeof imgID !== 'undefined') {
14 | $svg = $svg.attr('id', imgID);
15 | }
16 | // Add replaced image's classes to the new SVG
17 | if(typeof imgClass !== 'undefined') {
18 | $svg = $svg.attr('class', imgClass+' replaced-svg');
19 | }
20 | // Remove any invalid XML tags as per http://validator.w3.org
21 | $svg = $svg.removeAttr('xmlns:a');
22 | // Replace image with new SVG
23 | $img.replaceWith($svg);
24 | }, 'xml');
25 | });
26 |
--------------------------------------------------------------------------------
/examples/tasks/Liftfile.lua:
--------------------------------------------------------------------------------
1 | local task = require 'lift.task'
2 | local async = require 'lift.async'
3 |
4 | function task.brush_teeth()
5 | print 'Brushing teeth...'
6 | async.sleep(2000) -- 2 seconds
7 | print 'Finished brushing teeth.'
8 | end
9 |
10 | function task.take_shower()
11 | print 'Taking a shower...'
12 | async.sleep(3000) -- 3 seconds
13 | print 'Finished taking a shower.'
14 | end
15 |
16 | function task.get_ready() -- takes 5 seconds total
17 | task.take_shower()
18 | task.brush_teeth()
19 | print 'Done!'
20 | end
21 |
22 | function task.get_ready_fast() -- takes just 3 seconds
23 | task{task.take_shower, task.brush_teeth}()
24 | print 'Done fast!'
25 | end
26 |
27 | -- annotate the main tasks
28 | task.get_ready:desc('Take a shower then brush teeth (serial)')
29 | task.get_ready_fast:desc('Brush teeth while taking a shower (parallel)')
30 |
31 | task.default = task.get_ready
32 |
--------------------------------------------------------------------------------
/.lift/lift.rockspec:
--------------------------------------------------------------------------------
1 | package = "Lift"
2 | version = "{{version}}-0"
3 |
4 | source = {
5 | {% if version == 'scm' then %}
6 | url = "git://github.com/tbastos/lift",
7 | branch = "master"
8 | {% else %}
9 | url = "https://github.com/tbastos/lift/archive/v{{version}}.tar.gz",
10 | dir = "lift-{{version}}"
11 | {% end %}
12 | }
13 |
14 | description = {
15 | summary = "Lua automation tool and scripting framework.",
16 | homepage = "http://lift.run",
17 | license = "MIT",
18 | }
19 |
20 | dependencies = {
21 | 'lua >= 5.1', -- actually >= 5.2 or LuaJIT, but LuaJIT self-identifies as 5.1
22 | 'lpeg >= 1.0.0',
23 | 'luv >= 1.8.0-2',
24 | }
25 |
26 | build = {
27 | type = "builtin",
28 |
29 | modules = {
30 | {%
31 | for path in modules do
32 | path = path:sub(#base_dir + 2, -5)
33 | %}
34 | ["{{path:gsub('[/]', '.')}}"] = "{{path}}.lua",
35 | {% end %}
36 | },
37 |
38 | install = {
39 | bin = {
40 | ['lift'] = 'bin/lift'
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/.ci/appveyor.yml:
--------------------------------------------------------------------------------
1 | environment:
2 | LUAROCKS_VER: 2.3.0
3 | matrix:
4 | - LUA_VER: 5.2.4
5 | NOCOMPAT: true
6 | - LUA_VER: 5.3.2
7 | NOCOMPAT: true
8 | - LJ_VER: 2.0.4
9 | - LJ_VER: 2.1
10 |
11 | platform:
12 | - x86
13 | - x64
14 |
15 | configuration:
16 | - 2015
17 |
18 | matrix:
19 | fast_finish: true
20 |
21 | cache:
22 | - c:\lua -> .ci\appveyor.yml
23 | - c:\external -> .ci\appveyor.yml
24 |
25 | # init:
26 | # - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
27 |
28 | install:
29 | - call .ci\set_compiler_env.bat
30 | - call .ci\install.bat
31 |
32 | build_script:
33 | - luarocks install lpeg
34 | - luarocks install luv
35 | - luarocks install busted
36 | - busted -o tap -v
37 | - luarocks make lift-scm-0.rockspec
38 | - lift --help
39 |
40 | after_build:
41 | - luarocks remove lift
42 |
43 | test: off
44 |
45 | # on_finish:
46 | # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
47 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Thiago Bastos.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: c
2 | sudo: false
3 |
4 | addons:
5 | apt:
6 | sources:
7 | - kalakris-cmake
8 | packages:
9 | - cmake
10 |
11 | env:
12 | global:
13 | - LUAROCKS=2.3.0
14 | matrix:
15 | - LUA=lua5.2
16 | - LUA=lua5.3
17 | - LUA=luajit2.0 # current head of 2.0 branch
18 | - LUA=luajit2.1 # current head of 2.1 branch
19 |
20 | branches:
21 | only:
22 | - master
23 |
24 | before_install:
25 | - source .ci/setenv_lua.sh
26 |
27 | before_script:
28 | - luarocks install lpeg
29 | - luarocks install luv
30 | - luarocks install busted
31 | - luarocks install luacov
32 | - luarocks install luacov-coveralls
33 |
34 | script:
35 | - LUA_INIT="require'luacov'" busted -v
36 | - luarocks make lift-scm-0.rockspec
37 | - cd $TRAVIS_BUILD_DIR/examples/tasks && lift
38 | - cd $TRAVIS_BUILD_DIR/examples/downloads && lift
39 | - cd $TRAVIS_BUILD_DIR/examples/lua-logo && lift
40 | - cd $TRAVIS_BUILD_DIR/examples/build-lua && lift
41 | - cd $TRAVIS_BUILD_DIR/examples/count-cmd && lift count lua $CI_HOME
42 | - cd $TRAVIS_BUILD_DIR
43 |
44 | after_success:
45 | - luacov-coveralls -v
46 |
47 |
--------------------------------------------------------------------------------
/.ci/set_compiler_env.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | :: Now we declare a scope
4 | Setlocal EnableDelayedExpansion EnableExtensions
5 |
6 | if not defined Configuration set Configuration=2015
7 |
8 | if "%Configuration%"=="MinGW" ( goto :mingw )
9 |
10 | set arch=x86
11 |
12 | if "%platform%" EQU "x64" ( set arch=x86_amd64 )
13 |
14 | if "%Configuration%"=="2015" (
15 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
16 | )
17 |
18 | if "%Configuration%"=="2013" (
19 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
20 | )
21 |
22 | if "%Configuration%"=="2012" (
23 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
24 | )
25 |
26 | if "%Configuration%"=="2010" (
27 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
28 | )
29 |
30 | if "%Configuration%"=="2008" (
31 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
32 | )
33 |
34 | :: Visual Studio detected
35 | endlocal & call %SET_VS_ENV% %arch%
36 | goto :eof
37 |
38 | :: MinGW detected
39 | :mingw
40 | endlocal & set PATH=c:\mingw\bin;%PATH%
41 |
--------------------------------------------------------------------------------
/doc/assets/templates/header.html:
--------------------------------------------------------------------------------
1 | {:site.subtitle:}
19 | Edit this page on GitHub
20 |