File tree Expand file tree Collapse file tree 2 files changed +15
-21
lines changed
Expand file tree Collapse file tree 2 files changed +15
-21
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ CONFIG := $(DIR)../dcs-modules.txt
66.PHONY : test-es6-compat update-deps update-app-version
77
88# Check if we are in a VIRTUAL_ENV:
9+ # the `NODE_VIRTUAL_ENV` variable is set by nodeenv after activating the environment.
910__c :
1011 $(if $(NODE_VIRTUAL_ENV ) ,,$($(warning ************ WARNING: NOT INSIDE A VIRTUAL ENV ************ ) ) )
1112
Original file line number Diff line number Diff line change 2525
26264 . Install the Scada.js dependencies:
2727
28+ $ ./venv
2829 (scadajs1) $ make install-deps CONF=../dcs-modules.txt
2930
30- 5 . Optional: Move your nodeenv to a central location and use it between projects:
31-
32- dest=$HOME/nodeenv/scadajs-1 # or anywhere you like
33- mv nodeenv/ $dest
34- echo "export SCADAJS_1_ENV='$dest'" >> ~ /.bashrc
31+ # Using virtual environment from within Tmux
3532
36- > Next time you can use: ` ./scada.js/venv `
33+ 1 . (Optional) Set the ` SCADAJS_VENV_PATH ` variable for the ` TARGET_TMUX_SESSION ` :
3734
38- # Preparing Tmux
35+ ``` bash
36+ tmux setenv -t ${TARGET_TMUX_SESSION} ' SCADAJS_VENV_PATH' /path/to/somewhere/scadajs1
37+ ```
3938
40- 1 . Add the following in your ` ~/.profile ` (or ` ~/.bashrc ` ) :
39+ 2 . On every new pane, manually activate your virtual environment by :
4140
4241``` bash
43- # For Tmux VirtualEnv support
44- tmux_get_var (){
45- local key=$1
46- [[ -n " $TMUX " ]] && tmux showenv | awk -F= -v key=" $key " ' $1==key {print $2}'
47- }
48-
49- # activate the virtual environment if it is declared
50- venv=$( tmux_get_var " VIRTUAL_ENV" )
51- if [ -n " $venv " ]; then
52- source $venv /bin/activate;
53- fi
42+ $ ./scada.js/venv
43+ (scadajs1) $
5444```
5545
56- 2 . Set the ` VIRTUAL_ENV ` variable for the target session:
46+ By setting the Tmux's ` SCADAJS_VENV_PATH ` variable, ` ./scada.js/venv ` script uses this
47+ virtual environment by default. If you want to start a different virtual environment in your
48+ new pane:
5749
5850``` bash
59- tmux setenv -t ${SESSION_NAME} ' VIRTUAL_ENV' /path/to/virtualenv/
51+ $ ./scada.js/venv /path/to/your/other/virtual-environment
52+ (something) $
6053```
6154
You can’t perform that action at this time.
0 commit comments