Module: Toys::StandardMixins::GitCache

Includes:
Mixin
Defined in:
lib/toys/standard_mixins/git_cache.rb

Overview

A mixin that provides a git cache.

This mixin provides an instance of Utils::GitCache, providing cached access to files from a remote git repo.

Example usage:

include :git_cache

def run
  # Pull and cache the HEAD commit from the Toys repo.
  dir = git_cache.find("https://github.com/dazuma/toys.git")
  # Display the contents of the readme file.
  puts File.read(File.join(dir, "README.md"))
end

Constant Summary collapse

KEY =

Context key for the GitCache object.

Returns:

  • (Object)
::Object.new.freeze

Instance Method Summary collapse

Methods included from Mixin

create

Instance Method Details

#git_cacheToys::Utils::GitCache

Access the builtin GitCache.



36
37
38
# File 'lib/toys/standard_mixins/git_cache.rb', line 36

def git_cache
  self[KEY]
end