Class: Overapp::Git
Class Method Summary collapse
- .commit(output_path, message, &b) ⇒ Object
- .commit_inner(output_path, message, init, &b) ⇒ Object
- .repo?(path) ⇒ Boolean
Class Method Details
.commit(output_path, message, &b) ⇒ Object
18 19 20 21 |
# File 'lib/overapp/util/git.rb', line 18 def commit(output_path,,&b) init = !FileTest.exist?("#{output_path}/.git") commit_inner(output_path,,init,&b) end |
.commit_inner(output_path, message, init, &b) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/overapp/util/git.rb', line 4 def commit_inner(output_path,,init,&b) res = nil res = yield if block_given? if init `rm -rf #{output_path}/.git` ec "cd #{output_path} && git init && git config user.email [email protected] && git config user.name 'John Smith'", :silent => true end begin ec "cd #{output_path} && git add . && git commit -m '#{}'", :silent => true rescue; end res end |
.repo?(path) ⇒ Boolean
23 24 25 |
# File 'lib/overapp/util/git.rb', line 23 def repo?(path) path =~ /\.git/ || path =~ /file:\/\// || path =~ /git:\/\// end |