Class: CircleciDeploymentNotifier::BuildInfo
- Inherits:
-
Object
- Object
- CircleciDeploymentNotifier::BuildInfo
- Defined in:
- lib/circleci_deployment_notifier/build_info.rb
Overview
Gets build information from the environment. Expects and currently only works with builds of Github repositories.
Instance Method Summary collapse
- #branch_name ⇒ Object
- #build_identifier ⇒ Object
- #build_url ⇒ Object
- #builder_icon ⇒ Object
- #builder_url ⇒ Object
- #builder_username ⇒ Object
- #commit_browse_url ⇒ Object
- #commit_hash ⇒ Object
- #repository_url ⇒ Object
- #tag? ⇒ Boolean
- #tag_name ⇒ Object
- #tag_release_notes_url ⇒ Object
- #tag_url ⇒ Object
Instance Method Details
#branch_name ⇒ Object
14 15 16 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 14 def branch_name ENV['CIRCLE_BRANCH'] end |
#build_identifier ⇒ Object
56 57 58 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 56 def build_identifier ENV['CIRCLE_BUILD_NUM'] end |
#build_url ⇒ Object
60 61 62 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 60 def build_url ENV['CIRCLE_BUILD_URL'] end |
#builder_icon ⇒ Object
40 41 42 43 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 40 def builder_icon return unless builder_username "https://github.com/#{builder_username}.png" end |
#builder_url ⇒ Object
45 46 47 48 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 45 def builder_url return unless builder_username "https://github.com/#{builder_username}" end |
#builder_username ⇒ Object
36 37 38 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 36 def builder_username ENV['CIRCLE_USERNAME'] end |
#commit_browse_url ⇒ Object
10 11 12 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 10 def commit_browse_url "#{repository_url}/tree/#{commit_hash}" end |
#commit_hash ⇒ Object
6 7 8 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 6 def commit_hash ENV['CIRCLE_SHA1'] end |
#repository_url ⇒ Object
50 51 52 53 54 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 50 def repository_url ENV['CIRCLE_REPOSITORY_URL'].sub(/\Agit@([-\.a-z]+):(.+)\.git\z/) { |m| "https://#{$1}/#{$2}" } end |
#tag? ⇒ Boolean
32 33 34 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 32 def tag? tag_name end |
#tag_name ⇒ Object
18 19 20 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 18 def tag_name ENV['CIRCLE_TAG'] end |
#tag_release_notes_url ⇒ Object
27 28 29 30 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 27 def tag_release_notes_url return unless tag_name "#{repository_url}/releases/tag/#{tag_name}" end |
#tag_url ⇒ Object
22 23 24 25 |
# File 'lib/circleci_deployment_notifier/build_info.rb', line 22 def tag_url return unless tag_name "#{repository_url}/tree/#{tag_name}" end |