thali/install/cordova-hooks/ios/before_plugin_install.js
function updateJXcoreExtensionImport(context) {
  var cordovaUtil =
    context.requireCordovaModule('cordova-lib/src/cordova/util');
  var ConfigParser = context.requireCordovaModule('cordova-lib').configparser;
  var projectRoot = cordovaUtil.isCordova();
  var xml = cordovaUtil.projectConfig(projectRoot);
  var cfg = new ConfigParser(xml);

  var Q = context.requireCordovaModule('q');
  var deferred = new Q.defer();

  var jxcoreExtensionPath = path.join(
    context.opts.plugin.dir, 'src', 'ios', 'JXcoreExtension.m');
  try {
    console.log('Updating JXcoreExtension.m');

    var oldContent = fs.readFileSync(jxcoreExtensionPath, 'utf8');
    var newContent = oldContent.replace('%PROJECT_NAME%', cfg.name());
    fs.writeFileSync(jxcoreExtensionPath, newContent, 'utf8');

    deferred.resolve();
  } catch (error) {
    console.log('Failed updating of JXcoreExtension.m');

    deferred.reject(error);
  }

  return deferred.promise;
}
function updateJXcoreExtensionImport(context) {
  var cordovaUtil =
    context.requireCordovaModule('cordova-lib/src/cordova/util');
  var ConfigParser = context.requireCordovaModule('cordova-lib').configparser;
  var projectRoot = cordovaUtil.isCordova();
  var xml = cordovaUtil.projectConfig(projectRoot);
  var cfg = new ConfigParser(xml);

  var Q = context.requireCordovaModule('q');
  var deferred = new Q.defer();

  var jxcoreExtensionPath = path.join(
    context.opts.plugin.dir, 'src', 'ios', 'JXcoreExtension.m');
  try {
    console.log('Updating JXcoreExtension.m');

    var oldContent = fs.readFileSync(jxcoreExtensionPath, 'utf8');
    var newContent = oldContent.replace('%PROJECT_NAME%', cfg.name());
    fs.writeFileSync(jxcoreExtensionPath, newContent, 'utf8');

    deferred.resolve();
  } catch (error) {
    console.log('Failed updating of JXcoreExtension.m');

    deferred.reject(error);
  }

  return deferred.promise;
}
function updateJXcoreExtensionImport ( context ) { var cordovaUtil = context . requireCordovaModule ( 'cordova-lib/src/cordova/util' ) ; var ConfigParser = context . requireCordovaModule ( 'cordova-lib' ) . configparser ; var projectRoot = cordovaUtil . isCordova ( ) ; var xml = cordovaUtil . projectConfig ( projectRoot ) ; var cfg = new ConfigParser ( xml ) ; var Q = context . requireCordovaModule ( 'q' ) ; var deferred = new Q . defer ( ) ; var jxcoreExtensionPath = path . join ( context . opts . plugin . dir , 'src' , 'ios' , 'JXcoreExtension.m' ) ; try { console . log ( 'Updating JXcoreExtension.m' ) ; var oldContent = fs . readFileSync ( jxcoreExtensionPath , 'utf8' ) ; var newContent = oldContent . replace ( '%PROJECT_NAME%' , cfg . name ( ) ) ; fs . writeFileSync ( jxcoreExtensionPath , newContent , 'utf8' ) ; deferred . resolve ( ) ; } catch ( error ) { console . log ( 'Failed updating of JXcoreExtension.m' ) ; deferred . reject ( error ) ; } return deferred . promise ; }
Replaces PROJECT_NAME pattern with actual Cordova's project name
Replaces PROJECT_NAME pattern with actual Cordova s project name