This commit is contained in:
kaustubh-d 2013-06-24 11:12:30 +05:30
Родитель 750aea3dd9
Коммит 49ea97e9da
2 изменённых файлов: 30 добавлений и 9 удалений

Просмотреть файл

@ -21,18 +21,31 @@ class Azure
def initialize(connection)
@connection=connection
end
def all
deploys = Array.new
hosts = @connection.hosts.all
hosts.each do |host|
deploy = Deploy.new(@connection)
deploy.retrieve(host.name)
unless deploy.name == nil
deploys << deploy
# force_load should be true when there is something in local cache and we want to reload
# first call is always load.
def load(force_load = false)
if not @deploys || force_load
@deploys = begin
deploys = Array.new
hosts = @connection.hosts.all
hosts.each do |host|
deploy = Deploy.new(@connection)
deploy.retrieve(host.name)
if deploy.name
host.add_deploy(deploy)
deploys << deploy
end
end
deploys
end
end
deploys
@deploys
end
def all
self.load
end
def find(hostedservicename)
deployName = nil
self.all.each do |deploy|

Просмотреть файл

@ -80,8 +80,11 @@ class Azure
attr_accessor :connection, :name, :url, :label
attr_accessor :dateCreated, :description, :location
attr_accessor :dateModified, :status
attr_accessor :deploys
def initialize(connection)
@connection = connection
@deploys = []
end
def parse(serviceXML)
@name = xml_content(serviceXML, 'ServiceName')
@ -108,5 +111,10 @@ class Azure
def details
response = @connection.query_azure('hostedservices/' + @name + '?embed-detail=true')
end
# Deploys within this hostedservice
def add_deploy(deploy)
@deploys << deploy
end
end
end