Class: Deployments::AfterCreateService
- Inherits:
-
Object
- Object
- Deployments::AfterCreateService
- Defined in:
- app/services/deployments/after_create_service.rb
Instance Attribute Summary collapse
-
#deployable ⇒ Object
readonly
Returns the value of attribute deployable.
-
#deployment ⇒ Object
readonly
Returns the value of attribute deployment.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(deployment) ⇒ AfterCreateService
constructor
A new instance of AfterCreateService.
- #update_environment(deployment) ⇒ Object
Constructor Details
#initialize(deployment) ⇒ AfterCreateService
Returns a new instance of AfterCreateService.
12 13 14 15 |
# File 'app/services/deployments/after_create_service.rb', line 12 def initialize(deployment) @deployment = deployment @deployable = deployment.deployable end |
Instance Attribute Details
#deployable ⇒ Object (readonly)
Returns the value of attribute deployable
6 7 8 |
# File 'app/services/deployments/after_create_service.rb', line 6 def deployable @deployable end |
#deployment ⇒ Object (readonly)
Returns the value of attribute deployment
5 6 7 |
# File 'app/services/deployments/after_create_service.rb', line 5 def deployment @deployment end |
Instance Method Details
#execute ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/services/deployments/after_create_service.rb', line 17 def execute deployment.create_ref deployment.invalidate_cache update_environment(deployment) deployment end |
#update_environment(deployment) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/services/deployments/after_create_service.rb', line 26 def update_environment(deployment) ActiveRecord::Base.transaction do if (url = ) environment.external_url = url end renew_auto_stop_in environment.fire_state_event(action) if environment.save && !environment.stopped? deployment.update_merge_request_metrics! end end end |