Class: Statixite::DeploymentService
- Inherits:
-
Object
- Object
- Statixite::DeploymentService
- Defined in:
- app/services/statixite/deployment_service.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
Instance Method Summary collapse
- #deploy ⇒ Object
-
#initialize(site) ⇒ DeploymentService
constructor
A new instance of DeploymentService.
- #successful? ⇒ Boolean
Constructor Details
#initialize(site) ⇒ DeploymentService
Returns a new instance of DeploymentService.
5 6 7 |
# File 'app/services/statixite/deployment_service.rb', line 5 def initialize(site) @site = site end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
3 4 5 |
# File 'app/services/statixite/deployment_service.rb', line 3 def directory @directory end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
3 4 5 |
# File 'app/services/statixite/deployment_service.rb', line 3 def @error_message end |
Instance Method Details
#deploy ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/statixite/deployment_service.rb', line 9 def deploy gs = GitService.new(@site.site_build_path, @site.site_remote) if gs.successful? begin git_info_from_build = build_deploy_branch(gs) perform_deploy deployment = @site.deployments.create( :version => git_info_from_build[0], :sha => git_info_from_build[1] ) @status = :success rescue => e Rails.logger.error e @error_message = e. @status = :failed end else @error_message = gs. @status = :failed end self end |
#successful? ⇒ Boolean
32 33 34 |
# File 'app/services/statixite/deployment_service.rb', line 32 def successful? @status == :success end |