vagrant-hypconfigmgmt 0.0.4 → 0.0.5

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: f62543b9cfe6dacdf66c31382c50129a190a02f1
4
- data.tar.gz: e155f19effe974672617050a36902cf3ae04373b
3
+ metadata.gz: fcdc33fece45adb733b862dbc4187237f4e174d4
4
+ data.tar.gz: c6fd87ee4876d7124d13a2f933174e3241152030
5
5
  SHA512:
6
- metadata.gz: 2a4840c860526f349a5779d84eeeb0dd85a5d62a123d44b381c8b8aa94a3ea453c61801b172e67786f2cb14879ea0e901c91fe7450840f475b0c51a8ddfb8a5c
7
- data.tar.gz: ebed8ca5546dbf1d3ab9ab6f8b2c2ebb3f17e019201a2da94ae7bc52373afb5ba0e4b5709d05fc9a6480c2f477e5b71427aa071f13f2a2e91b715570dd34302e
6
+ metadata.gz: 5b51824b6737089497a1cb1d9047d48cb6e9917a74be2b6ae8440c55c8c47074654920ad57d17f2e7b8477a285d00e655885f83b0a990a08c1a0e28b3ecb349d
7
+ data.tar.gz: eb793c0fcc241b43dc41af702f92f7aea9bf883ce53179e68f09ec771993c09bd69cb8e16b6d3f47f081da84dad188836ec0bbf51a2ea70366f93b09543e2ee1
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.4 built to pkg/vagrant-hypconfigmgmt-0.0.4.gem.
14
+ vagrant-hypconfigmgmt 0.0.5 built to pkg/vagrant-hypconfigmgmt-0.0.5.gem.
15
15
  ```
@@ -16,6 +16,9 @@ AVAILABLE_FIREWALL_STATES = [true, false]
16
16
  DEFAULT_CGROUP_STATE = false
17
17
  AVAILABLE_CGROUP_STATES = [true, false]
18
18
 
19
+ DEFAULT_XDEBUG_STATE = false
20
+ AVAILABLE_XDEBUG_STATES = [true, false]
21
+
19
22
  # paths to local settings file
20
23
  H_V_SETTINGS_FILE = "local.yml"
21
24
  H_V_BASE_SETTINGS_FILE = ".local.base.yml"
@@ -150,7 +153,17 @@ module VagrantHypconfigmgmt
150
153
  env[:ui].info(message)
151
154
  return cgroup_state
152
155
  end
153
-
156
+
157
+
158
+ def get_xdebug_state(env)
159
+ ask_message = "Do you want to install Xdebug? Enter true or false [default false]: "
160
+ xdebug_enabled = get_setting(env, AVAILABLE_XDEBUG_STATES, DEFAULT_XDEBUG_STATE, ask_message)
161
+ xdebug_state = xdebug_enabled == 'true' ? true : false
162
+ message = "Xdebug will be #{xdebug_state ? 'enabled' : 'disabled'}"
163
+ env[:ui].info(message)
164
+ return xdebug_state
165
+ end
166
+
154
167
 
155
168
  def get_fs_type(env)
156
169
  ask_message = "What filesystem type do you want to use? Options: nfs_guest, nfs, rsync, virtualbox [default #{DEFAULT_FS_TYPE}]: "
@@ -331,8 +344,17 @@ HEREDOC
331
344
  AVAILABLE_CGROUP_STATES
332
345
  ) { get_cgroup_state(env) }
333
346
  end
334
-
335
-
347
+
348
+
349
+ def configure_xdebug(env)
350
+ ensure_setting_exists('xdebug')
351
+ ensure_attribute_configured(
352
+ env, 'xdebug', 'state',
353
+ AVAILABLE_XDEBUG_STATES
354
+ ) { get_xdebug_state(env) }
355
+ end
356
+
357
+
336
358
  def configure_synced_folders(env)
337
359
  ensure_setting_exists('fs')
338
360
  ensure_fs_type_configured(env)
@@ -356,6 +378,7 @@ HEREDOC
356
378
  configure_synced_folders(env)
357
379
  configure_firewall(env)
358
380
  configure_cgroup(env)
381
+ configure_xdebug(env)
359
382
  configure_vagrant(env)
360
383
  new_settings = retrieve_settings()
361
384
  return new_settings.to_yaml != old_settings.to_yaml
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Vagrant
5
5
  module Hypconfigmgmt
6
- VERSION = "0.0.4"
6
+ VERSION = "0.0.5"
7
7
  end
8
8
  end
@@ -0,0 +1,35 @@
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_xdebug(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_xdebug" do
22
+
23
+ context "when env is passed" do
24
+ it "configures the settings for xdebug" do
25
+ # check the xdebug settings is ensured to exist in the configuration file
26
+ expect(subject).to receive(:ensure_setting_exists).with('xdebug')
27
+ # check the xdebug state is ensured to be configured
28
+ expect(subject).to receive(:ensure_attribute_configured).with(
29
+ env, 'xdebug', 'state', AVAILABLE_XDEBUG_STATES
30
+ )
31
+ end
32
+ end
33
+ end
34
+ end
35
+
@@ -45,6 +45,8 @@ describe VagrantHypconfigmgmt::Command do
45
45
  expect(subject).to receive(:configure_firewall).with(env)
46
46
  # check the memory management settings are configured
47
47
  expect(subject).to receive(:configure_cgroup).with(env)
48
+ # check the Xdebug settings are configured
49
+ expect(subject).to receive(:configure_xdebug).with(env)
48
50
  # check the vagrant settings are configured
49
51
  expect(subject).to receive(:configure_vagrant).with(env)
50
52
  # check true is returned when settings are updated
@@ -68,6 +70,8 @@ describe VagrantHypconfigmgmt::Command do
68
70
  expect(subject).to receive(:configure_firewall).with(env)
69
71
  # check the memory management settings are configured
70
72
  expect(subject).to receive(:configure_cgroup).with(env)
73
+ # check the Xdebug settings are configured
74
+ expect(subject).to receive(:configure_xdebug).with(env)
71
75
  # check the vagrant settings are configured
72
76
  expect(subject).to receive(:configure_vagrant).with(env)
73
77
  # check false is returned when settings are not updated
@@ -0,0 +1,54 @@
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
+ # instantiate class of which a method is to be tested
20
+ subject { described_class.new(app, env) }
21
+
22
+ # the method that we are going to test
23
+ describe "#get_xdebug_state" do
24
+ expected_message = "Do you want to install Xdebug? Enter true or false [default false]: "
25
+
26
+ context "when the state is enabled" do
27
+ it "it notifies the user that it will be enabled and returns the value" do
28
+ # check if the setting is prompted for and pretend it returns a "xdebug enabled" answer
29
+ expect(subject).to receive(:get_setting).with(
30
+ env, AVAILABLE_XDEBUG_STATES, DEFAULT_XDEBUG_STATE, expected_message
31
+ ).and_return("true")
32
+ # check if the user is notified that the xdebug will be enabled
33
+ expect(ui).to receive(:info).once.with(/.*enabled.*/)
34
+ # check if the function returns true if the xdebug should be enabled
35
+ expect( subject.get_xdebug_state(env) ).to eq(true)
36
+ end
37
+ end
38
+
39
+
40
+ context "when the state is disabled" do
41
+ it "it notifies the user that it will be disabled and returns the value" do
42
+ # check if the setting is prompted for and pretend it returns a "xdebug disabled" answer
43
+ expect(subject).to receive(:get_setting).with(
44
+ env, AVAILABLE_XDEBUG_STATES, DEFAULT_XDEBUG_STATE, expected_message
45
+ ).and_return("false")
46
+ # check if the user is notified that the xdebug will be disabled
47
+ expect(ui).to receive(:info).once.with(/.*disabled.*/)
48
+ # check if the function returns false if the xdebug should be disabled
49
+ expect( subject.get_xdebug_state(env) ).to eq(false)
50
+ end
51
+ end
52
+ end
53
+ end
54
+
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
4
+ version: 0.0.5
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: 2016-10-31 00:00:00.000000000 Z
11
+ date: 2016-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -107,6 +107,7 @@ files:
107
107
  - spec/unit/command/configure_synced_folders_spec.rb
108
108
  - spec/unit/command/configure_vagrant_spec.rb
109
109
  - spec/unit/command/configure_varnish_spec.rb
110
+ - spec/unit/command/configure_xdebug_spec.rb
110
111
  - spec/unit/command/ensure_attribute_configured_spec.rb
111
112
  - spec/unit/command/ensure_firewall_disabled_for_incompatible_fs_types_spec.rb
112
113
  - spec/unit/command/ensure_fs_type_configured_spec.rb
@@ -123,6 +124,7 @@ files:
123
124
  - spec/unit/command/get_php_version_spec.rb
124
125
  - spec/unit/command/get_setting_spec.rb
125
126
  - spec/unit/command/get_varnish_state_spec.rb
127
+ - spec/unit/command/get_xdebug_state_spec.rb
126
128
  - spec/unit/command/inform_if_gatling_not_installed_spec.rb
127
129
  - spec/unit/command/retrieve_settings_spec.rb
128
130
  - spec/unit/command/update_settings_spec.rb