Save the site UUID into package.json

@param {string} siteId
176968
function _updatePjson(siteId) {
  pjson.vapid.site = siteId;
  writePkg.sync(pjsonPath, pjson);
}
1136380
function(context, pkg, source) {
		source = source || "{}";
		var packageJSON = JSON.parse(source);
		utils.extend(pkg, packageJSON);
		context.packages.push(pkg);
		return pkg;
	}
800906
function updateSourceWithId(zipFile, projectId) {
	return fetchProject(projectId)
	.then((project) => {
		return updateSource(zipFile, project);
	})
	.catch((error) => {
		console.trace(error);
		throw error;
	});
}
1294609
def create_site(sitename):
    """"""
    sitepath = os.path.join(CWD, sitename)
    if os.path.isdir(sitepath):
        print("Site directory '%s' exists already!" % sitename)
    else:
        print("Creating site: %s..." % sitename)
        os.makedirs(sitepath)
        copy_resource("skel/", sitepath)
        stamp_yass_current_version(sitepath)
        print("Site created successfully!")
        print("CD into '%s' and run 'yass serve' to view the site" % sitename)

    footer()
452265
public void saveTreeState(final String treeName, final String siteRoot, final Set<CmsUUID> openItemIds) {

        CmsRpcAction<Void> treeStateAction = new CmsRpcAction<Void>() {

            @Override
            public void execute() {

                start(600, false);
                getGalleryService().saveTreeOpenState(treeName, getTreeToken(), siteRoot, openItemIds, this);
            }

            @Override
            protected void onResponse(Void result) {

                stop(false);
            }
        };
        treeStateAction.execute();

    }
313740
function writeJSON(dbName, schema) {

    var baseUrl = 'http://www.filltext.com/?',
        promises = [],
        collection;

    for (collection in schema) {

        var meta = schema[collection].meta,
            fields = meta.fields,
            url;

        url = Object.keys(fields).map(function(key) {
            if (fields[key][0] === '[' && fields[key].slice(-1) === ']') {
                return key + '=' + fields[key];
            }
            return key + '={' + fields[key] + '}';
        }).join('&') + '&rows=' + meta.rows;

        console.log('Url for', collection, url);

        (function(c) {
            promises.push(fetch(baseUrl + url).then(function(response) {
                return response.json();
            })
            .then(function(rows) {
                schema[c] = rows;
            }));
        })(collection);
    }

    return Promise.all(promises).then(function() {
        fs.writeFile(dbName, JSON.stringify(schema, null, 4), function(err) {
            if (err) {
                Promise.reject('Failed to save JSON file: ' + err);
            }
        });
    });
}
547829
function uuid() {
    var d = Date.now();
    // Use high perf timer if avail.
    /* istanbul ignore next */
    if (typeof performance !== 'undefined' && is_1.isFunction(performance.now))
        d += performance.now();
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        var r = (d + Math.random() * 16) % 16 | 0;
        d = Math.floor(d / 16);
        return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
    });
}
386067
private void checkUUIDOfSiteRoot(CmsSite site, CmsObject clone, CmsObject cms_offline) {

        CmsUUID id = null;
        try {
            id = clone.readResource(site.getSiteRoot()).getStructureId();
        } catch (CmsException e) {
            //Ok, site root not available for online repository.
        }

        if (id == null) {
            try {
                id = cms_offline.readResource(site.getSiteRoot()).getStructureId();
                m_onlyOfflineSites.add(site);
            } catch (CmsException e) {
                //Siteroot not valid for on- and offline repository.
            }
        }
        if (id != null) {
            site.setSiteRootUUID(id);
            m_siteUUIDs.put(id, site);
        }
    }
840993
function(site, uuid, env, newBackup) {

    app.status('Pulling files.');

    if (firstTime()) {
      return pullFilesArchive(site, env, newBackup)
      .then(function() {
        return pullFilesRsync(uuid, env);
      });
    }
    else {
      return pullFilesRsync(uuid, env);
    }
  }
629725
function(uuid, env) {

    app.status('Pushing files.');

    // Hack together an rsync command
    var envSite = [env, uuid].join('.');
    var fileBox = envSite + '@appserver.' + envSite + '.drush.in:files/';
    return commands.rsync('/media/', fileBox);

  }
464592
async function inferUserDocsDirectory (cwd) {
  const paths = await globby([
    '**/.vuepress/config.js',
    '!node_modules'
  ], {
    cwd,
    dot: true
  })
  const siteConfigPath = paths && paths[0]
  if (siteConfigPath) {
    return path.resolve(
      cwd,
      siteConfigPath.replace('.vuepress/config.js', '')
    )
  }
  return null
}
1256041
function saveWebHook(projectRoot, hookContent) {
  var filePath = path.join(projectRoot, WEB_HOOK_FILE_PATH);
  var isSaved = true;

  // ensure directory exists
  createDirectoryIfNeeded(path.dirname(filePath));

  // write data to file
  try {
    fs.writeFileSync(filePath, hookContent, 'utf8');
  } catch (err) {
    console.warn('Failed to create android web hook!');
    console.warn(err);
    isSaved = false;
  }

  return isSaved;
}
1176497
function(uuid, env) {

    app.status('Pulling screenshot.');

    // Some meta data about image source and dest
    var imageFilename = util.format('%s.jpg', uuid);
    var host = 'http://s3.amazonaws.com/pantheon-screenshots-v2';
    var envUrl = [host, env, imageFilename].join('/');
    var devUrl = [host, 'dev', imageFilename].join('/');
    var downloadFolder = app.config.appRoot;

    // Try to download the devUrl first and then replace with the envUrl
    // if it exists, this should cover the case where the end
    return kbox.util.download.downloadFiles([envUrl], downloadFolder)

    // Seems like there is a problem downloading the env screenshot
    .catch(function(err) {
      log.info(util.format('Failed to grab %s screenshot %j', env, err));
      log.info('Trying dev screenshot');
      return kbox.util.download.downloadFiles([devUrl], downloadFolder);
    })

    // Rename file to screenshot.png.
    .then(function() {
      var src = path.join(downloadFolder, imageFilename);
      var dest = path.join(downloadFolder, 'screenshot.png');
      return kbox.Promise.fromNode(function(cb) {
        fs.rename(src, dest, cb);
      })
      .then(function() {
        log.info(util.format('Downloaded %s to %s.', imageFilename, dest));
      });
    })

    // Seems like there is a problem downloading the dev screenshot
    .catch(function(err) {
      log.info(util.format('Failed to grab %s screenshot %j', 'dev', err));
    });

  }
169305
async function initRepo({
  repository,
  endpoint,
  gitPrivateKey,
  gitFs,
  localDir,
}) {
  logger.debug(
    `initRepo("${JSON.stringify(
      { repository, endpoint, gitFs, localDir },
      null,
      2
    )}")`
  );
  const opts = hostRules.find({ platform }, { endpoint });
  // istanbul ignore if
  if (!(opts.username && opts.password)) {
    throw new Error(
      `No username/password found for Bitbucket repository ${repository}`
    );
  }
  // istanbul ignore if
  if (!opts.endpoint) {
    throw new Error(`No endpoint found for Bitbucket Server`);
  }
  hostRules.update({ ...opts, platform, default: true });
  api.reset();

  const [projectKey, repositorySlug] = repository.split('/');
  config = { projectKey, repositorySlug, gitPrivateKey };

  // Always gitFs
  const { host, pathname } = url.parse(opts.endpoint);
  const gitUrl = GitStorage.getUrl({
    gitFs: gitFs || 'https',
    auth: `${opts.username}:${opts.password}`,
    host: `${host}${pathname}${pathname.endsWith('/') ? '' : '/'}scm`,
    repository,
  });

  config.storage = new GitStorage();
  await config.storage.initRepo({
    ...config,
    localDir,
    url: gitUrl,
  });

  const platformConfig = {};

  try {
    const info = (await api.get(
      `./rest/api/1.0/projects/${config.projectKey}/repos/${
        config.repositorySlug
      }`
    )).body;
    platformConfig.privateRepo = info.is_private;
    platformConfig.isFork = !!info.parent;
    platformConfig.repoFullName = info.name;
    config.owner = info.project.key;
    logger.debug(`${repository} owner = ${config.owner}`);
    config.defaultBranch = (await api.get(
      `./rest/api/1.0/projects/${config.projectKey}/repos/${
        config.repositorySlug
      }/branches/default`
    )).body.displayId;
    config.baseBranch = config.defaultBranch;
    config.mergeMethod = 'merge';
  } catch (err) /* istanbul ignore next */ {
    logger.debug(err);
    if (err.statusCode === 404) {
      throw new Error('not-found');
    }
    logger.info({ err }, 'Unknown Bitbucket initRepo error');
    throw err;
  }
  delete config.prList;
  delete config.fileList;
  logger.debug(
    { platformConfig },
    `platformConfig for ${config.projectKey}/${config.repositorySlug}`
  );
  return platformConfig;
}
613579
function resolvePackageId(id) {
        each(
            packagesIndex,
            function (packageConf) {
                var name = packageConf.name;
                if (name === id) {
                    id = name + '/' + packageConf.main;
                    return false;
                }
            }
        );

        return id;
    }
975118
function(site_path, arg, cmd, done) {
    var start = Date.now();
    var nell_site = {
      site_path: site_path
    };

    async.series([
      function(callback) {
        nell_site.config_path = path.join(site_path, 'nell.json');
        fs.exists(nell_site.config_path, function(exists) {
          if (!exists) {
            return callback(new Error(__('Unable to load nell.json config file')));
          }
          callback();
        });
      },
      function(callback) {
        nell_site.config = require(nell_site.config_path);
        nell_site.output_path =  (nell_site.config.output && nell_site.config.output.path) ? path.join(nell_site.site_path, nell_site.config.output.path) : path.join(nell_site.site_path, 'output');
        async.forEach(Object.keys(nell_site.config), function(key, key_done) {
          nell_site[key] = nell_site.config[key] || {};
          key_done();
        }, callback);
      },
      function(callback) {
        loadSwig(nell_site, callback);
      },
      function(callback) {
        loadItems(nell_site, 'post', callback);
      },
      function(callback) {
        loadItems(nell_site, 'page', callback);
      },
      function(callback) {
        if (nell_site.config.output && nell_site.config.output.delete) {
          fs.unlink(nell_site.output_path, callback);
        } else {
          callback();
        }
      },
      function(callback) {
        outputItems(nell_site, 'post', callback);
      },
      function(callback) {
        outputItems(nell_site, 'page', callback);
      },
      function(callback) {
        outputIndex(nell_site, callback);
      },
      function(callback) {
        moveStatic(nell_site, callback);
      }
    ], function(err) {
      var end = Date.now();
      if (err) {
        return done(err);
      }
      done(null, __('Site "%s" generated in %ds', nell_site.site.title, (end - start) / 1000));
    });
  }
616423
public function saveExtension(
        $uuid,
        $data,
        $extensionName,
        $webspaceKey,
        $locale,
        $userId
    ) {
        $document = $this->loadDocument(
            $uuid,
            $locale,
            [
                'exclude_ghost' => true,
            ]
        );

        if (null === $document) {
            throw new TranslatedNodeNotFoundException($uuid, $locale);
        }

        if (!$document instanceof ExtensionBehavior) {
            throw new \RuntimeException(
                sprintf(
                    'Document of class "%s" must implement the ExtensionableBehavior if it is to be extended',
                    get_class($document)
                )
            );
        }

        // save data of extensions
        $extension = $this->extensionManager->getExtension($document->getStructureType(), $extensionName);
        $node = $this->inspector->getNode($document);

        $extension->save($node, $data, $webspaceKey, $locale);
        $extensionData = $extension->load($node, $webspaceKey, $locale);

        $document->setExtension($extension->getName(), $extensionData);

        $this->documentManager->flush();

        $structure = $this->documentToStructure($document);

        $event = new ContentNodeEvent($node, $structure);
        $this->eventDispatcher->dispatch(ContentEvents::NODE_POST_SAVE, $event);

        return $structure;
    }