Automatic LuaRocks to Git repo import utility
- Author: Martin Šrank, [email protected]
- License: MIT
- Part of the LuaDist project
Downloads all modules from LuaRocks and creates Git repositories with correct tags, branches and commit history for each module.
luarocks>= 2.2.0git>= 2.0.0
penlight>= 1.3.2lualogging
You need to have a LuaRocks mirror repository cloned and linked from config. Run this in your mirror_dir directory:
$ git clone https://github.com/rocks-moonscript-org/moonrocks-mirror.git ./Rocks2Git can be configured by specifying several environment variables described below.
All paths specified in the configuration file (rocks2git/config.lua) need to exist before the utility is run.
ROCKS2GIT_BASE_DIR- the base directory where everything else is located (defaults to the working directory)ROCKS2GIT_DATA_DIR- the base directory for all the generated data (defaults to${ROCKS2GIT_BASE_DIR}/data)ROCKS2GIT_MIRROR_DIR- directory containing the LuaRocks rockspec mirror repository (defaults to${ROCKS2GIT_DATA_DIR}/luarocks-mirror)ROCKS2GIT_REPO_DIR- base path for module repositories (defaults to${ROCKS2GIT_DATA_DIR}/repos)ROCKS2GIT_TEMP_DIR- temporary directory for LuaRocks downloaded modules (defaults to${ROCKS2GIT_DATA_DIR}/tmp)ROCKS2GIT_MANIFEST_FILE- manifest file with module dependencies (defaults to${ROCKS2GIT_DATA_DIR}/manifest-file)ROCKS2GIT_BLACKLIST_FILE- module blacklist file (defaults to${ROCKS2GIT_DATA_DIR}/module-blacklist)ROCKS2GIT_TRAVIS_FILE- Travis configuration template (defaults to${ROCKS2GIT_BASE_DIR}/travis_file.yml)
These are URLs for bash scripts which will be run by the Travis CI after wiring everything together. The names of the environment variables correspond to the names of the Travis CI events.
ROCKS2GIT_TRAVIS_BEFORE_INSTALL- defaults tohttps://raw.githubusercontent.com/LuaDist-core/travis-scripts/master/before_install.shROCKS2GIT_TRAVIS_SCRIPT- defaults tohttps://raw.githubusercontent.com/LuaDist-core/travis-scripts/master/script.shROCKS2GIT_TRAVIS_AFTER_SCRIPT- defaults tohttps://raw.githubusercontent.com/LuaDist-core/travis-scripts/master/after_script.shROCKS2GIT_LOG_DIR- log directory (defaults to${ROCKS2GIT_BASE_DIR}/logs)
ROCKS2GIT_GIT_USER_NAME- author of the Git commits (defaults toLunaCI)ROCKS2GIT_GIT_USER_MAIL- author's e-mail (defaults to[email protected])ROCKS2GIT_GIT_MODULE_SOURCE- module source endpoint - use %s in place of the module name (defaults togit://github.com/LuaDist2/%s.git)
This utility can be used in either batch or single mode.
In this mode, the utility processes all the modules from the LuaRocks mirror repository. Output is logged into a log file, which can be specified in config. You can also specify the level of logging.
$ lua ./rocks2git.luaIn this mode, only the module given on command line is processed. Output is logged to the console output on all levels.
$ lua ./rocks2git.lua module_nameTo push the generated Git repositories to Github, use the GitHub Pusher LuaDist utility.