Sha256: e6684257e5dde42f5fda3ab5b49b8e8188dda3fbca76957455ea04ddab8658e0
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
class Sibling::Deploy < ActiveRecord::Base attr_accessible :sibling_id, :instruction_id, :manual, :state attr_accessible :git_repo, :heroku_repo, :heroku_app_name belongs_to :sibling belongs_to :instruction validates :sibling_id, presence: true validates :manual, inclusion: { in: [true, false] } validates :git_repo, presence: true validates :heroku_repo, presence: true validates :heroku_app_name, presence: true after_create :async_deploy state_machine :initial => :new do event :queue do transition any => :queued end event :start do transition any => :deploying end event :fail do transition any => :failed end event :succeed do transition any => :succeeded end end scope :manual, where(manual: true) scope :automatic, where(manual: false) def deploy start! GithubHerokuDeployer.deploy(deployer_options) GithubHerokuDeployer.heroku_run("rake db:migrate", deployer_options) succeed! rescue StandardError => e fail! raise e end def deployer_options { github_repo: git_repo, heroku_repo: heroku_repo, heroku_app_name: heroku_app_name } end def async_deploy queue! Resque.enqueue(SiblingDeployer, self.id) rescue StandardError => e fail! raise e end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
g5_sibling_deployer_engine-0.2.6 | app/models/sibling/deploy.rb |