var prepare = function (callback, options) { options = _.assign({ config: {} }, options || {}); var configPath = 'config/'; var seederFile = 'seedPerson'; var config = _.assign({}, helpers.getTestConfig(), options.config); var configContent = JSON.stringify(config); var migrationFile = 'createPerson.' + ((flag.indexOf('coffee') === -1) ? 'js' : 'coffee'); seederFile = seederFile + '.' + ((flag.indexOf('coffee') === -1) ? 'js' : 'coffee'); if (flag.match(/config\.js$/)) { configPath = configPath + 'config.js'; configContent = 'module.exports = ' + configContent; } else { configPath = configPath + 'config.json'; } gulp .src(Support.resolveSupportPath('tmp')) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli('init')) .pipe(helpers.removeFile('config/config.json')) .pipe(helpers.copyMigration(migrationFile)) .pipe(helpers.copySeeder(seederFile)) .pipe(helpers.overwriteFile(configContent, configPath)) .pipe(helpers.runCli('db:migrate' + ((flag.indexOf('coffee') === -1 && flag.indexOf('config') === -1) ? '' : flag.replace('db:seed', '')))) .pipe(helpers.runCli(flag, { pipeStdout: true })) .pipe(helpers.teardown(callback)); };
var prepare = function(callback, options) { options = _.extend({ config: {} }, options || {}); var configPath = "config/"; var migrationFile = "createPerson." + ((flag.indexOf("coffee") === -1) ? "js" : "coffee"); var config = _.extend({}, helpers.getTestConfig(), options.config); var configContent = JSON.stringify(config); if (flag.match(/config\.js$/)) { configPath = configPath + "config.js"; configContent = "module.exports = " + configContent; } else { configPath = configPath + "config.json"; } gulp .src(Support.resolveSupportPath("tmp")) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli("init")) .pipe(helpers.removeFile("config/config.json")) .pipe(helpers.copyMigration(migrationFile)) .pipe(helpers.overwriteFile(configContent, configPath)) .pipe(helpers.runCli(flag, { pipeStdout: true })) .pipe(helpers.teardown(callback)); };
var prepare = function (callback) { gulp .src(Support.resolveSupportPath('tmp')) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli('init')) .pipe(helpers.copyMigration('createPerson.js')) .pipe(helpers.overwriteFile(JSON.stringify(helpers.getTestConfig()), 'config/config.json')) .pipe(helpers.runCli('db:migrate ' + flag + '=' + helpers.getTestUrl(), { pipeStdout: true })) .pipe(helpers.teardown(callback)); };
var prepare = function(callback) { gulp .src(Support.resolveSupportPath("tmp")) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli("init")) .pipe(helpers.copyMigration("createPerson.js")) .pipe(helpers.copyMigration("emptyMigration.js")) .pipe(helpers.copyMigration("renamePersonToUser.js")) .pipe(helpers.overwriteFile(JSON.stringify(helpers.getTestConfig()), "config/config.json")) .pipe(helpers.teardown(callback)); };
const prepare = function (callback, _flag) { _flag = _flag || flag; gulp .src(Support.resolveSupportPath('tmp')) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli('init')) .pipe(helpers.copyMigration('createPerson.js')) .pipe(helpers.overwriteFile(JSON.stringify(helpers.getTestConfig()), 'config/config.json')) .pipe(helpers.runCli(_flag, { pipeStdout: true })) .pipe(helpers.teardown(callback)); };
var prepare = function (config, callback) { config = helpers.getTestConfig(config); gulp .src(Support.resolveSupportPath('tmp')) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli('init')) .pipe(helpers.copyMigration('createPerson.js')) .pipe(helpers.copyMigration('emptyMigration.js')) .pipe(helpers.copyMigration('renamePersonToUser.js')) .pipe(helpers.overwriteFile(JSON.stringify(config), 'config/config.json')) .pipe(helpers.teardown(callback)); };
it('is correctly reports a down and an up migration', done => { gulp .src(Support.resolveSupportPath('tmp')) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli('init')) .pipe(helpers.copyMigration('createPerson.js')) .pipe(helpers.overwriteFile(JSON.stringify(helpers.getTestConfig()), 'config/config.json')) .pipe(helpers.runCli('db:migrate', { pipeStdout: false })) .pipe(helpers.copyMigration('renamePersonToUser.js')) .pipe(helpers.runCli(flag, { pipeStdout: true })) .pipe(helpers.ensureContent('up 20111117063700-createPerson.js')) .pipe(helpers.ensureContent('down 20111205064000-renamePersonToUser.js')) .pipe(helpers.teardown(done)); });
const prepare = function (callback) { gulp .src(Support.resolveSupportPath('tmp')) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli('init')) .pipe(helpers.copyMigration('createPerson.js')) .pipe( helpers.overwriteFile( JSON.stringify({ use_env_variable: 'SEQUELIZE_DB_URL' }), 'config/config.json' ) ) .pipe(helpers.runCli('db:migrate', { env: { SEQUELIZE_DB_URL: helpers.getTestUrl() } })) .pipe(helpers.teardown(callback)); };
const prepare = function (flag, callback, options) { options = _.assign({ config: {} }, options || {}); const configPath = 'config/config.json'; const config = _.assign({}, helpers.getTestConfig(), options.config); const configContent = JSON.stringify(config); gulp .src(Support.resolveSupportPath('tmp')) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli('init')) .pipe(helpers.removeFile(configPath)) .pipe(helpers.overwriteFile(configContent, configPath)) .pipe(helpers.runCli('db:create')) .pipe(helpers.runCli(flag, { pipeStdout: true })) .pipe(helpers.teardown(callback)); };
const prepare = function (callback, options) { const _flag = options.flag || flag; const pipeline = gulp .src(Support.resolveSupportPath('tmp')) .pipe(helpers.clearDirectory()) .pipe(helpers.runCli('init')) .pipe(helpers.copyMigration('createPerson.js')); if ( options.copySeeds ) { pipeline.pipe(helpers.copySeeder('seedPerson.js')); } pipeline.pipe(helpers.overwriteFile(JSON.stringify(helpers.getTestConfig()), 'config/config.json')) .pipe(helpers.runCli('db:migrate')) .pipe(helpers.runCli(_flag, { pipeStderr: true })) .pipe(helpers.teardown(callback)); };