Skip to content

Commit

Permalink
fixed #8 introduced regression bug. We now use /tmp as default tempor…
Browse files Browse the repository at this point in the history
…ary directory.
  • Loading branch information
ensky committed Jan 26, 2021
1 parent b0bdb55 commit 5c7801d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions lib/taiwan-holiday.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var TaiwanHoliday = {
*/
init: function (ctor_conf) {
ctor_conf = ctor_conf || {};
temp_dir = ctor_conf.temp_dir || env_conf.temp_dir || path.resolve(__dirname, '../data');
temp_dir = ctor_conf.temp_dir || env_conf.temp_dir;

this.cache = new Cache(path.resolve(temp_dir, 'taiwan-holiday-cache.json'));
return this.cache.load()
Expand All @@ -25,9 +25,11 @@ var TaiwanHoliday = {
.then((str) => ret = JSON.parse(str))
.then((result) => this.cache.save(result))
.then(() => ret);
})
.then((json) => {
}).then((json) => {
engine = new OpendataTW(json);
}).catch((e) => {
console.error(e);
throw e;
});
},

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "let me help you find out it's taiwan holiday or not.",
"main": "index.js",
"scripts": {
"test": "nyc mocha",
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
"test": "nyc mocha",
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"repository": {
"type": "git",
Expand All @@ -29,10 +29,10 @@
"nyc": "^11.4.1"
},
"config": {
"temp_dir": ""
"temp_dir": "/tmp"
},
"dependencies": {
"request": "^2.83.0",
"request-promise": "^4.2.2"
}
}
}

0 comments on commit 5c7801d

Please sign in to comment.