Class: Houston::Adapters::Deployment::Engineyard
- Inherits:
-
Object
- Object
- Houston::Adapters::Deployment::Engineyard
- Defined in:
- app/adapters/houston/adapters/deployment/engineyard.rb,
app/adapters/houston/adapters/deployment/engineyard/config.rb
Defined Under Namespace
Classes: Config
Instance Attribute Summary collapse
-
#environment_name ⇒ Object
readonly
Returns the value of attribute environment_name.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #deploy(deploy, options = {}) ⇒ Object
-
#initialize(project, environment_name) ⇒ Engineyard
constructor
A new instance of Engineyard.
- #last_deploy_commit ⇒ Object
Constructor Details
#initialize(project, environment_name) ⇒ Engineyard
Returns a new instance of Engineyard.
11 12 13 14 15 16 17 18 19 |
# File 'app/adapters/houston/adapters/deployment/engineyard.rb', line 11 def initialize(project, environment_name) @project = project @environment_name = environment_name @config = Houston::Adapters::Deployment::Engineyard::Config.new(project.read_file("config/ey.yml")) @ui = EY::CLI::UI.new @api = EY::CLI::API.new(config.endpoint, ui, Houston.config.engineyard[:api_token]) @repo = nil end |
Instance Attribute Details
#environment_name ⇒ Object (readonly)
Returns the value of attribute environment_name.
9 10 11 |
# File 'app/adapters/houston/adapters/deployment/engineyard.rb', line 9 def environment_name @environment_name end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
9 10 11 |
# File 'app/adapters/houston/adapters/deployment/engineyard.rb', line 9 def project @project end |
Instance Method Details
#deploy(deploy, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'app/adapters/houston/adapters/deployment/engineyard.rb', line 28 def deploy(deploy, ={}) = { ref: deploy.branch, environment: environment_name, config: { maintenance_on_migrate: [:maintenance_page] } }.with_indifferent_access env_config = config.environment_config(app_env.environment_name) deploy_config = EY::DeployConfig.new(, env_config, repo, ui) deployment = app_env.new_deployment( ref: deploy_config.ref, migrate: deploy_config.migrate, migrate_command: deploy_config.migrate_command, extra_config: deploy_config.extra_config, serverside_version: EY::ENGINEYARD_SERVERSIDE_VERSION) runner = EY::ServersideRunner.new( bridge: app_env.environment.bridge!([:ignore_bad_master]).hostname, app: app_env.app, environment: app_env.environment, verbose: deploy_config.verbose, serverside_version: EY::ENGINEYARD_SERVERSIDE_VERSION) # Triplicate: # 1. standard output gets a copy # 2. the Deploy model gets a copy # 3. EngineYard gets a copy out = EY::CLI::UI::Tee.new(ui.out, deploy.output_stream, deployment.output) err = EY::CLI::UI::Tee.new(ui.err, deploy.output_stream, deployment.output) deployment.start begin ui.show_deployment(deployment) runner.deploy do |args| args.config = deployment.config if deployment.config if deployment.migrate args.migrate = deployment.migrate_command else args.migrate = false end args.ref = deployment.resolved_ref end deployment.successful = runner.call(out, err) rescue StandardError => e Houston.report_exception(e) deployment.err << "Error encountered during deploy.\n#{e.class} #{e}\n" ui.print_exception(e) ensure deployment.finished Houston.try({max_tries: 5, ignore: true}, exceptions_wrapping(PG::ConnectionBad)) do deploy.update_attributes!(completed_at: Time.now) end end deployment.successful? end |
#last_deploy_commit ⇒ Object
22 23 24 |
# File 'app/adapters/houston/adapters/deployment/engineyard.rb', line 22 def last_deploy_commit app_env.last_deployment.commit end |