grunt-fluentmigrator
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "grunt-fluentmigrator", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Fluent Migrator wrapper", | ||
@@ -5,0 +5,0 @@ "main": "Gruntfile.js", |
### Overview | ||
Here is simple Migrate.exe wrapper. Provide path to executable(relative to project directory) and command-line parameters which will be passed directly to executable(you can list all parameters by typing Migrate.exe -h) | ||
```js | ||
@@ -7,9 +9,36 @@ grunt.initConfig({ | ||
exePath: 'tools/migrator/Migrate.exe', | ||
assembly : 'src/SomeProject.Migrations/bin/Debug/SomeProject.Migrations.dll', | ||
output: true, | ||
outputFileName: 'migrated.sql', | ||
conn: config['DB_CONNECTION_STRING'] | ||
params: { | ||
assembly : 'src/SomeProject.Migrations/bin/Debug/SomeProject.Migrations.dll', | ||
output: true, | ||
outputFileName: 'migrated.sql', | ||
conn: "Server=.;initial catalog=SiteDb;Integrated Security=true;" | ||
} | ||
} | ||
}, | ||
} | ||
}) | ||
``` | ||
### Defaults | ||
This default options will be merged with task-defined | ||
```js | ||
{ | ||
exePath: 'Migrate.exe', | ||
params: { | ||
provider: 'sqlserver2012', | ||
preview: true, | ||
task: 'migrate' | ||
} | ||
} | ||
``` | ||
### Change log | ||
0.1.2 (June 9, 2014) | ||
* Support all command-line parameters | ||
* fixed bug with output file name and directory | ||
0.1.1 (May 29, 2014) | ||
* Initial version | ||
var spawn = require('child_process').spawn, | ||
defaults = { | ||
exePath: 'Migrate.exe', | ||
provider: 'sqlserver2012', | ||
preview: true, | ||
task: 'migrate' | ||
}, | ||
buildCommandParameters = function(options) { | ||
var allParams = ['conn', 'provider', 'assembly', 'task', 'output', 'outputFilename', 'preview'], | ||
params = []; | ||
extend = require('./../utils').extend, | ||
buildCommandParameters = require('./../utils').buildCommandParameters; | ||
allParams.forEach(function(param) { | ||
var val = options[param]; | ||
if (val !== undefined) { | ||
if (typeof val == 'boolean') { | ||
val && params.push('--' + param); | ||
} else { | ||
params.push('--' + param); | ||
params.push(val) | ||
} | ||
} | ||
}); | ||
return params; | ||
}; | ||
module.exports = function(grunt) { | ||
grunt.registerTask('fluentmigrator', 'Migration starting', function() { | ||
var options = this.options(defaults), | ||
var options = extend({ | ||
exePath: 'Migrate.exe', | ||
params: { | ||
provider: 'sqlserver2012', | ||
preview: true, | ||
task: 'migrate' | ||
} | ||
}, this.options()), | ||
done = this.async(), | ||
log = function(message) { console.log(message.toString('utf8')); }, | ||
migrate = spawn(options.exePath, buildCommandParameters(options)); | ||
log = function(message) { | ||
console.log(message.toString('utf8')); | ||
}, | ||
migrate = spawn(options.exePath, buildCommandParameters(options.params)); | ||
@@ -34,0 +21,0 @@ migrate.stdout.on('data', log); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5150
7
66
44