Class: Deploy::Project

Inherits:
Resource show all
Defined in:
lib/deploy/resources/project.rb

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #errors, #id

Instance Method Summary collapse

Methods inherited from Resource

class_name, collection_path, #create, #destroy, find, find_all, find_single, member_path, #method_missing, #new_record?, post, #post, #save, #update

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Deploy::Resource

Instance Method Details

#deploy(server, start_revision, end_revision) ⇒ Object

 Create a deployment in this project (and queue it to run)



22
23
24
25
26
# 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) ⇒ Object

Return a deployment



10
11
12
# File 'lib/deploy/resources/project.rb', line 10

def deployment(identifier)
  Deployment.find(identifier, :project => self)
end

#deploymentsObject

Return all deployments for this project



5
6
7
# File 'lib/deploy/resources/project.rb', line 5

def deployments
  Deployment.find(:all, :project => self)
end

#latest_revision(branch = '') ⇒ Object



14
15
16
17
18
19
# 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) ⇒ Object



29
30
31
32
33
# 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_groupsObject



40
41
42
# File 'lib/deploy/resources/project.rb', line 40

def server_groups
  ServerGroup.find(:all, :project => self)
end

#serversObject

Return all servers for this project



36
37
38
# File 'lib/deploy/resources/project.rb', line 36

def servers
  Server.find(:all, :project => self)
end