vagrant-hypconfigmgmt 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80e7f327afb4448aae5bd838e9a482cb0ca29f45
4
- data.tar.gz: 7e990e3cee352ca9448da59794d3e977d05735ce
3
+ metadata.gz: 6730a56af721c8c091198340255a2333d919e72e
4
+ data.tar.gz: beba82b76a65bc87f9df90facfee55053520ab11
5
5
  SHA512:
6
- metadata.gz: ff807968290422145ade5a92a499f6656f96e7e41eced9c693814de75b277016a86d3d2dbd90dc3541b42c6ab700c30e518af87e90982cae830f7723ff0a3f09
7
- data.tar.gz: 679fe375389edba8d9b293954dc2f38a2571f316d6df8f0638e5702f7746c80ed16bdaa65b3c8c04ebe15aac1a8731d4d11976d08d10c982c77b0ce2f32e7fda
6
+ metadata.gz: 67044b50e77eddcbc5ef8ad55f2b7c9e3c0a68fe03fa0d9d65a983ab1f3fd32db6414f9c763cccf6af0364f6d279ce058fa82f626b1e8395245c98aa64f3904d
7
+ data.tar.gz: 4191d683a66dbd775d84315279d1ccb6f8a6d8aff15442a39484017a53369a88b65961731d79ef53a6bf6bde445c08a99ae205b3eb2e5d7f6162a5f1e91d3184
data/README.md CHANGED
@@ -11,5 +11,5 @@ Create the gemfile (package)
11
11
  ```
12
12
  $ make
13
13
  rake build
14
- vagrant-hypconfigmgmt 0.0.7 built to pkg/vagrant-hypconfigmgmt-0.0.7.gem.
14
+ vagrant-hypconfigmgmt 0.0.8 built to pkg/vagrant-hypconfigmgmt-0.0.8.gem.
15
15
  ```
@@ -36,6 +36,9 @@ AVAILABLE_FS_TYPES = ['nfs', 'nfs_guest', 'virtualbox', 'rsync']
36
36
  # Perhaps we should consider using a different default on different platforms.
37
37
  DEFAULT_FS_TYPE = 'virtualbox'
38
38
 
39
+ AVAILABLE_UBUNTU_VERSIONS = ['xenial', 'precise']
40
+ DEFAULT_UBUNTU_VERSION = 'xenial'
41
+
39
42
 
40
43
  module VagrantHypconfigmgmt
41
44
  class Command
@@ -187,6 +190,20 @@ module VagrantHypconfigmgmt
187
190
  end
188
191
 
189
192
 
193
+ def get_ubuntu_version(env)
194
+ ask_message = "What Ubuntu version do you want to use? Options: xenial, precise (deprecated) [default #{DEFAULT_UBUNTU_VERSION}]: "
195
+ ubuntu_version = get_setting(env, AVAILABLE_UBUNTU_VERSIONS, DEFAULT_UBUNTU_VERSION, ask_message)
196
+ case ubuntu_version
197
+ when "xenial"
198
+ message = ("Will use the Xenial version. This is the default.")
199
+ when "precise"
200
+ message = ("Will use the Precise version (will soon be deprecated)")
201
+ end
202
+ env[:ui].info(message)
203
+ return ubuntu_version
204
+ end
205
+
206
+
190
207
  # Make sure we don't link /data/web/public on Magento 2 Vagrants
191
208
  # because that dir will be a symlink to /data/web/magento2/pub and
192
209
  # we mount that. On Magento 1 Vagrants we need to make sure we don't
@@ -268,9 +285,9 @@ HEREDOC
268
285
  end
269
286
  end
270
287
 
271
-
272
288
  def ensure_vagrant_box_type_configured(env)
273
289
  settings = retrieve_settings()
290
+ settings['ubuntu_version'] ||= get_ubuntu_version(env)
274
291
  if settings['ubuntu_version'] == 'xenial'
275
292
  settings['vagrant']['box'] = 'hypernode_xenial'
276
293
  settings['vagrant']['box_url'] = 'http://vagrant.hypernode.com/customer/xenial/catalog.json'
@@ -289,7 +306,6 @@ HEREDOC
289
306
  update_settings(settings)
290
307
  end
291
308
 
292
-
293
309
  def ensure_default_domain_configured(env)
294
310
  settings = retrieve_settings()
295
311
  settings['hostmanager']['default_domain'] ||= DEFAULT_DOMAIN
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Vagrant
5
5
  module Hypconfigmgmt
6
- VERSION = "0.0.7"
6
+ VERSION = "0.0.8"
7
7
  end
8
8
  end
@@ -27,10 +27,11 @@ describe VagrantHypconfigmgmt::Command do
27
27
  # the method that we are going to test
28
28
  describe "#ensure_vagrant_box_type_configured" do
29
29
 
30
- context "when php 7.0 is configured" do
30
+ context "when php 7.0 is configured but no ubuntu version specified" do
31
31
  let(:retrieved_settings) { { "php" => { "version" => 7.0 }, "vagrant" => Hash.new } }
32
32
  it "sets the box name and box url to the right values for PHP 7.0" do
33
33
  expected_settings = {
34
+ "ubuntu_version" => "precise",
34
35
  "php" => {
35
36
  "version" => 7.0
36
37
  },
@@ -41,6 +42,8 @@ describe VagrantHypconfigmgmt::Command do
41
42
  }
42
43
  # check if settings are retrieved from disk and pretend they return a configuration for php 7.0
43
44
  expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
45
+ # check if the ubuntu version is gotten and pretend it returns precise
46
+ expect(subject).to receive(:get_ubuntu_version).once.with(env).and_return('precise')
44
47
  # check if the settings that are written back to disk contain the right box (name) and box_url
45
48
  expect(subject).to receive(:update_settings).once.with(expected_settings)
46
49
  end
@@ -61,6 +64,8 @@ describe VagrantHypconfigmgmt::Command do
61
64
  }
62
65
  # check if settings are retrieved from disk and pretend they return a configuration for php 7.0
63
66
  expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
67
+ # check if the ubuntu version is not gotten because we already have it specified in the settings
68
+ expect(subject).to receive(:get_ubuntu_version).never
64
69
  # check if the settings that are written back to disk contain the right box (name) and box_url
65
70
  expect(subject).to receive(:update_settings).once.with(expected_settings)
66
71
  end
@@ -81,15 +86,18 @@ describe VagrantHypconfigmgmt::Command do
81
86
  }
82
87
  # check if settings are retrieved from disk and pretend they return a configuration for php 7.0
83
88
  expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
89
+ # check if the ubuntu version is not gotten because we already have it specified in the settings
90
+ expect(subject).to receive(:get_ubuntu_version).never
84
91
  # check if the settings that are written back to disk contain the right box (name) and box_url
85
92
  expect(subject).to receive(:update_settings).once.with(expected_settings)
86
93
  end
87
94
  end
88
95
 
89
- context "when php 5.5 is configured" do
96
+ context "when php 5.5 is configured but no ubuntu version specified" do
90
97
  let(:retrieved_settings) { { "php" => { "version" => 5.5 }, "vagrant" => Hash.new } }
91
98
  it "sets the box name and box url to the right values for PHP 5.5" do
92
99
  expected_settings = {
100
+ "ubuntu_version" => "precise",
93
101
  "php" => {
94
102
  "version" => 5.5
95
103
  },
@@ -100,6 +108,8 @@ describe VagrantHypconfigmgmt::Command do
100
108
  }
101
109
  # check if settings are retrieved from disk and pretend they return a configuration for php 5.5
102
110
  expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
111
+ # check if the ubuntu version is gotten and pretend it returns precise
112
+ expect(subject).to receive(:get_ubuntu_version).once.with(env).and_return('precise')
103
113
  # check if the settings that are written back to disk contain the right box (name) and box_url
104
114
  expect(subject).to receive(:update_settings).once.with(expected_settings)
105
115
  end
@@ -120,6 +130,8 @@ describe VagrantHypconfigmgmt::Command do
120
130
  }
121
131
  # check if settings are retrieved from disk and pretend they return a configuration for php 5.5
122
132
  expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
133
+ # check if the ubuntu version is not gotten because we already have it specified in the settings
134
+ expect(subject).to receive(:get_ubuntu_version).never
123
135
  # check if the settings that are written back to disk contain the right box (name) and box_url
124
136
  expect(subject).to receive(:update_settings).once.with(expected_settings)
125
137
  end
@@ -140,6 +152,8 @@ describe VagrantHypconfigmgmt::Command do
140
152
  }
141
153
  # check if settings are retrieved from disk and pretend they return a configuration for php 5.5
142
154
  expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
155
+ # check if the ubuntu version is not gotten because we already have it specified in the settings
156
+ expect(subject).to receive(:get_ubuntu_version).never
143
157
  # check if the settings that are written back to disk contain the right box (name) and box_url
144
158
  expect(subject).to receive(:update_settings).once.with(expected_settings)
145
159
  end
@@ -148,18 +162,29 @@ describe VagrantHypconfigmgmt::Command do
148
162
  context "when an unknown php version is configured" do
149
163
  let(:retrieved_settings) { { "php" => { "version" => 1.0 }, "vagrant" => Hash.new } }
150
164
  it "does not set the box name and box url" do
165
+ expected_settings = {
166
+ "ubuntu_version" => "precise",
167
+ "php" => {
168
+ "version" => 1.0
169
+ },
170
+ "vagrant" => Hash.new
171
+ }
151
172
  # check if settings are retrieved from disk and pretend they return an invalid php version
152
173
  expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
174
+ # check if the ubuntu version is gotten and pretend it returns precise
175
+ expect(subject).to receive(:get_ubuntu_version).once.with(env).and_return('precise')
153
176
  # check if the settings we write back to disk have an unaltered box (name) and box_url
154
- expect(subject).to receive(:update_settings).once.with(retrieved_settings)
177
+ expect(subject).to receive(:update_settings).once.with(expected_settings)
155
178
  end
156
179
  end
157
180
 
158
- context "when an unknown php version is configured and xenial ubuntu vreesion specified" do
181
+ context "when an unknown php version is configured and xenial ubuntu version specified" do
159
182
  let(:retrieved_settings) { { "php" => { "version" => 1.0 }, "vagrant" => Hash.new, "ubuntu_version" => "xenial" } }
160
183
  it "does not set the box name and box url" do
161
184
  # check if settings are retrieved from disk and pretend they return an invalid php version
162
185
  expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
186
+ # check if the ubuntu version is not gotten because we already have it specified in the settings
187
+ expect(subject).to receive(:get_ubuntu_version).never
163
188
  # check if the settings we write back to disk have an unaltered box (name) and box_url
164
189
  expect(subject).to receive(:update_settings).once.with(retrieved_settings)
165
190
  end
@@ -0,0 +1,55 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # vim: set fileencoding=utf-8
3
+
4
+ require 'spec_helper'
5
+ require "vagrant-hypconfigmgmt/command"
6
+
7
+ describe VagrantHypconfigmgmt::Command do
8
+ # create a fake app and env to pass into the VagrantHypconfigmgmt::Command constructor
9
+ let(:app) { }
10
+ let(:env) { { :ui => ui } }
11
+
12
+ # pretend env contains the Vagrant ui element
13
+ let(:ui) do
14
+ double('ui').tap do |ui|
15
+ allow(ui).to receive(:info) { nil }
16
+ end
17
+ end
18
+
19
+
20
+ # instantiate class of which a method is to be tested
21
+ subject { described_class.new(app, env) }
22
+
23
+ # the method that we are going to test
24
+ describe "#ubuntu_version" do
25
+
26
+ context "when the user inputs ubuntu version precise" do
27
+ it "returns ubuntu version precise" do
28
+ # check if the setting is prompted for and pretend it returns a "precise" answer
29
+ expect(subject).to receive(:get_setting).with(
30
+ env, AVAILABLE_UBUNTU_VERSIONS, DEFAULT_UBUNTU_VERSION,
31
+ "What Ubuntu version do you want to use? Options: xenial, precise (deprecated) [default #{DEFAULT_UBUNTU_VERSION}]: "
32
+ ).and_return("precise")
33
+ # check a message is printed about the ubuntu version
34
+ expect(ui).to receive(:info).once.with(/.*Precise.*deprecated.*/)
35
+ # check if the function returns "precise"
36
+ expect( subject.get_ubuntu_version(env) ).to eq("precise")
37
+ end
38
+ end
39
+
40
+ context "when the user inputs ubuntu version xenial" do
41
+ it "returns ubuntu version xenial" do
42
+ # check if the setting is prompted for and pretend it returns a "virtualbox" answer
43
+ expect(subject).to receive(:get_setting).with(
44
+ env, AVAILABLE_UBUNTU_VERSIONS, DEFAULT_UBUNTU_VERSION,
45
+ "What Ubuntu version do you want to use? Options: xenial, precise (deprecated) [default #{DEFAULT_UBUNTU_VERSION}]: "
46
+ ).and_return("xenial")
47
+ # check a message is printed about the ubuntu version
48
+ expect(ui).to receive(:info).once.with(/.*Xenial.*default.*/)
49
+ # check if the function returns "xenial"
50
+ expect( subject.get_ubuntu_version(env) ).to eq("xenial")
51
+ end
52
+ end
53
+ end
54
+ end
55
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-hypconfigmgmt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick van de Loo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-22 00:00:00.000000000 Z
11
+ date: 2017-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,7 +98,7 @@ files:
98
98
  - lib/vagrant-hypconfigmgmt/command.rb
99
99
  - lib/vagrant-hypconfigmgmt/config.rb
100
100
  - lib/vagrant-hypconfigmgmt/version.rb
101
- - pkg/vagrant-hypconfigmgmt-0.0.6.gem
101
+ - pkg/vagrant-hypconfigmgmt-0.0.7.gem
102
102
  - spec/spec_helper.rb
103
103
  - spec/unit/command/call_spec.rb
104
104
  - spec/unit/command/configure_cgroup_spec.rb
@@ -126,6 +126,7 @@ files:
126
126
  - spec/unit/command/get_options_string_spec.rb
127
127
  - spec/unit/command/get_php_version_spec.rb
128
128
  - spec/unit/command/get_setting_spec.rb
129
+ - spec/unit/command/get_ubuntu_version_spec.rb
129
130
  - spec/unit/command/get_varnish_state_spec.rb
130
131
  - spec/unit/command/get_xdebug_state_spec.rb
131
132
  - spec/unit/command/inform_if_gatling_not_installed_spec.rb