Class: GitWrapper::Commands::Git
- Inherits:
-
Object
- Object
- GitWrapper::Commands::Git
- Defined in:
- lib/git_wrapper/commands/git.rb
Direct Known Subclasses
Add, Branch, Checkout, Commit, Config, Diff, DiffTree, Fetch, Init, Log, Merge, Pull, Push, Remote, Remove, Reset, RevList, Revert, Show, Status, Tag
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#location_folder ⇒ Object
readonly
Returns the value of attribute location_folder.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(location_folder) ⇒ Git
constructor
A new instance of Git.
- #result ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(location_folder) ⇒ Git
Returns a new instance of Git.
8 9 10 |
# File 'lib/git_wrapper/commands/git.rb', line 8 def initialize(location_folder) @location_folder = location_folder end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
6 7 8 |
# File 'lib/git_wrapper/commands/git.rb', line 6 def error @error end |
#location_folder ⇒ Object (readonly)
Returns the value of attribute location_folder.
4 5 6 |
# File 'lib/git_wrapper/commands/git.rb', line 4 def location_folder @location_folder end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
5 6 7 |
# File 'lib/git_wrapper/commands/git.rb', line 5 def output @output end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/git_wrapper/commands/git.rb', line 12 def execute begin @output, @error, status = Shell.execute("git #{command}", :chdir => @location_folder) @success = status.success? log = { :command => command, :location_folder => @location_folder, :output => @output, :error => @error } GitWrapper.logger.debug "[GitWrapper] #{log}" return result rescue Exception => e GitWrapper.logger.error "[GitWrapper] #{e.message}" @error = e. return false end end |
#result ⇒ Object
37 38 39 |
# File 'lib/git_wrapper/commands/git.rb', line 37 def result @success end |
#success? ⇒ Boolean
33 34 35 |
# File 'lib/git_wrapper/commands/git.rb', line 33 def success? @success end |