engineyard-serverside 1.6.5 → 1.7.0.pre2

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.
Files changed (99) hide show
  1. data/lib/engineyard-serverside.rb +2 -0
  2. data/lib/engineyard-serverside/cli.rb +83 -48
  3. data/lib/engineyard-serverside/configuration.rb +85 -18
  4. data/lib/engineyard-serverside/deploy.rb +105 -91
  5. data/lib/engineyard-serverside/deploy_hook.rb +22 -20
  6. data/lib/engineyard-serverside/deprecation.rb +9 -17
  7. data/lib/engineyard-serverside/future.rb +10 -4
  8. data/lib/engineyard-serverside/futures/celluloid.rb +3 -13
  9. data/lib/engineyard-serverside/futures/dataflow.rb +8 -13
  10. data/lib/engineyard-serverside/lockfile_parser.rb +1 -1
  11. data/lib/engineyard-serverside/rails_asset_support.rb +26 -10
  12. data/lib/engineyard-serverside/server.rb +17 -12
  13. data/lib/engineyard-serverside/shell.rb +98 -0
  14. data/lib/engineyard-serverside/shell/formatter.rb +71 -0
  15. data/lib/engineyard-serverside/shell/helpers.rb +29 -0
  16. data/lib/engineyard-serverside/strategies/git.rb +33 -63
  17. data/lib/engineyard-serverside/task.rb +34 -13
  18. data/lib/engineyard-serverside/version.rb +1 -1
  19. data/spec/basic_deploy_spec.rb +15 -50
  20. data/spec/bundler_deploy_spec.rb +3 -44
  21. data/spec/configuration_spec.rb +72 -0
  22. data/spec/custom_deploy_spec.rb +3 -4
  23. data/spec/deploy_hook_spec.rb +210 -162
  24. data/spec/deprecation_spec.rb +4 -26
  25. data/spec/ey_yml_customized_deploy_spec.rb +68 -0
  26. data/spec/fixtures/repos/assets_disabled/Gemfile +6 -0
  27. data/spec/fixtures/repos/assets_disabled/Gemfile.lock +90 -0
  28. data/spec/fixtures/repos/assets_disabled/README +1 -0
  29. data/spec/fixtures/repos/assets_disabled/Rakefile +5 -0
  30. data/spec/fixtures/repos/assets_disabled/config/application.rb +5 -0
  31. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +6 -0
  32. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +90 -0
  33. data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +1 -0
  34. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +5 -0
  35. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/application.rb +5 -0
  36. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +4 -0
  37. data/spec/fixtures/repos/assets_enabled/Gemfile +6 -0
  38. data/spec/fixtures/repos/assets_enabled/Gemfile.lock +90 -0
  39. data/spec/fixtures/repos/assets_enabled/README +1 -0
  40. data/spec/fixtures/repos/assets_enabled/Rakefile +5 -0
  41. data/spec/fixtures/repos/assets_enabled/config/application.rb +5 -0
  42. data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +1 -0
  43. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +5 -0
  44. data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +4 -0
  45. data/spec/fixtures/repos/assets_in_hook/Gemfile +6 -0
  46. data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +90 -0
  47. data/spec/fixtures/repos/assets_in_hook/README +2 -0
  48. data/spec/fixtures/repos/assets_in_hook/Rakefile +5 -0
  49. data/spec/fixtures/repos/assets_in_hook/config/application.rb +5 -0
  50. data/spec/fixtures/repos/assets_in_hook/deploy/before_migrate.rb +1 -0
  51. data/spec/fixtures/repos/default/Gemfile +5 -0
  52. data/spec/fixtures/repos/default/Gemfile.lock +14 -0
  53. data/spec/fixtures/repos/default/README +5 -0
  54. data/spec/fixtures/repos/ey_yml/Gemfile +4 -0
  55. data/spec/fixtures/repos/ey_yml/Gemfile.lock +12 -0
  56. data/spec/fixtures/repos/ey_yml/README +1 -0
  57. data/spec/fixtures/repos/ey_yml/config/ey.yml +12 -0
  58. data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +6 -0
  59. data/spec/fixtures/repos/ey_yml_alt/Gemfile +4 -0
  60. data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +12 -0
  61. data/spec/fixtures/repos/ey_yml_alt/README +1 -0
  62. data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +6 -0
  63. data/spec/fixtures/repos/ey_yml_alt/ey.yml +12 -0
  64. data/spec/fixtures/repos/hook_fails/README +1 -0
  65. data/spec/fixtures/repos/hook_fails/deploy/before_migrate.rb +1 -0
  66. data/spec/fixtures/repos/hooks/README +1 -0
  67. data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +1 -0
  68. data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +1 -0
  69. data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +1 -0
  70. data/spec/fixtures/repos/hooks/deploy/after_restart.rb +1 -0
  71. data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +1 -0
  72. data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +1 -0
  73. data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +1 -0
  74. data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +1 -0
  75. data/spec/fixtures/repos/hooks/deploy/before_restart.rb +1 -0
  76. data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +1 -0
  77. data/spec/fixtures/repos/no_ey_config/Gemfile +4 -0
  78. data/spec/fixtures/repos/no_ey_config/Gemfile.lock +12 -0
  79. data/spec/fixtures/repos/no_ey_config/README +1 -0
  80. data/spec/fixtures/repos/no_gemfile_lock/Gemfile +5 -0
  81. data/spec/fixtures/repos/no_gemfile_lock/README +1 -0
  82. data/spec/fixtures/repos/nodejs/README +1 -0
  83. data/spec/fixtures/repos/nodejs/package.json +7 -0
  84. data/spec/fixtures/repos/not_bundled/README +1 -0
  85. data/spec/fixtures/{gemfiles/1.0.21-rails-31-with-sqlite → repos/sqlite3/Gemfile} +0 -0
  86. data/spec/fixtures/{lockfiles/1.0.21-rails-31-with-sqlite → repos/sqlite3/Gemfile.lock} +0 -0
  87. data/spec/fixtures/repos/sqlite3/README +1 -0
  88. data/spec/git_strategy_spec.rb +11 -2
  89. data/spec/lockfile_parser_spec.rb +8 -3
  90. data/spec/nodejs_deploy_spec.rb +1 -26
  91. data/spec/rails31_deploy_spec.rb +23 -31
  92. data/spec/services_deploy_spec.rb +41 -100
  93. data/spec/shell_spec.rb +50 -0
  94. data/spec/spec_helper.rb +80 -66
  95. data/spec/sqlite3_deploy_spec.rb +10 -16
  96. data/spec/support/integration.rb +45 -139
  97. metadata +233 -78
  98. data/lib/engineyard-serverside/logged_output.rb +0 -91
  99. data/spec/logged_output_spec.rb +0 -55
@@ -12,34 +12,12 @@ describe EY::Serverside do
12
12
  $stderr = @original_stderr
13
13
  end
14
14
 
15
- def check_deprecation(new_const, prints_warning = true)
16
- old_name = new_const.to_s.gsub('EY::Serverside::', 'EY::')
17
- eval(old_name).should == new_const
18
- @warnings.string.should include(old_name) if prints_warning
19
- end
20
-
21
- it "preserves the old constants" do
22
- names = %w[CLI Deploy DeployBase Deploy::Configuration
23
- DeployHook LockfileParser LoggedOutput Server Task
24
- Strategies Strategies::Git]
25
-
26
- names.map do |name|
27
- const = eval("::EY::Serverside::#{name}")
28
- # The way deprecations are implemented currently, we don't print
29
- # warning messages for constants that aren't directly under EY::
30
- prints_warning = name.include?('::') ? false : true
31
- check_deprecation(const, prints_warning)
32
- end
33
- end
34
-
35
- it "deprecates EY.dna_json and EY.node" do
36
- EY.dna_json.should == EY::Serverside.dna_json
37
- @warnings.string.should include("EY.dna_json")
38
- EY.node.should == EY::Serverside.node
39
- @warnings.string.should include("EY.node")
15
+ it "deprecates EY::Serverside::LoggedOutput for EY::Serverside::Shell::Helpers" do
16
+ EY::Serverside::LoggedOutput.should == EY::Serverside::Shell::Helpers
17
+ @warnings.string.should include("EY::Serverside::LoggedOutput")
40
18
  end
41
19
 
42
20
  it "doesn't interfere with unrelated constants" do
43
- lambda{ EY::WTFNotDefined }.should raise_error(NameError, /uninitialized constant.*EY::WTFNotDefined/)
21
+ lambda{ EY::Serverside::WTFNotDefined }.should raise_error(NameError, /uninitialized constant.*WTFNotDefined/)
44
22
  end
45
23
  end
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Deploying an app with ey.yml" do
4
+ context "--no-migrate" do
5
+ before(:all) do
6
+ deploy_test_application('ey_yml', 'migrate' => nil)
7
+ end
8
+
9
+ it "does not migrate even though ey.yml says migrate: true" do
10
+ read_output.should_not =~ /Migrating/
11
+ end
12
+
13
+ it "does not enable the maintenance page at all" do
14
+ @deploy_dir.join('current','maintenance_disabled').should exist
15
+ end
16
+ end
17
+
18
+
19
+ context "with migration" do
20
+ before(:all) do
21
+ deploy_test_application('ey_yml')
22
+ end
23
+
24
+ it "excludes copy_excludes from releases" do
25
+ cmd = @deployer.commands.grep(/rsync -aq/).first
26
+ cmd.should include('rsync -aq --exclude=".git" --exclude="README"')
27
+ @deploy_dir.join('current', '.git').should_not exist
28
+ @deploy_dir.join('current', 'README').should_not exist
29
+ end
30
+
31
+ it "loads ey.yml at lower priority than command line options" do
32
+ @deploy_dir.join('current', 'REVISION').read.should == "somebranch\n"
33
+ end
34
+
35
+ it "loads bundle_without from the config, which overrides the default" do
36
+ cmd = @deployer.commands.grep(/bundle _\S*_ install/).first
37
+ cmd.should include('--without only test')
38
+ end
39
+
40
+ it "does not enable the maintenance page during migrations" do
41
+ @deploy_dir.join('current','maintenance_disabled').should exist
42
+ @deploy_dir.join('current','maintenance_enabled').should_not exist
43
+ end
44
+
45
+ it "makes custom variables available to hooks" do
46
+ @deploy_dir.join('current', 'custom_hook').read.should include("custom_from_ey_yml")
47
+ end
48
+
49
+ it "doesn't display the database adapter warning with ignore_database_adapter_warning: true" do
50
+ read_output.should_not =~ /WARNING/
51
+ end
52
+ end
53
+
54
+ context "with a different ey.yml" do
55
+ before(:all) do
56
+ deploy_test_application('ey_yml_alt')
57
+ end
58
+
59
+ it "always installs maintenance pages" do
60
+ @deploy_dir.join('current','maintenance_enabled').should exist
61
+ @deploy_dir.join('current','maintenance_disabled').should_not exist
62
+ end
63
+
64
+ it "displays the database adapter warning without ignore_database_adapter_warning" do
65
+ read_output.should =~ /WARNING: Gemfile.lock does not contain a recognized database adapter./
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,6 @@
1
+ source :rubygems
2
+
3
+ gem 'rake'
4
+ gem 'pg'
5
+ gem 'ey_config'
6
+ gem 'rails'
@@ -0,0 +1,90 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.3)
5
+ actionpack (= 3.2.3)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.3)
8
+ activemodel (= 3.2.3)
9
+ activesupport (= 3.2.3)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.2)
17
+ activemodel (3.2.3)
18
+ activesupport (= 3.2.3)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.3)
21
+ activemodel (= 3.2.3)
22
+ activesupport (= 3.2.3)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.3)
26
+ activemodel (= 3.2.3)
27
+ activesupport (= 3.2.3)
28
+ activesupport (3.2.3)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.2)
32
+ builder (3.0.0)
33
+ erubis (2.7.0)
34
+ ey_config (0.0.5)
35
+ hike (1.2.1)
36
+ i18n (0.6.0)
37
+ journey (1.0.3)
38
+ json (1.6.6)
39
+ mail (2.4.4)
40
+ i18n (>= 0.4.0)
41
+ mime-types (~> 1.16)
42
+ treetop (~> 1.4.8)
43
+ mime-types (1.18)
44
+ multi_json (1.3.2)
45
+ pg (0.13.2)
46
+ polyglot (0.3.3)
47
+ rack (1.4.1)
48
+ rack-cache (1.2)
49
+ rack (>= 0.4)
50
+ rack-ssl (1.3.2)
51
+ rack
52
+ rack-test (0.6.1)
53
+ rack (>= 1.0)
54
+ rails (3.2.3)
55
+ actionmailer (= 3.2.3)
56
+ actionpack (= 3.2.3)
57
+ activerecord (= 3.2.3)
58
+ activeresource (= 3.2.3)
59
+ activesupport (= 3.2.3)
60
+ bundler (~> 1.0)
61
+ railties (= 3.2.3)
62
+ railties (3.2.3)
63
+ actionpack (= 3.2.3)
64
+ activesupport (= 3.2.3)
65
+ rack-ssl (~> 1.3.2)
66
+ rake (>= 0.8.7)
67
+ rdoc (~> 3.4)
68
+ thor (~> 0.14.6)
69
+ rake (0.9.2.2)
70
+ rdoc (3.12)
71
+ json (~> 1.4)
72
+ sprockets (2.1.2)
73
+ hike (~> 1.2)
74
+ rack (~> 1.0)
75
+ tilt (~> 1.1, != 1.3.0)
76
+ thor (0.14.6)
77
+ tilt (1.3.3)
78
+ treetop (1.4.10)
79
+ polyglot
80
+ polyglot (>= 0.3.1)
81
+ tzinfo (0.3.33)
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ ey_config
88
+ pg
89
+ rails
90
+ rake
@@ -0,0 +1 @@
1
+ Standard rails31 app with assets disabled.
@@ -0,0 +1,5 @@
1
+ desc 'Precompile yar assetz'
2
+ task 'assets:precompile' do
3
+ sh 'touch precompiled'
4
+ end
5
+
@@ -0,0 +1,5 @@
1
+ module Rails31
2
+ class Application < Rails::Application
3
+ config.assets.enabled = false
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ source :rubygems
2
+
3
+ gem 'rake'
4
+ gem 'pg'
5
+ gem 'ey_config'
6
+ gem 'rails'
@@ -0,0 +1,90 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.3)
5
+ actionpack (= 3.2.3)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.3)
8
+ activemodel (= 3.2.3)
9
+ activesupport (= 3.2.3)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.2)
17
+ activemodel (3.2.3)
18
+ activesupport (= 3.2.3)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.3)
21
+ activemodel (= 3.2.3)
22
+ activesupport (= 3.2.3)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.3)
26
+ activemodel (= 3.2.3)
27
+ activesupport (= 3.2.3)
28
+ activesupport (3.2.3)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.2)
32
+ builder (3.0.0)
33
+ erubis (2.7.0)
34
+ ey_config (0.0.5)
35
+ hike (1.2.1)
36
+ i18n (0.6.0)
37
+ journey (1.0.3)
38
+ json (1.6.6)
39
+ mail (2.4.4)
40
+ i18n (>= 0.4.0)
41
+ mime-types (~> 1.16)
42
+ treetop (~> 1.4.8)
43
+ mime-types (1.18)
44
+ multi_json (1.3.2)
45
+ pg (0.13.2)
46
+ polyglot (0.3.3)
47
+ rack (1.4.1)
48
+ rack-cache (1.2)
49
+ rack (>= 0.4)
50
+ rack-ssl (1.3.2)
51
+ rack
52
+ rack-test (0.6.1)
53
+ rack (>= 1.0)
54
+ rails (3.2.3)
55
+ actionmailer (= 3.2.3)
56
+ actionpack (= 3.2.3)
57
+ activerecord (= 3.2.3)
58
+ activeresource (= 3.2.3)
59
+ activesupport (= 3.2.3)
60
+ bundler (~> 1.0)
61
+ railties (= 3.2.3)
62
+ railties (3.2.3)
63
+ actionpack (= 3.2.3)
64
+ activesupport (= 3.2.3)
65
+ rack-ssl (~> 1.3.2)
66
+ rake (>= 0.8.7)
67
+ rdoc (~> 3.4)
68
+ thor (~> 0.14.6)
69
+ rake (0.9.2.2)
70
+ rdoc (3.12)
71
+ json (~> 1.4)
72
+ sprockets (2.1.2)
73
+ hike (~> 1.2)
74
+ rack (~> 1.0)
75
+ tilt (~> 1.1, != 1.3.0)
76
+ thor (0.14.6)
77
+ tilt (1.3.3)
78
+ treetop (1.4.10)
79
+ polyglot
80
+ polyglot (>= 0.3.1)
81
+ tzinfo (0.3.33)
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ ey_config
88
+ pg
89
+ rails
90
+ rake
@@ -0,0 +1 @@
1
+ rails31 app with asset compilation enabled, but ey.yml turns it off.
@@ -0,0 +1,5 @@
1
+ desc 'Precompile yar assetz'
2
+ task 'assets:precompile' do
3
+ sh 'touch precompiled'
4
+ end
5
+
@@ -0,0 +1,5 @@
1
+ module Rails31
2
+ class Application < Rails::Application
3
+ config.assets.enabled = true
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ environments:
2
+ env:
3
+ precompile_assets: false
4
+ maintenance_on_migrate: false
@@ -0,0 +1,6 @@
1
+ source :rubygems
2
+
3
+ gem 'rake'
4
+ gem 'pg'
5
+ gem 'ey_config'
6
+ gem 'rails'
@@ -0,0 +1,90 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.3)
5
+ actionpack (= 3.2.3)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.3)
8
+ activemodel (= 3.2.3)
9
+ activesupport (= 3.2.3)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.2)
17
+ activemodel (3.2.3)
18
+ activesupport (= 3.2.3)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.3)
21
+ activemodel (= 3.2.3)
22
+ activesupport (= 3.2.3)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.3)
26
+ activemodel (= 3.2.3)
27
+ activesupport (= 3.2.3)
28
+ activesupport (3.2.3)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.2)
32
+ builder (3.0.0)
33
+ erubis (2.7.0)
34
+ ey_config (0.0.5)
35
+ hike (1.2.1)
36
+ i18n (0.6.0)
37
+ journey (1.0.3)
38
+ json (1.6.6)
39
+ mail (2.4.4)
40
+ i18n (>= 0.4.0)
41
+ mime-types (~> 1.16)
42
+ treetop (~> 1.4.8)
43
+ mime-types (1.18)
44
+ multi_json (1.3.2)
45
+ pg (0.13.2)
46
+ polyglot (0.3.3)
47
+ rack (1.4.1)
48
+ rack-cache (1.2)
49
+ rack (>= 0.4)
50
+ rack-ssl (1.3.2)
51
+ rack
52
+ rack-test (0.6.1)
53
+ rack (>= 1.0)
54
+ rails (3.2.3)
55
+ actionmailer (= 3.2.3)
56
+ actionpack (= 3.2.3)
57
+ activerecord (= 3.2.3)
58
+ activeresource (= 3.2.3)
59
+ activesupport (= 3.2.3)
60
+ bundler (~> 1.0)
61
+ railties (= 3.2.3)
62
+ railties (3.2.3)
63
+ actionpack (= 3.2.3)
64
+ activesupport (= 3.2.3)
65
+ rack-ssl (~> 1.3.2)
66
+ rake (>= 0.8.7)
67
+ rdoc (~> 3.4)
68
+ thor (~> 0.14.6)
69
+ rake (0.9.2.2)
70
+ rdoc (3.12)
71
+ json (~> 1.4)
72
+ sprockets (2.1.2)
73
+ hike (~> 1.2)
74
+ rack (~> 1.0)
75
+ tilt (~> 1.1, != 1.3.0)
76
+ thor (0.14.6)
77
+ tilt (1.3.3)
78
+ treetop (1.4.10)
79
+ polyglot
80
+ polyglot (>= 0.3.1)
81
+ tzinfo (0.3.33)
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ ey_config
88
+ pg
89
+ rails
90
+ rake