Class: Jets::Git::Codebuild
Instance Method Summary collapse
-
#full_repo ⇒ Object
ORG/REPO.
- #git_branch ⇒ Object
- #git_sha ⇒ Object
- #git_url ⇒ Object
- #host ⇒ Object
- #info ⇒ Object
- #repo_url ⇒ Object
Methods inherited from Base
Instance Method Details
#full_repo ⇒ Object
ORG/REPO
36 37 38 39 40 |
# File 'lib/jets/git/codebuild.rb', line 36 def full_repo return unless repo_url uri = URI(repo_url) uri.path.sub(/^\//, "") end |
#git_branch ⇒ Object
17 18 19 |
# File 'lib/jets/git/codebuild.rb', line 17 def git_branch ENV["CODEBUILD_SOURCE_VERSION"] end |
#git_sha ⇒ Object
21 22 23 |
# File 'lib/jets/git/codebuild.rb', line 21 def git_sha ENV["CODEBUILD_RESOLVED_SOURCE_VERSION"] end |
#git_url ⇒ Object
25 26 27 |
# File 'lib/jets/git/codebuild.rb', line 25 def git_url "#{host}/#{full_repo}" if host && full_repo end |
#host ⇒ Object
29 30 31 32 33 |
# File 'lib/jets/git/codebuild.rb', line 29 def host return unless ENV["CODEBUILD_SOURCE_REPO_URL"] uri = URI(ENV["CODEBUILD_SOURCE_REPO_URL"]) # https://github.com/ORG/REPO "#{uri.scheme}://#{uri.host}" end |
#info ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/jets/git/codebuild.rb', line 3 def info info = { git_system: "codebuild", git_branch: git_branch, git_sha: git_sha, git_dirty: false, git_url: git_url # git_message: nil, # git_version: nil, } info.delete_if { |k, v| v.nil? } info end |
#repo_url ⇒ Object
43 44 45 46 47 |
# File 'lib/jets/git/codebuild.rb', line 43 def repo_url return unless ENV["CODEBUILD_SOURCE_REPO_URL"] # https://github.com/ORG/REPO.git ENV["CODEBUILD_SOURCE_REPO_URL"].sub(".git", "") end |