Skip to content

Commit

Permalink
bump to v0.4.x and enforce https - closes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Jan 24, 2014
1 parent 86de239 commit 57c9a77
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# node-pre-gyp changelog

## Future
## 0.4.0
- Enforce only `https:` based remote publishing access.
- Added `node-pre-gyp info` command to display listing of published binaries
- Added support for changing the directory node-pre-gyp should build in with the `-C/--directory` option.
- Added support for S3 prefixes.
Expand Down
4 changes: 2 additions & 2 deletions lib/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function unpublish(gyp, argv, callback) {
};
s3.listObjects(s3_opts, function(err, meta){
if (err && err.code == 'NotFound') {
return callback(new Error('['+package_json.name+'] Not found: http://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix));
return callback(new Error('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix));
} else if(err) {
return callback(err);
} else {
Expand All @@ -38,7 +38,7 @@ function unpublish(gyp, argv, callback) {
console.log(obj.Key);
});
} else {
console.error('No objects found at http://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix )
console.error('No objects found at https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix )
}
return callback();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function publish(gyp, argv, callback) {
};
s3.putObject(s3_obj_opts, function(err, resp){
if(err) return callback(err);
console.log('['+package_json.name+'] Success: published to http://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
console.log('['+package_json.name+'] Success: published to https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
return callback();
});
} else if(err) {
Expand Down
4 changes: 2 additions & 2 deletions lib/unpublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function unpublish(gyp, argv, callback) {
};
s3.headObject(s3_opts, function(err, meta){
if (err && err.code == 'NotFound') {
console.log('['+package_json.name+'] Not found: http://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
console.log('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
return callback();
} else if(err) {
return callback(err);
Expand All @@ -37,7 +37,7 @@ function unpublish(gyp, argv, callback) {
s3.deleteObject(s3_opts, function(err, resp){
if (err) return callback(err);
log.info(JSON.stringify(resp));
console.log('['+package_json.name+'] Success: removed http://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
console.log('['+package_json.name+'] Success: removed https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
return callback();
})
}
Expand Down
6 changes: 6 additions & 0 deletions lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var fs = require('fs')
, request = require('request')
, win = process.platform == 'win32'
, os = require('os')
, url = require('url')
, existsAsync = fs.exists || path.exists
, cp = require('child_process')

Expand Down Expand Up @@ -51,6 +52,11 @@ function validate_config(package_json,callback) {
if (!o.remote_uri) {
return callback(new Error(msg+"package.json must declare 'binary.remote_uri'"));
}
// enforce `remote_uri` as https
var protocol = url.parse(o.remote_uri).protocol;
if (protocol !== 'https:') {
return callback(new Error("'remote_uri' protocol ("+protocol+") is invalid - only 'https:' is accepted"));
}
return callback();
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "node-pre-gyp",
"description": "Node.js native addon binary install tool",
"version": "0.3.1",
"version": "0.4.0",
"keywords": [
"native",
"addon",
Expand Down
8 changes: 4 additions & 4 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

set -e -u
# set -x
#set -x

# put npm's copy of node-gyp on the PATH
export PATH=`npm explore npm -g -- pwd`/bin/node-gyp-bin:$PATH
Expand All @@ -28,7 +28,7 @@ function MARK {
TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST:-false};

function build_app {
WD=$BASE/test/$1
WD=$( cd $BASE/test/$1 && pwd )

rm -rf ${WD}/lib/binding/*
rm -rf ${WD}/build/*
Expand All @@ -38,7 +38,7 @@ function build_app {
# run directly against node-pre-gyp
node-pre-gyp clean -C $WD
if [[ $1 == "app2" ]]; then
node-pre-gyp -C $WD install --fallback-to-build --custom_include_path=`pwd`/include
node-pre-gyp -C $WD install --fallback-to-build --custom_include_path=$WD/include
else
node-pre-gyp -C $WD install --fallback-to-build
fi
Expand Down Expand Up @@ -93,7 +93,7 @@ function build_app {
echo 'bogus' > $i;
done
if [[ $1 == "app2" ]]; then
npm install --custom_include_path=`pwd`/include
npm install --custom_include_path=$WD/include
else
npm install
fi
Expand Down
2 changes: 1 addition & 1 deletion test/app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"binary": {
"module_name": "app2",
"module_path": "./lib/binding/",
"remote_uri": "http://node-pre-gyp-tests.s3-us-west-1.amazonaws.com/app2/",
"remote_uri": "https://node-pre-gyp-tests.s3-us-west-1.amazonaws.com/app2/",
"template": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/app3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"binary": {
"module_name": "app3",
"module_path": "./lib/binding/",
"remote_uri": "http://node-pre-gyp-tests.s3-us-west-1.amazonaws.com/app3",
"remote_uri": "https://node-pre-gyp-tests.s3-us-west-1.amazonaws.com/app3",
"template": "{module_name}-v{major}.{minor}.{patch}-{prerelease}-{node_abi}-{platform}-{arch}.tar.gz"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/app4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"binary": {
"module_name": "app4",
"module_path": "./lib/binding/",
"remote_uri": "http://node-pre-gyp-tests.s3-us-west-1.amazonaws.com/app4/alpha-test/",
"remote_uri": "https://node-pre-gyp-tests.s3-us-west-1.amazonaws.com/app4/alpha-test/",
"template": "{module_name}-v{major}.{minor}.{patch}-{prerelease}-{node_abi}-{platform}-{arch}.tar.gz"
},
"scripts": {
Expand Down

0 comments on commit 57c9a77

Please sign in to comment.