Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions bin/deepforge
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node
const yaml = require('js-yaml'),
os = require('os'),
const os = require('os'),
IS_WINDOWS = os.type() === 'WINDOWS_NT',
SHELL = IS_WINDOWS ? true : '/bin/bash',
HOME_DIR = os.homedir(),
Expand Down Expand Up @@ -35,10 +34,7 @@ var Command = require('commander').Command,
return dir;
};

const ENV_FILE = path.join(__dirname, '..', 'environment.yml'),
DEEPFORGE_CONDA_ENV =
yaml.safeLoad(fs.readFileSync(ENV_FILE)).name || process.env.DEEPFORGE_CONDA_ENV;

const DEEPFORGE_CONDA_ENV = 'deepforge';
const getDeepForgeServerCommand = function(useConda){
if(useConda){
return `${IS_WINDOWS ? 'conda': 'source'} activate ${DEEPFORGE_CONDA_ENV} && node`;
Expand Down Expand Up @@ -417,4 +413,4 @@ module.exports.SHELL = SHELL;

if (require.main === module) {
program.parse(process.argv);
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"start": "node ./bin/deepforge start",
"postinstall": "node utils/reinstall-extensions.js && node utils/build-job-utils.js && node utils/conda-utils.js",
"postinstall": "node utils/reinstall-extensions.js && node utils/build-job-utils.js",
"start-dev": "NODE_ENV=dev node ./bin/deepforge start",
"start-authenticated": "NODE_ENV=production ./bin/deepforge start",
"server": "node ./bin/deepforge start --server",
Expand Down
14 changes: 2 additions & 12 deletions utils/conda-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const {spawnSync, spawn} = require('child_process'),
fs = require('fs'),
yaml = require('js-yaml'),
CONDA_COMMAND = 'conda',
SHELL = os.type() === 'Windows_NT' ? true: '/bin/bash',
ENV_FILE = path.join(__dirname, '..', 'environment.yml');
SHELL = os.type() === 'Windows_NT' ? true: '/bin/bash';

const getCondaEnvs = function () {
const envProcess = spawnSyncCondaProcess(['env', 'list']);
Expand Down Expand Up @@ -76,15 +75,6 @@ const spawnSyncCondaProcess = function (args) {
});
};

const runMain = function () {
checkConda();
createOrUpdateEnvironment(ENV_FILE);
};

const CondaManager = {checkConda, createOrUpdateEnvironment};

if (require.main === module) {
runMain();
}

module.exports = CondaManager;
module.exports = CondaManager;