Created
June 3, 2014 14:22
-
-
Save david-martin/fe1d993b161bf2d461f6 to your computer and use it in GitHub Desktop.
Using fhc, migrate all fh2 apps to fh3
This file contains hidden or 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
#!/usr/bin/env node | |
var fh = require('fh-fhc'); | |
var async = require('async'); | |
// Init fhc | |
fh.fhc.load(function (err) { | |
if (err) return console.error(err); | |
// Target my domain and login | |
fh.target(['https://testing.feedhenry.me','[email protected]','password'], function(err, ok) { | |
if (err) return console.error(err); | |
console.log('ok:', ok); | |
// List all apps | |
fh.apps([], function(err, apps) { | |
if (err) return console.error(err); | |
console.log('apps:', apps); | |
// Iterate over apps, calling migrate for each | |
async.mapSeries(apps.list, function(app, cb) { | |
// Passing 'silent' here will bypass prompt after validation check if check is ok | |
fh.migrate([app.id, 'silent'], function(err, data) { | |
if (err) return cb(err); | |
console.log('data:', data); | |
return cb(null, data); | |
}); | |
}, function(err, results) { | |
if (err) return console.error(err); | |
// all done | |
console.log('results:', results); | |
}); | |
}); | |
}); | |
}); |
This file contains hidden or 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
{ | |
"name": "migrate", | |
"version": "0.0.1", | |
"description": "Using fhc, migrate all fh2 apps to fh3", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "[email protected]", | |
"license": "BSD-2-Clause", | |
"dependencies": { | |
"async": "~0.9.0", | |
"fh-fhc": "~0.30.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment