class Gitti::GitMirror

Public Class Methods

new( path ) click to toggle source
# File lib/gitti/mirror.rb, line 14
def initialize( path )
  raise ArgumentError, "dir >#{path}< not found; dir MUST already exist for GitMirror class - sorry"   unless Dir.exist?( path )
  ## todo/check:  check for more dirs and files e.g.
  ##  /info,/objects,/refs, /hooks, HEAD, config, description -- why? why not?
  raise ArgumentError, "dir >#{path}/objects< not found; dir MUST already be initialized with git for GitMirror class - sorry"  unless Dir.exist?( "#{path}/objects" )
  @path = path
end
open( path, &blk ) click to toggle source
# File lib/gitti/mirror.rb, line 4
def self.open( path, &blk )
  new( path ).open( &blk )
end
update( path ) click to toggle source
# File lib/gitti/mirror.rb, line 8
def self.update( path )    ### all-in-one convenience shortcut
  new( path).open { |mirror| mirror.update }
end

Public Instance Methods

open( &blk ) click to toggle source
# File lib/gitti/mirror.rb, line 23
def open( &blk )
  Dir.chdir( @path ) do
    blk.call( self )
  end
end
update() click to toggle source
# File lib/gitti/mirror.rb, line 29
def update()           Git.update; end