How to use plist - 10 common examples

To help you get started, we’ve selected a few plist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / cordova-lib / test / ios-plist-install.js View on Github external
exports['should edit PhoneGap.plist'] = function (test) {
    // run the platform-specific function
    ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 });

    var plistPath = test_project_dir + '/SampleApp/PhoneGap.plist';
    var obj = plist.parseFileSync(plistPath);

    test.equal(obj.Plugins['com.phonegap.plugins.childbrowser'],
        'ChildBrowserCommand');
        
    test.equal(obj.ExternalHosts.length, 2)    
    test.equal(obj.ExternalHosts[0], "build.phonegap.com")
    test.equal(obj.ExternalHosts[1], "12345.s3.amazonaws.com")

    test.done();
}
github dancing-bone-machine / dancing-bone-machine / library / vendors / cordova / node_modules / cordova / node_modules / plugman / src / util / config-changes.js View on Github external
Object.keys(config_munge[file]).forEach(function(key) {
                        if (global_munge[file][key] && plistObj) {
                            // TODO: REMOVE in 3.4 (https://issues.apache.org/jira/browse/CB-4456)
                            require('../../plugman').emit('warn', 'DEPRECATION WARNING: Plugin "' + plugin_id + '" uses  element(s), which are now deprecated. Support will be removed in Cordova 3.4.');
                            delete plistObj.Plugins[key];
                            // TODO: don't write out on every change, do it once.
                            fs.writeFileSync(plistfile, plist.build(plistObj));
                            delete global_munge[file][key];
                        }
                    });
                }
github rev087 / ng-inspector / gulpfile.js View on Github external
run('git', ['diff', '--staged'], function(res) {
		if (res.length > 0) {
			return console.error('\n ' + ' BUMP ERROR '.redBG.bold.black +
				' Cannot update manifests with a dirty Git stage. \n'.red);
		}

		// Bump the version in package.json
		var pkg = require('./package.json');
		var old = pkg.version;
		pkg.version = 'v' + semver.inc(pkg.version, release);
		var pkgStr = JSON.stringify(pkg, null, 2);
		fs.writeFileSync('package.json', pkgStr);

		// Bump the version in Info.plist
		var info = plist.parseFileSync('ng-inspector.safariextension/Info.plist');
		info.CFBundleShortVersionString = pkg.version;
		info.CFBundleVersion = pkg.version;
		var plistStr = plist.build(info).toString();
		fs.writeFileSync('ng-inspector.safariextension/Info.plist', plistStr);

		// Bump the version in manifest.json
		var manifest = require('./ng-inspector.chrome/manifest.json');
		manifest.version = semver.inc(manifest.version, release);
		var manifestStr = JSON.stringify(manifest, null, 2);
		fs.writeFileSync('./ng-inspector.chrome/manifest.json', manifestStr);

		// Bump the version in manifest.json
		var ffpkg = require('./ng-inspector.firefox/package.json');
		ffpkg.version = semver.inc(fxpackage.version, release);
		var ffpkgString = JSON.stringify(fxpackage, null, 2);
		fs.writeFileSync('./ng-inspector.firefox/package.json', ffpkgString);
github apache / cordova-cli / src / metadata / ios_parser.js View on Github external
update_from_config:function(config, callback) {
        if (config instanceof config_parser) {
        } else {
            var err = new Error('update_from_config requires a config_parser object');
            if (callback) callback(err);
            else throw err;
            return;
        }
        var name = config.name();
        var pkg = config.packageName();

        // Update package id (bundle id)
        var plistFile = path.join(this.cordovaproj, this.originalName + '-Info.plist');
        var infoPlist = plist.parseFileSync(plistFile);
        infoPlist['CFBundleIdentifier'] = pkg;
        var info_contents = plist.build(infoPlist);
        info_contents = info_contents.replace(/[\s\r\n]*<\/string>/g,'');
        fs.writeFileSync(plistFile, info_contents, 'utf-8');
        events.emit('log', 'Wrote out iOS Bundle Identifier to "' + pkg + '"');

        // Update whitelist
        var self = this;
        this.config.access.remove();
        config.access.get().forEach(function(uri) {
            self.config.access.add(uri);
        });
        
        // Update preferences
        this.config.preference.remove();
        var prefs = config.preference.get();
github rev087 / ng-inspector / gulp / tasks / bump.js View on Github external
run('git', ['diff', '--staged'], function(res) {
		if (res.length > 0) {
			return console.error('\n ' + ' BUMP ERROR '.redBG.bold.black +
				' Cannot update manifests with a dirty Git stage. \n'.red);
		}

		// Bump the version in package.json
		var pkg = require('./package.json');
		var old = pkg.version;
		pkg.version = 'v' + semver.inc(pkg.version, release);
		var pkgStr = JSON.stringify(pkg, null, 2);
		fs.writeFileSync('package.json', pkgStr);

		// Bump the version in Info.plist
		var info = plist.parseFileSync(format('%s/Info.plist', config.safariDir));
		info.CFBundleShortVersionString = pkg.version;
		info.CFBundleVersion = pkg.version;
		var plistStr = plist.build(info).toString();
		fs.writeFileSync(format('%s/Info.plist', config.safariDir), plistStr);

		// Bump the version in manifest.json
		var manifest = require(format('./%s/manifest.json', config.chromeDir));
		manifest.version = semver.inc(manifest.version, release);
		var manifestStr = JSON.stringify(manifest, null, 2);
		fs.writeFileSync(format('./%s/manifest.json', config.chromeDir), manifestStr);

		// Bump the version in manifest.json
		var ffpkg = require(format('./%s/package.json', config.firefox));
		ffpkg.version = semver.inc(fxpackage.version, release);
		var ffpkgString = JSON.stringify(fxpackage, null, 2);
		fs.writeFileSync(format('./%s/package.json', config.firefoxDir), ffpkgString);
github MobileChromeApps / mobile-chrome-apps / node_modules / cordova / src / metadata / ios_parser.js View on Github external
update_from_config:function(config) {
        if (config instanceof config_parser) {
        } else {
            return Q.reject(new Error('update_from_config requires a config_parser object'));
        }
        var name = config.name();
        var pkg = config.packageName();
        var version = config.version();

        // Update package id (bundle id)
        var plistFile = path.join(this.cordovaproj, this.originalName + '-Info.plist');
        var infoPlist = plist.parseFileSync(plistFile);
        infoPlist['CFBundleIdentifier'] = pkg;

        // Update version (bundle version)
        infoPlist['CFBundleVersion'] = version;
        var info_contents = plist.build(infoPlist);
        info_contents = info_contents.replace(/[\s\r\n]*<\/string>/g,'');
        fs.writeFileSync(plistFile, info_contents, 'utf-8');
        events.emit('verbose', 'Wrote out iOS Bundle Identifier to "' + pkg + '"');
        events.emit('verbose', 'Wrote out iOS Bundle Version to "' + version + '"');

        if (name != this.originalName) {
            // Update product name inside pbxproj file
            var proj = new xcode.project(this.pbxproj);
            var parser = this;
            var d = Q.defer();
            proj.parse(function(err,hash) {
github DextApp / dext / app / main / plugins / plugins.spec.js View on Github external
it('should load all core plugins', async () => {
    // eslint-disable-next-line global-require
    require('conf').__setStoreData('plugins', [
      path.join(CORE_PLUGIN_PATH, 'foo-plugin'),
      path.join(CORE_PLUGIN_PATH, 'bar-plugin'),
      path.join(CORE_PLUGIN_PATH, 'baz-plugin'),
    ]);
    // eslint-disable-next-line global-require
    require('plist').__setParseObject({
      objects: [],
    });
    // load core plugins
    const results = await plugins.loadPlugins([
      { path: CORE_PLUGIN_PATH, isCore: true },
    ]);
    expect(results.length).toBeGreaterThan(0);
    expect(results.filter(p => p.name === 'about')).toBeTruthy();
  });
});
github electron / electron-osx-sign / util-entitlements.js View on Github external
.then(function (result) {
      entitlements = plist.parse(result)
      if (!entitlements['com.apple.security.app-sandbox']) {
        // Only automate when app sandbox enabled by user
        return
      }

      return readFileAsync(appInfoPath, 'utf8')
        .then(function (result) {
          appInfo = plist.parse(result)
          // Use ElectronTeamID in Info.plist if already specified
          if (appInfo.ElectronTeamID) {
            debuglog('`ElectronTeamID` found in `Info.plist`: ' + appInfo.ElectronTeamID)
          } else {
            // The team identifier in signing identity should not be trusted
            if (opts['provisioning-profile']) {
              appInfo.ElectronTeamID = opts['provisioning-profile'].message.Entitlements['com.apple.developer.team-identifier']
              debuglog('`ElectronTeamID` not found in `Info.plist`, use parsed from provisioning profile: ' + appInfo.ElectronTeamID)
github nwjs / grunt-nw-builder / tasks / lib / utils.js View on Github external
// Handle the INfo.plist file
        var info = plist.parseFileSync(abspath);
        info.CFBundleDisplayName = options.app_name;
        info.CFBundleName = options.app_name;

        info.CFBundleDocumentTypes = []; // zero out any document binding
        info.UTExportedTypeDeclarations = [];

        info.CFBundleVersion = options.app_version; // TODO: if git, get commit hash!
        info.CFBundleShortVersionString = 'Version ' + options.app_version;

        if(appOptions.copyright) {
          info.NSHumanReadableCopyright = appOptions.copyright;
        }

        grunt.file.write(target_filename, plist.build(info));
    };
github nwjs / grunt-nw-builder / tasks / lib / utils.js View on Github external
exports.generatePlist = function(abspath, target_filename, options, appOptions) {

        // Handle the INfo.plist file
        var info = plist.parseFileSync(abspath);
        info.CFBundleDisplayName = options.app_name;
        info.CFBundleName = options.app_name;

        info.CFBundleDocumentTypes = []; // zero out any document binding
        info.UTExportedTypeDeclarations = [];

        info.CFBundleVersion = options.app_version; // TODO: if git, get commit hash!
        info.CFBundleShortVersionString = 'Version ' + options.app_version;

        if(appOptions.copyright) {
          info.NSHumanReadableCopyright = appOptions.copyright;
        }

        grunt.file.write(target_filename, plist.build(info));
    };

plist

Apple's property list parser/builder for Node.js and browsers

MIT
Latest version published 8 months ago

Package Health Score

79 / 100
Full package analysis