Class: CircleCIReporter::Configuration
- Inherits:
-
Object
- Object
- CircleCIReporter::Configuration
- Defined in:
- lib/circleci_reporter/configuration.rb
Constant Summary collapse
- DEFAULT_REPORTERS =
[ Reporters::SimpleCov.new, Reporters::Flow.new, Reporters::RubyCritic.new ].freeze
- DEFAULT_VCS_TYPE =
'github'
Instance Attribute Summary collapse
- #artifacts_dir ⇒ String
- #base_revision ⇒ String
-
#circleci_token ⇒ Object
Returns the value of attribute circleci_token.
- #current_build_number ⇒ Integer
- #current_revision ⇒ String
- #previous_build_number ⇒ Integer?
- #reporters ⇒ Array<Reporters::Base>
- #repository_name ⇒ String
-
#template ⇒ Object
writeonly
Sets the attribute template.
-
#template_safe_mode ⇒ Object
writeonly
Sets the attribute template_safe_mode.
- #user_name ⇒ String
-
#vcs_token ⇒ Object
Returns the value of attribute vcs_token.
- #vcs_type ⇒ String
Instance Method Summary collapse
Instance Attribute Details
#artifacts_dir ⇒ String
37 38 39 |
# File 'lib/circleci_reporter/configuration.rb', line 37 def artifacts_dir @artifacts_dir ||= ENV['CIRCLE_ARTIFACTS'] end |
#base_revision ⇒ String
42 43 44 |
# File 'lib/circleci_reporter/configuration.rb', line 42 def base_revision @base_revision ||= `git merge-base origin/master HEAD`.strip end |
#circleci_token ⇒ Object
Returns the value of attribute circleci_token.
16 17 18 |
# File 'lib/circleci_reporter/configuration.rb', line 16 def circleci_token @circleci_token end |
#current_build_number ⇒ Integer
47 48 49 |
# File 'lib/circleci_reporter/configuration.rb', line 47 def current_build_number @current_build_number ||= ENV['CIRCLE_BUILD_NUM'] end |
#current_revision ⇒ String
52 53 54 |
# File 'lib/circleci_reporter/configuration.rb', line 52 def current_revision @current_revision ||= ENV['CIRCLE_SHA1'] end |
#previous_build_number ⇒ Integer?
57 58 59 |
# File 'lib/circleci_reporter/configuration.rb', line 57 def previous_build_number @previous_build_number ||= ENV['CIRCLE_PREVIOUS_BUILD_NUM']&.to_i end |
#reporters ⇒ Array<Reporters::Base>
27 28 29 |
# File 'lib/circleci_reporter/configuration.rb', line 27 def reporters @reporters ||= DEFAULT_REPORTERS.dup end |
#repository_name ⇒ String
62 63 64 |
# File 'lib/circleci_reporter/configuration.rb', line 62 def repository_name @repository_name ||= ENV['CIRCLE_PROJECT_REPONAME'] end |
#template=(value) ⇒ Object (writeonly)
Sets the attribute template
17 18 19 |
# File 'lib/circleci_reporter/configuration.rb', line 17 def template=(value) @template = value end |
#template_safe_mode=(value) ⇒ Object (writeonly)
Sets the attribute template_safe_mode
17 18 19 |
# File 'lib/circleci_reporter/configuration.rb', line 17 def template_safe_mode=(value) @template_safe_mode = value end |
#user_name ⇒ String
67 68 69 |
# File 'lib/circleci_reporter/configuration.rb', line 67 def user_name @user_name ||= ENV['CIRCLE_PROJECT_USERNAME'] end |
#vcs_token ⇒ Object
Returns the value of attribute vcs_token.
16 17 18 |
# File 'lib/circleci_reporter/configuration.rb', line 16 def vcs_token @vcs_token end |
#vcs_type ⇒ String
32 33 34 |
# File 'lib/circleci_reporter/configuration.rb', line 32 def vcs_type @vcs_type ||= DEFAULT_VCS_TYPE end |
Instance Method Details
#dump ⇒ void
This method returns an undefined value.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/circleci_reporter/configuration.rb', line 72 def dump puts <<~CONFIGURATION Configuration | Value ----------------------|---------------------------------------------------------------------------- artifacts_dir | #{artifacts_dir.inspect} base_revision | #{base_revision.inspect} circleci_token | #{circleci_token[-4..].rjust(40, '*').inspect if circleci_token} current_build_number | #{current_build_number.inspect} current_revision | #{current_revision.inspect} previous_build_number | #{previous_build_number.inspect} reporters | #{reporters.inspect} repository_name | #{repository_name.inspect} user_name | #{user_name.inspect} vcs_token | #{vcs_token[-4..].rjust(40, '*').inspect if vcs_token} vcs_type | #{vcs_type.inspect} CONFIGURATION end |
#project ⇒ String
22 23 24 |
# File 'lib/circleci_reporter/configuration.rb', line 22 def project "#{user_name}/#{repository_name}" end |