Skip to content

Commit

Permalink
feat: Switch to sqlite library
Browse files Browse the repository at this point in the history
Closes #12
  • Loading branch information
avaly committed Jul 9, 2018
1 parent 355cf2b commit 3615b2e
Show file tree
Hide file tree
Showing 22 changed files with 892 additions and 831 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module.exports = {
node: true
},
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 8
},
rules: {
indent: ['error', 'tab'],
'linebreak-style': ['error', 'unix'],
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/config.default.js
/config.dev.js
/*.log
package-lock.json
18 changes: 1 addition & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# https://github.com/JoshuaWise/better-sqlite3/blob/v2.0.1/.travis.yml
sudo: false
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9

language: node_js
node_js:
- "6"
- "8"

cache:
directories:
Expand All @@ -21,12 +11,6 @@ notifications:
email:
on_success: never

before_install:
- export CC="gcc-4.9" CXX="g++-4.9"

before_script:
- npm prune

script:
- npm test
- npm run lint
Expand Down
5 changes: 3 additions & 2 deletions bin/backup-to-cloud
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Options:
`);
}

function main() {
async function main() {
if (fs.existsSync(LOCK_FILE) && !utils.hasFlag('ignore-lock')) {
utils.log('Another instance of the backup is already running or has not ' +
'properly terminated. Remove lock file to continue.');
Expand Down Expand Up @@ -62,10 +62,11 @@ function main() {
}

db = new DB();
await db.initialize();

if (!utils.hasFlag('skip-scan')) {
const scanner = new Scanner(db);
scanner.scan();
await scanner.scan();
}

if (!utils.hasFlag('only-scan')) {
Expand Down
20 changes: 12 additions & 8 deletions bin/backup-verify
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@ Options:
`);
}

function main() {
async function main() {
utils.log(`${package.name} version ${package.version}`);
if (utils.DRY_RUN) {
utils.log('This is a DRY run! No changes/uploads will be made.');
}

const verifier = new Verifier();
verifier.start(
utils.TEST ? utils.getOption('aws-ls-mock') : null
)
.catch(
(err) => {
utils.log('Verifier error:', err);
}

try {
await verifier.start(
utils.TEST ? utils.getOption('aws-ls-mock') : null
);
} catch(err) {
utils.log('Verifier error:', err);

verifier.stop();

process.exit(1);
}
}

if (utils.hasFlag('help')) {
Expand Down
14 changes: 5 additions & 9 deletions config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@ const FIXTURES_DIR = path.resolve(__dirname, 'test', '_fixtures_');

module.exports = Object.assign({}, config, {
aws: path.resolve(__dirname, 'test', '_mocks_', 'aws-mock.js'),
compressLeavesPatterns: [
FIXTURES_DIR + path.sep + 'ham'
],
compressLeavesPatterns: [FIXTURES_DIR + path.sep + 'ham'],
// Deprecated
db: 'data/db-test.json',
dbSQLite: 'data/db-test.sqlite',
encryptionPassphrase: 'password',
logTimestamp: false,
maxSessionFailures: 2,
maxSessionSize: 1 * 1024,
prefixRemove: [
'/foo'
],
prefixRemove: ['/foo'],
scanInterval: 1000,
slackHook: 'https://localhost/slack',
slackHook: null,
sources: [
FIXTURES_DIR + path.sep + 'foo',
FIXTURES_DIR + path.sep + 'bar',
FIXTURES_DIR + path.sep + 'ham'
FIXTURES_DIR + path.sep + 'ham',
],
s3bucket: 'test-bucket'
s3bucket: 'test-bucket',
});
Loading

0 comments on commit 3615b2e

Please sign in to comment.