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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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