engineyard-serverside 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,20 +3,32 @@ module EY
3
3
  module DependencyManager
4
4
  class Composer < Base
5
5
  def detected?
6
- composer_lock? || composer_json?
6
+ composer_lock? || composer_json?
7
7
  end
8
8
 
9
- def install
10
- if composer_available?
11
- shell.status "Checking for composer updates..."
12
- composer_selfupdate
13
- shell.status "Installing composer packages (composer.#{lock_or_json} detected)"
14
- composer_install
15
- else
16
- shell.warning "composer.#{lock_or_json} detected but composer not available."
9
+ def check
10
+ unless composer_available?
11
+ raise EY::Serverside::RemoteFailure.new("composer.#{lock_or_json} detected but composer not available!")
12
+ end
13
+
14
+ if composer_json? && !composer_lock?
15
+ shell.warning <<-WARN
16
+ composer.json found but composer.lock missing!
17
+ This may result in different versions of packages
18
+ being installed than what you tested with.
19
+
20
+ To fix this problem, commit your composer.lock to the repository and redeploy.
21
+ WARN
17
22
  end
18
23
  end
19
24
 
25
+ def install
26
+ shell.status "Checking for composer updates..."
27
+ composer_selfupdate
28
+ shell.status "Installing composer packages (composer.#{lock_or_json} detected)"
29
+ composer_install
30
+ end
31
+
20
32
  def lock_or_json
21
33
  composer_lock? ? 'lock' : 'json'
22
34
  end
@@ -71,7 +71,8 @@ module EY
71
71
  # silentely failed assets. Only reusing when assets are enabled
72
72
  # ensures that existing assets were successful.
73
73
  def reuse_assets?
74
- previous_revision &&
74
+ asset_strategy.reusable? &&
75
+ previous_revision &&
75
76
  active_revision &&
76
77
  runner.strategy.same?(previous_revision, active_revision, asset_dependencies)
77
78
  end
@@ -33,6 +33,10 @@ module EY
33
33
  @runner = runner
34
34
  end
35
35
 
36
+ def reusable?
37
+ previous_assets_path.directory? && previous_assets_path.entries.any?
38
+ end
39
+
36
40
  def reuse
37
41
  run "mkdir -p #{paths.public_assets} && rsync -aq #{previous_assets_path}/ #{paths.public_assets}"
38
42
  end
@@ -73,6 +77,10 @@ module EY
73
77
  @runner = runner
74
78
  end
75
79
 
80
+ def reusable?
81
+ shared_assets_path.directory? && shared_assets_path.entries.any?
82
+ end
83
+
76
84
  def reuse
77
85
  run "mkdir -p #{shared_assets_path} && ln -nfs #{shared_assets_path} #{paths.public}"
78
86
  end
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '2.1.3'
3
+ VERSION = '2.1.4'
4
4
  end
5
5
  end
@@ -30,6 +30,11 @@ describe "Deploying an application that uses PHP and Composer" do
30
30
  deploy_test_application('php_no_composer_lock')
31
31
  end
32
32
 
33
+ it "outputs a warning about deploying without a .lock" do
34
+ warning_out = read_output.should include("WARNING: composer.json found but composer.lock missing!")
35
+ warning_out.should_not be_nil
36
+ end
37
+
33
38
  it "runs 'composer install'" do
34
39
  install_cmd = @deployer.commands.grep(/composer install/).first
35
40
  install_cmd.should_not be_nil
@@ -52,24 +57,16 @@ describe "Deploying an application that uses PHP and Composer" do
52
57
  context "without composer available" do
53
58
 
54
59
  context "with a composer.lock" do
55
- before(:all) do
56
- deploy_test_application('php_composer_lock')
57
- end
58
60
 
59
- it "outputs a warning, but continues" do
60
- warning_out = read_output.should include("WARNING: composer.lock")
61
- warning_out.should_not be_nil
61
+ it "fails to deploy" do
62
+ expect {deploy_test_application('php_composer_lock')}.to raise_error EY::Serverside::RemoteFailure
62
63
  end
63
64
  end
64
65
 
65
66
  context "WITHOUT a composer.lock but with composer.json" do
66
- before(:all) do
67
- deploy_test_application('php_no_composer_lock')
68
- end
69
67
 
70
- it "outputs a warning, but continues" do
71
- warning_out = read_output.should include("WARNING: composer.json")
72
- warning_out.should_not be_nil
68
+ it "fails to deploy" do
69
+ expect {deploy_test_application('php_no_composer_lock')}.to raise_error EY::Serverside::RemoteFailure
73
70
  end
74
71
 
75
72
  end
@@ -43,6 +43,21 @@ describe "Deploying a Rails 3.1 application" do
43
43
  deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
44
44
  read_output.should_not =~ %r#Reusing existing assets#
45
45
  end
46
+
47
+ it "precompile assets when redeploying the same ref, but assets were turned off the first time" do
48
+ deploy_test_application('assets_enabled_in_ey_yml', 'config' => {'precompile_assets' => 'false'})
49
+ deploy_dir.join('current', 'precompiled').should_not exist
50
+ deploy_dir.join('current', 'public', 'assets').should_not exist
51
+ deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should_not exist
52
+ read_output.should_not include("Precompiling assets. (precompile_assets: true)")
53
+
54
+ # assets will show as unchanged, but it should compile them fresh anyway.
55
+ redeploy_test_application('config' => {'precompile_assets' => 'true'})
56
+ deploy_dir.join('current', 'precompiled').should exist # it does runs the task
57
+ deploy_dir.join('current', 'public', 'assets').should exist
58
+ deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
59
+ read_output.should_not =~ %r#Reusing existing assets#
60
+ end
46
61
  end
47
62
 
48
63
  context "with asset compilation enabled in ey.yml, despite not otherwise being enabled" do
data/spec/shell_spec.rb CHANGED
@@ -3,10 +3,11 @@ require 'tempfile'
3
3
  require 'timecop'
4
4
 
5
5
  describe EY::Serverside::Shell do
6
+ let(:output) { StringIO.new }
7
+
6
8
  if "".respond_to?(:force_encoding)
7
9
  it "status works for ut8" do
8
- output = StringIO.new
9
- shell = EY::Serverside::Shell.new(:verbose => true, :stdout => @output, :stderr => @output, :log_path => tmpdir.join("engineyard-serverside-#{Time.now.to_i}-#{$$}.log"), :start_time => Time.local(2008, 9, 1, 12, 10, 25))
10
+ shell = EY::Serverside::Shell.new(:verbose => true, :stdout => output, :stderr => output, :log_path => tmpdir.join("engineyard-serverside-#{Time.now.to_i}-#{$$}.log"), :start_time => Time.local(2008, 9, 1, 12, 10, 25))
10
11
  shell.status("\u2603".force_encoding("binary"))
11
12
  end
12
13
  end
@@ -16,8 +17,7 @@ describe EY::Serverside::Shell do
16
17
  time2 = Time.local(2008, 9, 1, 12, 3, 5)
17
18
  time3 = Time.local(2008, 9, 1, 12, 10, 25)
18
19
 
19
- @output = StringIO.new
20
- @shell = EY::Serverside::Shell.new(:verbose => true, :stdout => @output, :stderr => @output, :log_path => tmpdir.join("engineyard-serverside-#{Time.now.to_i}-#{$$}.log"), :start_time => time1)
20
+ @shell = EY::Serverside::Shell.new(:verbose => true, :stdout => output, :stderr => output, :log_path => tmpdir.join("engineyard-serverside-#{Time.now.to_i}-#{$$}.log"), :start_time => time1)
21
21
 
22
22
  Timecop.freeze(time1) do
23
23
  @shell.debug('debug')
@@ -36,8 +36,8 @@ describe EY::Serverside::Shell do
36
36
  tstp_2 = "+ 3m 05s "
37
37
  tstp_3 = "+10m 25s "
38
38
  notstp = " "
39
- @output.rewind
40
- @output.read.should == <<-OUTPUT
39
+ output.rewind
40
+ output.read.should == <<-OUTPUT
41
41
  #{notstp} debug
42
42
 
43
43
  \e[1m\e[33m#{tstp_1} !> notice
metadata CHANGED
@@ -1,159 +1,157 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.4
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 1
9
- - 3
10
- version: 2.1.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - EY Cloud Team
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-06-05 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-06-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rspec
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - "="
26
- - !ruby/object:Gem::Version
27
- hash: 31
28
- segments:
29
- - 1
30
- - 3
31
- - 2
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
32
21
  version: 1.3.2
33
- prerelease: false
34
22
  type: :development
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.3.2
30
+ - !ruby/object:Gem::Dependency
37
31
  name: rake
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 11
44
- segments:
45
- - 0
46
- - 9
47
- - 2
48
- - 2
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
49
37
  version: 0.9.2.2
50
38
  - - <
51
- - !ruby/object:Gem::Version
52
- hash: 35
53
- segments:
54
- - 10
55
- - 0
56
- version: "10.0"
57
- prerelease: false
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
58
41
  type: :development
59
- requirement: *id002
60
- - !ruby/object:Gem::Dependency
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: 0.9.2.2
49
+ - - <
50
+ - !ruby/object:Gem::Version
51
+ version: '10.0'
52
+ - !ruby/object:Gem::Dependency
61
53
  name: rdoc
62
- version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ requirement: !ruby/object:Gem::Requirement
63
55
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 3
68
- segments:
69
- - 0
70
- version: "0"
71
- prerelease: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
72
60
  type: :development
73
- requirement: *id003
74
- - !ruby/object:Gem::Dependency
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
75
69
  name: timecop
76
- version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ requirement: !ruby/object:Gem::Requirement
77
71
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- hash: 3
82
- segments:
83
- - 0
84
- version: "0"
85
- prerelease: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
86
76
  type: :development
87
- requirement: *id004
88
- - !ruby/object:Gem::Dependency
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
89
85
  name: simplecov
90
- version_requirements: &id005 !ruby/object:Gem::Requirement
86
+ requirement: !ruby/object:Gem::Requirement
91
87
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
97
- - 0
98
- version: "0"
99
- prerelease: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
100
92
  type: :development
101
- requirement: *id005
102
- - !ruby/object:Gem::Dependency
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ - !ruby/object:Gem::Dependency
103
101
  name: engineyard-cloud-client
104
- version_requirements: &id006 !ruby/object:Gem::Requirement
102
+ requirement: !ruby/object:Gem::Requirement
105
103
  none: false
106
- requirements:
104
+ requirements:
107
105
  - - ~>
108
- - !ruby/object:Gem::Version
109
- hash: 1
110
- segments:
111
- - 1
112
- - 0
113
- - 11
106
+ - !ruby/object:Gem::Version
114
107
  version: 1.0.11
115
- prerelease: false
116
108
  type: :development
117
- requirement: *id006
118
- - !ruby/object:Gem::Dependency
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ~>
114
+ - !ruby/object:Gem::Version
115
+ version: 1.0.11
116
+ - !ruby/object:Gem::Dependency
119
117
  name: engineyard-serverside-adapter
120
- version_requirements: &id007 !ruby/object:Gem::Requirement
118
+ requirement: !ruby/object:Gem::Requirement
121
119
  none: false
122
- requirements:
120
+ requirements:
123
121
  - - ~>
124
- - !ruby/object:Gem::Version
125
- hash: 3
126
- segments:
127
- - 2
128
- - 0
129
- - 6
122
+ - !ruby/object:Gem::Version
130
123
  version: 2.0.6
131
- prerelease: false
132
124
  type: :development
133
- requirement: *id007
134
- - !ruby/object:Gem::Dependency
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 2.0.6
132
+ - !ruby/object:Gem::Dependency
135
133
  name: sqlite3
136
- version_requirements: &id008 !ruby/object:Gem::Requirement
134
+ requirement: !ruby/object:Gem::Requirement
137
135
  none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
145
- prerelease: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
146
140
  type: :development
147
- requirement: *id008
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
148
  description:
149
149
  email: cloud@engineyard.com
150
- executables:
150
+ executables:
151
151
  - engineyard-serverside
152
152
  extensions: []
153
-
154
153
  extra_rdoc_files: []
155
-
156
- files:
154
+ files:
157
155
  - bin/engineyard-serverside
158
156
  - lib/engineyard-serverside/about.rb
159
157
  - lib/engineyard-serverside/cli.rb
@@ -390,40 +388,32 @@ files:
390
388
  - spec/support/integration.rb
391
389
  homepage: http://github.com/engineyard/engineyard-serverside
392
390
  licenses: []
393
-
394
391
  post_install_message:
395
392
  rdoc_options: []
396
-
397
- require_paths:
393
+ require_paths:
398
394
  - lib
399
- required_ruby_version: !ruby/object:Gem::Requirement
395
+ required_ruby_version: !ruby/object:Gem::Requirement
400
396
  none: false
401
- requirements:
402
- - - ">="
403
- - !ruby/object:Gem::Version
404
- hash: 3
405
- segments:
397
+ requirements:
398
+ - - ! '>='
399
+ - !ruby/object:Gem::Version
400
+ version: '0'
401
+ segments:
406
402
  - 0
407
- version: "0"
408
- required_rubygems_version: !ruby/object:Gem::Requirement
403
+ hash: 1955652891792976111
404
+ required_rubygems_version: !ruby/object:Gem::Requirement
409
405
  none: false
410
- requirements:
411
- - - ">="
412
- - !ruby/object:Gem::Version
413
- hash: 23
414
- segments:
415
- - 1
416
- - 3
417
- - 6
406
+ requirements:
407
+ - - ! '>='
408
+ - !ruby/object:Gem::Version
418
409
  version: 1.3.6
419
410
  requirements: []
420
-
421
411
  rubyforge_project:
422
412
  rubygems_version: 1.8.25
423
413
  signing_key:
424
414
  specification_version: 3
425
415
  summary: A gem that deploys ruby applications on EY Cloud instances
426
- test_files:
416
+ test_files:
427
417
  - spec/basic_deploy_spec.rb
428
418
  - spec/bundler_deploy_spec.rb
429
419
  - spec/configuration_spec.rb