diff --git a/.gitignore b/.gitignore index 0d20b64..928b2fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ *.pyc +README.md +build/ +dist/ +*.egg-info/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c8a2c2f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 un.def + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..9d5d250 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include LICENSE +include README.rst diff --git a/README.md b/README.md index d1f810e..0fa544a 100644 --- a/README.md +++ b/README.md @@ -7,49 +7,78 @@ Lua environment manager built on top of [hererocks](https://github.com/mpeterv/h ### Installation -... +1. Install `luamb` (`hererocks` will be installed automatically): +``` +$ pip install luamb +``` + +2. Create directory for envs: +``` +$ mkdir $HOME/.luambenvs +``` + +3. Configure your shell (add these lines to `~/.bashrc`): +``` +export LUAMB_DIR=$HOME/.luambenvs +source /usr/local/bin/luamb.sh # default path in Debian if luamb has been installed globally +# optional variables: +# LUAMB_LUA_DEFAULT=lua5.3 # default Lua version +# LUAMB_LUAROCKS_DEFAULT=latest # default LuaRocks version +# LUAMB_PYTHON_BIN=/usr/bin/python3 # explicitly set Python executable +``` + +4. Try to execute in new shell: +``` +$ luamb --help +``` ### Examples -* create environment 'myproject' with latest Lua 5.2 (5.2.4), latest LuaRocks and associate it with /home/user/projects/myproject: +* Create environment 'myproject' with latest Lua 5.2 (5.2.4), latest LuaRocks and associate it with /home/user/projects/myproject: ``` $ luamb mk myproject -l 5.2 -r latest -a /home/user/projects/myproject ``` -* set LuaJIT 2.0 (2.0.4) and latest LuaRocks version by default: +* Create environment 'jittest' with LuaJIT 2.0.4, without LuaRocks and associate it with /home/user/projects/jitproj: +``` +$ luamb mk myproject -j 2.0.4 -a /home/user/projects/jitproj +``` + +* Set LuaJIT 2.0 (2.0.4) and latest LuaRocks version by default: ``` $ export LUAMB_LUA_DEFAULT=luajit2.0 $ export LUAMB_LUAROCKS_DEFAULT=latest ``` -* create environment 'newenv' with default versions and without associated project directory: +* Create environment 'newenv' with default versions and without associated project directory: ``` $ luamb mk newenv ``` -* create environment 'norocks' with default Lua version (LuaJIT 2.0.4) and without LuaRocks (verbose mode): +* Create environment 'norocks' with default Lua version (LuaJIT 2.0.4) and without LuaRocks (verbose mode): ``` $ luamb mk norocs --no-luarocks --verbose ``` -* activate 'newenv' environment: +* Activate 'newenv' environment: ``` $ luamb on newenv ``` -* deactivate current environment: +* Deactivate current environment: ``` $ luamb off ``` -* delete 'myproject' environment (it will remove env dir only, not project dir): +* Delete 'myproject' environment (it will remove env dir only, not project dir): ``` $ luamb rm myproject ``` + ### Commands Each command has one or more alias. diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..bc2fea9 --- /dev/null +++ b/README.rst @@ -0,0 +1,109 @@ +(🌑) luamb +========= + +Lua environment manager built on top of +`hererocks `__. + +Installation +~~~~~~~~~~~~ + +1. Install ``luamb`` (``hererocks`` will be installed automatically): + + :: + + $ pip install luamb + +2. Create directory for envs: + + :: + + $ mkdir $HOME/.luambenvs + +3. Configure your shell (add these lines to ``~/.bashrc``): + + :: + + export LUAMB_DIR=$HOME/.luambenvs + source /usr/local/bin/luamb.sh # default path in Debian if luamb has been installed globally + # optional variables: + # LUAMB_LUA_DEFAULT=lua5.3 # default Lua version + # LUAMB_LUAROCKS_DEFAULT=latest # default LuaRocks version + # LUAMB_PYTHON_BIN=/usr/bin/python3 # explicitly set Python executable + +4. Try to execute in new shell: + + :: + + $ luamb --help + +Examples +~~~~~~~~ + +- Create environment 'myproject' with latest Lua 5.2 (5.2.4), latest + LuaRocks and associate it with /home/user/projects/myproject: + + :: + + $ luamb mk myproject -l 5.2 -r latest -a /home/user/projects/myproject + +- Create environment 'jittest' with LuaJIT 2.0.4, without LuaRocks and + associate it with /home/user/projects/jitproj: + + :: + + $ luamb mk myproject -j 2.0.4 -a /home/user/projects/jitproj + +- Set LuaJIT 2.0 (2.0.4) and latest LuaRocks version by default: + + :: + + $ export LUAMB_LUA_DEFAULT=luajit2.0 + $ export LUAMB_LUAROCKS_DEFAULT=latest + +- Create environment 'newenv' with default versions and without + associated project directory: + + :: + + $ luamb mk newenv + +- Create environment 'norocks' with default Lua version (LuaJIT 2.0.4) + and without LuaRocks (verbose mode): + + :: + + $ luamb mk norocs --no-luarocks --verbose + +- Activate 'newenv' environment: + + :: + + $ luamb on newenv + +- Deactivate current environment: + + :: + + $ luamb off + +- Delete 'myproject' environment (it will remove env dir only, not + project dir): + + :: + + $ luamb rm myproject + +Commands +~~~~~~~~ + +Each command has one or more alias. + +``on`` \| ``activate`` — activate existing environment + +``off`` \| ``disable`` — deactivate current environment + +``mk`` \| ``new`` \| ``create`` — create new environment + +``rm`` \| ``remove`` \| ``del`` — delete existing environment + +``ls`` \| ``list`` — list all environments diff --git a/luamb.py b/luamb.py index e050ba6..2b7ef41 100644 --- a/luamb.py +++ b/luamb.py @@ -10,6 +10,10 @@ from collections import OrderedDict +__author__ = 'un.def ' +__version__ = '0.1.0' + + def error(msg, exit_status=1): print(msg) sys.exit(exit_status) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d6460a3 --- /dev/null +++ b/setup.py @@ -0,0 +1,40 @@ +import os +import re + +from setuptools import setup + + +os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) + + +with open('README.rst') as f: + long_description = f.read() + +with open('luamb.py') as f: + author, author_email, version = re.search( + "__author__ = '(.+) <(.+)>'.+__version__ = '([.0-9]+)'", + f.read(), + flags=re.DOTALL + ).groups() + + +setup( + name='luamb', + version=version, + py_modules=['luamb'], + scripts=['luamb.sh'], + install_requires=['hererocks'], + license='MIT', + description='Lua environment manager', + long_description=long_description, + url='https://github.com/un-def/luamb', + author=author, + author_email=author_email, + classifiers=[ + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 3', + ], +)