Module: GitCli::Common
- Includes:
- Antrapol::ToolRack::ConditionUtils, Antrapol::ToolRack::ExceptionUtils
- Included in:
- Gvcs::Vcs, Gvcs::Workspace
- Defined in:
- lib/git_cli.rb
Instance Method Summary collapse
- #dry_run ⇒ Object
- #dry_run=(val) ⇒ Object
- #log_debug(str) ⇒ Object
- #log_error(str) ⇒ Object
- #log_warn(str) ⇒ Object
- #os_exec(path, &block) ⇒ Object
Instance Method Details
#dry_run ⇒ Object
85 86 87 |
# File 'lib/git_cli.rb', line 85 def dry_run @dry_run.nil? ? false : @dry_run end |
#dry_run=(val) ⇒ Object
81 82 83 |
# File 'lib/git_cli.rb', line 81 def dry_run=(val) @dry_run = val if not_empty?(val) and is_bool?(val) end |
#log_debug(str) ⇒ Object
69 70 71 |
# File 'lib/git_cli.rb', line 69 def log_debug(str) GitCli::Global.instance.logger.debug(str) end |
#log_error(str) ⇒ Object
73 74 75 |
# File 'lib/git_cli.rb', line 73 def log_error(str) GitCli::Global.instance.logger.error(str) end |
#log_warn(str) ⇒ Object
77 78 79 |
# File 'lib/git_cli.rb', line 77 def log_warn(str) GitCli::Global.instance.logger.warn(str) end |
#os_exec(path, &block) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/git_cli.rb', line 48 def os_exec(path, &block) Gvcs::Config.instance.command_output.puts("Git command : #{path}") if Gvcs::Config.instance.is_show_vcs_command? # redirect stderr to stdout path = "#{path} 2>&1" if dry_run block.call(:dry_run_command, path) if block else res = Antrapol::ToolRack::ProcessUtilsEngine.exec(path) if block # $?.exitstatus => error codes # $?.success? => true / false # $?.pid => child PID block.call($?, res) else res.strip end end end |