engineyard 2.0.8 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -231,6 +231,22 @@ Log in and verify access to EY Cloud. Use logout first if you need to switch use
231
231
  Remove the current API key from ~/.eyrc or env variable $EYRC
232
232
 
233
233
 
234
+ == Global Options
235
+
236
+ All commands accept the following options.
237
+
238
+ --api-token=API_TOKEN # Use API-TOKEN to authenticate this command
239
+ --serverside-version=SERVERSIDE_VERSION # Please use with care! Override deploy system version
240
+ # (same as ENV variable ENGINEYARD_SERVERSIDE_VERSION)
241
+
242
+ Not all commands will make use of these options. For example,
243
+ ey status does not use, and will ignore the --serverside-version flag.
244
+
245
+ Also, please consider that it's usually not a good idea to override the
246
+ version of serverside unless you know what you're doing. CLI and serverside
247
+ versions are designed to work together and mixing them can cause errors.
248
+
249
+
234
250
  == API Client
235
251
 
236
252
  See https://github.com/engineyard/engineyard-cloud-client for the API client library.
@@ -36,6 +36,7 @@ module EY
36
36
  end
37
37
 
38
38
  class_option :api_token, :type => :string, :desc => "Use API-TOKEN to authenticate this command"
39
+ class_option :serverside_version, :type => :string, :desc => "Please use with care! Override deploy system version (same as ENV variable ENGINEYARD_SERVERSIDE_VERSION)"
39
40
 
40
41
  desc "deploy [--environment ENVIRONMENT] [--ref GIT-REF]",
41
42
  "Deploy specified branch, tag, or sha to specified environment."
@@ -81,13 +82,14 @@ module EY
81
82
  deploy_config = EY::DeployConfig.new(options, env_config, repo, ui)
82
83
 
83
84
  deployment = app_env.new_deployment({
84
- :ref => deploy_config.ref,
85
- :migrate => deploy_config.migrate,
86
- :migrate_command => deploy_config.migrate_command,
87
- :extra_config => deploy_config.extra_config,
85
+ :ref => deploy_config.ref,
86
+ :migrate => deploy_config.migrate,
87
+ :migrate_command => deploy_config.migrate_command,
88
+ :extra_config => deploy_config.extra_config,
89
+ :serverside_version => serverside_version,
88
90
  })
89
91
 
90
- runner = serverside_runner(app_env, deploy_config.verbose, options[:ignore_bad_master])
92
+ runner = serverside_runner(app_env, deploy_config.verbose, deployment.serverside_version, options[:ignore_bad_master])
91
93
 
92
94
  out = EY::CLI::UI::Tee.new(ui.out, deployment.out)
93
95
  err = EY::CLI::UI::Tee.new(ui.err, deployment.err)
@@ -4,13 +4,14 @@ require 'engineyard-serverside-adapter'
4
4
 
5
5
  module EY
6
6
  class ServersideRunner
7
- def initialize(bridge, app, environment, verbose)
8
- @verbose = verbose || ENV['DEBUG']
9
- @adapter = load_adapter(bridge, app, environment)
10
- @username = environment.username
11
- @hostname = bridge
12
- @command = nil
13
- @acc_env_name = "#{app.account.name}/#{environment.name}"
7
+ def initialize(options)
8
+ @verbose = options[:verbose] || !!ENV['DEBUG']
9
+ @hostname = options[:bridge]
10
+ env = options[:environment]
11
+ @adapter = load_adapter(@hostname, options[:app], env, @verbose, options[:serverside_version])
12
+ @username = env.username
13
+ @hierarchy_name = env.hierarchy_name
14
+ @command = nil
14
15
  end
15
16
 
16
17
  def deploy(&block)
@@ -47,9 +48,9 @@ module EY
47
48
 
48
49
  private
49
50
 
50
- def load_adapter(bridge, app, environment)
51
+ def load_adapter(bridge, app, environment, verbose, serverside_version)
51
52
  EY::Serverside::Adapter.new("/usr/local/ey_resin/ruby/bin") do |args|
52
- args.serverside_version = EY::ENGINEYARD_SERVERSIDE_VERSION
53
+ args.serverside_version = serverside_version
53
54
  args.app = app.name
54
55
  args.repo = app.repository_uri
55
56
  args.instances = instances_data(environment.deploy_to_instances, bridge)
@@ -57,7 +58,7 @@ module EY
57
58
  args.framework_env = environment.framework_env
58
59
  args.environment_name = environment.name
59
60
  args.account_name = app.account.name
60
- args.verbose = @verbose
61
+ args.verbose = verbose
61
62
  end
62
63
  end
63
64
 
@@ -99,7 +100,7 @@ module EY
99
100
  raise EY::Error, <<-ERROR
100
101
  Authentication Failed. Things to fix:
101
102
  1. Add your SSH key to your local SSH agent with `ssh-add path/to/key`.
102
- 2. Add your SSH key to #{@acc_env_name} on Engine Yard Cloud and apply the changes.
103
+ 2. Add your SSH key to #{@hierarchy_name} on Engine Yard Cloud and apply the changes.
103
104
  (https://support.cloud.engineyard.com/entries/20996846-set-up-ssh-keys)
104
105
  ERROR
105
106
  end
@@ -29,8 +29,18 @@ module EY
29
29
  @repo ||= EY::Repo.new
30
30
  end
31
31
 
32
- def serverside_runner(app_env, verbose, ignore_bad_bridge = false)
33
- ServersideRunner.new(app_env.environment.bridge!(ignore_bad_bridge).hostname, app_env.app, app_env.environment, verbose)
32
+ def serverside_version
33
+ respond_to?(:options) && options[:serverside_version] || EY::ENGINEYARD_SERVERSIDE_VERSION
34
+ end
35
+
36
+ def serverside_runner(app_env, verbose, serverside_version = serverside_version, ignore_bad_bridge = false)
37
+ ServersideRunner.new({
38
+ :bridge => app_env.environment.bridge!(ignore_bad_bridge).hostname,
39
+ :app => app_env.app,
40
+ :environment => app_env.environment,
41
+ :verbose => verbose,
42
+ :serverside_version => serverside_version
43
+ })
34
44
  end
35
45
 
36
46
  def use_default_environment
@@ -1,4 +1,4 @@
1
1
  module EY
2
- VERSION = '2.0.8'
2
+ VERSION = '2.0.9'
3
3
  ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.0.3'
4
4
  end
@@ -431,6 +431,26 @@ describe "ey deploy" do
431
431
  end
432
432
  end
433
433
 
434
+ context "setting a specific serverside version" do
435
+ use_git_repo("deploy test")
436
+
437
+ before(:all) do
438
+ login_scenario "one app, one environment"
439
+ end
440
+
441
+ it "should send the correct serverside version when specified" do
442
+ fast_ey %w[deploy --no-migrate --serverside-version 1.6.4]
443
+ deploy_command = @ssh_commands.find {|c| c =~ /engineyard-serverside.*deploy/ }
444
+ deploy_command.should =~ /engineyard-serverside _1.6.4_ deploy/
445
+ end
446
+
447
+ it "should send the default serverside version when unspecified" do
448
+ fast_ey %w[deploy --no-migrate]
449
+ deploy_command = @ssh_commands.find {|c| c =~ /engineyard-serverside.*deploy/ }
450
+ deploy_command.should =~ /engineyard-serverside _#{EY::ENGINEYARD_SERVERSIDE_VERSION}_ deploy/
451
+ end
452
+ end
453
+
434
454
  context "sending necessary information" do
435
455
  use_git_repo("deploy test")
436
456
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-24 00:00:00.000000000 Z
12
+ date: 2012-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: 1.0.6
101
+ version: 1.0.7
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: 1.0.6
109
+ version: 1.0.7
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: net-ssh
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -425,7 +425,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
425
425
  version: '0'
426
426
  segments:
427
427
  - 0
428
- hash: 3271443734841409447
428
+ hash: 961483598276783294
429
429
  required_rubygems_version: !ruby/object:Gem::Requirement
430
430
  none: false
431
431
  requirements:
@@ -434,7 +434,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
434
434
  version: '0'
435
435
  segments:
436
436
  - 0
437
- hash: 3271443734841409447
437
+ hash: 961483598276783294
438
438
  requirements: []
439
439
  rubyforge_project:
440
440
  rubygems_version: 1.8.24