Class: Deployment

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb

Constant Summary collapse

AWSM_SERVERSIDE_VERSION =
'2.0.0.awsm'

Instance Method Summary collapse

Instance Method Details

#deployObject

pretend to trigger a deploy

this deploy will be instant, unlike real deploys



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb', line 38

def deploy
  unless serverside_version
    # only set serverside version if it's not set, to imitate the api
    # behavior of choosing its own serverside version if one is not
    # sent
    update :serverside_version => AWSM_SERVERSIDE_VERSION
  end
  finished!(
    :successful => true,
    :output => 'Deployment triggered by the API'
  )
end

#finished!(attrs) ⇒ Object



55
56
57
58
59
60
# File 'lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb', line 55

def finished!(attrs)
  return true if finished?
  attrs = attrs.dup
  attrs['finished_at'] ||= Time.now
  update(attrs)
end

#finished?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb', line 51

def finished?
  finished_at != nil
end

#inspectObject



21
22
23
# File 'lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb', line 21

def inspect
  "#<Deployment app_environment:#{app_environment.inspect}>"
end

#resolved_refObject

normally a property, but we don’t have the code to find this so just pretend



30
31
32
# File 'lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb', line 30

def resolved_ref
  "resolved-#{ref}"
end

#user_nameObject



25
26
27
# File 'lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb', line 25

def user_name
  app_environment.app..user.name
end