Class: Evrone::CI::CSM::Git
- Inherits:
-
Object
- Object
- Evrone::CI::CSM::Git
- Includes:
- Evrone::CI::Common::Helper::Shell
- Defined in:
- lib/evrone/ci/csm/git.rb,
lib/evrone/ci/csm/git/git_ssh.rb
Defined Under Namespace
Classes: GitSSH
Constant Summary collapse
- COMMIT_RE =
/^(.*) -:- (.*) \((.*)\) -:- (.*)$/
Instance Attribute Summary collapse
-
#git_ssh ⇒ Object
readonly
Returns the value of attribute git_ssh.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
Class Method Summary collapse
Instance Method Summary collapse
- #commit_info ⇒ Object
- #fetch ⇒ Object
-
#initialize(src, sha, path, options = {}, &block) ⇒ Git
constructor
A new instance of Git.
Constructor Details
Instance Attribute Details
#git_ssh ⇒ Object (readonly)
Returns the value of attribute git_ssh.
14 15 16 |
# File 'lib/evrone/ci/csm/git.rb', line 14 def git_ssh @git_ssh end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
14 15 16 |
# File 'lib/evrone/ci/csm/git.rb', line 14 def logger @logger end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
14 15 16 |
# File 'lib/evrone/ci/csm/git.rb', line 14 def path @path end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
14 15 16 |
# File 'lib/evrone/ci/csm/git.rb', line 14 def sha @sha end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
14 15 16 |
# File 'lib/evrone/ci/csm/git.rb', line 14 def src @src end |
Class Method Details
.make_export_command(from, to) ⇒ Object
32 33 34 |
# File 'lib/evrone/ci/csm/git.rb', line 32 def self.make_export_command(from, to) %{ (cd '#{from}' && git checkout-index -a -f --prefix='#{to}/') }.strip end |
Instance Method Details
#commit_info ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/evrone/ci/csm/git.rb', line 36 def commit_info rs = {} if str = commit_info_string if m = str.match(COMMIT_RE) rs.merge!( sha: m[1], author: m[2], email: m[3], message: m[4] ) end end OpenStruct.new rs end |
#fetch ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/evrone/ci/csm/git.rb', line 24 def fetch code = git_ssh.open do repo_exist? ? update : clone end code = checkout if code == 0 code end |