不要怂,就是干,撸起袖子干!

Commit a93bb7d1 by Sascha Depold

Ensure that coffee files are correctly executed

1 parent d01c7e11
......@@ -50,6 +50,15 @@ module.exports = (function() {
Object.defineProperty(Migration.prototype, 'migration', {
get: function() {
if (this.path.match(/\.coffee$/)) {
try {
require('coffee-script/register')
} catch(e) {
console.log("You have to add \"coffee-script\" to your package.json.")
process.exit(1)
}
}
return require(this.path)
}
})
......
......@@ -69,7 +69,8 @@
"lcov-result-merger": "0.0.2",
"istanbul": "~0.1.45",
"coveralls": "~2.5.0",
"async": "~0.2.9"
"async": "~0.2.9",
"coffee-script": "~1.7.1"
},
"keywords": [
"mysql",
......
......@@ -30,7 +30,7 @@ describe(Support.getTestDialectTeaser("Migrator"), function() {
describe('getUndoneMigrations', function() {
it("supports coffee files", function(done) {
this.init({
filesFilter: /\.cs$/,
filesFilter: /\.coffee$/,
to: 20111130161100
}, function(migrator) {
migrator.getUndoneMigrations(function(err, migrations) {
......@@ -120,6 +120,24 @@ describe(Support.getTestDialectTeaser("Migrator"), function() {
})
describe('executions', function() {
it("supports coffee files", function(done) {
var self = this
this.init({
filesFilter: /\.coffee$/,
to: 20111130161100
}, function(migrator) {
self.migrator = migrator
self.migrator.migrate().success(function() {
self.sequelize.getQueryInterface().showAllTables().success(function(tableNames) {
tableNames = tableNames.filter(function(e){ return e != 'SequelizeMeta' })
expect(tableNames).to.eql([ 'Person' ])
done()
})
})
})
})
it("executes migration #20111117063700 and correctly creates the table", function(done) {
this.sequelize.getQueryInterface().showAllTables().success(function(tableNames) {
tableNames = tableNames.filter(function(e){ return e != 'SequelizeMeta' })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!