vagrant-hypconfigmgmt 0.0.1 → 0.0.2

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rspec +1 -0
  4. data/Makefile +3 -1
  5. data/README.md +2 -3
  6. data/lib/vagrant-hypconfigmgmt/.command.rb.swo +0 -0
  7. data/lib/vagrant-hypconfigmgmt/command.rb +224 -183
  8. data/lib/vagrant-hypconfigmgmt/version.rb +1 -1
  9. data/pkg/vagrant-hypconfigmgmt-0.0.2.gem +0 -0
  10. data/spec/spec_helper.rb +15 -0
  11. data/spec/unit/command/call_spec.rb +93 -0
  12. data/spec/unit/command/configure_magento_spec.rb +35 -0
  13. data/spec/unit/command/configure_php_spec.rb +35 -0
  14. data/spec/unit/command/configure_synced_folders_spec.rb +35 -0
  15. data/spec/unit/command/configure_vagrant_spec.rb +33 -0
  16. data/spec/unit/command/configure_varnish_spec.rb +35 -0
  17. data/spec/unit/command/ensure_attribute_configured_spec.rb +100 -0
  18. data/spec/unit/command/ensure_magento_mounts_configured_spec.rb +268 -0
  19. data/spec/unit/command/ensure_required_plugins_are_installed_spec.rb +78 -0
  20. data/spec/unit/command/ensure_setting_exists_spec.rb +50 -0
  21. data/spec/unit/command/ensure_settings_are_configured_spec.rb +71 -0
  22. data/spec/unit/command/ensure_vagrant_box_type_configured_spec.rb +78 -0
  23. data/spec/unit/command/get_magento_version_spec.rb +57 -0
  24. data/spec/unit/command/get_options_string_spec.rb +48 -0
  25. data/spec/unit/command/get_php_version_spec.rb +56 -0
  26. data/spec/unit/command/get_setting_spec.rb +55 -0
  27. data/spec/unit/command/get_varnish_state_spec.rb +56 -0
  28. data/spec/unit/command/inform_if_gatling_not_installed_spec.rb +67 -0
  29. data/spec/unit/command/retrieve_settings_spec.rb +39 -0
  30. data/spec/unit/command/update_settings_spec.rb +30 -0
  31. data/spec/unit/command/use_default_input_if_input_empty_spec.rb +30 -0
  32. data/spec/unit/command/validate_magento2_root_spec.rb +101 -0
  33. data/vagrant-hypconfigmgmt.gemspec +3 -0
  34. metadata +70 -3
  35. data/pkg/vagrant-hypconfigmgmt-0.0.1.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1ca6d12b79bff6c9cc89da885833eb16a0a2d3b
4
- data.tar.gz: 4663a9bd184d529a84ec76a4d0afcf42f975c900
3
+ metadata.gz: e9cee22257d778227a2d1b2b2286e7ee518ee55c
4
+ data.tar.gz: 96bef3d160c2e5a77b5fa7e884c916906bd62abd
5
5
  SHA512:
6
- metadata.gz: 3832d2fa53fac113c4ae7a41f5eae81d127ddd4b6bde96bc16a6723c03cf3c7dd7dda702fb130ab0ec531b034e8571355decd7c712c16f923051928a25ea5630
7
- data.tar.gz: e653bc874f0a4ced2a4b5fa4718a3ce3552b2241a2baa78ca2616db35d6d9ad5422d149dbdf4724b6c81b0ab4497db5b2a84aca62362501899671db092696566
6
+ metadata.gz: f51b5e656562c661f5d1b8bc35e2a947f04675810f165bf1506e5675ef7cae288619825791179ea89b4d4e1cfe97fa2859f2298ced0e77f2d1e1575e2dd3d60a
7
+ data.tar.gz: 2d9b031d84ea2c15e4d4c372517aa59f6c578c35717d82b7075ad1d108bdbfdcb975333ef546f7be06a0f4ca9e3626131386cba4dd773ec58f712159659cdad0
data/.gitignore CHANGED
@@ -0,0 +1,3 @@
1
+ .coverage/
2
+ Gemfile.lock
3
+ coverage/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Makefile CHANGED
@@ -7,8 +7,10 @@ DESCRIPTION := Prompt to configure a hypernode-vagrant
7
7
 
8
8
  all:
9
9
  rake build
10
+ test:
11
+ bundle exec rspec spec/
10
12
  install:
11
- find pkg/ | tail -n 1 | xargs vagrant plugin install
13
+ find pkg/ -name '*.gem' | head -n 1 | xargs vagrant plugin install
12
14
  clean:
13
15
  git clean -xfd
14
16
 
data/README.md CHANGED
@@ -2,8 +2,7 @@ Install the build deps
2
2
  ======================
3
3
 
4
4
  ```
5
- sudo apt-get install bundler
6
- sudo apt-get install rake
5
+ sudo gem install bundler rake rspec simplecov coveralls
7
6
  ```
8
7
 
9
8
  Create the gemfile (package)
@@ -12,5 +11,5 @@ Create the gemfile (package)
12
11
  ```
13
12
  $ make
14
13
  rake build
15
- vagrant-hypconfigmgmt 0.0.1 built to pkg/vagrant-hypconfigmgmt-0.0.1.gem.
14
+ vagrant-hypconfigmgmt 0.0.2 built to pkg/vagrant-hypconfigmgmt-0.0.2.gem.
16
15
  ```
@@ -12,224 +12,265 @@ AVAILABLE_VARNISH_STATES = [true, false]
12
12
 
13
13
  # paths to local settings file
14
14
  H_V_SETTINGS_FILE = "local.yml"
15
+ H_V_BASE_SETTINGS_FILE = ".local.base.yml"
15
16
 
16
17
  RECOMMENDED_PLUGINS = ["vagrant-hostmanager", "vagrant-vbguest"]
17
18
 
18
19
 
19
- def retrieve_settings()
20
- return YAML.load_file(H_V_SETTINGS_FILE)
21
- end
22
-
23
-
24
- def update_settings(settings)
25
- File.open(H_V_SETTINGS_FILE, 'w') {|f| f.write settings.to_yaml }
26
- end
27
-
28
-
29
- def use_default_if_input_empty(input, default)
30
- if input == ''
31
- return default.to_s
32
- else
33
- return input
34
- end
35
- end
20
+ module VagrantHypconfigmgmt
21
+ class Command
36
22
 
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
37
27
 
38
- def get_varnish_state(env)
39
- input = env[:ui].ask("Do you want to enable Varnish? Enter true or false [default false]: ")
40
- varnish_state = use_default_if_input_empty(input, DEFAULT_VARNISH_STATE)
41
28
 
42
- case varnish_state
43
- when "true"
44
- env[:ui].info("Varnish will be enabled.")
45
- when "false"
46
- env[:ui].info("Varnish will be disabled by loading a nocache vcl.")
47
- else
48
- env[:ui].error("The value #{varnish_state} is not a valid value. Please enter true or false")
49
- return get_varnish_state(env)
50
- end
51
- return varnish_state == "true" ? true : false
52
- end
29
+ # prompt for missing settings in local.yml. complain if there are invalid settings.
30
+ def call(env)
31
+ if env[:machine].config.hypconfigmgmt.enabled
32
+ changed = ensure_settings_configured(env)
33
+ ensure_required_plugins_are_installed(env)
34
+ if changed
35
+ env[:ui].info("Your hypernode-vagrant is now configured. Please run \"vagrant up\" again.")
36
+ return
37
+ end
38
+ end
39
+ @app.call(env)
40
+ end
53
41
 
54
42
 
55
- def get_magento_version(env)
56
- available_versions = AVAILABLE_MAGENTO_VERSIONS.join(' or ')
57
- input = env[:ui].ask("Is this a Magento #{available_versions} Hypernode? [default #{DEFAULT_MAGENTO_VERSION}]: ")
58
- magento_version = use_default_if_input_empty(input, DEFAULT_MAGENTO_VERSION)
43
+ def retrieve_settings()
44
+ begin
45
+ return YAML.load_file(H_V_SETTINGS_FILE)
46
+ rescue Errno::ENOENT
47
+ return YAML.load_file(H_V_BASE_SETTINGS_FILE)
48
+ end
49
+ end
50
+
59
51
 
60
- case magento_version
61
- when "1"
62
- env[:ui].info("Nginx will be configured for Magento 1. The webdir will be /data/web/public")
63
- when "2"
64
- env[:ui].info("Nginx will be configured for Magento 2. /data/web/magento2/pub will be symlinked to /data/web/public")
65
- else
66
- env[:ui].error("The value #{magento_version} is not a valid Magento version. Please enter #{available_versions}")
67
- return get_magento_version(env)
68
- end
69
- return magento_version.to_i
70
- end
52
+ def update_settings(settings)
53
+ File.open(H_V_SETTINGS_FILE, 'w') {|f| f.write settings.to_yaml }
54
+ end
55
+
56
+
57
+ def use_default_if_input_empty(input, default)
58
+ return input == '' ? default.to_s : input
59
+ end
60
+
61
+
62
+ def get_setting(env, available, default, ask_message)
63
+ input = env[:ui].ask(ask_message)
64
+ value = use_default_if_input_empty(input, default)
65
+ unless available.map { | v | v.to_s }.include?(value.to_s)
66
+ available_versions = get_options_string(available)
67
+ env[:ui].error("The value #{value} is not a valid value. Please enter #{available_versions}")
68
+ return get_setting(env, available, default, ask_message)
69
+ end
70
+ return value
71
+ end
71
72
 
72
73
 
73
- # todo: refactor this and the above function into one
74
- def get_php_version(env)
75
- available_versions = AVAILABLE_PHP_VERSIONS.join(' or ')
76
- input = env[:ui].ask("Is this a PHP #{available_versions} Hypernode? [default #{DEFAULT_PHP_VERSION}]: ")
77
- php_version = use_default_if_input_empty(input, DEFAULT_PHP_VERSION)
78
-
79
- case php_version
80
- when "5.5"
81
- env[:ui].info("Will boot a box with PHP 5.5 installed")
82
- when "7.0"
83
- env[:ui].info("Will boot a box with PHP 7.0 installed")
84
- else
85
- env[:ui].error("The value #{php_version} is not a valid PHP version. Please enter #{available_versions}")
86
- return get_php_version(env)
87
- end
88
- return php_version.to_f
89
- end
74
+ def get_options_string(available)
75
+ return available.map { | v | v.to_s }.join(' or ')
76
+ end
90
77
 
91
78
 
92
- def ensure_varnish_state_configured(env)
93
- settings = retrieve_settings()
94
- if settings['varnish']['enabled'].nil?
95
- settings['varnish']['enabled'] = get_varnish_state(env)
96
- elsif ![true, false].include?(settings['varnish']['enabled'])
97
- env[:ui].error("The Varnish state configured in local.yml is invalid.")
98
- settings['varnish']['enabled'] = get_varnish_state(env)
99
- end
100
- update_settings(settings)
101
- end
79
+ def get_php_version(env)
80
+ available_versions = get_options_string(AVAILABLE_PHP_VERSIONS)
81
+ ask_message = "Is this a PHP #{available_versions} Hypernode? [default #{DEFAULT_PHP_VERSION}]: "
82
+ php_version = get_setting(env, AVAILABLE_PHP_VERSIONS, DEFAULT_PHP_VERSION, ask_message).to_f
83
+ env[:ui].info("Will boot a box with PHP #{php_version} installed")
84
+ return php_version
85
+ end
102
86
 
103
87
 
104
- def ensure_magento_version_configured(env)
105
- settings = retrieve_settings()
106
- if settings['magento']['version'].nil?
107
- settings['magento']['version'] = get_magento_version(env)
108
- elsif !AVAILABLE_MAGENTO_VERSIONS.include?(settings['magento']['version'].to_i)
109
- env[:ui].error("The Magento version configured in local.yml is invalid.")
110
- settings['magento']['version'] = get_magento_version(env)
111
- end
112
- update_settings(settings)
113
- end
88
+ def get_magento_version(env)
89
+ available_versions = get_options_string(AVAILABLE_MAGENTO_VERSIONS)
90
+ ask_message = "Is this a Magento #{available_versions} Hypernode? [default #{DEFAULT_MAGENTO_VERSION}]: "
91
+ magento_version = get_setting(env, AVAILABLE_MAGENTO_VERSIONS, DEFAULT_MAGENTO_VERSION, ask_message).to_i
92
+ message = "Nginx will be configured for Magento #{magento_version}."
93
+ case magento_version
94
+ when 1
95
+ message += " The webdir will be /data/web/public"
96
+ when 2
97
+ message += " /data/web/magento2/pub will be symlinked to /data/web/public"
98
+ end
99
+ env[:ui].info(message)
100
+ return magento_version
101
+ end
114
102
 
115
103
 
116
- # Make sure we don't link /data/web/public on Magento 2 Vagrants
117
- # because that dir will be a symlink to /data/web/magento2/pub and
118
- # we mount that. On Magento 1 Vagrants we need to make sure we don't
119
- # mount /data/web/magento2/pub.
120
- def ensure_magento_mounts_configured(env)
121
- settings = retrieve_settings()
122
- if !settings['fs'].nil? and !settings['fs']['folders'].nil?
123
- if settings['fs']['disabled_folders'].nil?
124
- settings['fs']['disabled_folders'] = Hash.new
125
- end
126
- if settings['magento']['version'] == 1
127
- if !settings['fs']['disabled_folders']['magento1'].nil?
128
- settings['fs']['folders']['magento1'] = settings['fs']['disabled_folders']['magento1'].clone
129
- settings['fs']['disabled_folders'].delete('magento1')
130
- env[:ui].info("Re-enabling fs->disabled_folders->magento1 in the local.yml.")
131
- end
132
- if !settings['fs']['folders']['magento2'].nil?
133
- settings['fs']['disabled_folders']['magento2'] = settings['fs']['folders']['magento2'].clone
134
- settings['fs']['folders'].delete('magento2')
135
- env[:ui].info("Disabling fs->folders->magento2 in the local.yml because Magento 1 was configured.")
136
- end
137
- elsif settings['magento']['version'] == 2
138
- if !settings['fs']['disabled_folders']['magento2'].nil?
139
- settings['fs']['folders']['magento2'] = settings['fs']['disabled_folders']['magento2'].clone
140
- settings['fs']['disabled_folders'].delete('magento2')
141
- env[:ui].info("Re-enabling fs->disabled_folders->magento2 in the local.yml.")
104
+ def get_varnish_state(env)
105
+ ask_message = "Do you want to enable Varnish? Enter true or false [default false]: "
106
+ varnish_enabled = get_setting(env, AVAILABLE_VARNISH_STATES, DEFAULT_VARNISH_STATE, ask_message)
107
+ varnish_state = varnish_enabled == 'true' ? true : false
108
+ message = "Varnish will be #{varnish_state ? 'enabled' : 'disabled'}"
109
+ if ! varnish_state
110
+ message += " by loading a nocache vcl."
142
111
  end
143
- if !settings['fs']['folders']['magento1'].nil?
144
- settings['fs']['disabled_folders']['magento1'] = settings['fs']['folders']['magento1'].clone
145
- settings['fs']['folders'].delete('magento1')
146
- env[:ui].info("Disabling fs->folders->magento1 in the local.yml because Magento 2 was configured..")
112
+ env[:ui].info(message)
113
+ return varnish_state
114
+ end
115
+
116
+
117
+ # Make sure we don't link /data/web/public on Magento 2 Vagrants
118
+ # because that dir will be a symlink to /data/web/magento2/pub and
119
+ # we mount that. On Magento 1 Vagrants we need to make sure we don't
120
+ # mount /data/web/magento2/pub.
121
+ def ensure_magento_mounts_configured(env)
122
+ settings = retrieve_settings()
123
+ if !settings['fs'].nil? and !settings['fs']['folders'].nil?
124
+ settings['fs']['disabled_folders'] ||= Hash.new
125
+ if settings['magento']['version'].to_s == "1"
126
+ if !settings['fs']['disabled_folders']['magento1'].nil?
127
+ settings['fs']['folders']['magento1'] = settings['fs']['disabled_folders']['magento1'].clone
128
+ settings['fs']['disabled_folders'].delete('magento1')
129
+ env[:ui].info("Re-enabling fs->disabled_folders->magento1 in the local.yml.")
130
+ end
131
+ if !settings['fs']['folders']['magento2'].nil?
132
+ settings['fs']['disabled_folders']['magento2'] = settings['fs']['folders']['magento2'].clone
133
+ settings['fs']['folders'].delete('magento2')
134
+ env[:ui].info("Disabling fs->folders->magento2 in the local.yml because Magento 1 was configured.")
135
+ end
136
+ elsif settings['magento']['version'].to_s == "2"
137
+ if !settings['fs']['disabled_folders']['magento2'].nil?
138
+ settings['fs']['folders']['magento2'] = settings['fs']['disabled_folders']['magento2'].clone
139
+ settings['fs']['disabled_folders'].delete('magento2')
140
+ env[:ui].info("Re-enabling fs->disabled_folders->magento2 in the local.yml.")
141
+ end
142
+ if !settings['fs']['folders']['magento1'].nil?
143
+ settings['fs']['disabled_folders']['magento1'] = settings['fs']['folders']['magento1'].clone
144
+ settings['fs']['folders'].delete('magento1')
145
+ env[:ui].info("Disabling fs->folders->magento1 in the local.yml because Magento 2 was configured..")
146
+ end
147
+ end
148
+ if settings['fs']['disabled_folders'] == Hash.new
149
+ settings['fs'].delete('disabled_folders')
150
+ end
147
151
  end
148
- end
149
- if settings['fs']['disabled_folders'] == Hash.new
150
- settings['fs'].delete('disabled_folders')
152
+ update_settings(settings)
151
153
  end
152
- end
153
- update_settings(settings)
154
- end
155
154
 
156
155
 
157
- # todo: refactor this and the above function into one
158
- def ensure_php_version_configured(env)
159
- settings = retrieve_settings()
160
- if settings['php']['version'].nil?
161
- settings['php']['version'] = get_php_version(env)
162
- elsif !AVAILABLE_PHP_VERSIONS.include?(settings['php']['version'].to_f)
163
- env[:ui].error("The PHP version configured in local.yml is invalid.")
164
- settings['php']['version'] = get_php_version(env)
165
- end
166
- update_settings(settings)
167
- end
156
+ def ensure_attribute_configured(env, name, attribute, available)
157
+ settings = retrieve_settings()
158
+ if settings[name][attribute].nil?
159
+ settings[name][attribute] = yield
160
+ elsif !available.map { | v | v.to_s }.include?(settings[name][attribute].to_s)
161
+ env[:ui].error("The #{name} #{attribute} configured in local.yml is invalid.")
162
+ settings[name][attribute] = yield
163
+ end
164
+ update_settings(settings)
165
+ end
168
166
 
169
167
 
170
- def ensure_setting_exists(name)
171
- settings = retrieve_settings()
172
- if settings[name].nil?
173
- settings[name] = Hash.new
174
- end
175
- update_settings(settings)
176
- end
168
+ def ensure_setting_exists(name)
169
+ settings = retrieve_settings()
170
+ settings[name] ||= Hash.new
171
+ update_settings(settings)
172
+ end
173
+
174
+
175
+ def validate_magento2_root(env)
176
+ settings = retrieve_settings()
177
+ if !settings['fs'].nil? and !settings['fs']['folders'].nil?
178
+ if settings['fs']['folders'].select{ |_, f| f['guest'].start_with?('/data/web/public') }.any? && settings['magento']['version'] == 2
179
+ env[:ui].info("Can not configure a synced /data/web/public directory with Magento 2, this will be symlinked to /data/web/magento2!")
180
+ env[:ui].error("Please remove all fs->folders->*->guest paths that start with /data/web/public from your local.yml. Use /data/web/magento2 instead.")
181
+ end
182
+ end
183
+ end
177
184
 
178
185
 
179
- def validate_magento2_root(env)
180
- settings = retrieve_settings()
181
- if !settings['fs'].nil? and !settings['fs']['folders'].nil?
182
- if settings['fs']['folders'].select{ |_, f| f['guest'].start_with?('/data/web/public') }.any? && settings['magento']['version'] == 2
183
- env[:ui].info("Can not configure a synced /data/web/public directory with Magento 2, this will be symlinked to /data/web/magento2!")
184
- env[:ui].error("Please remove all fs->folders->*->guest paths that start with /data/web/public from your local.yml. Use /data/web/magento2 instead.")
186
+ def inform_if_gatling_not_installed(env)
187
+ settings = retrieve_settings()
188
+ if settings['fs']['type'] == 'rsync' and !Vagrant.has_plugin?('vagrant-gatling-rsync')
189
+ env[:ui].info(<<-HEREDOC
190
+ 'Tip: run "vagrant plugin install vagrant-gatling-rsync" to speed up
191
+ shared folder operations.\nYou can then sync with "vagrant gatling-rsync-auto"
192
+ instead of "vagrant rsync-auto" to increase performance
193
+ HEREDOC
194
+ )
195
+ end
185
196
  end
186
- end
187
- end
188
-
189
-
190
- def ensure_settings_configured(env)
191
- old_settings = retrieve_settings()
192
- ensure_setting_exists('magento')
193
- ensure_magento_version_configured(env)
194
- ensure_setting_exists('php')
195
- ensure_php_version_configured(env)
196
- ensure_setting_exists('varnish')
197
- ensure_varnish_state_configured(env)
198
- ensure_magento_mounts_configured(env)
199
- validate_magento2_root(env)
200
- new_settings = retrieve_settings()
201
- return new_settings.to_yaml != old_settings.to_yaml
202
- end
203
197
 
204
198
 
205
- def ensure_required_plugins_are_installed(env)
206
- RECOMMENDED_PLUGINS.each do |plugin|
207
- unless Vagrant.has_plugin?(plugin)
208
- env[:ui].info("Installing the #{plugin} plugin.")
209
- system("vagrant plugin install #{plugin}")
199
+ def ensure_vagrant_box_type_configured(env)
200
+ settings = retrieve_settings()
201
+ case settings['php']['version']
202
+ when 5.5
203
+ env[:ui].info("Will use PHP 5.5. If you want PHP 7 instead change the php version in local.yml.")
204
+ settings['vagrant']['box'] = 'hypernode_php5'
205
+ settings['vagrant']['box_url'] = 'http://vagrant.hypernode.com/customer/php5/catalog.json'
206
+ when 7.0
207
+ env[:ui].info("Will use PHP 7. If you want PHP 5.5 instead change the php version in local.yml.")
208
+ settings['vagrant']['box'] = 'hypernode_php7'
209
+ settings['vagrant']['box_url'] = 'http://vagrant.hypernode.com/customer/php7/catalog.json'
210
+ end
211
+ update_settings(settings)
212
+ end
213
+
214
+
215
+ def configure_magento(env)
216
+ ensure_setting_exists('magento')
217
+ ensure_attribute_configured(
218
+ env, 'magento', 'version',
219
+ AVAILABLE_MAGENTO_VERSIONS
220
+ ) { get_magento_version(env) }
221
+ end
222
+
223
+
224
+ def configure_php(env)
225
+ ensure_setting_exists('php')
226
+ ensure_attribute_configured(
227
+ env, 'php', 'version',
228
+ AVAILABLE_PHP_VERSIONS
229
+ ) { get_php_version(env) }
230
+ end
231
+
232
+
233
+ def configure_varnish(env)
234
+ ensure_setting_exists('varnish')
235
+ ensure_attribute_configured(
236
+ env, 'varnish', 'state',
237
+ AVAILABLE_VARNISH_STATES
238
+ ) { get_varnish_state(env) }
239
+ end
240
+
241
+
242
+ def configure_synced_folders(env)
243
+ ensure_magento_mounts_configured(env)
244
+ validate_magento2_root(env)
245
+ inform_if_gatling_not_installed(env)
210
246
  end
211
- end
212
- end
213
-
214
247
 
215
- module VagrantHypconfigmgmt
216
- class Command
217
248
 
218
- def initialize(app, env)
219
- @app = app
220
- @env = env
249
+ def configure_vagrant(env)
250
+ ensure_setting_exists('vagrant')
251
+ ensure_vagrant_box_type_configured(env)
221
252
  end
222
-
223
- def call(env)
224
- if env[:machine].config.hypconfigmgmt.enabled
225
- changed = ensure_settings_configured(env)
226
- ensure_required_plugins_are_installed(env)
227
- if changed
228
- env[:ui].info("Your hypernode-vagrant is now configured. Please run \"vagrant up\" again.")
229
- return
230
- end
253
+
254
+
255
+ def ensure_settings_configured(env)
256
+ old_settings = retrieve_settings()
257
+ configure_magento(env)
258
+ configure_php(env)
259
+ configure_varnish(env)
260
+ configure_synced_folders(env)
261
+ configure_vagrant(env)
262
+ new_settings = retrieve_settings()
263
+ return new_settings.to_yaml != old_settings.to_yaml
264
+ end
265
+
266
+
267
+ def ensure_required_plugins_are_installed(env)
268
+ RECOMMENDED_PLUGINS.each do |plugin|
269
+ unless Vagrant.has_plugin?(plugin)
270
+ env[:ui].info("Installing the #{plugin} plugin.")
271
+ system("vagrant plugin install #{plugin}")
272
+ end
231
273
  end
232
- @app.call(env)
233
274
  end
234
275
  end
235
276
  end