Class: Toys::Utils::GitCache::RepoInfo
- Inherits:
 - 
      Object
      
        
- Object
 - Toys::Utils::GitCache::RepoInfo
 
 
- Includes:
 - Comparable
 
- Defined in:
 - lib/toys/utils/git_cache.rb
 
Overview
Information about a remote git repository in the cache.
This object is returned from #repo_info.
Instance Attribute Summary collapse
- 
  
    
      #base_dir  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The base directory of this git repository's cache entry.
 - 
  
    
      #last_accessed  ⇒ Time? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The last time any cached data from this repo was accessed, or
nilif the information is unavailable. - 
  
    
      #refs  ⇒ Array<RefInfo> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
A list of git refs (branches, tags, shas) that have been accessed from this repo.
 - 
  
    
      #remote  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The git remote, usually a file system path or URL.
 - 
  
    
      #sources  ⇒ Array<SourceInfo> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
A list of shared source files and directories accessed for this repo.
 
Instance Method Summary collapse
- 
  
    
      #<=>(other)  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
Comparison function.
 - 
  
    
      #to_h  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Convert this RepoInfo to a hash suitable for JSON output.
 
Instance Attribute Details
#base_dir ⇒ String (readonly)
The base directory of this git repository's cache entry. This directory contains all cached data related to this repo. Deleting it effectively removes the repo from the cache.
      61 62 63  | 
    
      # File 'lib/toys/utils/git_cache.rb', line 61 def base_dir @base_dir end  | 
  
#last_accessed ⇒ Time? (readonly)
The last time any cached data from this repo was accessed, or nil
if the information is unavailable.
      76 77 78  | 
    
      # File 'lib/toys/utils/git_cache.rb', line 76 def last_accessed @last_accessed end  | 
  
#refs ⇒ Array<RefInfo> (readonly)
A list of git refs (branches, tags, shas) that have been accessed from this repo.
      84 85 86  | 
    
      # File 'lib/toys/utils/git_cache.rb', line 84 def refs @refs end  | 
  
#remote ⇒ String (readonly)
The git remote, usually a file system path or URL.
      68 69 70  | 
    
      # File 'lib/toys/utils/git_cache.rb', line 68 def remote @remote end  | 
  
#sources ⇒ Array<SourceInfo> (readonly)
A list of shared source files and directories accessed for this repo.
      91 92 93  | 
    
      # File 'lib/toys/utils/git_cache.rb', line 91 def sources @sources end  | 
  
Instance Method Details
#<=>(other) ⇒ Integer
Comparison function
      115 116 117  | 
    
      # File 'lib/toys/utils/git_cache.rb', line 115 def <=>(other) remote <=> other.remote end  | 
  
#to_h ⇒ Hash
Convert this RepoInfo to a hash suitable for JSON output
      98 99 100 101 102 103 104 105 106 107  | 
    
      # File 'lib/toys/utils/git_cache.rb', line 98 def to_h result = { "remote" => remote, "base_dir" => base_dir, } result["last_accessed"] = last_accessed.to_i if last_accessed result["refs"] = refs.map(&:to_h) result["sources"] = sources.map(&:to_h) result end  |