Module: PactBroker::Badges::Service
- Extended by:
- Service
- Includes:
- Logging
- Included in:
- Service
- Defined in:
- lib/pact_broker/badges/service.rb
Constant Summary collapse
- SPACE_DASH_UNDERSCORE =
/[\s_\-]/
- CACHE =
{}
Instance Method Summary collapse
- #can_i_deploy_badge_url(tag, environment_tag, label, deployable) ⇒ Object
- #can_provide_badge_using_redirect? ⇒ Boolean
- #clear_cache ⇒ Object
- #error_badge_url(left_text, right_text) ⇒ Object
- #pact_verification_badge(pact, label, initials, pseudo_branch_verification_status, metadata = {}) ⇒ Object
- #pact_verification_badge_url(pact, label, initials, pseudo_branch_verification_status, metadata = {}) ⇒ Object
Methods included from Logging
Instance Method Details
#can_i_deploy_badge_url(tag, environment_tag, label, deployable) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/pact_broker/badges/service.rb', line 36 def can_i_deploy_badge_url(tag, environment_tag, label, deployable) title = label || "can-i-deploy" status = "#{tag} to #{environment_tag}" color = deployable ? "brightgreen" : "red" build_shield_io_uri(title, status, color) end |
#can_provide_badge_using_redirect? ⇒ Boolean
19 20 21 |
# File 'lib/pact_broker/badges/service.rb', line 19 def can_provide_badge_using_redirect? PactBroker.configuration.badge_provider_mode == :redirect && !!PactBroker.configuration.shields_io_base_url end |
#clear_cache ⇒ Object
47 48 49 |
# File 'lib/pact_broker/badges/service.rb', line 47 def clear_cache CACHE.clear end |
#error_badge_url(left_text, right_text) ⇒ Object
43 44 45 |
# File 'lib/pact_broker/badges/service.rb', line 43 def error_badge_url(left_text, right_text) build_shield_io_uri(left_text, right_text, "lightgrey") end |
#pact_verification_badge(pact, label, initials, pseudo_branch_verification_status, metadata = {}) ⇒ Object
23 24 25 26 27 |
# File 'lib/pact_broker/badges/service.rb', line 23 def pact_verification_badge pact, label, initials, pseudo_branch_verification_status, = {} return static_svg(pact, pseudo_branch_verification_status) unless pact dynamic_svg(pact, label, initials, pseudo_branch_verification_status, ) || static_svg(pact, pseudo_branch_verification_status) end |
#pact_verification_badge_url(pact, label, initials, pseudo_branch_verification_status, metadata = {}) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/pact_broker/badges/service.rb', line 29 def pact_verification_badge_url(pact, label, initials, pseudo_branch_verification_status, = {}) title = badge_title(pact, label, initials, ) status = badge_status(pseudo_branch_verification_status) color = badge_color(pseudo_branch_verification_status) build_shield_io_uri(title, status, color) end |