vagrant-hypconfigmgmt 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/Makefile +1 -1
- data/README.md +1 -1
- data/lib/vagrant-hypconfigmgmt/command.rb +30 -9
- data/lib/vagrant-hypconfigmgmt/version.rb +1 -1
- data/pkg/vagrant-hypconfigmgmt-0.0.5.gem +0 -0
- data/spec/unit/command/configure_hostmanager_spec.rb +33 -0
- data/spec/unit/command/configure_vagrant_spec.rb +1 -1
- data/spec/unit/command/ensure_default_domain_configured_spec.rb +50 -0
- data/spec/unit/command/ensure_settings_are_configured_spec.rb +4 -0
- data/spec/unit/command/ensure_vagrant_box_type_configured_spec.rb +95 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37e5a7641e42c8af9f12aae45a852020ceaf1c8a
|
4
|
+
data.tar.gz: efaa3f9988ad512b94ad777d515b6742d7548061
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3712a2116da7bc8bd03966c7d57002010e2abcb7f83ad9d46ae02a83982b8333178555c55a8607035d3e51cd89590c83b9afe9b443a1188f66012471a394e0ec
|
7
|
+
data.tar.gz: ce7b39b7ea26cc1e5757efd4b9e53ec4b4153575eb13c8a549b730caef398d269b1ecbe4b29a73d82d5b9caca7d8aefa9a923ae66b9adbc0e5b31f66b95cae03
|
data/Makefile
CHANGED
data/README.md
CHANGED
@@ -19,6 +19,8 @@ AVAILABLE_CGROUP_STATES = [true, false]
|
|
19
19
|
DEFAULT_XDEBUG_STATE = false
|
20
20
|
AVAILABLE_XDEBUG_STATES = [true, false]
|
21
21
|
|
22
|
+
DEFAULT_DOMAIN = 'hypernode.local'
|
23
|
+
|
22
24
|
# paths to local settings file
|
23
25
|
H_V_SETTINGS_FILE = "local.yml"
|
24
26
|
H_V_BASE_SETTINGS_FILE = ".local.base.yml"
|
@@ -269,19 +271,31 @@ HEREDOC
|
|
269
271
|
|
270
272
|
def ensure_vagrant_box_type_configured(env)
|
271
273
|
settings = retrieve_settings()
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
274
|
+
if settings['ubuntu_version'] == 'xenial'
|
275
|
+
settings['vagrant']['box'] = 'hypernode'
|
276
|
+
settings['vagrant']['box_url'] = 'http://vagrant.hypernode.com/customer/xenial/catalog.json'
|
277
|
+
else
|
278
|
+
case settings['php']['version']
|
279
|
+
when 5.5
|
280
|
+
env[:ui].info("Will use PHP 5.5. If you want PHP 7 instead change the php version in local.yml.")
|
281
|
+
settings['vagrant']['box'] = 'hypernode_php5'
|
282
|
+
settings['vagrant']['box_url'] = 'http://vagrant.hypernode.com/customer/php5/catalog.json'
|
283
|
+
when 7.0
|
284
|
+
env[:ui].info("Will use PHP 7. If you want PHP 5.5 instead change the php version in local.yml.")
|
285
|
+
settings['vagrant']['box'] = 'hypernode_php7'
|
286
|
+
settings['vagrant']['box_url'] = 'http://vagrant.hypernode.com/customer/php7/catalog.json'
|
287
|
+
end
|
281
288
|
end
|
282
289
|
update_settings(settings)
|
283
290
|
end
|
284
291
|
|
292
|
+
|
293
|
+
def ensure_default_domain_configured(env)
|
294
|
+
settings = retrieve_settings()
|
295
|
+
settings['hostmanager']['default_domain'] ||= DEFAULT_DOMAIN
|
296
|
+
update_settings(settings)
|
297
|
+
end
|
298
|
+
|
285
299
|
|
286
300
|
def ensure_firewall_disabled_for_incompatible_fs_types(env)
|
287
301
|
settings = retrieve_settings()
|
@@ -368,6 +382,12 @@ HEREDOC
|
|
368
382
|
ensure_setting_exists('vagrant')
|
369
383
|
ensure_vagrant_box_type_configured(env)
|
370
384
|
end
|
385
|
+
|
386
|
+
|
387
|
+
def configure_hostmanager(env)
|
388
|
+
ensure_setting_exists('hostmanager')
|
389
|
+
ensure_default_domain_configured(env)
|
390
|
+
end
|
371
391
|
|
372
392
|
|
373
393
|
def ensure_settings_configured(env)
|
@@ -380,6 +400,7 @@ HEREDOC
|
|
380
400
|
configure_cgroup(env)
|
381
401
|
configure_xdebug(env)
|
382
402
|
configure_vagrant(env)
|
403
|
+
configure_hostmanager(env)
|
383
404
|
new_settings = retrieve_settings()
|
384
405
|
return new_settings.to_yaml != old_settings.to_yaml
|
385
406
|
end
|
Binary file
|
@@ -0,0 +1,33 @@
|
|
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) { }
|
11
|
+
|
12
|
+
# Call the method under test after every 'it'. Similar to setUp in Python TestCase
|
13
|
+
after do
|
14
|
+
subject.configure_hostmanager(env)
|
15
|
+
end
|
16
|
+
|
17
|
+
# instantiate class of which a method is to be tested
|
18
|
+
subject { described_class.new(app, env) }
|
19
|
+
|
20
|
+
# the method that we are going to test
|
21
|
+
describe "#configure_hostmanager" do
|
22
|
+
|
23
|
+
context "when env is passed" do
|
24
|
+
it "configures the settings for the hostmanager" do
|
25
|
+
# check the hostmanager settings is ensured to exist in the configuration file
|
26
|
+
expect(subject).to receive(:ensure_setting_exists).with('hostmanager')
|
27
|
+
# check the default domain is configured for the hostmanager
|
28
|
+
expect(subject).to receive(:ensure_default_domain_configured).with(env)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -24,7 +24,7 @@ describe VagrantHypconfigmgmt::Command do
|
|
24
24
|
it "configures the settings for vagrant" do
|
25
25
|
# check the vagrant settings is ensured to exist in the configuration file
|
26
26
|
expect(subject).to receive(:ensure_setting_exists).with('vagrant')
|
27
|
-
# check the vagrant box type is set to the right box for the
|
27
|
+
# check the vagrant box type is set to the right box for the PHP version
|
28
28
|
expect(subject).to receive(:ensure_vagrant_box_type_configured).with(env)
|
29
29
|
end
|
30
30
|
end
|
@@ -0,0 +1,50 @@
|
|
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) { { } }
|
11
|
+
|
12
|
+
# Call the method under test after every 'it'. Similar to setUp in Python TestCase
|
13
|
+
after do
|
14
|
+
subject.ensure_default_domain_configured(env)
|
15
|
+
end
|
16
|
+
|
17
|
+
# instantiate class of which a method is to be tested
|
18
|
+
subject { described_class.new(app, env) }
|
19
|
+
|
20
|
+
# the method that we are going to test
|
21
|
+
describe "#ensure_default_domain_configured" do
|
22
|
+
|
23
|
+
context "when a default domain is configured" do
|
24
|
+
let(:retrieved_settings) { { "hostmanager" => { "default_domain" => "example.com" } } }
|
25
|
+
it "does not change the retrieved settings" do
|
26
|
+
# check if settings are retrieved from disk and pretend they return a configuration for domain configured
|
27
|
+
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
28
|
+
# check if the settings that are written back to disk contain the same data
|
29
|
+
expect(subject).to receive(:update_settings).once.with(retrieved_settings)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when no default domain is configured" do
|
34
|
+
let(:retrieved_settings) { { "hostmanager" => Hash.new } }
|
35
|
+
it "sets the default domain to the default domain" do
|
36
|
+
expected_settings = {
|
37
|
+
"hostmanager" => {
|
38
|
+
"default_domain" => "hypernode.local"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
# check if settings are retrieved from disk and pretend they return a configuration for domain not configured
|
42
|
+
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
43
|
+
# check if the settings that are written back to disk contain the default domain
|
44
|
+
expect(subject).to receive(:update_settings).once.with(expected_settings)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
|
@@ -49,6 +49,8 @@ describe VagrantHypconfigmgmt::Command do
|
|
49
49
|
expect(subject).to receive(:configure_xdebug).with(env)
|
50
50
|
# check the vagrant settings are configured
|
51
51
|
expect(subject).to receive(:configure_vagrant).with(env)
|
52
|
+
# check the hostmanager settings are configured
|
53
|
+
expect(subject).to receive(:configure_hostmanager).with(env)
|
52
54
|
# check true is returned when settings are updated
|
53
55
|
expect( subject.ensure_settings_configured(env) ).to eq(true)
|
54
56
|
end
|
@@ -74,6 +76,8 @@ describe VagrantHypconfigmgmt::Command do
|
|
74
76
|
expect(subject).to receive(:configure_xdebug).with(env)
|
75
77
|
# check the vagrant settings are configured
|
76
78
|
expect(subject).to receive(:configure_vagrant).with(env)
|
79
|
+
# check the hostmanager settings are configured
|
80
|
+
expect(subject).to receive(:configure_hostmanager).with(env)
|
77
81
|
# check false is returned when settings are not updated
|
78
82
|
expect( subject.ensure_settings_configured(env) ).to eq(false)
|
79
83
|
end
|
@@ -36,7 +36,48 @@ describe VagrantHypconfigmgmt::Command do
|
|
36
36
|
},
|
37
37
|
"vagrant" => {
|
38
38
|
"box" => "hypernode_php7",
|
39
|
-
"box_url" => "http://vagrant.hypernode.com/customer/php7/catalog.json"
|
39
|
+
"box_url" => "http://vagrant.hypernode.com/customer/php7/catalog.json"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
# check if settings are retrieved from disk and pretend they return a configuration for php 7.0
|
43
|
+
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
44
|
+
# check if the settings that are written back to disk contain the right box (name) and box_url
|
45
|
+
expect(subject).to receive(:update_settings).once.with(expected_settings)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "when php 7.0 is configured and precise ubuntu version specified" do
|
50
|
+
let(:retrieved_settings) { { "php" => { "version" => 7.0 }, "vagrant" => Hash.new, "ubuntu_version" => "precise" } }
|
51
|
+
it "sets the box name and box url to the right values for PHP 7.0" do
|
52
|
+
expected_settings = {
|
53
|
+
"ubuntu_version" => "precise",
|
54
|
+
"php" => {
|
55
|
+
"version" => 7.0
|
56
|
+
},
|
57
|
+
"vagrant" => {
|
58
|
+
"box" => "hypernode_php7",
|
59
|
+
"box_url" => "http://vagrant.hypernode.com/customer/php7/catalog.json"
|
60
|
+
}
|
61
|
+
}
|
62
|
+
# check if settings are retrieved from disk and pretend they return a configuration for php 7.0
|
63
|
+
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
64
|
+
# check if the settings that are written back to disk contain the right box (name) and box_url
|
65
|
+
expect(subject).to receive(:update_settings).once.with(expected_settings)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "when php 7.0 is configured and xenial ubuntu version specified" do
|
70
|
+
let(:retrieved_settings) { { "php" => { "version" => 7.0 }, "vagrant" => Hash.new, "ubuntu_version" => "xenial" } }
|
71
|
+
it "sets the box name and box url to the right values for PHP 7.0" do
|
72
|
+
expected_settings = {
|
73
|
+
"ubuntu_version" => "xenial",
|
74
|
+
"php" => {
|
75
|
+
"version" => 7.0
|
76
|
+
},
|
77
|
+
"vagrant" => {
|
78
|
+
"box" => "hypernode",
|
79
|
+
"box_url" => "http://vagrant.hypernode.com/customer/xenial/catalog.json"
|
80
|
+
}
|
40
81
|
}
|
41
82
|
# check if settings are retrieved from disk and pretend they return a configuration for php 7.0
|
42
83
|
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
@@ -54,7 +95,48 @@ describe VagrantHypconfigmgmt::Command do
|
|
54
95
|
},
|
55
96
|
"vagrant" => {
|
56
97
|
"box" => "hypernode_php5",
|
57
|
-
"box_url" => "http://vagrant.hypernode.com/customer/php5/catalog.json"
|
98
|
+
"box_url" => "http://vagrant.hypernode.com/customer/php5/catalog.json"
|
99
|
+
}
|
100
|
+
}
|
101
|
+
# check if settings are retrieved from disk and pretend they return a configuration for php 5.5
|
102
|
+
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
103
|
+
# check if the settings that are written back to disk contain the right box (name) and box_url
|
104
|
+
expect(subject).to receive(:update_settings).once.with(expected_settings)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context "when php 5.5 is configured and precise ubuntu version specified" do
|
109
|
+
let(:retrieved_settings) { { "php" => { "version" => 5.5 }, "vagrant" => Hash.new, "ubuntu_version" => "precise" } }
|
110
|
+
it "sets the box name and box url to the right values for PHP 5.5" do
|
111
|
+
expected_settings = {
|
112
|
+
"ubuntu_version" => "precise",
|
113
|
+
"php" => {
|
114
|
+
"version" => 5.5
|
115
|
+
},
|
116
|
+
"vagrant" => {
|
117
|
+
"box" => "hypernode_php5",
|
118
|
+
"box_url" => "http://vagrant.hypernode.com/customer/php5/catalog.json"
|
119
|
+
}
|
120
|
+
}
|
121
|
+
# check if settings are retrieved from disk and pretend they return a configuration for php 5.5
|
122
|
+
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
123
|
+
# check if the settings that are written back to disk contain the right box (name) and box_url
|
124
|
+
expect(subject).to receive(:update_settings).once.with(expected_settings)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context "when php 5.5 is configured and xenial ubuntu version specified" do
|
129
|
+
let(:retrieved_settings) { { "php" => { "version" => 5.5 }, "vagrant" => Hash.new, "ubuntu_version" => "xenial" } }
|
130
|
+
it "sets the box name and box url to the right values for PHP 5.5" do
|
131
|
+
expected_settings = {
|
132
|
+
"ubuntu_version" => "xenial",
|
133
|
+
"php" => {
|
134
|
+
"version" => 5.5
|
135
|
+
},
|
136
|
+
"vagrant" => {
|
137
|
+
"box" => "hypernode",
|
138
|
+
"box_url" => "http://vagrant.hypernode.com/customer/xenial/catalog.json"
|
139
|
+
}
|
58
140
|
}
|
59
141
|
# check if settings are retrieved from disk and pretend they return a configuration for php 5.5
|
60
142
|
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
@@ -65,7 +147,17 @@ describe VagrantHypconfigmgmt::Command do
|
|
65
147
|
|
66
148
|
context "when an unknown php version is configured" do
|
67
149
|
let(:retrieved_settings) { { "php" => { "version" => 1.0 }, "vagrant" => Hash.new } }
|
68
|
-
it "
|
150
|
+
it "does not set the box name and box url" do
|
151
|
+
# check if settings are retrieved from disk and pretend they return an invalid php version
|
152
|
+
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
153
|
+
# 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)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
context "when an unknown php version is configured and xenial ubuntu vreesion specified" do
|
159
|
+
let(:retrieved_settings) { { "php" => { "version" => 1.0 }, "vagrant" => Hash.new, "ubuntu_version" => "xenial" } }
|
160
|
+
it "does not set the box name and box url" do
|
69
161
|
# check if settings are retrieved from disk and pretend they return an invalid php version
|
70
162
|
expect(subject).to receive(:retrieve_settings).once.with(no_args).and_return(retrieved_settings)
|
71
163
|
# check if the settings we write back to disk have an unaltered box (name) and box_url
|
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.
|
4
|
+
version: 0.0.6
|
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:
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,10 +98,12 @@ 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.5.gem
|
101
102
|
- spec/spec_helper.rb
|
102
103
|
- spec/unit/command/call_spec.rb
|
103
104
|
- spec/unit/command/configure_cgroup_spec.rb
|
104
105
|
- spec/unit/command/configure_firewall_spec.rb
|
106
|
+
- spec/unit/command/configure_hostmanager_spec.rb
|
105
107
|
- spec/unit/command/configure_magento_spec.rb
|
106
108
|
- spec/unit/command/configure_php_spec.rb
|
107
109
|
- spec/unit/command/configure_synced_folders_spec.rb
|
@@ -109,6 +111,7 @@ files:
|
|
109
111
|
- spec/unit/command/configure_varnish_spec.rb
|
110
112
|
- spec/unit/command/configure_xdebug_spec.rb
|
111
113
|
- spec/unit/command/ensure_attribute_configured_spec.rb
|
114
|
+
- spec/unit/command/ensure_default_domain_configured_spec.rb
|
112
115
|
- spec/unit/command/ensure_firewall_disabled_for_incompatible_fs_types_spec.rb
|
113
116
|
- spec/unit/command/ensure_fs_type_configured_spec.rb
|
114
117
|
- spec/unit/command/ensure_magento_mounts_configured_spec.rb
|