Class: Deploy::Project
- Defined in:
- lib/deploy/resources/project.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #config_files_deployment(server) ⇒ Object
-
#deploy(server, start_revision, end_revision, config_files_only: false) ⇒ Object
Create a deployment in this project (and queue it to run).
-
#deployment(identifier) ⇒ Object
Return a deployment.
-
#deployments ⇒ Object
Return all deployments for this project.
- #latest_revision(branch = '') ⇒ Object
-
#preview(server, start_revision, end_revision) ⇒ Object
Create a deployment preview.
- #server_groups ⇒ Object
-
#servers ⇒ Object
Return all servers for this project.
Methods inherited from Resource
class_name, collection_path, #create, #destroy, find, find_all, find_single, member_path, #method_missing, #new_record?, post, #post, #respond_to_missing?, #save, #update
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Deploy::Resource
Instance Method Details
#config_files_deployment(server) ⇒ Object
31 32 33 |
# File 'lib/deploy/resources/project.rb', line 31 def config_files_deployment(server) deploy(server, nil, nil, config_files_only: true) end |
#deploy(server, start_revision, end_revision, config_files_only: false) ⇒ Object
Create a deployment in this project (and queue it to run)
24 25 26 27 28 29 |
# File 'lib/deploy/resources/project.rb', line 24 def deploy(server, start_revision, end_revision, config_files_only: false) run_deployment(server, start_revision, end_revision) do |d| d.mode = 'queue' d.config_files_deployment = '1' if config_files_only end end |
#deployment(identifier) ⇒ Object
Return a deployment
12 13 14 |
# File 'lib/deploy/resources/project.rb', line 12 def deployment(identifier) Deployment.find(identifier, project: self) end |
#deployments ⇒ Object
Return all deployments for this project
7 8 9 |
# File 'lib/deploy/resources/project.rb', line 7 def deployments Deployment.find(:all, project: self) end |
#latest_revision(branch = '') ⇒ Object
16 17 18 19 20 21 |
# File 'lib/deploy/resources/project.rb', line 16 def latest_revision(branch = '') branch ||= 'master' req = Request.new(self.class.member_path(permalink) + "/repository/latest_revision?branch=#{branch}").make parsed = JSON.parse(req.output) parsed['ref'] end |
#preview(server, start_revision, end_revision) ⇒ Object
Create a deployment preview
36 37 38 39 40 |
# File 'lib/deploy/resources/project.rb', line 36 def preview(server, start_revision, end_revision) run_deployment(server, start_revision, end_revision) do |d| d.mode = 'preview' end end |
#server_groups ⇒ Object
47 48 49 |
# File 'lib/deploy/resources/project.rb', line 47 def server_groups ServerGroup.find(:all, project: self) end |