engineyard-serverside 1.5.2 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,6 @@ require 'engineyard-serverside/server'
24
24
  require 'engineyard-serverside/deploy'
25
25
  require 'engineyard-serverside/deploy_hook'
26
26
  require 'engineyard-serverside/lockfile_parser'
27
- require 'engineyard-serverside/bundle_installer'
28
27
  require 'engineyard-serverside/cli'
29
28
  require 'engineyard-serverside/configuration'
30
29
  require 'engineyard-serverside/deprecation'
@@ -5,8 +5,9 @@ module EY
5
5
  module Serverside
6
6
  class Deploy::Configuration
7
7
  DEFAULT_CONFIG = Thor::CoreExt::HashWithIndifferentAccess.new({
8
- "branch" => "master",
9
- "strategy" => "Git",
8
+ "branch" => "master",
9
+ "strategy" => "Git",
10
+ "bundle_without" => "test development",
10
11
  })
11
12
 
12
13
  attr_reader :configuration
@@ -73,6 +74,10 @@ module EY
73
74
  configuration['migrate'] == "migrate" ? DEFAULT_CONFIG["migrate"] : configuration['migrate']
74
75
  end
75
76
 
77
+ def bundle_without
78
+ configuration['bundle_without']
79
+ end
80
+
76
81
  def user
77
82
  configuration['user'] || ENV['USER']
78
83
  end
@@ -130,6 +135,18 @@ module EY
130
135
  File.join(deploy_to, "shared")
131
136
  end
132
137
 
138
+ def bundled_gems_path
139
+ File.join(shared_path, "bundled_gems")
140
+ end
141
+
142
+ def ruby_version_file
143
+ File.join(bundled_gems_path, "RUBY_VERSION")
144
+ end
145
+
146
+ def system_version_file
147
+ File.join(bundled_gems_path, "SYSTEM_VERSION")
148
+ end
149
+
133
150
  def release_dir
134
151
  File.join(deploy_to, "releases")
135
152
  end
@@ -14,7 +14,6 @@ module EY
14
14
  def deploy
15
15
  debug "Starting deploy at #{Time.now.asctime}"
16
16
  update_repository_cache
17
- check_repository
18
17
  cached_deploy
19
18
  end
20
19
 
@@ -25,6 +24,7 @@ module EY
25
24
 
26
25
  info "~> Starting full deploy"
27
26
  copy_repository_cache
27
+ check_repository
28
28
 
29
29
  with_failed_release_cleanup do
30
30
  create_revision_file
@@ -52,14 +52,32 @@ module EY
52
52
  end
53
53
 
54
54
  def check_repository
55
- if gemfile? && lockfile
56
- unless lockfile.any_database_adapter?
57
- warning <<-WARN
58
- Gemfile.lock does not contain a recognized databaseadapter.
55
+ if gemfile?
56
+ info "~> Gemfile found."
57
+ if lockfile
58
+ info "~> Gemfile.lock found."
59
+ unless lockfile.any_database_adapter?
60
+ warning <<-WARN
61
+ Gemfile.lock does not contain a recognized database adapter.
59
62
  A database-adapter gem such as mysql2, mysql, or do_mysql was expected.
60
63
  This can prevent applications that use MySQL or PostreSQL from booting.
64
+
65
+ To fix, add any needed adapter to your Gemfile, bundle, commit, and redeploy.
66
+ Applications that don't use MySQL or PostgreSQL can safely ignore this warning.
67
+ WARN
68
+ end
69
+ else
70
+ warning <<-WARN
71
+ Gemfile.lock is missing!
72
+ You can get different versions of gems in production than what you tested with.
73
+ You can get different versions of gems on every deployment even if your Gemfile hasn't changed.
74
+ Deploying will take longer.
75
+
76
+ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
61
77
  WARN
62
78
  end
79
+ else
80
+ info "~> No Gemfile. Deploying without bundler support."
63
81
  end
64
82
  end
65
83
 
@@ -312,25 +330,20 @@ This can prevent applications that use MySQL or PostreSQL from booting.
312
330
  raise
313
331
  end
314
332
 
315
- def warn_about_missing_lockfile
316
- warning <<-WARN
317
- Gemfile.lock is missing!
318
- You can get different versions of gems in production than what you tested with.
319
- You can get different versions of gems on every deployment even if your Gemfile hasn't changed.
320
- Deploying will take longer.
321
-
322
- To fix this problem, commit your Gemfile.lock to your repository.
323
- WARN
324
- end
333
+ def bundler_config
334
+ version = LockfileParser.default_version
335
+ options = [
336
+ "--path #{c.bundled_gems_path}",
337
+ "--binstubs #{c.binstubs_path}",
338
+ "--without #{c.bundle_without}"
339
+ ]
325
340
 
326
- def get_bundler_installer
327
341
  if lockfile
328
- bundler_10_installer(lockfile.bundler_version)
329
- else
330
- warn_about_missing_lockfile
331
- # deployment mode is not supported without a Gemfile.lock, so we turn that off.
332
- bundler_10_installer(LockfileParser.default_version, deployment_mode = false)
342
+ version = lockfile.bundler_version
343
+ options.unshift('--deployment') # deployment mode is not supported without a Gemfile.lock
333
344
  end
345
+
346
+ return [version, options.join(' ')]
334
347
  end
335
348
 
336
349
  def lockfile
@@ -342,44 +355,32 @@ To fix this problem, commit your Gemfile.lock to your repository.
342
355
  end
343
356
  end
344
357
 
345
- # Set +deploymemt_mode+ to false to avoid passing the --deployment flag.
346
- def bundler_10_installer(version, deployment_mode = true)
347
- options = ["--path #{c.shared_path}/bundled_gems",
348
- "--binstubs #{c.binstubs_path}",
349
- "--without development test"]
350
- options.unshift('--deployment') if deployment_mode
351
- BundleInstaller.new(version, options.join(' '))
352
- end
353
-
354
358
  def check_ruby_bundler
355
359
  if gemfile?
356
- info "~> Gemfile detected, bundling gems"
360
+ info "~> Bundling gems..."
357
361
 
358
- bundler_installer = get_bundler_installer
362
+ bundler_version, install_switches = bundler_config
359
363
 
360
- sudo "#{clean_environment} && #{serverside_bin} install_bundler #{bundler_installer.version}"
364
+ sudo "#{clean_environment} && #{serverside_bin} install_bundler #{bundler_version}"
361
365
 
362
- bundled_gems_path = File.join(c.shared_path, "bundled_gems")
363
- ruby_version_file = File.join(bundled_gems_path, "RUBY_VERSION")
364
- system_version_file = File.join(bundled_gems_path, "SYSTEM_VERSION")
365
- ruby_version = `ruby -v`
366
+ ruby_version = `ruby -v`
366
367
  system_version = `uname -m`
367
368
 
368
- if File.directory?(bundled_gems_path)
369
+ if File.directory?(c.bundled_gems_path)
369
370
  rebundle = false
370
371
 
371
- rebundle = true if File.exist?(ruby_version_file) && File.read(ruby_version_file) != ruby_version
372
- rebundle = true if File.exist?(system_version_file) && File.read(system_version_file) != system_version
372
+ rebundle = true if File.exist?(c.ruby_version_file) && File.read(c.ruby_version_file) != ruby_version
373
+ rebundle = true if File.exist?(c.system_version_file) && File.read(c.system_version_file) != system_version
373
374
 
374
375
  if rebundle
375
376
  info "~> Ruby version change detected, cleaning bundled gems"
376
- run "rm -Rf #{bundled_gems_path}"
377
+ run "rm -Rf #{c.bundled_gems_path}"
377
378
  end
378
379
  end
379
380
 
380
- run "#{clean_environment} && cd #{c.release_path} && ruby -S bundle _#{bundler_installer.version}_ install #{bundler_installer.options}"
381
+ run "#{clean_environment} && cd #{c.release_path} && ruby -S bundle _#{bundler_version}_ install #{install_switches}"
381
382
 
382
- run "mkdir -p #{bundled_gems_path} && ruby -v > #{ruby_version_file} && uname -m > #{system_version_file}"
383
+ run "mkdir -p #{c.bundled_gems_path} && ruby -v > #{c.ruby_version_file} && uname -m > #{c.system_version_file}"
383
384
  end
384
385
  end
385
386
 
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '1.5.2'
3
+ VERSION = '1.5.4'
4
4
  end
5
5
  end
@@ -15,14 +15,15 @@ describe "Deploying an application that uses Bundler" do
15
15
 
16
16
  # run a deploy
17
17
  config = EY::Serverside::Deploy::Configuration.new({
18
- "strategy" => "IntegrationSpec",
19
- "deploy_to" => @deploy_dir,
20
- "group" => `id -gn`.strip,
21
- "stack" => 'nginx_passenger',
22
- "migrate" => "ruby -e 'puts ENV[\"PATH\"]' > #{@deploy_dir}/path-when-migrating",
23
- 'app' => 'foo',
24
- 'framework_env' => 'staging'
25
- })
18
+ "strategy" => "IntegrationSpec",
19
+ "deploy_to" => @deploy_dir,
20
+ "group" => `id -gn`.strip,
21
+ "stack" => 'nginx_passenger',
22
+ "migrate" => "ruby -e 'puts ENV[\"PATH\"]' > #{@deploy_dir}/path-when-migrating",
23
+ 'app' => 'foo',
24
+ 'framework_env' => 'staging',
25
+ 'bundle_without' => 'release test',
26
+ })
26
27
 
27
28
  # pretend there is a shared bundled_gems directory
28
29
  FileUtils.mkdir_p(File.join(@deploy_dir, 'shared', 'bundled_gems'))
@@ -68,6 +69,12 @@ describe "Deploying an application that uses Bundler" do
68
69
  File.read(File.join(@deploy_dir, 'path-when-migrating')).should include('ey_bundler_binstubs')
69
70
  end
70
71
 
72
+ it "runs 'bundle install' with custom --without options" do
73
+ bundle_install_cmd = @deployer.commands.grep(/bundle _\S+_ install/).first
74
+ bundle_install_cmd.should_not be_nil
75
+ bundle_install_cmd.should include("--without release test")
76
+ end
77
+
71
78
  it "creates a ruby version file" do
72
79
  File.exist?(File.join(@deploy_dir, 'shared', 'bundled_gems', 'RUBY_VERSION')).should be_true
73
80
  end
@@ -19,7 +19,7 @@ describe EY::Serverside do
19
19
  end
20
20
 
21
21
  it "preserves the old constants" do
22
- names = %w[BundleInstaller CLI Deploy DeployBase Deploy::Configuration
22
+ names = %w[CLI Deploy DeployBase Deploy::Configuration
23
23
  DeployHook LockfileParser LoggedOutput Server Task
24
24
  Strategies Strategies::Git]
25
25
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "the bundler version retrieved from the lockfile" do
4
4
  def load_lockfile(file)
5
- File.read(File.expand_path("../support/lockfiles/#{file}", __FILE__))
5
+ File.read(File.expand_path("../fixtures/lockfiles/#{file}", __FILE__))
6
6
  end
7
7
 
8
8
  def get_parser(file)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 2
10
- version: 1.5.2
9
+ - 4
10
+ version: 1.5.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - EY Cloud Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-18 00:00:00 -07:00
18
+ date: 2011-10-21 00:00:00 -07:00
19
19
  default_executable: engineyard-serverside
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -58,7 +58,6 @@ extra_rdoc_files: []
58
58
 
59
59
  files:
60
60
  - bin/engineyard-serverside
61
- - lib/engineyard-serverside/bundle_installer.rb
62
61
  - lib/engineyard-serverside/cli.rb
63
62
  - lib/engineyard-serverside/configuration.rb
64
63
  - lib/engineyard-serverside/default_maintenance_page.html
@@ -272,6 +271,19 @@ files:
272
271
  - spec/fixtures/gitrepo/foo
273
272
  - spec/fixtures/gitrepo.tar.gz
274
273
  - spec/fixtures/invalid_hook.rb
274
+ - spec/fixtures/lockfiles/0.9-no-bundler
275
+ - spec/fixtures/lockfiles/0.9-with-bundler
276
+ - spec/fixtures/lockfiles/1.0-no-bundler
277
+ - spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler
278
+ - spec/fixtures/lockfiles/1.0.18-do_mysql
279
+ - spec/fixtures/lockfiles/1.0.18-do_postgres
280
+ - spec/fixtures/lockfiles/1.0.18-mysql
281
+ - spec/fixtures/lockfiles/1.0.18-mysql2
282
+ - spec/fixtures/lockfiles/1.0.18-pg
283
+ - spec/fixtures/lockfiles/1.0.6-no-bundler
284
+ - spec/fixtures/lockfiles/1.0.6-with-any-bundler
285
+ - spec/fixtures/lockfiles/1.0.6-with-bundler
286
+ - spec/fixtures/lockfiles/not-a-lockfile
275
287
  - spec/fixtures/valid_hook.rb
276
288
  - spec/git_strategy_spec.rb
277
289
  - spec/lockfile_parser_spec.rb
@@ -281,19 +293,6 @@ files:
281
293
  - spec/server_spec.rb
282
294
  - spec/spec_helper.rb
283
295
  - spec/support/integration.rb
284
- - spec/support/lockfiles/0.9-no-bundler
285
- - spec/support/lockfiles/0.9-with-bundler
286
- - spec/support/lockfiles/1.0-no-bundler
287
- - spec/support/lockfiles/1.0.0.rc.1-with-bundler
288
- - spec/support/lockfiles/1.0.18-do_mysql
289
- - spec/support/lockfiles/1.0.18-do_postgres
290
- - spec/support/lockfiles/1.0.18-mysql
291
- - spec/support/lockfiles/1.0.18-mysql2
292
- - spec/support/lockfiles/1.0.18-pg
293
- - spec/support/lockfiles/1.0.6-no-bundler
294
- - spec/support/lockfiles/1.0.6-with-any-bundler
295
- - spec/support/lockfiles/1.0.6-with-bundler
296
- - spec/support/lockfiles/not-a-lockfile
297
296
  has_rdoc: true
298
297
  homepage: http://github.com/engineyard/engineyard-serverside
299
298
  licenses: []
@@ -337,6 +336,19 @@ test_files:
337
336
  - spec/fixtures/gitrepo/foo
338
337
  - spec/fixtures/gitrepo.tar.gz
339
338
  - spec/fixtures/invalid_hook.rb
339
+ - spec/fixtures/lockfiles/0.9-no-bundler
340
+ - spec/fixtures/lockfiles/0.9-with-bundler
341
+ - spec/fixtures/lockfiles/1.0-no-bundler
342
+ - spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler
343
+ - spec/fixtures/lockfiles/1.0.18-do_mysql
344
+ - spec/fixtures/lockfiles/1.0.18-do_postgres
345
+ - spec/fixtures/lockfiles/1.0.18-mysql
346
+ - spec/fixtures/lockfiles/1.0.18-mysql2
347
+ - spec/fixtures/lockfiles/1.0.18-pg
348
+ - spec/fixtures/lockfiles/1.0.6-no-bundler
349
+ - spec/fixtures/lockfiles/1.0.6-with-any-bundler
350
+ - spec/fixtures/lockfiles/1.0.6-with-bundler
351
+ - spec/fixtures/lockfiles/not-a-lockfile
340
352
  - spec/fixtures/valid_hook.rb
341
353
  - spec/git_strategy_spec.rb
342
354
  - spec/lockfile_parser_spec.rb
@@ -346,16 +358,3 @@ test_files:
346
358
  - spec/server_spec.rb
347
359
  - spec/spec_helper.rb
348
360
  - spec/support/integration.rb
349
- - spec/support/lockfiles/0.9-no-bundler
350
- - spec/support/lockfiles/0.9-with-bundler
351
- - spec/support/lockfiles/1.0-no-bundler
352
- - spec/support/lockfiles/1.0.0.rc.1-with-bundler
353
- - spec/support/lockfiles/1.0.18-do_mysql
354
- - spec/support/lockfiles/1.0.18-do_postgres
355
- - spec/support/lockfiles/1.0.18-mysql
356
- - spec/support/lockfiles/1.0.18-mysql2
357
- - spec/support/lockfiles/1.0.18-pg
358
- - spec/support/lockfiles/1.0.6-no-bundler
359
- - spec/support/lockfiles/1.0.6-with-any-bundler
360
- - spec/support/lockfiles/1.0.6-with-bundler
361
- - spec/support/lockfiles/not-a-lockfile
@@ -1,6 +0,0 @@
1
- module EY
2
- module Serverside
3
- class BundleInstaller < Struct.new(:version, :options)
4
- end
5
- end
6
- end