Move data to resin module

This commit is contained in:
Juan Cruz Viotti 2014-11-26 12:56:52 -04:00
parent 1736d8a759
commit 64cb1520f6
13 changed files with 30 additions and 19 deletions

View File

@ -1,5 +1,4 @@
_ = require('lodash') _ = require('lodash')
data = require('./data/data')
resin = require('./resin') resin = require('./resin')
config = require('./config') config = require('./config')
packageJSON = require('../package.json') packageJSON = require('../package.json')
@ -127,7 +126,7 @@ program
.description('Remove environment variable') .description('Remove environment variable')
.action(env.remove) .action(env.remove)
data.prefix.set config.dataPrefix, (error) -> resin.data.prefix.set config.dataPrefix, (error) ->
throw error if error? throw error if error?
program.parse(process.argv) program.parse(process.argv)
resin.log.setQuiet(program.quiet) resin.log.setQuiet(program.quiet)

View File

@ -3,7 +3,7 @@ nock = require('nock')
_ = require('lodash') _ = require('lodash')
async = require('async') async = require('async')
auth = require('./auth') auth = require('./auth')
data = require('../data/data') resin = require('../resin')
config = require('../config') config = require('../config')
mock = require('../../tests/utils/mock') mock = require('../../tests/utils/mock')
johnDoeFixture = require('../../tests/fixtures/johndoe') johnDoeFixture = require('../../tests/fixtures/johndoe')
@ -19,7 +19,7 @@ describe 'Auth:', ->
beforeEach (done) -> beforeEach (done) ->
mock.fs.init() mock.fs.init()
data.prefix.set(config.dataPrefix, done) resin.data.prefix.set(config.dataPrefix, done)
afterEach -> afterEach ->
mock.fs.restore() mock.fs.restore()

View File

@ -2,7 +2,7 @@ expect = require('chai').expect
mock = require('../../tests/utils/mock') mock = require('../../tests/utils/mock')
fsUtils = require('./fs-utils') fsUtils = require('./fs-utils')
config = require('../config') config = require('../config')
data = require('../data/data') resin = require('../resin')
FILESYSTEM = FILESYSTEM =
text: text:
@ -41,7 +41,7 @@ describe 'FsUtils:', ->
beforeEach (done) -> beforeEach (done) ->
mock.fs.init(FILESYSTEM) mock.fs.init(FILESYSTEM)
data.prefix.set(config.dataPrefix, done) resin.data.prefix.set(config.dataPrefix, done)
afterEach -> afterEach ->
mock.fs.restore() mock.fs.restore()

View File

@ -4,7 +4,7 @@ sinon = require('sinon')
expect = require('chai').expect expect = require('chai').expect
config = require('../config') config = require('../config')
auth = require('../auth/auth') auth = require('../auth/auth')
data = require('../data/data') resin = require('../resin')
authHooks = require('./auth') authHooks = require('./auth')
johnDoeFixture = require('../../tests/fixtures/johndoe') johnDoeFixture = require('../../tests/fixtures/johndoe')
mock = require('../../tests/utils/mock') mock = require('../../tests/utils/mock')
@ -21,7 +21,7 @@ describe 'Auth Hooks:', ->
beforeEach (done) -> beforeEach (done) ->
mock.fs.init() mock.fs.init()
data.prefix.set(config.dataPrefix, done) resin.data.prefix.set(config.dataPrefix, done)
afterEach -> afterEach ->
mock.fs.restore() mock.fs.restore()

View File

@ -1,5 +1,5 @@
mkdirp = require('mkdirp') mkdirp = require('mkdirp')
fsUtils = require('../fs-utils/fs-utils') fsUtils = require('../../fs-utils/fs-utils')
prefix = null prefix = null

View File

@ -2,11 +2,11 @@ expect = require('chai').expect
_ = require('lodash') _ = require('lodash')
async = require('async') async = require('async')
fs = require('fs') fs = require('fs')
fsUtils = require('../fs-utils/fs-utils') fsUtils = require('../../fs-utils/fs-utils')
rimraf = require('rimraf') rimraf = require('rimraf')
dataPrefix = require('./data-prefix') dataPrefix = require('./data-prefix')
config = require('../config') config = require('../../config')
mock = require('../../tests/utils/mock') mock = require('../../../tests/utils/mock')
PREFIXES = PREFIXES =
main: config.dataPrefix main: config.dataPrefix

View File

@ -1,7 +1,7 @@
fs = require('fs') fs = require('fs')
path = require('path') path = require('path')
rimraf = require('rimraf') rimraf = require('rimraf')
fsUtils = require('../fs-utils/fs-utils') fsUtils = require('../../fs-utils/fs-utils')
exports.prefix = require('./data-prefix') exports.prefix = require('./data-prefix')
haltIfNoPrefix = (callback) -> haltIfNoPrefix = (callback) ->

View File

@ -1,9 +1,9 @@
expect = require('chai').expect expect = require('chai').expect
_ = require('lodash') _ = require('lodash')
fsUtils = require('../fs-utils/fs-utils') fsUtils = require('../../fs-utils/fs-utils')
mock = require('../../tests/utils/mock') mock = require('../../../tests/utils/mock')
async = require('async') async = require('async')
config = require('../config') config = require('../../config')
data = require('./data') data = require('./data')
FILES_FIXTURES = FILES_FIXTURES =

View File

@ -4,3 +4,4 @@ module.exports =
log: require('./log/log') log: require('./log/log')
errors: require('./errors/errors') errors: require('./errors/errors')
token: require('./token/token') token: require('./token/token')
data: require('./data/data')

View File

@ -6,6 +6,7 @@ chaiAsPromised = require('chai-as-promised')
expect = chai.expect expect = chai.expect
chai.use(chaiAsPromised) chai.use(chaiAsPromised)
data = require('../data/data')
mock = require('../../../tests/utils/mock') mock = require('../../../tests/utils/mock')
canvas = require('./_canvas') canvas = require('./_canvas')
config = require('../../config') config = require('../../config')
@ -22,6 +23,13 @@ RESPONSE =
describe 'Canvas:', -> describe 'Canvas:', ->
beforeEach (done) ->
mock.fs.init()
data.prefix.set(config.dataPrefix, done)
afterEach ->
mock.fs.restore()
before -> before ->
mock.connection.init() mock.connection.init()

View File

@ -4,7 +4,7 @@ url = require('url')
server = require('./server') server = require('./server')
config = require('../../config') config = require('../../config')
token = require('../token/token') token = require('../token/token')
data = require('../../data/data') data = require('../data/data')
mock = require('../../../tests/utils/mock') mock = require('../../../tests/utils/mock')
johnDoeFixture = require('../../../tests/fixtures/johndoe.json') johnDoeFixture = require('../../../tests/fixtures/johndoe.json')

View File

@ -1,4 +1,4 @@
data = require('../../data/data') data = require('../data/data')
TOKEN_KEY = 'token' TOKEN_KEY = 'token'

View File

@ -1,6 +1,8 @@
expect = require('chai').expect expect = require('chai').expect
async = require('async') async = require('async')
token = require('./token') token = require('./token')
config = require('../../config')
data = require('../data/data')
mock = require('../../../tests/utils/mock') mock = require('../../../tests/utils/mock')
johnDoeFixture = require('../../../tests/fixtures/johndoe.json') johnDoeFixture = require('../../../tests/fixtures/johndoe.json')
@ -8,8 +10,9 @@ janeDoeFixture = require('../../../tests/fixtures/janedoe.json')
describe 'Token:', -> describe 'Token:', ->
beforeEach -> beforeEach (done) ->
mock.fs.init() mock.fs.init()
data.prefix.set(config.dataPrefix, done)
afterEach -> afterEach ->
mock.fs.restore() mock.fs.restore()