Class: GitDump

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/git_dump.rb,
lib/git_dump/cmd.rb,
lib/git_dump/repo.rb,
lib/git_dump/tree.rb,
lib/git_dump/entry.rb,
lib/git_dump/version.rb,
lib/git_dump/repo/git.rb,
lib/git_dump/tree/base.rb,
lib/git_dump/path_object.rb,
lib/git_dump/repo/rugged.rb,
lib/git_dump/tree/builder.rb,
lib/git_dump/version/base.rb,
lib/git_dump/version/builder.rb

Overview

Main interface, most instance methods forwarded to Repo

Defined Under Namespace

Classes: Cmd, Entry, PathObject, Repo, Tree, Version

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}) ⇒ GitDump

Initialize using existing repositiory use ‘:create => true` or `:create => :bare` to create bare repo if missing or `:create => :non_bare` for non bare one



13
14
15
# File 'lib/git_dump.rb', line 13

def initialize(path, options = {})
  @repo = Repo.new(path, options)
end

Class Method Details

.hostnameObject

hostname as returned by ‘hostname` or “unknown”



29
30
31
32
33
34
# File 'lib/git_dump.rb', line 29

def self.hostname
  @hostname ||= begin
    hostname = `hostname`.chomp
    hostname.empty? ? 'unknown' : hostname
  end
end

.remote_version_ids(url) ⇒ Object

List remote version ids



23
24
25
# File 'lib/git_dump.rb', line 23

def remote_version_ids(url)
  Repo.remote_version_ids(url)
end

.uuidObject

From 1.9 securerandom.rb, to replace with SecureRandom.uuid



37
38
39
40
41
42
# File 'lib/git_dump.rb', line 37

def self.uuid
  ary = SecureRandom.random_bytes(16).unpack('NnnnnN')
  ary[2] = (ary[2] & 0x0fff) | 0x4000
  ary[3] = (ary[3] & 0x3fff) | 0x8000
  format '%08x-%04x-%04x-%04x-%04x%08x', *ary
end