forked from gemini-testing/gemini
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgemini
More file actions
executable file
·33 lines (29 loc) · 987 Bytes
/
Copy pathgemini
File metadata and controls
executable file
·33 lines (29 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env node
'use strict';
var path = require('path'),
resolve = require('resolve'),
chalk = require('chalk'),
ownVersion = require('../package.json').version;
function getCliModule() {
var localPackage;
try {
// try local module first
localPackage = resolve.sync('gemini/package.json', {
basedir: process.cwd()
});
} catch (e) {
// if fails, use global package
return '../lib/cli';
}
var localModule = path.dirname(localPackage),
localVersion = require(localPackage).version;
if (ownVersion !== localVersion) {
console.error(chalk.yellow('WARNING'));
console.error('Running local gemini from %s', chalk.cyan(localModule));
console.error('Version: %s', chalk.red(localVersion));
console.error('Global: %s', chalk.green(ownVersion));
console.error('');
}
return path.join(localModule, 'lib', 'cli');
}
require(getCliModule()).run();