class Deploy::Project
Public Instance Methods
deploy(server, start_revision, end_revision)
click to toggle source
Create a deployment in this project (and queue it to run)
# File lib/deploy/resources/project.rb, line 22 def deploy(server, start_revision, end_revision) run_deployment(server, start_revision, end_revision) do |d| d.mode = 'queue' end end
deployment(identifier)
click to toggle source
Return a deployment
# File lib/deploy/resources/project.rb, line 10 def deployment(identifier) Deployment.find(identifier, :project => self) end
deployments()
click to toggle source
Return all deployments for this project
# File lib/deploy/resources/project.rb, line 5 def deployments Deployment.find(:all, :project => self) end
latest_revision(branch = '')
click to toggle source
# File lib/deploy/resources/project.rb, line 14 def latest_revision(branch = '') branch ||= 'master' req = Request.new(self.class.member_path(self.permalink) + "/repository/latest_revision?branch=#{branch}").make parsed = JSON.parse(req.output) parsed['ref'] end
preview(server, start_revision, end_revision)
click to toggle source
# File lib/deploy/resources/project.rb, line 29 def preview(server, start_revision, end_revision) run_deployment(server, start_revision, end_revision) do |d| d.mode = 'preview' end end
server_groups()
click to toggle source
# File lib/deploy/resources/project.rb, line 40 def server_groups ServerGroup.find(:all, :project => self) end
servers()
click to toggle source
Return all servers for this project
# File lib/deploy/resources/project.rb, line 36 def servers Server.find(:all, :project => self) end
Private Instance Methods
run_deployment(server, start_revision, end_revision, &block)
click to toggle source
# File lib/deploy/resources/project.rb, line 46 def run_deployment(server, start_revision, end_revision, &block) d = Deployment.new d.project = self d.parent_identifier = (server.is_a?(Server) ? server.identifier : server) d.start_revision = start_revision d.end_revision = end_revision d.copy_config_files = '1' d.email_notify = '1' block.call(d) if block_given? d.save d end