after_plugin_install.js 777 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. module.exports = function (context) {
  3. var req = context.requireCordovaModule,
  4. Q = req('q'),
  5. path = req('path'),
  6. fs = require("./lib/filesystem")(Q, req('fs'), path),
  7. settings = require("./lib/settings")(fs, path),
  8. android = require("./lib/android")(context),
  9. ios = require("./lib/ios")(Q, fs, path, req('plist'), req('xcode'));
  10. return settings.get()
  11. .then(function (config) {
  12. return Q.all([
  13. android.afterPluginInstall(config),
  14. // ios.afterPluginInstall(config) // not implemented for iOS
  15. ]);
  16. })
  17. .catch(function(err) {
  18. if (err.code === 'NEXIST') {
  19. console.log("app-settings.json not found: creating a sample file");
  20. return settings.create();
  21. }
  22. console.log ('unhandled exception', err);
  23. throw err;
  24. });
  25. };