Module: Jets::Git::GitCli
Instance Method Summary collapse
- #git(args, on_error: :nil) ⇒ Object
- #git? ⇒ Boolean
- #git_folder? ⇒ Boolean
- #git_installed? ⇒ Boolean
Instance Method Details
#git(args, on_error: :nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jets/git/git_cli.rb', line 15 def git(args, on_error: :nil) out = `git #{args}`.strip unless $?.success? case on_error when :raise raise Jets::Git::Error, "ERROR: git #{args} failed".color(:red) when :nil return end end out end |
#git? ⇒ Boolean
3 4 5 |
# File 'lib/jets/git/git_cli.rb', line 3 def git? git_folder? && git_installed? end |
#git_folder? ⇒ Boolean
7 8 9 |
# File 'lib/jets/git/git_cli.rb', line 7 def git_folder? File.exist?(".git") end |
#git_installed? ⇒ Boolean
11 12 13 |
# File 'lib/jets/git/git_cli.rb', line 11 def git_installed? system "type git > /dev/null 2>&1" end |