Method: Trahald::Git#add!
- Defined in:
- lib/trahald/git.rb
#add!(name, body) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/trahald/git.rb', line 24 def add!(name, body) path = "#{@repo_dir}/#{name}.#{@ext}" FileUtils.mkdir_p File.dirname(path) begin File.open(path, 'w'){|f| f.write(body)} Dir.chdir(@repo_dir){ repo.add "#{name}.#{@ext}".force_encoding("ASCII-8BIT") } true rescue => exception puts exception false end end |