Assets for a given release
176933
def release_assets(self, release):
        
        release = self.as_id(release)
        return self.get_list(url='%s/%s/assets' % (self, release))
957145
def _update_release_content(self, release, content):
        """"""
        if release.body:
            new_body = []
            current_parser = None
            is_start_line = False
            for parser in self.parsers:
                parser.replaced = False

            # update existing sections
            for line in release.body.splitlines():

                if current_parser:
                    if current_parser._is_end_line(current_parser._process_line(line)):
                        parser_content = current_parser.render()
                        if parser_content:
                            # replace existing section with new content
                            new_body.append(parser_content + "\r\n")
                        current_parser = None

                for parser in self.parsers:
                    if (
                        parser._render_header().strip()
                        == parser._process_line(line).strip()
                    ):
                        parser.replaced = True
                        current_parser = parser
                        is_start_line = True
                        break
                    else:
                        is_start_line = False

                if is_start_line:
                    continue
                if current_parser:
                    continue
                else:
                    # preserve existing sections
                    new_body.append(line.strip())

            # catch section without end line
            if current_parser:
                new_body.append(current_parser.render())

            # add new sections at bottom
            for parser in self.parsers:
                parser_content = parser.render()
                if parser_content and not parser.replaced:
                    new_body.append(parser_content + "\r\n")

            content = u"\r\n".join(new_body)

        return content
512194
function assetFile(filename, callback) {
      const data = {
        source: files[filename].source,
        destination: files[filename].destination || path.join(path.dirname(filename), '.')
      }
      delete files[filename]
      metalsmithAssets(data)(files, metalsmith, callback)
    }
338086
def additional_assets(context: Context):
    
    rsync_flags = '-avz' if context.verbosity == 2 else '-az'
    for path in context.app.additional_asset_paths:
        context.shell('rsync %s %s %s/' % (rsync_flags, path, context.app.asset_build_path))
997435
public static function exportAssetsVersion()
    {
        $process = new Process('git log -n 1');

        if (0 !== $process->run()) {
            return;
        }

        $output = $process->getOutput();

        if (empty($output)) {
            return;
        }

        putenv(self::ENV_ASSETS_VERSION.'='.md5($output));
    }
1346909
def bind_releases
      releases = @deployment_plan.releases
      with_release_locks(releases.map(&:name)) do
        releases.each do |release|
          release.bind_model
        end
      end
    end
852673
function prepareRelease() {
  // Load WTF binary. Search a few paths.
  // TODO(benvanik): look in ENV?
  var searchPaths = [
    '.',
    './build-out',
    '../build-out'
  ];
  var modulePath = path.dirname(module.filename);
  var wtfPath = null;
  for (var n = 0; n < searchPaths.length; n++) {
    var searchPath = path.join(
        searchPaths[n], 'wtf_node_js_compiled.js');
    searchPath = path.join(modulePath, searchPath);
    if (fs.existsSync(searchPath)) {
      wtfPath = path.relative(modulePath, searchPath);
      break;
    }
  }
  if (!wtfPath) {
    console.log('Unable to find wtf_node_js_compiled.js');
    process.exit(-1);
    return;
  }
  var wtf = require(wtfPath.replace('.js', ''));
  global.wtf = wtf;
}
15469
function getAsset(key) {
  return new Promise((resolve, reject) => {
    return instance.assets.then(db => {
      const req = db.transaction(db.name)
        .objectStore(db.name).get(key);
      req.onsuccess = event => {
        const undef = event.target.result === undefined;
        const value = undef ? undefined : event.target.result.value;
        resolve(value);
      };
      req.onerror = event => reject(event);
    });
  });
}
22594
function(release) {
    release = release || this.release;
    if (release) {
      if (this.useHash) {
        return addHash(release, this);
      } else {
        return release;
      }
    } else {
      fis.log.error('unreleasable file [%s]', this.realpath);
    }
  }
1171549
function putAsset(key, content) {
  return new Promise((resolve, reject) => {
    return instance.assets.then(db => {
      const obj = db.transaction(db.name, 'readwrite')
        .objectStore(db.name);
      const req = obj.put({key: key, value: content});
      req.onerror = event => reject(event);
      req.onsuccess = () => resolve();
    });
  });
}
1199641
def update_asset_attributes
      if !self.external_service? and self.present? and self.changed?
        self.content_type = self.filename.file.content_type
        self.file_size = self.filename.file.size
        self.width, self.height = `identify -format "%wx%h" #{self.filename.file.path}`.split(/x/) unless self.document? or self.width? or self.height?
        self.ratio = self.width.to_f / self.height.to_f if self.width.present? and self.height.present?
      end
    end
1146446
def view_release():
    """"""
    build = g.build
    if request.method == 'POST':
        form = forms.ReleaseForm(request.form)
    else:
        form = forms.ReleaseForm(request.args)

    form.validate()

    ops = operations.BuildOps(build.id)
    release, run_list, stats_dict, approval_log = ops.get_release(
        form.name.data, form.number.data)

    if not release:
        abort(404)

    if request.method == 'POST':
        decision_states = (
            models.Release.REVIEWING,
            models.Release.RECEIVING,
            models.Release.PROCESSING)

        if form.good.data and release.status in decision_states:
            release.status = models.Release.GOOD
            auth.save_admin_log(build, release_good=True, release=release)
        elif form.bad.data and release.status in decision_states:
            release.status = models.Release.BAD
            auth.save_admin_log(build, release_bad=True, release=release)
        elif form.reviewing.data and release.status in (
                models.Release.GOOD, models.Release.BAD):
            release.status = models.Release.REVIEWING
            auth.save_admin_log(build, release_reviewing=True, release=release)
        else:
            logging.warning(
                'Bad state transition for name=%r, number=%r, form=%r',
                release.name, release.number, form.data)
            abort(400)

        db.session.add(release)
        db.session.commit()

        ops.evict()

        return redirect(url_for(
            'view_release',
            id=build.id,
            name=release.name,
            number=release.number))

    # Update form values for rendering
    form.good.data = True
    form.bad.data = True
    form.reviewing.data = True

    return render_template(
        'view_release.html',
        build=build,
        release=release,
        run_list=run_list,
        release_form=form,
        approval_log=approval_log,
        stats_dict=stats_dict)
576013
function (asset) {
    var bundle = this.bundle;
    var requires = bundle.getRequiredFiles(asset.assetFilePath);
    if (requires.length > 0) {
      return requires.map(function (file) {
        return bundle.getAsset(file).logicalPath;
      });
    } else {
      return [asset.logicalPath];
    }
  }
702852
def build_assets():
    """"""
    cwd = os.getcwd()
    try:
        from webassets.script import GenericArgparseImplementation
        from django_assets.env import get_env
        prog = "%s assets" % os.path.basename(sys.argv[0])
        impl = GenericArgparseImplementation(
            env=get_env(), log=LOGGER, no_global_options=True, prog=prog)
        impl.run_with_argv(["build"])
    except ImportError:
        pass
    os.chdir(cwd)
1186153
def assets(self):
        
        if self._assets is None:
            self._assets = AssetList(self._version, service_sid=self._solution['sid'], )
        return self._assets
226363
function updateManifest() {
  const {stdout: branch} = exec(`git rev-parse --abbrev-ref HEAD`)

  if (!branch.includes("release")) {
    return;
  }

  console.log("[copy-assets] update assets manifest");

  const last = lastRelease();
  exec(`git cat-file -p ${last}:assets/module-manifest.json > assets/module-manifest.json`);
}
155869
function() {
                var asset;
                Microloader.updatedAssetsReady = true;

                if (Microloader.updatedManifest) {
                    while (Microloader.removedAssets.length > 0) {
                        asset = Microloader.removedAssets.pop();
                        //<debug>
                            _debug("Asset: " + asset.assetConfig.path + " was removed, un-caching");
                        //</debug>
                        asset.uncache();
                    }

                    if (Microloader.updatedManifest) {
                        //<debug>
                        _debug("Manifest was updated, re-caching");
                        //</debug>
                        Microloader.updatedManifest.cache();
                    }

                    while (Microloader.updatedAssets.length > 0) {
                        asset = Microloader.updatedAssets.pop();
                        //<debug>
                            _debug("Asset: " + asset.assetConfig.path + " was updated, re-caching");
                        //</debug>
                        asset.cache();
                    }

                }

                Microloader.notifyUpdateReady();
            }