Created
April 15, 2015 05:19
-
-
Save hideokamoto/7055ee43e0ff40997a94 to your computer and use it in GitHub Desktop.
ymlファイルが更新されたら勝手にDBを更新する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//node.jsのchild-processを呼び出す | |
var exec = require('child_process').exec; | |
//ymlファイルの更新を監視する | |
gulp.task('default',function(){ | |
gulp.watch("orm/yaml/**.yml",['db-update']); | |
}); | |
//DoctrineでEntityを作る | |
gulp.task('db-generate-entities', function(){ | |
return exec('doctrine orm:generate-entities app/orm', | |
function (error, stdout, stderr) { | |
console.log('generate'); | |
console.log('stdout: ' + stdout); | |
console.log('stderr: ' + stderr); | |
if (error !== null) { | |
console.log('exec error: ' + error); | |
} | |
}); | |
}); | |
//DoctrineでDBをアップデートする | |
gulp.task('db-update', ['db-generate-entities'], function(){ | |
return exec('doctrine orm:schema-tool:update --force', | |
function (error, stdout, stderr) { | |
console.log('update'); | |
console.log('stdout: ' + stdout); | |
console.log('stderr: ' + stderr); | |
if (error !== null) { | |
console.log('exec error: ' + error); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment