Class: FlatHash::Vcs
Instance Method Summary collapse
Instance Method Details
#commit(comment) ⇒ Object
6 7 8 |
# File 'lib/flat_hash/vcs.rb', line 6 def commit comment execute "commit -m \"#{comment}\"" end |
#execute(command) ⇒ Object
10 11 12 |
# File 'lib/flat_hash/vcs.rb', line 10 def execute command sh "#{name} #{command}" end |
#init ⇒ Object
2 3 4 |
# File 'lib/flat_hash/vcs.rb', line 2 def init execute "init" end |
#sh(command) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/flat_hash/vcs.rb', line 14 def sh command lines = [] IO.popen("#{command} 2>&1") {|io| io.each {|l| lines << l.chomp } } unless $?.success? raise "\"#{command}\" failed with status #{$?}:\n#{lines.join("\n")}" unless block_given? return yield($?, lines) end lines end |