Class: Moku::SCM::File

Inherits:
Object
  • Object
show all
Defined in:
lib/moku/scm/file.rb

Overview

Represents a backend over a local repository.

See Also:

Instance Method Summary collapse

Instance Method Details

#safe_checkout(url, _commitish, dir) {|Array<Pathname>| ... } ⇒ Object

Checkout (copy) into a temporary directory, and yield the files

Parameters:

  • url (String)

    This should be a path or Pathname

  • commitish (String)

    A name for the reference.

Yields:

  • (Array<Pathname>)

    Files contained in the checked-out repository, including the working directory itself.


26
27
28
29
30
31
32
33
34
35
# File 'lib/moku/scm/file.rb', line 26

def safe_checkout(url, _commitish, dir)
  cloned_dir = Pathname.new(dir) + "moku"
  FileUtils.cp_r url, cloned_dir
  working_directory = WorkingDirectory.from_path(cloned_dir)
  if block_given?
    yield working_directory
  else
    working_directory
  end
end

#sha(_url, commitish) ⇒ String

Returns The commitish given to this method.

Parameters:

  • url (String)

    This should be a path or Pathname

  • commitish (String)

    A name for the reference.

Returns:

  • (String)

    The commitish given to this method.


16
17
18
# File 'lib/moku/scm/file.rb', line 16

def sha(_url, commitish)
  commitish
end