Class: RJGit::LocalRefWriter
- Inherits:
-
RefWriter
- Object
- RefWriter
- RJGit::LocalRefWriter
- 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
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(refs, path) ⇒ LocalRefWriter
constructor
A new instance of LocalRefWriter.
- #writeFile(file, content) ⇒ Object
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
#path ⇒ Object
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 |