engineyard-serverside 2.2.0.pre2 → 2.2.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,82 @@
1
- require 'engineyard-serverside/dependency_manager/base'
2
1
  require 'engineyard-serverside/dependency_manager/bundler'
3
- require 'engineyard-serverside/dependency_manager/bundler_lock'
4
2
  require 'engineyard-serverside/dependency_manager/npm'
5
3
  require 'engineyard-serverside/dependency_manager/composer'
6
4
 
7
5
  module EY
8
6
  module Serverside
9
- module DependencyManager
10
- def self.detect(servers, config, shell, runner)
11
- Bundler.detect(servers, config, shell, runner) ||
12
- BundlerLock.detect(servers, config, shell, runner) ||
13
- Npm.detect(servers, config, shell, runner) ||
14
- Composer.detect(servers, config, shell, runner) ||
15
- Base.new(servers, config, shell, runner)
7
+ # DependencyManager encapsulates any number of dependency manager objects.
8
+ #
9
+ # If a dependency manager indicates that it has detected the required
10
+ # file or state in order to run, it will be included in this set.
11
+ #
12
+ # Methods called on an instance of DependencyManager are forwarded to
13
+ # any or all of the detected dependency managers.
14
+ #
15
+ # Some actions, like check and install, are forwarded to all of the
16
+ # dependency managers. Other methods will take the first dependency manager
17
+ # that returns a value.
18
+ #
19
+ class DependencyManager
20
+ # Registry pattern be damned. Hard code it and fix it when we want to
21
+ # support dynamic loading. Right now we have no way to load dependency
22
+ # managers dynamically, so why support it?
23
+ AVAILABLE_MANAGERS = [Bundler, Composer, Npm]
24
+
25
+ include Enumerable
26
+
27
+ # Initialize detected dependency managers
28
+ def initialize(*args)
29
+ @detected = AVAILABLE_MANAGERS.map { |klass| klass.new(*args) }.select { |manager| manager.detected? }
30
+ end
31
+
32
+ def each(&block)
33
+ @detected.each(&block)
34
+ end
35
+
36
+ def to_a
37
+ @detected
38
+ end
39
+
40
+ # Did we find any dependency managers?
41
+ def detected?
42
+ any?
43
+ end
44
+
45
+ # Verify application state with respect to dependency management.
46
+ # Warn if there is anything wrong with the dependency manager.
47
+ def check
48
+ each { |m| m.check }
49
+ end
50
+
51
+ # Install dependencies for each of the dependency managers.
52
+ def install
53
+ each { |m| m.install }
54
+ end
55
+
56
+ # Assume application is not using sqlite3 unless a dependency manager
57
+ # says that sqlite is loaded and likely to be the only manager.
58
+ #
59
+ # This may have problems in the future if one manager detects sqlite
60
+ # but another has the primary database manager.
61
+ #
62
+ # Hopefully this method can be removed in the future and sqlite loading
63
+ # can be done without interfering with other systems.
64
+ def uses_sqlite3?
65
+ any? { |m| m.respond_to?(:uses_sqlite3?) && m.uses_sqlite3? }
66
+ end
67
+
68
+ # Use the response from the first dependency manager that returns
69
+ # a rails version.
70
+ def rails_version
71
+ version = nil
72
+ find { |m| version = m.respond_to?(:rails_version) && m.rails_version }
73
+ version
74
+ end
75
+
76
+ # If services are installed, print intructions for using ey_config if
77
+ # the dependency manager has a compatible version.
78
+ def show_ey_config_instructions
79
+ each { |m| m.respond_to?(:show_ey_config_instructions) && m.show_ey_config_instructions }
16
80
  end
17
81
  end
18
82
  end
@@ -1,42 +1,21 @@
1
1
  module EY
2
2
  module Serverside
3
- module DependencyManager
3
+ class DependencyManager
4
4
  class Base
5
- def self.detect(servers, config, shell, runner)
6
- manager = new(servers, config, shell, runner)
7
- manager.detected? && manager
8
- end
9
-
10
5
  attr_reader :servers, :config, :shell, :runner
11
6
 
12
7
  def initialize(servers, config, shell, runner)
13
- @servers, @config, @shell = servers, config, shell
14
- @runner = runner
8
+ @servers, @config, @shell, @runner = servers, config, shell, runner
15
9
  end
16
10
 
17
11
  # Public interface
18
12
  #
19
-
20
- def detected?() true end
13
+ def detected?() false end
21
14
  def check() end
22
15
  def install() end
23
-
24
- # assume not using sqlite3 unless a dependency system says so
25
- def uses_sqlite3?() false end
16
+ def uses_sqlite3?() end
26
17
  def rails_version() end
27
- def check_ey_config() end
28
-
29
- # Legacy methods, this should not be public API to this class
30
- # With proper warning, cut these methods off
31
- def gemfile?() end
32
- def bundler_config
33
- raise "This method has been removed. Use bundle_options in ey.yml"
34
- end
35
- def lockfile() end
36
- def check_ruby_bundler() end
37
- def check_node_npm() end
38
- def clean_bundle_on_system_version_change() end
39
- def write_system_version() end
18
+ def show_ey_config_instructions() end
40
19
 
41
20
  protected
42
21
 
@@ -1,6 +1,8 @@
1
+ require 'engineyard-serverside/dependency_manager/base'
2
+
1
3
  module EY
2
4
  module Serverside
3
- module DependencyManager
5
+ class DependencyManager
4
6
  class Bundler < Base
5
7
  DEFAULT_VERSION = "1.3.4"
6
8
 
@@ -9,51 +11,64 @@ module EY
9
11
  end
10
12
 
11
13
  def detected?
12
- gemfile? && !lockfile?
14
+ gemfile?
13
15
  end
14
16
 
15
17
  def gemfile?
16
18
  paths.gemfile.exist?
17
19
  end
18
20
 
19
- def lockfile?
20
- lockfile_path.exist?
21
- end
22
-
23
21
  def check
24
- shell.warning <<-WARN
22
+ if lockfile
23
+ shell.status "Gemfile and Gemfile.lock found"
24
+
25
+ if config.check_database_adapter? && !lockfile.any_database_adapter?
26
+ shell.warning <<-WARN
27
+ Gemfile.lock does not contain a recognized database adapter.
28
+ A database-adapter gem such as pg, mysql2, mysql, or do_mysql was expected.
29
+ This can prevent applications that use PostgreSQL or MySQL from booting.
30
+
31
+ To fix, add any needed adapter to your Gemfile, bundle, commit, and redeploy.
32
+ Applications not using PostgreSQL or MySQL can safely ignore this warning by
33
+ adding ignore_database_adapter_warning: true to the application's ey.yml file
34
+ under the defaults: top level key and committing the file to the repository.
35
+ WARN
36
+ end
37
+ else
38
+ shell.warning <<-WARN
25
39
  Gemfile found but Gemfile.lock is missing!
26
40
  You can get different versions of gems in production than what you tested with.
27
41
  You can get different versions of gems on every deployment even if your Gemfile hasn't changed.
28
42
  Deploying will take longer and some deploy options will be limited.
29
43
 
30
44
  To fix this problem, commit your Gemfile.lock to your repository and redeploy.
31
- WARN
45
+ WARN
46
+ end
32
47
  end
33
48
 
34
49
  def install
35
- check_ruby_bundler
50
+ shell.status "Bundling gems..."
51
+ clean_bundle_on_system_version_change
52
+ install_bundler_gem
53
+ run "#{clean_environment} && cd #{paths.active_release} && #{bundle_install_command}"
54
+ write_system_version
36
55
  end
37
56
 
38
- # Without Gemfile.lock, don't do anything with sqlite3
39
57
  def uses_sqlite3?
40
- false
58
+ lockfile && lockfile.uses_sqlite3?
41
59
  end
42
60
 
43
- # Without Gemfile.lock, don't do anything about ey_config
44
- def check_ey_config
61
+ def show_ey_config_instructions
62
+ if lockfile && !lockfile.has_ey_config?
63
+ shell.warning "Gemfile.lock does not contain ey_config. Add gem 'ey_config' to your Gemfile to access service configurations through EY::Config."
64
+ end
45
65
  end
46
66
 
47
- # Without Gemfile.lock, there is no determining the rails version.
48
67
  def rails_version
49
- nil
68
+ lockfile && lockfile.rails_version
50
69
  end
51
70
 
52
- private
53
-
54
- def lockfile_path
55
- paths.gemfile_lock
56
- end
71
+ protected
57
72
 
58
73
  def write_system_version
59
74
  store_ruby_version = "#{config.ruby_version_command} > #{paths.ruby_version}"
@@ -63,14 +78,6 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
63
78
  run "#{store_ruby_version} && #{store_system_version}"
64
79
  end
65
80
 
66
- def check_ruby_bundler
67
- shell.status "Bundling gems..."
68
- clean_bundle_on_system_version_change
69
- install_bundler_gem
70
- run "#{clean_environment} && cd #{paths.active_release} && #{bundle_install_command}"
71
- write_system_version
72
- end
73
-
74
81
  # Install bundler in the system ruby
75
82
  def install_bundler_gem
76
83
  egrep_escaped_version = bundler_version.gsub(/\./, '\.')
@@ -96,6 +103,7 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
96
103
  "--path", "#{paths.bundled_gems}",
97
104
  "--binstubs", "#{paths.binstubs}",
98
105
  ]
106
+ options += ["--deployment"] if lockfile
99
107
  options += config.extra_bundle_install_options
100
108
  options
101
109
  end
@@ -115,7 +123,108 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
115
123
  end
116
124
 
117
125
  def bundler_version
118
- self.class.default_version
126
+ @bundler_version ||= lockfile && lockfile.bundler_version || self.class.default_version
127
+ end
128
+
129
+ def lockfile
130
+ return @lockfile if defined? @lockfile
131
+
132
+ lockfile_path = paths.gemfile_lock
133
+ if lockfile_path.exist?
134
+ @lockfile = Lockfile.new(lockfile_path.read, self.class.default_version)
135
+ end
136
+ end
137
+
138
+ class Lockfile
139
+ attr_reader :bundler_version
140
+
141
+ def initialize(lockfile_contents, default = EY::Serverside::DependencyManager::Bundler.default_version)
142
+ @contents = lockfile_contents
143
+ @default = default
144
+ @default_gem_version = Gem::Version.new(@default)
145
+ parse
146
+ end
147
+
148
+ def has_ey_config?
149
+ !!@contents.index(/^\s+ey_config\s\([^\)]+\)$/)
150
+ end
151
+
152
+ def rails_version
153
+ section = dependencies_section
154
+ if section.empty?
155
+ return nil
156
+ end
157
+ result = scan_gem('rails', section)
158
+ result ? result.last : nil
159
+ end
160
+
161
+ def any_database_adapter?
162
+ any_ruby_adapter = %w[mysql2 mysql do_mysql pg do_postgres].any? do |type|
163
+ @contents.index(/^\s+#{type}\s\([^\)]+\)$/)
164
+ end
165
+
166
+ any_jruby_adapter = %w[mysql postgresql postgres].any? do |type|
167
+ @contents.index(/^\s+jdbc-#{type}\s\([^\)]+\)$/) || @contents.index(/^\s+activerecord-jdbc#{type}-adapter\s\([^\)]+\)$/)
168
+ end
169
+
170
+ any_ruby_adapter || any_jruby_adapter
171
+ end
172
+
173
+ def uses_sqlite3?
174
+ !any_database_adapter? && @contents.index(/^\s+sqlite3\s\([^\)]+\)$/)
175
+ end
176
+
177
+ def parse
178
+ parse_from_metadata ||
179
+ parse_from_dependencies ||
180
+ raise("Malformed or pre bundler-1.0.0 Gemfile.lock: #{@contents[0,50]}...")
181
+ end
182
+
183
+ def slice_section(header)
184
+ if start = @contents.index(/^#{header}/)
185
+ finish = @contents.index(/(^\S|\Z)/, start + header.length)
186
+ @contents.slice(start..finish)
187
+ else
188
+ ""
189
+ end
190
+ end
191
+
192
+ def parse_from_metadata
193
+ section = slice_section('METADATA')
194
+
195
+ if section.empty?
196
+ return nil
197
+ end
198
+
199
+ result = section.scan(/^\s*version:\s*(.*)$/).first
200
+ @bundler_version = result ? result.first : @default
201
+ end
202
+
203
+ def dependencies_section
204
+ @dependencies_section ||= slice_section('DEPENDENCIES')
205
+ end
206
+
207
+ def parse_from_dependencies
208
+ section = dependencies_section
209
+ if section.empty?
210
+ return nil
211
+ end
212
+
213
+ result = scan_gem('bundler', section)
214
+ bundler_version = result ? result.last : nil
215
+ version_qualifier = result ? result.first : nil
216
+ @bundler_version = fetch_version(version_qualifier, bundler_version)
217
+ end
218
+
219
+ def fetch_version(operator, version)
220
+ return version || @default unless operator && version
221
+ req = Gem::Requirement.new(["#{operator} #{version}"])
222
+ req.satisfied_by?(@default_gem_version) ? @default : version
223
+ end
224
+
225
+ def scan_gem(gem, dep_section)
226
+ dep_section.scan(/^\s*#{Regexp.escape(gem)}\s*\((>?=|~>)\s*([^,\)]+)/).first
227
+ end
119
228
  end
120
229
  end
121
230
  end
@@ -1,6 +1,8 @@
1
+ require 'engineyard-serverside/dependency_manager/base'
2
+
1
3
  module EY
2
4
  module Serverside
3
- module DependencyManager
5
+ class DependencyManager
4
6
  class Composer < Base
5
7
  def detected?
6
8
  composer_lock? || composer_json?
@@ -1,6 +1,6 @@
1
1
  module EY
2
2
  module Serverside
3
- module DependencyManager
3
+ class DependencyManager
4
4
  module LegacyHelpers
5
5
  [
6
6
  :gemfile?,
@@ -13,9 +13,7 @@ module EY
13
13
  :clean_environment,
14
14
  ].each do |meth|
15
15
  define_method(meth) do |*a|
16
- if dependency_manager.respond_to?(meth)
17
- dependency_manager.send(meth)
18
- end
16
+ raise "The method '#{meth}' has been removed to better support future dependency management systems.\nAlthough using these methods directly is discouraged, please see the DependencyManager class and related subclasses if you need access to this information."
19
17
  end
20
18
  end
21
19
  end
@@ -1,6 +1,8 @@
1
+ require 'engineyard-serverside/dependency_manager/base'
2
+
1
3
  module EY
2
4
  module Serverside
3
- module DependencyManager
5
+ class DependencyManager
4
6
  class Npm < Base
5
7
  def detected?
6
8
  paths.package_json.exist?
@@ -81,6 +81,18 @@ module EY
81
81
  dependency_manager.check
82
82
  end
83
83
 
84
+ def rails_application?
85
+ dependency_manager.rails_version
86
+ end
87
+
88
+ def bundle
89
+ install_dependencies
90
+ end
91
+
92
+ def install_dependencies
93
+ dependency_manager.install
94
+ end
95
+
84
96
  def restart_with_maintenance_page
85
97
  load_ey_yml
86
98
  require_custom_tasks
@@ -157,14 +169,6 @@ chmod 0700 #{path}
157
169
  SCRIPT
158
170
  end
159
171
 
160
- def bundle
161
- install_dependencies
162
- end
163
-
164
- def install_dependencies
165
- dependency_manager.install
166
- end
167
-
168
172
  # task
169
173
  def cleanup_old_releases
170
174
  clean_release_directory(paths.releases)
@@ -257,7 +261,7 @@ Deploy again if your services configuration appears incomplete or out of date.
257
261
 
258
262
  if services = config.configured_services
259
263
  shell.status "Services configured: #{services.join(', ')}"
260
- dependency_manager.check_ey_config
264
+ dependency_manager.show_ey_config_instructions
261
265
  end
262
266
  end
263
267
 
@@ -431,9 +435,8 @@ YML
431
435
 
432
436
  def dependency_manager
433
437
  ensure_git_ssh_wrapper
434
- @dependency_manager ||= DependencyManager.detect(servers, config, shell, self)
438
+ @dependency_manager ||= DependencyManager.new(servers, config, shell, self)
435
439
  end
436
- public :dependency_manager # FIXME
437
440
 
438
441
  def compile_assets
439
442
  RailsAssets.detect_and_compile(config, shell, self)
@@ -18,8 +18,8 @@ module EY
18
18
  EY::Serverside.deprecation_warning("EY::Serverside::LoggedOutput has been deprecated. Use EY::Serverside::Shell::Helpers instead.")
19
19
  EY::Serverside::Shell::Helpers
20
20
  when :LockfileParser
21
- EY::Serverside.deprecation_warning("EY::Serverside::LockfileParser has been deprecated. Use EY::Serverside::DependencyManager::BundlerLock::Lockfile instead.")
22
- EY::Serverside::DependencyManager::BundlerLock::Lockfile
21
+ EY::Serverside.deprecation_warning("EY::Serverside::LockfileParser has been deprecated. Use EY::Serverside::DependencyManager::Bundler::Lockfile instead.")
22
+ EY::Serverside::DependencyManager::Bundler::Lockfile
23
23
  else
24
24
  super
25
25
  end
@@ -79,7 +79,7 @@ module EY
79
79
 
80
80
  def precompile_detected_assets
81
81
  shell.status "Precompiling assets. ('#{app_assets}' exists, 'public/assets' not found, not disabled in config.)"
82
- if !runner.dependency_manager.rails_version
82
+ if !runner.rails_application?
83
83
  shell.warning "Precompiling assets even though Rails was not bundled."
84
84
  end
85
85
 
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '2.2.0.pre2'
3
+ VERSION = '2.2.0.pre3'
4
4
  end
5
5
  end
@@ -0,0 +1 @@
1
+ Merger of simple composer app and simple node npm app
@@ -0,0 +1,5 @@
1
+ {
2
+ "require": {
3
+ "monolog/monolog": "1.2.*"
4
+ }
5
+ }
@@ -0,0 +1,462 @@
1
+ {
2
+ "hash": "6481f6a258c344122ba0157d5eadc0fd",
3
+ "packages": [
4
+ {
5
+ "name": "bjyoungblood/bjy-authorize",
6
+ "version": "1.2.6",
7
+ "source": {
8
+ "type": "git",
9
+ "url": "https://github.com/bjyoungblood/BjyAuthorize.git",
10
+ "reference": "1.2.6"
11
+ },
12
+ "dist": {
13
+ "type": "zip",
14
+ "url": "https://api.github.com/repos/bjyoungblood/BjyAuthorize/zipball/1.2.6",
15
+ "reference": "1.2.6",
16
+ "shasum": ""
17
+ },
18
+ "require": {
19
+ "php": ">=5.3.3",
20
+ "zendframework/zend-permissions-acl": ">=2.1,<3.0",
21
+ "zendframework/zend-mvc": ">=2.1,<3.0",
22
+ "zendframework/zend-eventmanager": ">=2.1,<3.0",
23
+ "zendframework/zend-servicemanager": ">=2.1,<3.0",
24
+ "zendframework/zend-view": ">=2.1,<3.0"
25
+ },
26
+ "require-dev": {
27
+ "doctrine/common": ">=2.3,<2.5-dev",
28
+ "zendframework/zend-developer-tools": "0.*",
29
+ "zf-commons/zfc-user": "0.*"
30
+ },
31
+ "time": "2013-05-12 16:07:25",
32
+ "type": "library",
33
+ "extra": {
34
+ "branch-alias": {
35
+ "dev-master": "1.3-dev"
36
+ }
37
+ },
38
+ "installation-source": "dist",
39
+ "autoload": {
40
+ "psr-0": {
41
+ "BjyAuthorize\\": "src/"
42
+ }
43
+ },
44
+ "license": [
45
+ "BSD-3-Clause"
46
+ ],
47
+ "authors": [
48
+ {
49
+ "name": "Marco Pivetta",
50
+ "email": "ocramius@gmail.com",
51
+ "homepage": "http://ocramius.github.com/",
52
+ "role": "Developer"
53
+ },
54
+ {
55
+ "name": "Ben Youngblood",
56
+ "email": "bx.youngblood@gmail.com",
57
+ "homepage": "http://bjyoungblood.com/",
58
+ "role": "Developer"
59
+ }
60
+ ],
61
+ "description": "Zend\\Acl based firewall system for ZF2 dispatch protection",
62
+ "homepage": "https://github.com/bjyoungblood/BjyAuthorize",
63
+ "keywords": [
64
+ "zf2",
65
+ "acl",
66
+ "zfc-user"
67
+ ]
68
+ },
69
+ {
70
+ "name": "bjyoungblood/bjy-profiler",
71
+ "version": "dev-master",
72
+ "source": {
73
+ "type": "git",
74
+ "url": "https://github.com/bjyoungblood/BjyProfiler.git",
75
+ "reference": "1ca31611b6960bcd744dced95764e3627e8d807a"
76
+ },
77
+ "dist": {
78
+ "type": "zip",
79
+ "url": "https://api.github.com/repos/bjyoungblood/BjyProfiler/zipball/1ca31611b6960bcd744dced95764e3627e8d807a",
80
+ "reference": "1ca31611b6960bcd744dced95764e3627e8d807a",
81
+ "shasum": ""
82
+ },
83
+ "require": {
84
+ "php": ">=5.3",
85
+ "zendframework/zendframework": ">=2.1.0"
86
+ },
87
+ "time": "1364225067",
88
+ "type": "library",
89
+ "installation-source": "source",
90
+ "autoload": {
91
+ "psr-0": {
92
+ "BjyProfiler": "src/"
93
+ },
94
+ "classmap": [
95
+ "./Module.php"
96
+ ]
97
+ },
98
+ "authors": [
99
+ {
100
+ "name": "Ben Youngblood",
101
+ "email": "bx.youngblood@gmail.com",
102
+ "homepage": "http://bjyoungblood.com/",
103
+ "role": "Developer"
104
+ }
105
+ ],
106
+ "description": "Database profiler for Zend\\Db (also plugin for ZendDeveloperTools)",
107
+ "homepage": "https://github.com/bjyoungblood/BjyProfiler",
108
+ "keywords": [
109
+ "db",
110
+ "zf2",
111
+ "profiler",
112
+ "zdt"
113
+ ]
114
+ },
115
+ {
116
+ "name": "darkmatus/roleuserbridge",
117
+ "version": "dev-master",
118
+ "source": {
119
+ "type": "git",
120
+ "url": "https://github.com/dshafik/roleuserbridge",
121
+ "reference": "9f70ef6f24e75c6592f769bd0cd598f135108f48"
122
+ },
123
+ "dist": {
124
+ "type": "zip",
125
+ "url": "https://github.com/dshafik/roleuserbridge/zipball/9f70ef6f24e75c6592f769bd0cd598f135108f48",
126
+ "reference": "9f70ef6f24e75c6592f769bd0cd598f135108f48",
127
+ "shasum": ""
128
+ },
129
+ "require": {
130
+ "php": ">=5.3.3",
131
+ "zendframework/zendframework": "2.*",
132
+ "zf-commons/zfc-base": "0.1.*",
133
+ "zf-commons/zfc-user": "0.1.*",
134
+ "bjyoungblood/bjy-authorize": "1.2.*"
135
+ },
136
+ "time": "1365313580",
137
+ "type": "library",
138
+ "installation-source": "source",
139
+ "autoload": {
140
+ "psr-0": {
141
+ "RoleUserBridge": "src/"
142
+ },
143
+ "classmap": [
144
+ "./"
145
+ ]
146
+ },
147
+ "authors": [
148
+ {
149
+ "name": "Darkmatus",
150
+ "email": "mueller@s-p-it.de",
151
+ "homepage": "https://github.com/darkmatus/"
152
+ }
153
+ ],
154
+ "description": "ZfcUser/BjyAuthorize Bridge for auto-adding User to the user_role_table from BjyAuthorize.",
155
+ "homepage": "https://github.com/darkmatus/roleuserbridge",
156
+ "keywords": [
157
+ "zf2"
158
+ ],
159
+ "support": {
160
+ "source": "https://github.com/dshafik/roleuserbridge/tree/master"
161
+ }
162
+ },
163
+ {
164
+ "name": "zendframework/zend-developer-tools",
165
+ "version": "dev-master",
166
+ "source": {
167
+ "type": "git",
168
+ "url": "https://github.com/zendframework/ZendDeveloperTools",
169
+ "reference": "9e2cf51ffbd3778f07be4a245e6b7a84a6a18a1c"
170
+ },
171
+ "dist": {
172
+ "type": "zip",
173
+ "url": "https://github.com/zendframework/ZendDeveloperTools/zipball/9e2cf51ffbd3778f07be4a245e6b7a84a6a18a1c",
174
+ "reference": "9e2cf51ffbd3778f07be4a245e6b7a84a6a18a1c",
175
+ "shasum": ""
176
+ },
177
+ "require": {
178
+ "php": ">=5.3.3",
179
+ "zendframework/zend-mvc": "2.*",
180
+ "zendframework/zend-eventmanager": "2.*",
181
+ "zendframework/zend-stdlib": "2.*",
182
+ "zendframework/zend-servicemanager": "2.*",
183
+ "zendframework/zend-version": "2.*"
184
+ },
185
+ "suggest": {
186
+ "bjyoungblood/bjy-profiler": "Version: dev-master, allows the usage of the (Zend) Db collector."
187
+ },
188
+ "time": "1368974025",
189
+ "type": "zf-module",
190
+ "installation-source": "source",
191
+ "autoload": {
192
+ "psr-0": {
193
+ "ZendDeveloperTools": "src/"
194
+ },
195
+ "classmap": [
196
+ "./Module.php"
197
+ ]
198
+ },
199
+ "license": [
200
+ "BSD-3-Clause"
201
+ ],
202
+ "authors": [
203
+ {
204
+ "name": "Evan Coury",
205
+ "email": "me@evancoury.com",
206
+ "homepage": "http://blog.evan.pro/"
207
+ },
208
+ {
209
+ "name": "Eric Boh",
210
+ "email": "cossish@gmail.com"
211
+ }
212
+ ],
213
+ "description": "Module for developer and debug tools for working with the ZF2 MVC layer.",
214
+ "homepage": "https://github.com/zendframework/ZendDeveloperTools",
215
+ "keywords": [
216
+ "debug",
217
+ "developer",
218
+ "zf2",
219
+ "module"
220
+ ],
221
+ "support": {
222
+ "source": "https://github.com/zendframework/ZendDeveloperTools/tree/master",
223
+ "issues": "https://github.com/zendframework/ZendDeveloperTools/issues"
224
+ }
225
+ },
226
+ {
227
+ "name": "zendframework/zendframework",
228
+ "version": "2.1.5",
229
+ "source": {
230
+ "type": "git",
231
+ "url": "https://github.com/zendframework/zf2.git",
232
+ "reference": "release-2.1.5"
233
+ },
234
+ "dist": {
235
+ "type": "zip",
236
+ "url": "https://api.github.com/repos/zendframework/zf2/zipball/release-2.1.5",
237
+ "reference": "release-2.1.5",
238
+ "shasum": ""
239
+ },
240
+ "require": {
241
+ "php": ">=5.3.3"
242
+ },
243
+ "replace": {
244
+ "zendframework/zend-authentication": "self.version",
245
+ "zendframework/zend-barcode": "self.version",
246
+ "zendframework/zend-cache": "self.version",
247
+ "zendframework/zend-captcha": "self.version",
248
+ "zendframework/zend-code": "self.version",
249
+ "zendframework/zend-config": "self.version",
250
+ "zendframework/zend-console": "self.version",
251
+ "zendframework/zend-crypt": "self.version",
252
+ "zendframework/zend-db": "self.version",
253
+ "zendframework/zend-debug": "self.version",
254
+ "zendframework/zend-di": "self.version",
255
+ "zendframework/zend-dom": "self.version",
256
+ "zendframework/zend-escaper": "self.version",
257
+ "zendframework/zend-eventmanager": "self.version",
258
+ "zendframework/zend-feed": "self.version",
259
+ "zendframework/zend-file": "self.version",
260
+ "zendframework/zend-filter": "self.version",
261
+ "zendframework/zend-form": "self.version",
262
+ "zendframework/zend-http": "self.version",
263
+ "zendframework/zend-i18n": "self.version",
264
+ "zendframework/zend-inputfilter": "self.version",
265
+ "zendframework/zend-json": "self.version",
266
+ "zendframework/zend-ldap": "self.version",
267
+ "zendframework/zend-loader": "self.version",
268
+ "zendframework/zend-log": "self.version",
269
+ "zendframework/zend-mail": "self.version",
270
+ "zendframework/zend-math": "self.version",
271
+ "zendframework/zend-memory": "self.version",
272
+ "zendframework/zend-mime": "self.version",
273
+ "zendframework/zend-modulemanager": "self.version",
274
+ "zendframework/zend-mvc": "self.version",
275
+ "zendframework/zend-navigation": "self.version",
276
+ "zendframework/zend-paginator": "self.version",
277
+ "zendframework/zend-permissions-acl": "self.version",
278
+ "zendframework/zend-permissions-rbac": "self.version",
279
+ "zendframework/zend-progressbar": "self.version",
280
+ "zendframework/zend-serializer": "self.version",
281
+ "zendframework/zend-server": "self.version",
282
+ "zendframework/zend-servicemanager": "self.version",
283
+ "zendframework/zend-session": "self.version",
284
+ "zendframework/zend-soap": "self.version",
285
+ "zendframework/zend-stdlib": "self.version",
286
+ "zendframework/zend-tag": "self.version",
287
+ "zendframework/zend-test": "self.version",
288
+ "zendframework/zend-text": "self.version",
289
+ "zendframework/zend-uri": "self.version",
290
+ "zendframework/zend-validator": "self.version",
291
+ "zendframework/zend-version": "self.version",
292
+ "zendframework/zend-view": "self.version",
293
+ "zendframework/zend-xmlrpc": "self.version"
294
+ },
295
+ "require-dev": {
296
+ "doctrine/common": ">=2.1",
297
+ "ircmaxell/random-lib": "dev-master",
298
+ "ircmaxell/security-lib": "dev-master",
299
+ "phpunit/phpunit": "3.7.*"
300
+ },
301
+ "suggest": {
302
+ "doctrine/common": "Doctrine\\Common >=2.1 for annotation features",
303
+ "ext-intl": "ext/intl for i18n features",
304
+ "ircmaxell/random-lib": "Fallback random byte generator for Zend\\Math\\Rand if OpenSSL/Mcrypt extensions are unavailable",
305
+ "pecl-weakref": "Implementation of weak references for Zend\\Stdlib\\CallbackHandler",
306
+ "zendframework/zendpdf": "ZendPdf for creating PDF representations of barcodes",
307
+ "zendframework/zendservice-recaptcha": "ZendService\\ReCaptcha for rendering ReCaptchas in Zend\\Captcha and/or Zend\\Form"
308
+ },
309
+ "time": "2013-04-17 15:15:58",
310
+ "bin": [
311
+ "bin/classmap_generator.php"
312
+ ],
313
+ "type": "library",
314
+ "extra": {
315
+ "branch-alias": {
316
+ "dev-master": "2.1-dev",
317
+ "dev-develop": "2.2-dev"
318
+ }
319
+ },
320
+ "installation-source": "dist",
321
+ "autoload": {
322
+ "psr-0": {
323
+ "Zend\\": "library/",
324
+ "ZendTest\\": "tests/"
325
+ }
326
+ },
327
+ "license": [
328
+ "BSD-3-Clause"
329
+ ],
330
+ "description": "Zend Framework 2",
331
+ "homepage": "http://framework.zend.com/",
332
+ "keywords": [
333
+ "framework",
334
+ "zf2"
335
+ ]
336
+ },
337
+ {
338
+ "name": "zf-commons/zfc-base",
339
+ "version": "v0.1.2",
340
+ "source": {
341
+ "type": "git",
342
+ "url": "https://github.com/ZF-Commons/ZfcBase.git",
343
+ "reference": "v0.1.2"
344
+ },
345
+ "dist": {
346
+ "type": "zip",
347
+ "url": "https://api.github.com/repos/ZF-Commons/ZfcBase/zipball/v0.1.2",
348
+ "reference": "v0.1.2",
349
+ "shasum": ""
350
+ },
351
+ "require": {
352
+ "php": ">=5.3.3",
353
+ "zendframework/zend-db": ">=2.1,<3.0",
354
+ "zendframework/zend-eventmanager": ">=2.1,<3.0",
355
+ "zendframework/zend-loader": ">=2.1,<3.0",
356
+ "zendframework/zend-modulemanager": ">=2.1,<3.0",
357
+ "zendframework/zend-mvc": ">=2.1,<3.0",
358
+ "zendframework/zend-servicemanager": ">=2.1,<3.0",
359
+ "zendframework/zend-stdlib": ">=2.1,<3.0"
360
+ },
361
+ "time": "2013-05-02 12:33:49",
362
+ "type": "library",
363
+ "installation-source": "dist",
364
+ "autoload": {
365
+ "psr-0": {
366
+ "ZfcBase": "src/"
367
+ },
368
+ "classmap": [
369
+ "./Module.php"
370
+ ]
371
+ },
372
+ "authors": [
373
+ {
374
+ "name": "Kyle Spraggs",
375
+ "email": "theman@spiffyjr.me",
376
+ "homepage": "http://www.spiffyjr.me/"
377
+ },
378
+ {
379
+ "name": "Evan Coury",
380
+ "email": "me@evancoury.com",
381
+ "homepage": "http://blog.evan.pro/"
382
+ }
383
+ ],
384
+ "description": "A set of genetic (abstract) classes which are commonly used across multiple modules.",
385
+ "homepage": "https://github.com/ZF-Commons/ZfcBase",
386
+ "keywords": [
387
+ "zf2"
388
+ ]
389
+ },
390
+ {
391
+ "name": "zf-commons/zfc-user",
392
+ "version": "0.1.2",
393
+ "source": {
394
+ "type": "git",
395
+ "url": "https://github.com/ZF-Commons/ZfcUser.git",
396
+ "reference": "0.1.2"
397
+ },
398
+ "dist": {
399
+ "type": "zip",
400
+ "url": "https://api.github.com/repos/ZF-Commons/ZfcUser/zipball/0.1.2",
401
+ "reference": "0.1.2",
402
+ "shasum": ""
403
+ },
404
+ "require": {
405
+ "php": ">=5.3.3",
406
+ "zendframework/zend-authentication": ">=2.1,<3.0",
407
+ "zendframework/zend-crypt": ">=2.1,<3.0",
408
+ "zendframework/zend-form": ">=2.1,<3.0",
409
+ "zendframework/zend-inputfilter": ">=2.1,<3.0",
410
+ "zendframework/zend-loader": ">=2.1,<3.0",
411
+ "zendframework/zend-modulemanager": ">=2.1,<3.0",
412
+ "zendframework/zend-mvc": ">=2.1,<3.0",
413
+ "zendframework/zend-servicemanager": ">=2.1,<3.0",
414
+ "zendframework/zend-stdlib": ">=2.1,<3.0",
415
+ "zendframework/zend-validator": ">=2.1,<3.0",
416
+ "zendframework/zend-view": ">=2.1,<3.0",
417
+ "zf-commons/zfc-base": "0.*"
418
+ },
419
+ "suggest": {
420
+ "zendframework/zend-session": "To use the default authentication adapter."
421
+ },
422
+ "time": "2013-05-02 12:33:31",
423
+ "type": "library",
424
+ "installation-source": "dist",
425
+ "autoload": {
426
+ "psr-0": {
427
+ "ZfcUser": "src/"
428
+ },
429
+ "classmap": [
430
+ "./Module.php"
431
+ ]
432
+ },
433
+ "authors": [
434
+ {
435
+ "name": "Kyle Spraggs",
436
+ "email": "theman@spiffyjr.me",
437
+ "homepage": "http://www.spiffyjr.me/"
438
+ },
439
+ {
440
+ "name": "Evan Coury",
441
+ "email": "me@evancoury.com",
442
+ "homepage": "http://blog.evan.pro/"
443
+ }
444
+ ],
445
+ "description": "A generic user registration and authentication module for ZF2. Supports Zend\\Db and Doctrine2.",
446
+ "homepage": "https://github.com/ZF-Commons/ZfcUser",
447
+ "keywords": [
448
+ "zf2"
449
+ ]
450
+ }
451
+ ],
452
+ "packages-dev": null,
453
+ "aliases": [
454
+
455
+ ],
456
+ "minimum-stability": "stable",
457
+ "stability-flags": {
458
+ "zendframework/zend-developer-tools": 20,
459
+ "bjyoungblood/bjy-profiler": 20,
460
+ "darkmatus/roleuserbridge": 20
461
+ }
462
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "node-example",
3
+ "version": "0.0.1",
4
+ "dependencies": {
5
+ "express": "2.5.8"
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ <?php
2
+
3
+ echo "Hello, world!";
4
+
@@ -6,7 +6,7 @@ describe "the bundler version retrieved from the lockfile" do
6
6
  end
7
7
 
8
8
  def get_parser(file)
9
- EY::Serverside::DependencyManager::BundlerLock::Lockfile.new(load_lockfile(file))
9
+ EY::Serverside::DependencyManager::Bundler::Lockfile.new(load_lockfile(file))
10
10
  end
11
11
 
12
12
  def get_version(file)
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Deploying an application that uses Node.js and NPM" do
4
+ with_composer_mocked do |composer_mocked|
5
+ with_npm_mocked do |npm_mocked|
6
+
7
+ before(:all) do
8
+ mock_composer if composer_mocked
9
+ mock_npm if npm_mocked
10
+ deploy_test_application('multi_dep_manager')
11
+ end
12
+
13
+ it "runs 'npm install' and 'composer install'" do
14
+ npm_cmd = @deployer.commands.grep(/npm install/).first
15
+ npm_cmd.should_not be_nil
16
+
17
+ update_cmd = @deployer.commands.grep(/composer self-update/).first
18
+ update_cmd.should_not be_nil
19
+
20
+ composer_cmd = @deployer.commands.grep(/composer install/).first
21
+ composer_cmd.should_not be_nil
22
+ end
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.pre2
4
+ version: 2.2.0.pre3
5
5
  prerelease: 6
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: 2013-06-28 00:00:00.000000000 Z
12
+ date: 2013-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -154,7 +154,6 @@ files:
154
154
  - lib/engineyard-serverside/default_maintenance_page.html
155
155
  - lib/engineyard-serverside/dependency_manager/base.rb
156
156
  - lib/engineyard-serverside/dependency_manager/bundler.rb
157
- - lib/engineyard-serverside/dependency_manager/bundler_lock.rb
158
157
  - lib/engineyard-serverside/dependency_manager/composer.rb
159
158
  - lib/engineyard-serverside/dependency_manager/legacy_helpers.rb
160
159
  - lib/engineyard-serverside/dependency_manager/npm.rb
@@ -342,6 +341,11 @@ files:
342
341
  - spec/fixtures/repos/hooks/deploy/before_restart.rb
343
342
  - spec/fixtures/repos/hooks/deploy/before_symlink.rb
344
343
  - spec/fixtures/repos/hooks/README
344
+ - spec/fixtures/repos/multi_dep_manager/composer.json
345
+ - spec/fixtures/repos/multi_dep_manager/composer.lock
346
+ - spec/fixtures/repos/multi_dep_manager/package.json
347
+ - spec/fixtures/repos/multi_dep_manager/public/index.php
348
+ - spec/fixtures/repos/multi_dep_manager/README
345
349
  - spec/fixtures/repos/no_ey_config/ey.yml
346
350
  - spec/fixtures/repos/no_ey_config/Gemfile
347
351
  - spec/fixtures/repos/no_ey_config/Gemfile.lock
@@ -365,6 +369,7 @@ files:
365
369
  - spec/fixtures/valid_hook.rb
366
370
  - spec/git_strategy_spec.rb
367
371
  - spec/lockfile_parser_spec.rb
372
+ - spec/multi_dependency_manager_spec.rb
368
373
  - spec/nodejs_deploy_spec.rb
369
374
  - spec/php_deploy_spec.rb
370
375
  - spec/rails31_deploy_spec.rb
@@ -504,6 +509,11 @@ test_files:
504
509
  - spec/fixtures/repos/hooks/deploy/before_restart.rb
505
510
  - spec/fixtures/repos/hooks/deploy/before_symlink.rb
506
511
  - spec/fixtures/repos/hooks/README
512
+ - spec/fixtures/repos/multi_dep_manager/composer.json
513
+ - spec/fixtures/repos/multi_dep_manager/composer.lock
514
+ - spec/fixtures/repos/multi_dep_manager/package.json
515
+ - spec/fixtures/repos/multi_dep_manager/public/index.php
516
+ - spec/fixtures/repos/multi_dep_manager/README
507
517
  - spec/fixtures/repos/no_ey_config/ey.yml
508
518
  - spec/fixtures/repos/no_ey_config/Gemfile
509
519
  - spec/fixtures/repos/no_ey_config/Gemfile.lock
@@ -527,6 +537,7 @@ test_files:
527
537
  - spec/fixtures/valid_hook.rb
528
538
  - spec/git_strategy_spec.rb
529
539
  - spec/lockfile_parser_spec.rb
540
+ - spec/multi_dependency_manager_spec.rb
530
541
  - spec/nodejs_deploy_spec.rb
531
542
  - spec/php_deploy_spec.rb
532
543
  - spec/rails31_deploy_spec.rb
@@ -1,155 +0,0 @@
1
- require 'engineyard-serverside/dependency_manager/bundler'
2
-
3
- module EY
4
- module Serverside
5
- module DependencyManager
6
- class BundlerLock < Bundler
7
- def detected?
8
- gemfile? && lockfile?
9
- end
10
-
11
- def check
12
- shell.status "Gemfile and Gemfile.lock found"
13
-
14
- if config.check_database_adapter? && !lockfile.any_database_adapter?
15
- shell.warning <<-WARN
16
- Gemfile.lock does not contain a recognized database adapter.
17
- A database-adapter gem such as pg, mysql2, mysql, or do_mysql was expected.
18
- This can prevent applications that use PostgreSQL or MySQL from booting.
19
-
20
- To fix, add any needed adapter to your Gemfile, bundle, commit, and redeploy.
21
- Applications not using PostgreSQL or MySQL can safely ignore this warning by
22
- adding ignore_database_adapter_warning: true to the application's ey.yml file
23
- under this environment's name and adding the file to your repository.
24
- WARN
25
- end
26
- end
27
-
28
- def uses_sqlite3?
29
- lockfile.uses_sqlite3?
30
- end
31
-
32
- def check_ey_config
33
- unless lockfile.has_ey_config?
34
- shell.warning "Gemfile.lock does not contain ey_config.\nAdd gem 'ey_config' to get access to service configuration through EY::Config."
35
- end
36
- end
37
-
38
- def rails_version
39
- lockfile.rails_version
40
- end
41
-
42
- private
43
-
44
- def lockfile_path
45
- paths.gemfile_lock
46
- end
47
-
48
- def lockfile
49
- @lockfile ||= Lockfile.new(lockfile_path.read, self.class.default_version)
50
- end
51
-
52
- # deployment mode is not supported without a Gemfile.lock
53
- def bundle_install_options
54
- super + ["--deployment"]
55
- end
56
-
57
- def bundler_version
58
- @bundler_version ||= lockfile.bundler_version || super
59
- end
60
-
61
- class Lockfile
62
- attr_reader :bundler_version
63
-
64
- def initialize(lockfile_contents, default = EY::Serverside::DependencyManager::Bundler.default_version)
65
- @contents = lockfile_contents
66
- @default = default
67
- @default_gem_version = Gem::Version.new(@default)
68
- parse
69
- end
70
-
71
- def has_ey_config?
72
- !!@contents.index(/^\s+ey_config\s\([^\)]+\)$/)
73
- end
74
-
75
- def rails_version
76
- section = dependencies_section
77
- if section.empty?
78
- return nil
79
- end
80
- result = scan_gem('rails', section)
81
- result ? result.last : nil
82
- end
83
-
84
- def any_database_adapter?
85
- any_ruby_adapter = %w[mysql2 mysql do_mysql pg do_postgres].any? do |type|
86
- @contents.index(/^\s+#{type}\s\([^\)]+\)$/)
87
- end
88
-
89
- any_jruby_adapter = %w[mysql postgresql postgres].any? do |type|
90
- @contents.index(/^\s+jdbc-#{type}\s\([^\)]+\)$/) || @contents.index(/^\s+activerecord-jdbc#{type}-adapter\s\([^\)]+\)$/)
91
- end
92
-
93
- any_ruby_adapter || any_jruby_adapter
94
- end
95
-
96
- def uses_sqlite3?
97
- !any_database_adapter? && @contents.index(/^\s+sqlite3\s\([^\)]+\)$/)
98
- end
99
-
100
- def parse
101
- parse_from_metadata ||
102
- parse_from_dependencies ||
103
- raise("Malformed or pre bundler-1.0.0 Gemfile.lock: #{@contents[0,50]}...")
104
- end
105
-
106
- def slice_section(header)
107
- if start = @contents.index(/^#{header}/)
108
- finish = @contents.index(/(^\S|\Z)/, start + header.length)
109
- @contents.slice(start..finish)
110
- else
111
- ""
112
- end
113
- end
114
-
115
- def parse_from_metadata
116
- section = slice_section('METADATA')
117
-
118
- if section.empty?
119
- return nil
120
- end
121
-
122
- result = section.scan(/^\s*version:\s*(.*)$/).first
123
- @bundler_version = result ? result.first : @default
124
- end
125
-
126
- def dependencies_section
127
- @dependencies_section ||= slice_section('DEPENDENCIES')
128
- end
129
-
130
- def parse_from_dependencies
131
- section = dependencies_section
132
- if section.empty?
133
- return nil
134
- end
135
-
136
- result = scan_gem('bundler', section)
137
- bundler_version = result ? result.last : nil
138
- version_qualifier = result ? result.first : nil
139
- @bundler_version = fetch_version(version_qualifier, bundler_version)
140
- end
141
-
142
- def fetch_version(operator, version)
143
- return version || @default unless operator && version
144
- req = Gem::Requirement.new(["#{operator} #{version}"])
145
- req.satisfied_by?(@default_gem_version) ? @default : version
146
- end
147
-
148
- def scan_gem(gem, dep_section)
149
- dep_section.scan(/^\s*#{Regexp.escape(gem)}\s*\((>?=|~>)\s*([^,\)]+)/).first
150
- end
151
- end
152
- end
153
- end
154
- end
155
- end