Class: RJGit::LocalRefWriter

Inherits:
RefWriter
  • Object
show all
Defined in:
lib/repo.rb

Overview

Implementation of RefWriter for local files. This class is able to generate and write the $GIT_DIR/info/refs. For use in Repo::update_server_info.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(refs, path) ⇒ LocalRefWriter

Returns a new instance of LocalRefWriter.



15
16
17
18
# File 'lib/repo.rb', line 15

def initialize(refs, path)
  super(refs)
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#writeFile(file, content) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/repo.rb', line 20

def writeFile(file, content)
    file = File.join(@path, file)
  begin
    f = File.open(file, "w")
    f.write String.from_java_bytes(content)
    f.close
  rescue
    raise IOException.new # JGit API requires RefWriter.writeFile to throw IOException
  end
end