envirius — universal virtual environments manager.
Usually this kind of tools narrowly specialized for a particular programming language. For example:
- virtualenv for python
- rvm for ruby
- kerl for erlang
- nvm/nodeenv for node.js
- and so on
But there are many cases when in one and the same environment you must have more
than one programming language. For example, to create an environment with
python2.6 and node.js 0.10.24. This idea underlies envirius.
Support for new programming languages are implemented as plug-ins.
At first:
$ git clone https://github.com/ekalinin/envirius.git
$ cd envirius
$ make installThen youd need to add into your .bashrc the following:
# activate envirius itself
# (mandatory part)
if [ -e "$HOME/.envirius/nv" ] ; then
. ~/.envirius/nv
fi
# auto environment activation
# when navigate to folder with '.envirius' file
# (optional part)
if [ -e ".envirius" ] && [ -f ".envirius" ]; then
nv on `cat .envirius`
fiYou can create environments for the following programming languages at the moment:
To check available plugins:
➥ nv ls-plugins
elixir
erlang
go
julia
node
python
rustTo check available versions for each plugin:
➥ nv ls-versions --rust --erlang
* rust:
0.1 0.2 0.3 0.4 0.5
0.6 0.7 0.8 0.9
* erlang:
R10B-0 R10B-10 R10B-1a R10B-2 R10B-3 R10B-4
R10B-5 R10B-6 R10B-7 R10B-8 R10B-9 R11B-0
R11B-1 R11B-2 R11B-3 R11B-4 R11B-5 R12B-0
R12B-1 R12B-2 R12B-3 R12B-4 R12B-5 R13A
R13B R13B01 R13B02-1 R13B02 R13B03 R13B04
R14A R14B R14B01 R14B02 R14B03 R14B04
R15B R15B01 R15B02 R15B02 R15B03-1 R15B03
R16A R16B R16B01 R16B02 R16B03-1 R16B03
17.0-rc1To create an environment:
➥ nv mk mixed-rust-erlang --rust=0.9 --erlang=17.0-rc1
Creating environment: mixed-rust-erlang ...
* installing rust==0.9 ...
* done (in 5 secs.)
* installing erlang==17.0-rc1 ...
* done (in 11 secs.)Get list of the environments:
➥ nv ls
Available environment(s):
mixed-rust-erlang
rust-0.9
erl-17-rc1To activate environment:
➥ nv on mixed-rust-erlang
Environment mixed-rust-erlang activated.To check if environment activated:
(mixed-rust-erlang) ➥ nv current
mixed-rust-erlangTo deactivate environment:
(mixed-rust-erlang) ➥ nv off
Environment mixed-rust-erlang was deactivated.All plugins are in the directory nv-plugins. If you need a new one
you should add it inside this directory.
In the simplest case you need to implement 2 functions in the plugin's body:
plug_list_versionswhich returns list of available versions of the pluginplug_url_for_downloadwhich returns full url for downloading tarball
If installation is not typical then you should implement plug_install
instead of plug_url_for_download. Default implementation of the
plug_install function is in the src/nv-commands/mk file.
plug_list_versions_columns_count— variable — number of the columns in the output of thenv ls-versionfor each pluginplug_list_versions_columns_size— variable — each column width in chars in the output of thenv ls-versionfor each pluginplug_post_install_actions— optional function — executes after installation. For examplepipinstallation in the python pluginplug_state— variable — if ==disabledthen plugin is not active and will not be account in the commands:- mk
- ls-versions
- ls-plugins
Here is an example of building hugo static
site generator under envirius with go plugin:
$ whereis go
go:
$ nv mk go-hudo-test --go=1.2.1
Creating environment: go-hudo-test ...
* installing go==1.2.1 ...
* done (in 8 secs.)
$ nv ls
Available environment(s):
go-hudo-test (go==1.2.1)
$ nv on go-hudo-test
(go-hudo-test) $ go get github.com/spf13/hugo
(go-hudo-test) $ cd $GOPATH/src/github.com/spf13/hugo
(go-hudo-test) $ go build -o hugo main.go
(go-hudo-test) $ cd -
(go-hudo-test) $ hugo version
Hugo Static Site Generator v0.11-dev- bash
- curl / wget
- tar
- git
- gcc
- bats
- ubuntu
Most of the code is covered by tests. For testing bats was used. To run tests:
➥ make tests
...
22 tests, 0 failuresSee CHANGELOG.md.
See LICENSE.