8.9.3.

@Update(
version = "8009003",
description = "Adding support for Asset Packagist."
)
187785
public function update_8009003() {
    $composer_json = $this->updater->getComposerJson();

    $composer_json['extra']['installer-types'][] = 'bower-asset';
    $composer_json['extra']['installer-types'][] = 'npm-asset';
    $composer_json['extra']['installer-paths']['docroot/libraries/{$name}'][] = 'type:bower-asset';
    $composer_json['extra']['installer-paths']['docroot/libraries/{$name}'][] = 'type:npm-asset';

    // Add the Asset Packagist repository if it does not already exist.
    if (isset($composer_json['repositories'])) {
      $repository_key = NULL;
      foreach ($composer_json['repositories'] as $key => $repository) {
        if ($repository['type'] == 'composer' && strpos($repository['url'], 'https://asset-packagist.org') === 0) {
          $repository_key = $key;
          break;
        }
      }
      if (is_null($repository_key)) {
        $composer_json['repositories']['asset-packagist'] = [
          'type' => 'composer',
          'url' => 'https://asset-packagist.org',
        ];
      }
    }

    $projectAcsfHooks = $this->updater->getRepoRoot() . '/factory-hooks';
    $acsf_inited = file_exists($projectAcsfHooks);
    if ($acsf_inited) {
      $composer_json['config']['platform']['php'] = '5.6';
    }

    $this->updater->writeComposerJson($composer_json);

    $messages = [
      "Your composer.json file has been modified to be compatible with Lightning 2.1.8+.",
      "You must execute `composer update` to update your lock file.",
    ];
    $formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
    $this->updater->getOutput()->writeln("");
    $this->updater->getOutput()->writeln($formattedBlock);
    $this->updater->getOutput()->writeln("");
  }
1079785
def update(sc, filename, asset_id):
    '''
    
    '''
    addresses = []
    with open(filename) as hostfile:
        for line in hostfile.readlines():
            addresses.append(line.strip('\n'))
    sc.asset_update(asset_id, dns=addresses)
158060
public function add(FileAssetInterface $asset)
    {
        if (!$asset->getPackageName()) {
            // Deprecated.
            $asset->setPackageName('extensions');
        }

        $key = $asset->getPackageName()."/".$asset->getPath();

        if ($asset->getType() === 'javascript') {
            $this->javascript[$key] = $asset;
        } elseif ($asset->getType() === 'stylesheet') {
            $this->stylesheet[$key] = $asset;
        } else {
            throw new \InvalidArgumentException(sprintf('Requested asset type %s is not valid.', $asset->getType()));
        }
    }
1047194
@Override
    public T addPackage(Package pack) throws IllegalArgumentException {
        Validate.notNull(pack, "Pack must be specified");

        return addPackage(pack.getName());
    }
669692
@Override
    public T addAsModule(final String resourceName, final ArchivePath targetPath) throws IllegalArgumentException {
        Validate.notNull(resourceName, "ResourceName must be specified");
        Validate.notNull(targetPath, "Target Path must be specified");

        final Asset asset = new ClassLoaderAsset(resourceName);
        return addAsModule(asset, targetPath);
    }
1317671
public function upgrade(): void
    {
        // These tables were created by webtrees 1.x, and may not exist if we first installed webtrees 2.x
        DB::schema()->dropIfExists('site_access_rule');
        DB::schema()->dropIfExists('next_id');

        // Split the media table into media/media_file so that we can store multiple media
        // files in each media object.
        DB::schema()->create('media_file', static function (Blueprint $table): void {
            $table->integer('id', true);
            $table->string('m_id', 20);
            $table->integer('m_file');
            $table->string('multimedia_file_refn', 248); // GEDCOM only allows 30 characters
            $table->string('multimedia_format', 4);
            $table->string('source_media_type', 15);
            $table->string('descriptive_title', 248);

            $table->index(['m_id', 'm_file']);
            $table->index(['m_file', 'm_id']);
            $table->index(['m_file', 'multimedia_file_refn']);
            $table->index(['m_file', 'multimedia_format']);
            $table->index(['m_file', 'source_media_type']);
            $table->index(['m_file', 'descriptive_title']);
        });

        if (DB::schema()->hasColumn('media', 'm_filename')) {
            (new Builder(DB::connection()))->from('media_file')->insertUsing([
                'm_id',
                'm_file',
                'multimedia_file_refn',
                'multimedia_format',
                'source_media_type',
                'descriptive_title',
            ], static function (Builder $query): void {
                $query->select([
                    'm_id',
                    'm_file',
                    'm_filename',
                    'm_ext',
                    'm_type',
                    'm_titl',
                ])->from('media');
            });

            // SQLite can only drop one column at a time.
            DB::schema()->table('media', static function (Blueprint $table): void {
                $table->dropColumn('m_filename');
            });
            DB::schema()->table('media', static function (Blueprint $table): void {
                $table->dropColumn('m_ext');
            });
            DB::schema()->table('media', static function (Blueprint $table): void {
                $table->dropColumn('m_type');
            });
            DB::schema()->table('media', static function (Blueprint $table): void {
                $table->dropColumn('m_titl');
            });
        }
    }
1114074
function packageVersion(repo) {
    var location = repo ? path.join(repo, 'package.json') : './package.json';
    var pack = require(location);
    return pack['version'];
}
1329065
@Override
    public T addAsApplicationResource(Asset resource, ArchivePath target) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource must be specified");
        Validate.notNull(target, "Target must be specified");

        ArchivePath location = new BasicPath(getApplicationPath(), target);
        return add(resource, location);
    }
785914
public function onKernelRequest()
    {
        foreach ($this->kernel->getBundles() as $bundle) {
            $bundlePathPackage = new BundlePathPackage($this->versionStrategy);
            $bundlePathPackage->setBundlePath($bundle->getName());
            $this->assetsPackages->addPackage($bundle->getName(), $bundlePathPackage);
        }
    }
127093
protected function addScriptsToNpmPackage()
    {
        $package = json_decode(file_get_contents(base_path('package.json')), true);

        $package['scripts']['build-'.$this->assetName()] = 'cd '.$this->relativeAssetPath().' && npm run dev';
        $package['scripts']['build-'.$this->assetName().'-prod'] = 'cd '.$this->relativeAssetPath().' && npm run prod';

        file_put_contents(
            base_path('package.json'),
            json_encode($package, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
        );
    }
340821
function version() {
  const packageJson = require(path.resolve(__dirname, '..', 'package.json'));
  logger.info('@blackbaud/skyux-builder: %s', packageJson.version);
}
1058057
public function update_8009001() {
    $project_yml = $this->updater->getProjectYml();
    unset($project_yml['phpcs']['filesets']['files.php.custom.modules']);
    unset($project_yml['phpcs']['filesets']['files.php.custom.themes']);
    unset($project_yml['phpcs']['filesets']['files.php.tests']);
    $this->updater->writeProjectYml($project_yml);
  }
447184
def update_stampfile_hook(self, dependencies):  # suppress(no-self-use)
        """"""
        hashes = {d: _sha1_for_file(d) for d in dependencies
                  if os.path.exists(d)}
        with open(self._stamp_file_hashes_path, "wb") as hashes_file:
            hashes_file.write(json.dumps(hashes).encode("utf-8"))
820092
function updateVersion(pkg) {
  fs.readFile(__dirname + '/../package.json', 'utf8', (err, data) => {
    errorOnFail(err)
    const globalVersion = JSON.parse(data).version

    fs.readFile(__dirname + '/../packages/' + pkg + '/package.json', (err, data) => {
      errorOnFail(err)

      const packageJSON = JSON.parse(data)
      packageJSON.version = globalVersion

      // Update react-look-core dependency version
      if (pkg !== 'react-look-core') {
        packageJSON.dependencies['react-look-core'] = '^' + globalVersion
      }

      // Update react-look dependency version
      if (pkg === 'react-look-test-utils') {
        packageJSON.peerDependencies['react-look'] = '^' + globalVersion
      }

      const newPackageJSON = JSON.stringify(packageJSON, null, 4)

      fs.writeFile(__dirname + '/../packages/' + pkg + '/package.json', newPackageJSON, err => {
        errorOnFail(err)
        console.log('Successfully updated ' + pkg + ' version and react-look-core dependency version to ' + globalVersion + '.')
      })
    })
  })
}
1011103
public function update_8007000() {
    $composer_required_json = $this->updater->getComposerRequiredJson();
    $composer_suggested_json = $this->updater->getComposerSuggestedJson();
    $composer_json = $this->updater->getComposerJson();

    // Remove deprecated config.
    unset($composer_json['extra']['blt']['composer-exclude-merge']);

    // Remove packages from root composer.json that are already defined in BLT's composer.required.json with matching version.
    if (!empty($composer_required_json['require'])) {
      foreach ($composer_required_json['require'] as $package_name => $package_version) {
        if (array_key_exists($package_name,
            $composer_json['require']) && $package_version == $composer_json['require'][$package_name]
        ) {
          unset($composer_json['require'][$package_name]);
        }
      }
    }

    // Do the same for require-dev.
    if (!empty($composer_required_json['require-dev']) && !empty($composer_json['require-dev'])) {
      foreach ($composer_required_json['require-dev'] as $package_name => $package_version) {
        if (array_key_exists($package_name,
            $composer_json['require-dev']) && $package_version == $composer_json['require-dev'][$package_name]
        ) {
          unset($composer_json['require-dev'][$package_name]);
        }
      }
    }

    // Remove packages from root composer.json that are already defined in BLT's composer.suggested.json with matching version.
    if (!empty($composer_suggested_json['require'])) {
      foreach ($composer_suggested_json['require'] as $package_name => $package_version) {
        if (array_key_exists($package_name,
            $composer_json['require']) && $package_version == $composer_json['require'][$package_name]
        ) {
          unset($composer_json['require'][$package_name]);
        }
      }
    }
    // Do the same for require-dev.
    if (!empty($composer_suggested_json['require-dev'])) {
      foreach ($composer_suggested_json['require-dev'] as $package_name => $package_version) {
        if (array_key_exists($package_name,
            $composer_json['require-dev']) && $package_version == $composer_json['require-dev'][$package_name]
        ) {
          unset($composer_json['require-dev'][$package_name]);
        }
      }
    }

    // Remove redundant config for drupal-scaffold.
    if (!empty($composer_json['extra']['drupal-scaffold']) && !empty($composer_required_json['extra']['drupal-scaffold']) &&
      $composer_json['extra']['drupal-scaffold'] == $composer_required_json['extra']['drupal-scaffold']) {
      unset($composer_json['extra']['drupal-scaffold']);
    }

    // Remove redundant config for autoload-dev.
    unset($composer_json['autoload-dev']['psr-4']['Drupal\\Tests\\PHPUnit\\']);
    if (empty($composer_json['autoload-dev']['psr-4'])) {
      unset($composer_json['autoload-dev']['psr-4']);
    }
    if (empty($composer_json['autoload-dev'])) {
      unset($composer_json['autoload-dev']);
    }

    if (!empty($composer_json['scripts'])) {
      foreach ($composer_required_json['scripts'] as $script_name => $script) {
        if (array_key_exists($script_name, $composer_json['scripts'])) {
          unset($composer_json['scripts'][$script_name]);
        }
      }
      if (empty($composer_json['scripts'])) {
        unset($composer_json['scripts']);
      }
    }

    $template_composer_json = $this->updater->getTemplateComposerJson();
    // Set installer-paths to match template.
    foreach ($template_composer_json['extra']['installer-paths'] as $key => $template_installer_path) {
      $composer_json['extra']['installer-paths'][$key] = $template_installer_path;
    }

    // Set wikimedia/composer-merge-plugin config.
    if (!empty($composer_json['extra']['merge-plugin'])) {
      $composer_json['extra']['merge-plugin'] = ArrayManipulator::arrayMergeRecursiveDistinct($composer_json['extra']['merge-plugin'], $template_composer_json['extra']['merge-plugin']);
    }
    else {
      $composer_json['extra']['merge-plugin'] = $template_composer_json['extra']['merge-plugin'];
    }

    // Write to file.
    $this->updater->writeComposerJson($composer_json);

    $messages = [
      'BLT will no longer directly modify your composer.json requirements!',
      "Default composer.json values from BLT are now merged into your root composer.json via wikimedia/composer-merge-plugin. Please see the following documentation for more information:\n",
      "  - http://blt.readthedocs.io/en/9.x/readme/updating-blt/#modifying-blts-default-composer-values\n   - https://github.com/wikimedia/composer-merge-plugin"
    ];
    $formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');

    $this->updater->getOutput()->writeln("");
    $this->updater->getOutput()->writeln($formattedBlock);
    $this->updater->getOutput()->writeln("");
    $this->updater->getOutput()->writeln("<comment>Please execute `composer update` to incorporate these final automated changes to composer.json.</comment>");

    // Sync updates to drushrc.php manually since it has been added to ignore-existing.txt.
    $drushrcFile = 'drush/drushrc.php';
    $this->updater->syncWithTemplate($drushrcFile, TRUE);

    // Legacy versions will have defaulted to use features for config management.
    // Must explicitly set formerly assumed value.
    $project_yml = $this->updater->getProjectYml();
    $project_yml['cm']['strategy'] = 'features';
    $this->updater->writeProjectYml($project_yml);
  }
698187
function updateSampleConfig() {
  console.info('Updating plugin package.json...');

  const argVersion = process.argv[2]; // -v
  const argVersionNumber = process.argv[3]; // eg 1.5.6

  let pluginPackageFile = './package.json';
  let samplePackageFile = './sample/package.json';
  fs.readFile(pluginPackageFile, 'utf8', (err, data) => {
    let obj = JSON.parse(data);

    let versions = new Array();

    versions = obj.version.split('.');

    PLUGIN_NAME = obj.name || PLUGIN_NAME;
    PLUGIN_VERSION = obj.version || PLUGIN_VERSION;

    if (versions && (versions.length > 0)) {
      if (argVersion != undefined && argVersionNumber == undefined) {
        versions[versions.length - 1] = safeIncreaseVersion(versions[versions.length - 1]);
      }
      if (argVersionNumber != undefined) {
        versions = argVersionNumber.split('.');
      }
      console.info(`Version changing ${obj.version} => ${versions.join('.')}`);
      obj.version = versions.join('.');
      PLUGIN_VERSION = versions.join('.');
    }

    const dev = obj.dependencies;
    let sampleDep = {};
    let sample = {};

    fs.readFile(samplePackageFile, 'utf8', (err, res) => {

      sample = JSON.parse(res);
      sampleDep = sample.dependencies;

      sample.dependencies = dev;
      sample.version = PLUGIN_VERSION;
      sample.name = PLUGIN_SAMPLE_NAME;

      obj = JSON.stringify(obj, null, 4);
      let smplObj = JSON.stringify(sample, null, 4);

      fs.writeFile(pluginPackageFile, obj, function (e) { });
      fs.writeFile(samplePackageFile, smplObj, function (e) { });

      console.log('Plugin package.json updated.');

    });


  });
}
566431
public function update()
    {
        $update_url = 'https://raw.github.com/ai/autoprefixer-rails/master/vendor/autoprefixer.js';
        $local_path = __DIR__ . '/vendor/autoprefixer.js';
        $new = file_get_contents($update_url);
        $old = file_get_contents($local_path);
        
        if (md5($new) == md5($old)) return false;
        
        file_put_contents($local_path, $new);
        return true;
    }