Amend @repository with the tag information from the downloaded
 file.

 === Parameters
 file(String):: file that was downloaded
964462
def note_tag(file)
      digest = Digest::SHA1.new
      File.open(file) {|f| digest << f.read(4096) }
      repo = @repository.clone
      repo.tag = digest.hexdigest
      @repository = repo
    end
405838
def change(file)
      if file.is_a?(Ichiban::HelperFile) or file.is_a?(Ichiban::ModelFile)
        delete_all
        load_all
        Ichiban.logger.reload(file.abs)
      end
    end
7752
def with_file(name, *args)
      logger.debug "with_file(#{name.inspect}, #{args.inspect})"
      result = args.inject(config_for(name)) { |v, i|
        logger.debug "v = #{v.inspect}, i = #{i.inspect}"
        case v
          when Hash
            v[i.to_s]
          when Array
            i.is_a?(Integer) ? v[i] : nil
          else
            nil
        end
      }
      logger.debug "with_file(#{name.inspect}, #{args.inspect}) => #{result.inspect}"
      result
    end
1271201
def _downloaded_filename(self):
        
        # Peep doesn't support requirements that don't come down as a single
        # file, because it can't hash them. Thus, it doesn't support editable
        # requirements, because pip itself doesn't support editable
        # requirements except for "local projects or a VCS url". Nor does it
        # support VCS requirements yet, because we haven't yet come up with a
        # portable, deterministic way to hash them. In summary, all we support
        # is == requirements and tarballs/zips/etc.

        # TODO: Stop on reqs that are editable or aren't ==.

        # If the requirement isn't already specified as a URL, get a URL
        # from an index:
        link = self._link() or self._finder.find_requirement(self._req, upgrade=False)

        if link:
            lower_scheme = link.scheme.lower()  # pip lower()s it for some reason.
            if lower_scheme == 'http' or lower_scheme == 'https':
                file_path = self._download(link)
                return basename(file_path)
            elif lower_scheme == 'file':
                # The following is inspired by pip's unpack_file_url():
                link_path = url_to_path(link.url_without_fragment)
                if isdir(link_path):
                    raise UnsupportedRequirementError(
                        "%s: %s is a directory. So that it can compute "
                        "a hash, peep supports only filesystem paths which "
                        "point to files" %
                        (self._req, link.url_without_fragment))
                else:
                    copy(link_path, self._temp_path)
                    return basename(link_path)
            else:
                raise UnsupportedRequirementError(
                    "%s: The download link, %s, would not result in a file "
                    "that can be hashed. Peep supports only == requirements, "
                    "file:// URLs pointing to files (not folders), and "
                    "http:// and https:// URLs pointing to tarballs, zips, "
                    "etc." % (self._req, link.url))
        else:
            raise UnsupportedRequirementError(
                "%s: couldn't determine where to download this requirement from."
                % (self._req,))
33004
def copy(from_path, to_path)
      resp = request('/files/copy', from_path: from_path, to_path: to_path)
      parse_tagged_response(resp)
    end
649355
def resolve_snippet_path(context, tag)
      if tag.has_repo?
        pkg = find_package_by_tag(tag)
        pkg.snippet_path tag.path
      else
        new_context = context.clone
        new_context.dirname + "/" + tag.filename
      end
    end
1055349
def file(name, &block)
      path = @path + name
      unless ::File.file?(path)
        FileUtils.touch(path)
        @ctx.add(path)
      end
      f = File.new(@ctx, path)
      f.instance_eval(&block) if block_given?
      f
    end
738011
def load(path)
      if File.directory?(path)
        Dir[path+"/**/*.rb"].each do |file|
          # Ruby 1.8 doesn't understand that "jsduck/tag/tag" and
          # "./lib/jsduck/tag/tag.rb" refer to the same file.  So
          # explicitly avoid loading this file (as it's required on
          # top already) to prevent warnings of constants getting
          # defined multiple times.
          require(file) unless file =~ /jsduck\/tag\/tag\.rb$/
        end
      else
        require(path)
      end
    end
1373961
def file_cmd(context, tags, archive, bundle_name, path):
    """"""
    bundle_obj = context.obj['db'].bundle(bundle_name)
    if bundle_obj is None:
        click.echo(click.style(f"unknown bundle: {bundle_name}", fg='red'))
        context.abort()
    version_obj = bundle_obj.versions[0]
    new_file = context.obj['db'].new_file(
        path=str(Path(path).absolute()),
        to_archive=archive,
        tags=[context.obj['db'].tag(tag_name) if context.obj['db'].tag(tag_name) else
              context.obj['db'].new_tag(tag_name) for tag_name in tags]
    )
    new_file.version = version_obj
    context.obj['db'].add_commit(new_file)
    click.echo(click.style(f"new file added: {new_file.path} ({new_file.id})", fg='green'))
1006836
def download_to_file(self, file):
        
        con = ConnectionManager().get_connection(self._connection_alias)
        return con.download_to_file(self.file, file, append_base_url=False)
832389
def update_links_from_file(file)
      File.foreach(file) do |line|
        next if line.chomp.empty?
        url, name, description, tag = line.chomp.split(';')
        website.find_links(url).first.update({ name:        name,
                                               description: description,
                                               tag:         tag })
      end
    end
302780
def update(oldrev=nil, newrev=nil)
      if index_file_exists? && oldrev != "0"*40
        hg([
            "log --debug -r ?:? --style ? >> ?",
            oldrev, newrev, Style.file_index, path
          ])
      else
        hg(["log --debug -r : --style ? > ?", Style.file_index, path])
      end
    end
178663
function getUrl (file) {

            if (!that.ignore(file)) {
                file = that.map(file);
                file = utils.normalize(file);
                return file;
            }
        }
221543
def versionfile(dir = Dir.pwd, options = {})
      file    = (options[:file])    ? options[:file]    : 'VERSION'
      version = (options[:version]) ? options[:version] : '0.0.0'
      info " ==> bootstrapping a VERSION file"
      path = normalized_path(dir)
      path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
      unless Dir.exist?( path )
        warning "The directory #{path} does not exists and will be created"
        really_continue?
        FileUtils.mkdir_p path
      end
      versionfile = File.join(path, file)
      if File.exist?( versionfile )
        puts "  ... not overwriting the #{file} file which already exists"
      else
        FalkorLib::Versioning.set_version(version, path, :type => 'file',
                                          :source => { :filename => file })
        Dir.chdir( path ) do
          run %( git tag #{options[:tag]} ) if options[:tag]
        end
      end

      # unless File.exists?( versionfile )
      #     run %{  echo "#{version}" > #{versionfile} }
      #     if FalkorLib::Git.init?(path)
      #         FalkorLib::Git.add(versionfile, "Initialize #{file} file")
      #         Dir.chdir( path ) do
      #             run %{ git tag #{options[:tag]} } if options[:tag]
      #         end
      #     end
      # else
      #     puts "  ... not overwriting the #{file} file which already exists"
      # end
    end
395123
def from_file
      config = YAML.load_file @file
      version = VersionNumberFactory.from_string config['version']

      BumpInfo.new version, config['files'], config['commit']
    end
200059
def _parse_file_modify(self, info):
        
        params = info.split(b' ', 2)
        path = self._path(params[2])
        mode = self._mode(params[0])
        if params[1] == b'inline':
            dataref = None
            data = self._get_data(b'filemodify')
        else:
            dataref = params[1]
            data = None
        return commands.FileModifyCommand(path, mode, dataref,
            data)
1172581
def loadfile
      valid_existing_file?(@file)

      results = Threshold::Parser.new(@file)
      @stored_hash= results.filehash
      #puts stored_hash
      results.caps.each do |result|
        builder = Threshold::Builder.new(result)
        self << builder.build
      end

    end