1..9 not ok 1 TOC for local README.md # (from function `assert_equal' in file tests/test_helper.bash, line 7, # in test file tests/tests.bats, line 12) # `assert_equal "${lines[2]}" " * [gh-md-toc](#gh-md-toc)"' failed # expected: * [gh-md-toc

gh-md-toc — is for you if you want to generate TOC for README.md or GitHub's wiki page and don't want to install any additional software.

It's my try to fix a problem:

gh-md-toc is able to process:

gh-md-toc tested on Ubuntu only. If you want it on Mac OS X or Windows you better to use a golang based implementation:

It's more solid, reliable and with ability of a parallel processing. And absolutely without dependencies.

Build Status

Table of contents

Installation

$ wget https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc $ chmod a x gh-md-toc

Usage

STDIN

Here's an example of TOC creating for markdown from STDIN:

➥ cat ~/projects/Dockerfile.vim/README.md | ./gh-md-toc -   * [Dockerfile.vim](#dockerfilevim)   * [Screenshot](#screenshot)   * [Installation](#installation)         * [OR using Pathogen:](#or-using-pathogen)         * [OR using Vundle:](#or-using-vundle)   * [License](#license)

Local files

Here's an example of TOC creating for a local README.md:

➥ ./gh-md-toc ~/projects/Dockerfile.vim/README.md                                                                                                                                                Вс. марта 22 22:51:46 MSK 2015  Table of Contents =================    * [Dockerfile.vim](#dockerfilevim)   * [Screenshot](#screenshot)   * [Installation](#installation)         * [OR using Pathogen:](#or-using-pathogen)         * [OR using Vundle:](#or-using-vundle)   * [License](#license)

Remote files

And here's an example, when you have a README.md like this:

And you want to generate TOC for it.

There is nothing easier:

➥ ./gh-md-toc https://github.com/ekalinin/envirius/blob/master/README.md  Table of Contents =================    * [envirius](#envirius)     * [Idea](#idea)     * [Features](#features)   * [Installation](#installation)   * [Uninstallation](#uninstallation)   * [Available plugins](#available-plugins)   * [Usage](#usage)     * [Check available plugins](#check-available-plugins)     * [Check available versions for each plugin](#check-available-versions-for-each-plugin)     * [Create an environment](#create-an-environment)     * [Activate/deactivate environment](#activatedeactivate-environment)       * [Activating in a new shell](#activating-in-a-new-shell)       * [Activating in the same shell](#activating-in-the-same-shell)     * [Get list of environments](#get-list-of-environments)     * [Get current activated environment](#get-current-activated-environment)     * [Do something in environment without enabling it](#do-something-in-environment-without-enabling-it)     * [Get help](#get-help)     * [Get help for a command](#get-help-for-a-command)   * [How to add a plugin?](#how-to-add-a-plugin)     * [Mandatory elements](#mandatory-elements)       * [plug_list_versions](#plug_list_versions)       * [plug_url_for_download](#plug_url_for_download)       * [plug_build](#plug_build)     * [Optional elements](#optional-elements)       * [Variables](#variables)       * [Functions](#functions)     * [Examples](#examples)   * [Example of the usage](#example-of-the-usage)   * [Dependencies](#dependencies)   * [Supported OS](#supported-os)   * [Tests](#tests)   * [Version History](#version-history)   * [License](#license)   * [README in another language](#readme-in-another-language)

That's all! Now all you need — is copy/paste result from console into original README.md.

And here is a result:

Moreover, it's able to work with GitHub's wiki pages:

➥ ./gh-md-toc https://github.com/ekalinin/nodeenv/wiki/Who-Uses-Nodeenv  Table of Contents =================    * [Who Uses Nodeenv?](#who-uses-nodeenv)     * [OpenStack](#openstack)     * [pre-commit.com](#pre-commitcom)

Multiple files

It supports multiple files as well:

➥ ./gh-md-toc \     https://github.com/aminb/rust-for-c/blob/master/hello_world/README.md \     https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md \     https://github.com/aminb/rust-for-c/blob/master/primitive_types_and_operators/README.md \     https://github.com/aminb/rust-for-c/blob/master/unique_pointers/README.md    * [Hello world](https://github.com/aminb/rust-for-c/blob/master/hello_world/README.md#hello-world)    * [Control Flow](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#control-flow)     * [If](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#if)     * [Loops](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#loops)     * [For loops](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#for-loops)     * [Switch/Match](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#switchmatch)     * [Method call](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#method-call)    * [Primitive Types and Operators](https://github.com/aminb/rust-for-c/blob/master/primitive_types_and_operators/README.md#primitive-types-and-operators)    * [Unique Pointers](https://github.com/aminb/rust-for-c/blob/master/unique_pointers/README.md#unique-pointers)

Combo

You can easily combine both ways:

➥ ./gh-md-toc \     ~/projects/Dockerfile.vim/README.md \     https://github.com/ekalinin/sitemap.s/blob/master/README.md    * [Dockerfile.vim](~/projects/Dockerfile.vim/README.md#dockerfilevim)   * [Screenshot](~/projects/Dockerfile.vim/README.md#screenshot)   * [Installation](~/projects/Dockerfile.vim/README.md#installation)         * [OR using Pathogen:](~/projects/Dockerfile.vim/README.md#or-using-pathogen)         * [OR using Vundle:](~/projects/Dockerfile.vim/README.md#or-using-vundle)   * [License](~/projects/Dockerfile.vim/README.md#license)    * [sitemap.js](https://github.com/ekalinin/sitemap.js/blob/master/README.md#sitemapjs)     * [Installation](https://github.com/ekalinin/sitemap.js/blob/master/README.md#installation)     * [Usage](https://github.com/ekalinin/sitemap.js/blob/master/README.md#usage)     * [License](https://github.com/ekalinin/sitemap.js/blob/master/README.md#license)  Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)

Tests

Done with bats. Useful articles:

How to run tests:

➥ make test                                                                                                                                                                                                      Пн. марта 23 13:59:27 MSK 2015  ✓ TOC for local README.md  ✓ TOC for remote README.md  ✓ TOC for mixed README.md (remote/local)  ✓ TOC for markdown from stdin  ✓ --help  ✓ --version  6 tests, 0 failures

Dependency](#gh-md-toc) # actual: * [gh-md-toc](#gh-md-toc) not ok 2 TOC for remote README.md # (from function `assert_equal' in file tests/test_helper.bash, line 7, # in test file tests/tests.bats, line 33) # `assert_equal "${lines[2]}" " * [sitemap.js](#sitemapjs)"' failed # expected: * [sitemap.js

sitemap.js is a high-level sitemap-generating framework that makes creating sitemap XML files easy.

Installation

It's recommended to install via npm:

npm install --save sitemap 

Usage

Here's an example of using sitemap.js with express:

var express = require('express')   , sm = require('sitemap');  var app = express.createServer()   , sitemap = sm.createSitemap ({       hostname: 'http://example.com',       cacheTime: 600000,        // 600 sec - cache purge period       urls: [         { url: '/page-1/',  changefreq: 'daily', priority: 0.3 },         { url: '/page-2/',  changefreq: 'monthly',  priority: 0.7 },         { url: '/page-3/'},    // changefreq: 'weekly',  priority: 0.5         { url: '/page-4/,   img: "http://urlTest.com" }       ]     });  app.get('/sitemap.xml', function(req, res) {   sitemap.toXML( function (xml) {       res.header('Content-Type', 'application/xml');       res.send( xml );   }); });  app.listen(3000);

And here is an example of synchronous sitemap.js usage:

var express = require('express')   , sm = require('sitemap');  var app = express.createServer()   , sitemap = sm.createSitemap ({       hostname: 'http://example.com',       cacheTime: 600000,  // 600 sec cache period       urls: [         { url: '/page-1/',  changefreq: 'daily', priority: 0.3 },         { url: '/page-2/',  changefreq: 'monthly',  priority: 0.7 },         { url: '/page-3/' } // changefreq: 'weekly',  priority: 0.5       ]     });  app.get('/sitemap.xml', function(req, res) {   res.header('Content-Type', 'application/xml');   res.send( sitemap.toString() ); });  app.listen(3000);

Example of dynamic page manipulations into sitemap:

var sitemap = sm.createSitemap ({       hostname: 'http://example.com',       cacheTime: 600000     }); sitemap.add({url: '/page-1/'}); sitemap.add({url: '/page-2/', changefreq: 'monthly', priority: 0.7}); sitemap.del({url: '/page-2/'}); sitemap.del('/page-1/');

License

See LICENSE file.

Something went wrong with that request. Please try again.
](#sitemapjs) # actual: * [sitemap.js](#sitemapjs) not ok 3 TOC for mixed README.md (remote/local) # (from function `assert_equal' in file tests/test_helper.bash, line 7, # in test file tests/tests.bats, line 46) # `assert_equal "${lines[0]}" " * [gh-md-toc](README.md#gh-md-toc)"' failed # expected: * [gh-md-toc

gh-md-toc — is for you if you want to generate TOC for README.md or GitHub's wiki page and don't want to install any additional software.

It's my try to fix a problem:

gh-md-toc is able to process:

gh-md-toc tested on Ubuntu only. If you want it on Mac OS X or Windows you better to use a golang based implementation:

It's more solid, reliable and with ability of a parallel processing. And absolutely without dependencies.

Build Status

Table of contents

Installation

$ wget https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc $ chmod a x gh-md-toc

Usage

STDIN

Here's an example of TOC creating for markdown from STDIN:

➥ cat ~/projects/Dockerfile.vim/README.md | ./gh-md-toc -   * [Dockerfile.vim](#dockerfilevim)   * [Screenshot](#screenshot)   * [Installation](#installation)         * [OR using Pathogen:](#or-using-pathogen)         * [OR using Vundle:](#or-using-vundle)   * [License](#license)

Local files

Here's an example of TOC creating for a local README.md:

➥ ./gh-md-toc ~/projects/Dockerfile.vim/README.md                                                                                                                                                Вс. марта 22 22:51:46 MSK 2015  Table of Contents =================    * [Dockerfile.vim](#dockerfilevim)   * [Screenshot](#screenshot)   * [Installation](#installation)         * [OR using Pathogen:](#or-using-pathogen)         * [OR using Vundle:](#or-using-vundle)   * [License](#license)

Remote files

And here's an example, when you have a README.md like this:

And you want to generate TOC for it.

There is nothing easier:

➥ ./gh-md-toc https://github.com/ekalinin/envirius/blob/master/README.md  Table of Contents =================    * [envirius](#envirius)     * [Idea](#idea)     * [Features](#features)   * [Installation](#installation)   * [Uninstallation](#uninstallation)   * [Available plugins](#available-plugins)   * [Usage](#usage)     * [Check available plugins](#check-available-plugins)     * [Check available versions for each plugin](#check-available-versions-for-each-plugin)     * [Create an environment](#create-an-environment)     * [Activate/deactivate environment](#activatedeactivate-environment)       * [Activating in a new shell](#activating-in-a-new-shell)       * [Activating in the same shell](#activating-in-the-same-shell)     * [Get list of environments](#get-list-of-environments)     * [Get current activated environment](#get-current-activated-environment)     * [Do something in environment without enabling it](#do-something-in-environment-without-enabling-it)     * [Get help](#get-help)     * [Get help for a command](#get-help-for-a-command)   * [How to add a plugin?](#how-to-add-a-plugin)     * [Mandatory elements](#mandatory-elements)       * [plug_list_versions](#plug_list_versions)       * [plug_url_for_download](#plug_url_for_download)       * [plug_build](#plug_build)     * [Optional elements](#optional-elements)       * [Variables](#variables)       * [Functions](#functions)     * [Examples](#examples)   * [Example of the usage](#example-of-the-usage)   * [Dependencies](#dependencies)   * [Supported OS](#supported-os)   * [Tests](#tests)   * [Version History](#version-history)   * [License](#license)   * [README in another language](#readme-in-another-language)

That's all! Now all you need — is copy/paste result from console into original README.md.

And here is a result:

Moreover, it's able to work with GitHub's wiki pages:

➥ ./gh-md-toc https://github.com/ekalinin/nodeenv/wiki/Who-Uses-Nodeenv  Table of Contents =================    * [Who Uses Nodeenv?](#who-uses-nodeenv)     * [OpenStack](#openstack)     * [pre-commit.com](#pre-commitcom)

Multiple files

It supports multiple files as well:

➥ ./gh-md-toc \     https://github.com/aminb/rust-for-c/blob/master/hello_world/README.md \     https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md \     https://github.com/aminb/rust-for-c/blob/master/primitive_types_and_operators/README.md \     https://github.com/aminb/rust-for-c/blob/master/unique_pointers/README.md    * [Hello world](https://github.com/aminb/rust-for-c/blob/master/hello_world/README.md#hello-world)    * [Control Flow](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#control-flow)     * [If](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#if)     * [Loops](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#loops)     * [For loops](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#for-loops)     * [Switch/Match](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#switchmatch)     * [Method call](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#method-call)    * [Primitive Types and Operators](https://github.com/aminb/rust-for-c/blob/master/primitive_types_and_operators/README.md#primitive-types-and-operators)    * [Unique Pointers](https://github.com/aminb/rust-for-c/blob/master/unique_pointers/README.md#unique-pointers)

Combo

You can easily combine both ways:

➥ ./gh-md-toc \     ~/projects/Dockerfile.vim/README.md \     https://github.com/ekalinin/sitemap.s/blob/master/README.md    * [Dockerfile.vim](~/projects/Dockerfile.vim/README.md#dockerfilevim)   * [Screenshot](~/projects/Dockerfile.vim/README.md#screenshot)   * [Installation](~/projects/Dockerfile.vim/README.md#installation)         * [OR using Pathogen:](~/projects/Dockerfile.vim/README.md#or-using-pathogen)         * [OR using Vundle:](~/projects/Dockerfile.vim/README.md#or-using-vundle)   * [License](~/projects/Dockerfile.vim/README.md#license)    * [sitemap.js](https://github.com/ekalinin/sitemap.js/blob/master/README.md#sitemapjs)     * [Installation](https://github.com/ekalinin/sitemap.js/blob/master/README.md#installation)     * [Usage](https://github.com/ekalinin/sitemap.js/blob/master/README.md#usage)     * [License](https://github.com/ekalinin/sitemap.js/blob/master/README.md#license)  Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)

Tests

Done with bats. Useful articles:

How to run tests:

➥ make test                                                                                                                                                                                                      Пн. марта 23 13:59:27 MSK 2015  ✓ TOC for local README.md  ✓ TOC for remote README.md  ✓ TOC for mixed README.md (remote/local)  ✓ TOC for markdown from stdin  ✓ --help  ✓ --version  6 tests, 0 failures

Dependency](README.md#gh-md-toc) # actual: * [gh-md-toc](README.md#gh-md-toc) not ok 4 TOC for markdown from stdin # (in test file tests/tests.bats, line 65) # `cat README.md | {' failed # expected: * [gh-md-toc

gh-md-toc — is for you if you want to generate TOC for README.md or GitHub's wiki page and don't want to install any additional software.

It's my try to fix a problem:

gh-md-toc is able to process:

gh-md-toc tested on Ubuntu only. If you want it on Mac OS X or Windows you better to use a golang based implementation:

It's more solid, reliable and with ability of a parallel processing. And absolutely without dependencies.

Build Status

Table of contents

Installation

$ wget https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc $ chmod a x gh-md-toc

Usage

STDIN

Here's an example of TOC creating for markdown from STDIN:

➥ cat ~/projects/Dockerfile.vim/README.md | ./gh-md-toc - * [Dockerfile.vim](#dockerfilevim) * [Screenshot](#screenshot) * [Installation](#installation) * [OR using Pathogen:](#or-using-pathogen) * [OR using Vundle:](#or-using-vundle) * [License](#license)

Local files

Here's an example of TOC creating for a local README.md:

➥ ./gh-md-toc ~/projects/Dockerfile.vim/README.md                                                                                                                                                Вс. марта 22 22:51:46 MSK 2015  Table of Contents =================  * [Dockerfile.vim](#dockerfilevim) * [Screenshot](#screenshot) * [Installation](#installation) * [OR using Pathogen:](#or-using-pathogen) * [OR using Vundle:](#or-using-vundle) * [License](#license)

Remote files

And here's an example, when you have a README.md like this:

And you want to generate TOC for it.

There is nothing easier:

➥ ./gh-md-toc https://github.com/ekalinin/envirius/blob/master/README.md  Table of Contents =================  * [envirius](#envirius) * [Idea](#idea) * [Features](#features) * [Installation](#installation) * [Uninstallation](#uninstallation) * [Available plugins](#available-plugins) * [Usage](#usage) * [Check available plugins](#check-available-plugins) * [Check available versions for each plugin](#check-available-versions-for-each-plugin) * [Create an environment](#create-an-environment) * [Activate/deactivate environment](#activatedeactivate-environment) * [Activating in a new shell](#activating-in-a-new-shell) * [Activating in the same shell](#activating-in-the-same-shell) * [Get list of environments](#get-list-of-environments) * [Get current activated environment](#get-current-activated-environment) * [Do something in environment without enabling it](#do-something-in-environment-without-enabling-it) * [Get help](#get-help) * [Get help for a command](#get-help-for-a-command) * [How to add a plugin?](#how-to-add-a-plugin) * [Mandatory elements](#mandatory-elements) * [plug_list_versions](#plug_list_versions) * [plug_url_for_download](#plug_url_for_download) * [plug_build](#plug_build) * [Optional elements](#optional-elements) * [Variables](#variables) * [Functions](#functions) * [Examples](#examples) * [Example of the usage](#example-of-the-usage) * [Dependencies](#dependencies) * [Supported OS](#supported-os) * [Tests](#tests) * [Version History](#version-history) * [License](#license) * [README in another language](#readme-in-another-language)

That's all! Now all you need — is copy/paste result from console into original README.md.

And here is a result:

Moreover, it's able to work with GitHub's wiki pages:

➥ ./gh-md-toc https://github.com/ekalinin/nodeenv/wiki/Who-Uses-Nodeenv  Table of Contents =================  * [Who Uses Nodeenv?](#who-uses-nodeenv) * [OpenStack](#openstack) * [pre-commit.com](#pre-commitcom)

Multiple files

It supports multiple files as well:

➥ ./gh-md-toc     https://github.com/aminb/rust-for-c/blob/master/hello_world/README.md     https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md     https://github.com/aminb/rust-for-c/blob/master/primitive_types_and_operators/README.md     https://github.com/aminb/rust-for-c/blob/master/unique_pointers/README.md  * [Hello world](https://github.com/aminb/rust-for-c/blob/master/hello_world/README.md#hello-world)  * [Control Flow](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#control-flow) * [If](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#if) * [Loops](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#loops) * [For loops](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#for-loops) * [Switch/Match](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#switchmatch) * [Method call](https://github.com/aminb/rust-for-c/blob/master/control_flow/README.md#method-call)  * [Primitive Types and Operators](https://github.com/aminb/rust-for-c/blob/master/primitive_types_and_operators/README.md#primitive-types-and-operators)  * [Unique Pointers](https://github.com/aminb/rust-for-c/blob/master/unique_pointers/README.md#unique-pointers)

Combo

You can easily combine both ways:

➥ ./gh-md-toc     ~/projects/Dockerfile.vim/README.md     https://github.com/ekalinin/sitemap.s/blob/master/README.md  * [Dockerfile.vim](~/projects/Dockerfile.vim/README.md#dockerfilevim) * [Screenshot](~/projects/Dockerfile.vim/README.md#screenshot) * [Installation](~/projects/Dockerfile.vim/README.md#installation) * [OR using Pathogen:](~/projects/Dockerfile.vim/README.md#or-using-pathogen) * [OR using Vundle:](~/projects/Dockerfile.vim/README.md#or-using-vundle) * [License](~/projects/Dockerfile.vim/README.md#license)  * [sitemap.js](https://github.com/ekalinin/sitemap.js/blob/master/README.md#sitemapjs) * [Installation](https://github.com/ekalinin/sitemap.js/blob/master/README.md#installation) * [Usage](https://github.com/ekalinin/sitemap.js/blob/master/README.md#usage) * [License](https://github.com/ekalinin/sitemap.js/blob/master/README.md#license)  Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)

Tests

Done with bats. Useful articles:

How to run tests:

➥ make test                                                                                                                                                                                                      Пн. марта 23 13:59:27 MSK 2015 ✓ TOC for local README.md ✓ TOC for remote README.md ✓ TOC for mixed README.md (remote/local) ✓ TOC for markdown from stdin ✓ --help ✓ --version  6 tests, 0 failures

Dependency](#gh-md-toc) # actual: * [gh-md-toc](#gh-md-toc) ok 5 --help ok 6 no arguments ok 7 --version not ok 8 TOC for non-english chars, #6, #10 # (from function `assert_equal' in file tests/test_helper.bash, line 7, # in test file tests/tests.bats, line 113) # `assert_equal "${lines[2]}" " * [envirius](#envirius)"' failed # expected: * [envirius

envirius — универсальный менеджер виртуальных окружений.

Идея

Обычно подобные утилиты узко специализированы под какой-то конкретный язык программирования. Например:

Но не редки случаи, когда в одном и том же окружении необходимо иметь более одного языка программирования. Например, создать виртуальное окружение с python2.6 и node.js 0.10.24. Именно такая идея и лежит в основе envirius.

Кроме того, поддержка новых языков программирования реализована в виде плагинов. То есть, процедура добавления поддержки нового языка максимальна унифицирована (подробности — см. ниже).

Особенности

Установка

Установка тривиальна:

$ git clone git@github.com:ekalinin/envirius.git $ cd envirius $ make install

Далее, необходимо прописать в своём .bashrc файле следующие комманды:

[ -f "$HOME/.envirius/nv" ] && . ~/.envirius/nv

Удаление

Удаление так же тривиально, как и установка:

$ cd envirius $ make uninstall

Доступные плагины

В настоящий момент виртуальные окружения можно создавать для следующих языков программирования:

Как пользоваться?

Список поддерживаемых плагинов

➥ nv ls-plugins elixir elixir-prebuilt erlang go-prebuilt haskell haskell-prebuilt julia node node-prebuilt python rust rust-prebuilt scala

В настоящее время есть 2 типа плагинов:

Очевидно, что работа со вторым вариантом будет гораздо быстрее, так как сборка, порой, занимает значительное время.

К сожалению, не все языки доступны в предварительно собранных пакетах. Поэтому *-prebuilt плагинов меньше, чем плагинов, которые собираются из исходных кодов.

Cписок доступных версий для каждого из плагинов

➥ 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-rc1

Создать окружение

➥ 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.)

Если необходимо активировать окружение сразу после создания, то:

➥ nv mk mixed-rust-erlang --rust=0.9 --erlang=17.0-rc1 --on Creating environment: mixed-rust-erlang ... .... Environment mixed-rust-erlang activated. (mixed-rust-erlang) ➥ 

Активация/деактивация окружения

Активация в новой оболочке

По-умолчанию, окружение активируется в новой shell-оболочке:

echo $$ 112 ➥ nv on mixed-rust-erlang Environment mixed-rust-erlang activated. (mixed-rust-erlang) ➥  echo $$ 3437

То есть, чтобы выключить окружение, необходимо выйти из новой оболочки, то есть, использовать exit или Ctrl-D:

(mixed-rust-erlang) ➥  echo $$ 3437 (mixed-rust-erlang) ➥  exitecho $$ 112

Начиная с версии 0.7.2 можно использовать nv off во всех случаях для выхода из окружения.

Активация в текущей оболочке

Если необходимо активировать окружение в текущем экземпляре оболочки, то:

echo $$ 5099 ➥ nv on --same-shell mixed-rust-erlang Environment mixed-rust-erlang activated. (mixed-rust-erlang) ➥  echo $$ 5099

Чтобы выйти из окружения используйте nv off, а не exit:

(mixed-rust-erlang) ➥  echo $$ 5099 (mixed-rust-erlang) ➥ nv off Environment mixed-rust-erlang was deactivated. ➥  echo $$ 5099

Cписок окружений

➥ nv ls Available environment(s): mixed-rust-erlang rust-0.9 erl-17-rc1

Активное окружение

(mixed-rust-erlang) ➥ nv current mixed-rust-erlang

Если никакого окружения не активировано, то вернется пустая строка:

➥ nv current ➥ 

Выполнить команду в окружении без активации

➥ nv do node-0.10.26 'npm -g ls'

Помощь

➥ nv --help

Помощь для команды

Например, для команды do:

➥ nv do --help

Как добавить плагин?

Плагины находятся в директории nv-plugins. То есть, чтобы добавить плагин, нужно разместить его именно в этой директории.

Обязательные элементы

Если вы делаете плагин, который будет собирать всё сам из исходников, то в самом типовом случае достаточно реализовать 2 функции:

plug_list_versions

Эта функция должна возвращать список доступных версий плагина. Например:

plug_list_versions() {     local versions=$(curl -s "http://nodejs.org/dist" | \                 grep -v "node-" | \                 egrep -o '[0-9] \.[0-9] \.[0-9] ' | \                 sort -u -k 1,1n -k 2,2n -k 3,3n -t .)     echo $versions }

plug_url_for_download

Эта функция должна возвращать полный url для скачивания архива для установки плагина. Например:

plug_url_for_download() {     local version=$1     echo "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz" }

plug_build

Эта функция необходимо лишь тогда, когда вы делаете плагин для предварительно собранного языка и необходимо лишь скачать архив и распокавать его. Эта функция переопределяет процесс сборки, так как в этом случае, сборка нам не нужно, а нужно лишь скопировать бинарники. Например:

plug_build() {     local src_path=$1     local build_path=$2     cp -r "$src_path"/*/* "$build_path" }

Если процедура установки плагина не типична, то можно вместо функции plug_url_for_download (или в дополнение к ней) объявить функцию plug_install, реализующую полную логику сборки плагина и его установки в новое виртуальное окружение. Дефолтную реализацию этой функции можно посмотреть в файле src/nv-commands/mk.

Необязательные элементы

Переменные

Функции

Функции перечислены в порядке их вызова в плагине:

Зависимости

Поддерживаемые ОС

Тестирование

Большая часть кода покрыта тестами. Для тестирования использован фреймворк bats. Чтобы выполнить тесты:

➥ make tests

С горячим кэшем (то есть, например, исходники elang/rust уже скачаны и собраны бинарники) на Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz с 4 GB of RAM в Ubuntu 13.10 (32-bits) тесты занимают:

time make tests ...  100 tests, 0 failure  real    8m26.572s user    1m17.428s sys     2m25.352s

История изменений

См. файл CHANGELOG.md.

Лицензия

См. файл LICENSE.

Something went wrong with that request. Please try again.
](#envirius) # actual: * [envirius](#envirius) not ok 9 TOC for text with backquote, #13 # (from function `assert_equal' in file tests/test_helper.bash, line 7, # in test file tests/tests.bats, line 143) # `assert_equal "${lines[2]}" " * [The command foo1 ](#the-command-foo1)"' failed # expected: * [The command foo1

Blabla...

The command foo2 is better

Blabla...

The command bar1

Blabla...

The command bar2 is better

Blabla...

The command bar3 is the best](#the-command-foo1) # actual: * [The command foo1 ](#the-command-foo1) # make: *** [Makefile:6: test] Error 1