Skip to content

Commit

Permalink
Auto-merge for PR #11 via VersionBot
Browse files Browse the repository at this point in the history
Set up automated pre-gyp publishing for ext2fs
  • Loading branch information
resin-io-versionbot[bot] authored Nov 21, 2017
2 parents 3561aba + 9ce9bac commit e5c7209
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
/build
/pregyp
25 changes: 23 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
language: node_js

os:
- linux
- osx

node_js:
- "6"
- "7"
- "8"
env:
- CXX=g++-4.8
- "9"

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8

install:
- npm install --build-from-source

notifications:
email: false

deploy:
provider: script
script: npm run pre-gyp-release
skip_cleanup: true
on:
# Deploys happen for all tagged releases
tags: true
repo: resin-io/node-ext2fs
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).

## v0.1.0 - 2017-11-21

* Add clock_gettime implementation so this works on OSX < 10.11 #11 [Tim Perry]
* Automatically release built binaries to github for pre-gyp #11 [Tim Perry]
* Use pre-gyp-github to automatically install prebuilt binaries when available #11 [Tim Perry]
* Add a changelog so we can set up versionbot #11 [Tim Perry]
* Add Windows tests with appveyor #11 [Tim Perry]
* Update e2fsprogs #11 [Tim Perry]

## v0.0.15 - 2017-11-02

- Capable of mounting and using a real ext filesystem
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@ Support

If you're having any problems, please [raise an issue][github-issue] on GitHub.

### Package fails to install as no pre-built package is available

Node-ext2fs is pre-built for a range of OSs and Node versions, but we don't have perfect coverage
here yet, and it may fail to install if you're not on an pre-built version and you don't have local
build tools available.

If you have an issue with this, and your platform is one you feel we should support, please
[raise an issue][github-issue] on this repo, so we can look at adding your configuration to the
pre-built versions that works automatically.

In the meantime, you can typically install this package by updating to a newer Node release which
does have pre-built binaries, or by setting up a local environment so the build is successful (see
['Installation'](#installation) above).

License
-------

Expand Down
8 changes: 7 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ cache:

environment:
matrix:
- nodejs_version: 9
- nodejs_version: 8
- nodejs_version: 7
- nodejs_version: 6

install:
Expand All @@ -25,9 +27,13 @@ install:
build_script:
- refreshenv
# Installs dependencies, and runs node-gyp rebuild
- npm install --msvs_version=2015
- npm install --msvs_version=2015 --build-from-source

test_script:
- node --version
- npm --version
- cmd: npm test

deploy_script:
- IF "%APPVEYOR_REPO_TAG%" == "true" (npm run pre-gyp-release)
- IF NOT "%APPVEYOR_REPO_TAG%" == "true" (echo 'Not tagged, skipping deploy')
11 changes: 10 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
]
},
{
"target_name": "bindings",
"target_name": "<(module_name)",
"sources": [
"src/node_ext2fs.cc",
"src/async.cc",
Expand All @@ -177,6 +177,15 @@
"include_dirs": [
"<!(node -e \"require('nan')\")"
],
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}]
}
]
}
6 changes: 5 additions & 1 deletion lib/binding.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict';

const bindings = require('bindings')('bindings');
const binary = require('node-pre-gyp');
const path = require('path');
const binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
const bindings = require(binding_path);

const constants = require('./constants');
const queue = require('./queue');
const fs = require('fs'); // original fs module, used for its constants
Expand Down
6 changes: 5 additions & 1 deletion lib/ext2fs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const Promise = require('bluebird');
const bindings = require('bindings')('bindings');

const binary = require('node-pre-gyp');
const path = require('path');
const binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
const bindings = require(binding_path);

exports.constants = require('./constants');
const diskModule = require('./disk');
Expand Down
20 changes: 16 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ext2fs",
"version": "0.0.15",
"version": "0.1.0",
"description": "NodeJS native bindings to the libext2fs for cross-platform ext filesystem handling",
"author": "Petros Angelatos <[email protected]>",
"contributors": [
Expand All @@ -17,18 +17,30 @@
"test": "mocha",
"publish-please": "publish-please",
"prepublish": "publish-please guard",
"install": "node-gyp rebuild"
"install": "node-pre-gyp install --fallback-to-build",
"pre-gyp-release": "node-pre-gyp rebuild package && node-pre-gyp-github publish --release"
},
"binary": {
"module_name": "bindings",
"module_path": "pregyp",
"host": "https://github.com/resin-io/node-ext2fs/releases/download/",
"remote_path": "{version}"
},
"dependencies": {
"async": "^2.4.1",
"bindings": "^1.2.1",
"eslint": "^3.19.0",
"file-disk": "^1.0.0",
"nan": "^2.5.1"
"nan": "^2.5.1",
"node-pre-gyp": "^0.6.39"
},
"bundledDependencies": [
"node-pre-gyp"
],
"devDependencies": {
"bluebird": "^3.4.7",
"mocha": "^3.2.0",
"node-pre-gyp-github": "^1.3.1",
"publish-please": "^2.2.0"
},
"homepage": "https://github.com/resin-io/node-ext2fs#readme",
Expand All @@ -48,4 +60,4 @@
"bugs": {
"url": "https://github.com/resin-io/node-ext2fs/issues"
}
}
}
29 changes: 23 additions & 6 deletions src/node_ext2fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,30 @@ class CloseWorker : public AsyncWorker {
X_NAN_METHOD(close, CloseWorker, 3);

#ifdef _WIN32
// Windows does not include CLOCK_REALTIME or clock_gettime
#define CLOCK_REALTIME 0
int clock_gettime(int, struct timespec *spec) //C-file part
{ __int64 wintime; GetSystemTimeAsFileTime((FILETIME*)&wintime);
wintime -=116444736000000000i64; //1jan1601 to 1jan1970
spec->tv_sec =wintime / 10000000i64; //seconds
spec->tv_nsec =wintime % 10000000i64 *100; //nano-seconds
return 0;
int clock_gettime(int, struct timespec *spec) {
__int64 wintime; GetSystemTimeAsFileTime((FILETIME*)&wintime);
wintime -= 116444736000000000i64; //1jan1601 to 1jan1970
spec->tv_sec = wintime / 10000000i64; //seconds
spec->tv_nsec = wintime % 10000000i64 *100; //nano-seconds
return 0;
}
#endif

#if defined(__MACH__) && !defined(CLOCK_REALTIME)
// clock_gettime is not implemented on older versions of OS X (< 10.12).
// If implemented, CLOCK_REALTIME will have already been defined.

#include <sys/time.h>
#define CLOCK_REALTIME 0
int clock_gettime(int, struct timespec* spec) {
struct timeval now;
int rv = gettimeofday(&now, NULL);
if (rv) return rv;
spec->tv_sec = now.tv_sec;
spec->tv_nsec = now.tv_usec * 1000;
return 0;
}
#endif

Expand Down

0 comments on commit e5c7209

Please sign in to comment.