Sha256: 2b7ef2320488baa01d0f2fe766eb93de3f129da0289b9c00db92ad1db3061b97

Contents?: true

Size: 947 Bytes

Versions: 7

Compression:

Stored size: 947 Bytes

Contents

require 'dm-core'

class Deployment
  include DataMapper::Resource

  property :id,                 Serial
  property :created_at,         DateTime
  property :finished_at,        DateTime
  property :commit,             String, :default => 'abcdef1234'*4
  property :migrate,            String
  property :migrate_command,    String
  property :ref,                String
  property :successful,         Boolean
  property :output,             Text

  belongs_to :app_environment

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

  def user_name
    app_environment.app.account.user.name
  end

  # normally a property, but we don't have the code to find this so just pretend
  def resolved_ref
    "resolved-#{ref}"
  end

  def finished?
    finished_at != nil
  end

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

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
engineyard-cloud-client-1.0.6 lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb
engineyard-cloud-client-1.0.5 lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb
engineyard-cloud-client-1.0.4 lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb
engineyard-cloud-client-1.0.3 lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb
engineyard-cloud-client-1.0.2 lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb
engineyard-cloud-client-1.0.1 lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb
engineyard-cloud-client-1.0.0 lib/engineyard-cloud-client/test/fake_awsm/models/deployment.rb