Skip to content

Commit 7ccebfc

Browse files
authored
Improved the install script (#48, fixes #38)
1 parent 8faf0ae commit 7ccebfc

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979

8080
"dependencies":
8181
{
82+
"colors" : "~1.1",
8283
"node-gyp" : "~3.6"
8384
},
8485

scripts/install.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
var mFS = require ("fs" );
1717
var mCrypto = require ("crypto");
1818
var mHTTP = require ("http" );
19+
var mColors = require ("colors/safe");
1920

2021

2122

@@ -39,7 +40,7 @@ var BINARY =
3940

4041
var SOURCE = REMOTE + process.env.npm_package_version + "/" + BINARY;
4142
var SIGS = REMOTE + process.env.npm_package_version + "/signatures.txt";
42-
var TARGET = "./Library/" + BINARY;
43+
var TARGET = "./lib/" + BINARY;
4344

4445
////////////////////////////////////////////////////////////////////////////////
4546
/// Fingerprint: ssh-rsa 4096 25:9D:39:06:78:19:07:7B:1C:85:31:6E:D1:FA:9B:EA
@@ -75,11 +76,13 @@ var target = mFS.createWriteStream (TARGET);
7576

7677
var genericFailure = function (details)
7778
{
78-
console.error
79-
("ERROR: robot-js binaries failed to install. " +
80-
"You will need to install them manually, see " +
81-
"http://getrobot.net/docs/node.html for more " +
82-
"information. Details: " + details);
79+
console.warn (mColors.yellow.bold (
80+
"WARNING: robot-js precompiled binaries could " +
81+
"not be downloaded, an attempt to compile them" +
82+
" manually will be made. For more information," +
83+
" please visit http://getrobot.net/docs/node.html." +
84+
" Details: " + details
85+
));
8386

8487
try
8588
{
@@ -95,22 +98,21 @@ var genericFailure = function (details)
9598

9699
var verifyFailure = function (details)
97100
{
98-
console.error
99-
("ERROR: robot-js binaries could not be verified. " +
100-
"This could be a result of a man-in-the-middle " +
101-
"attack. If you want to continue anyway, use the " +
102-
"following command to disable verification: 'npm " +
103-
"config set robot-js:verify false'. Details: " +
104-
details);
101+
console.error (mColors.red.bold (
102+
"ERROR: robot-js precompiled binaries could not " +
103+
"be verified. This could be a result of a man-in" +
104+
"-the-middle attack. If you want to continue " +
105+
"anyway, use the following command to disable" +
106+
" verification: 'npm config set robot-js:verify " +
107+
"false'. Details: " + details
108+
));
105109

106110
try
107111
{
108112
// Delete target binary
109113
mFS.unlinkSync (TARGET);
110114

111115
} catch (e) { }
112-
113-
process.exitCode = 1;
114116
};
115117

116118
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)