Skip to content

Commit

Permalink
improved README.rst; used debug options at npm
Browse files Browse the repository at this point in the history
installation;
  • Loading branch information
ekalinin committed Mar 29, 2011
1 parent 09f18dc commit fb37b80
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 24 deletions.
48 changes: 40 additions & 8 deletions README.rst
Expand Up @@ -21,21 +21,53 @@ Usage

The basic usage is::

$ python nve.py env-2.6
$ . env-2.6/bin/activate
(env-0.2.6) $ node -v
v0.2.6
(env-0.2.6) $ deactivate

$ python nve.py --node "0.4.3" --without-ssl --with-npm env-4.3
$ ./nve.py --without-ssl env
* Creating: ~/nodeenv/env/src ... done.
* Retrieve: http://nodejs.org/dist/node-v0.4.4.tar.gz ...
######################################################################## 100,0%
* Retrieve: http://nodejs.org/dist/node-v0.4.4.tar.gz ... done.
* Compile: ~/nodeenv/env/src/node-v0.4.4 ... done.
* Writing env/bin/activate ... done.

$ . env/bin/activate

(env-0.4.4) $ node -v
v0.4.4

(env-0.4.4) $ deactivate

$ ./nve.py --list
0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.1.0
0.1.2 0.1.3 0.1.4 0.1.5 0.1.6 0.1.7 0.1.8
0.1.10 0.1.11 0.1.12 0.1.13 0.1.14 0.1.15 0.1.16
0.1.18 0.1.19 0.1.20 0.1.21 0.1.22 0.1.23 0.1.24
0.1.26 0.1.27 0.1.28 0.1.29 0.1.30 0.1.31 0.1.32
0.1.90 0.1.91 0.1.92 0.1.93 0.1.94 0.1.95 0.1.96
0.1.98 0.1.99 0.1.100 0.1.101 0.1.102 0.1.103 0.1.104
0.2.1 0.2.2 0.2.3 0.2.4 0.2.5 0.2.6 0.3.0
0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8
0.4.1 0.4.2 0.4.3 0.4.4

$ ./nve.py --without-ssl --node "0.4.3" --with-npm env-4.3
* Creating: /home/shorrty/projects/my/nodeenv/env-4.3/src ... done.
* Retrieve: http://nodejs.org/dist/node-v0.4.3.tar.gz ...
######################################################################## 100,0%
* Retrieve: http://nodejs.org/dist/node-v0.4.3.tar.gz ... done.
* Compile: /home/shorrty/projects/my/nodeenv/env-4.3/src/node-v0.4.3 ... done.
* Writing env-4.3/bin/activate ... done.
* Install node.js package manager ... done.

$ . env-4.3/bin/activate

(env-0.4.3) $ node -v
v0.4.3

(env-0.4.3) $ npm -v
0.3.17
0.3.18

(env-0.4.3) $ deactivate

If you install it you can also just do ``nve ENV``.

Alternatives
------------
Expand Down
37 changes: 21 additions & 16 deletions nve.py
Expand Up @@ -7,15 +7,9 @@
nve - Node.js virtual environment
TODO:
- local installation:
* add nve.sh:
functions nve() {
NVE_HOME=$(cd $(dirname $0); pwd)
python $NVE_HOME/nve.py --передать параметры извне "$*" ??--
}
- add option --debug
- add option --profile
- compile log only for verbose mode
- local installation (without setup.py, package install)
- add option --debug for compile
- add option --profile for compile
- add setup.py
:copyright: (c) 2011 by Eugene Kalinin
Expand Down Expand Up @@ -205,12 +199,23 @@ def install_node(env_dir, src_dir, opt):
os.chdir(old_chdir)


def install_npm(env_dir, src_dir):
logger.info(' * Install node.js package manager ... ')
os.system('. %s && curl %s|bash && deactivate'%(
join(env_dir, 'bin', 'activate'),
'http://npmjs.org/install.sh'))
logger.info(' * Install node.js package manager ... done.')
def install_npm(env_dir, src_dir, opt):
if opt.debug:
logger.info(' * Install node.js package manager ... ')
os.system('. %s && curl %s|bash && deactivate'%(
join(env_dir, 'bin', 'activate'),
'http://npmjs.org/install.sh'))
logger.info(' * Install node.js package manager ... done.')
else:
logger.info(' * Install node.js package manager ... ',
extra=dict(continued=True))
npm = subprocess.Popen('. %s && curl %s|bash && deactivate'%(
join(env_dir, 'bin', 'activate'),
'http://npmjs.org/install.sh'), shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
npm.communicate()
logger.info('done.')



def install_activate(env_dir, opt):
Expand Down Expand Up @@ -241,7 +246,7 @@ def create_environment(env_dir, opt):
install_node(env_dir, dirs["src"], opt)
install_activate(env_dir, opt)
if opt.with_npm:
install_npm(env_dir, dirs["src"])
install_npm(env_dir, dirs["src"], opt)


def print_node_versions():
Expand Down

0 comments on commit fb37b80

Please sign in to comment.