nugrant 2.1.2 → 2.1.4

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 (71) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +23 -23
  3. data/.travis.yml +15 -10
  4. data/CHANGELOG.md +347 -338
  5. data/CONTRIBUTORS.md +7 -5
  6. data/Gemfile +13 -13
  7. data/README.md +601 -601
  8. data/lib/nugrant/bag.rb +264 -264
  9. data/lib/nugrant/config.rb +201 -201
  10. data/lib/nugrant/helper/bag.rb +38 -38
  11. data/lib/nugrant/helper/env/exporter.rb +195 -195
  12. data/lib/nugrant/helper/env/namer.rb +47 -47
  13. data/lib/nugrant/helper/parameters.rb +12 -12
  14. data/lib/nugrant/helper/stack.rb +86 -86
  15. data/lib/nugrant/mixin/parameters.rb +178 -178
  16. data/lib/nugrant/parameters.rb +29 -29
  17. data/lib/nugrant/vagrant/errors.rb +35 -35
  18. data/lib/nugrant/vagrant/v2/action/auto_export.rb +45 -45
  19. data/lib/nugrant/vagrant/v2/action.rb +17 -17
  20. data/lib/nugrant/vagrant/v2/command/env.rb +118 -118
  21. data/lib/nugrant/vagrant/v2/command/parameters.rb +153 -153
  22. data/lib/nugrant/vagrant/v2/command/restricted_keys.rb +64 -64
  23. data/lib/nugrant/vagrant/v2/command/root.rb +95 -95
  24. data/lib/nugrant/vagrant/v2/config/user.rb +29 -29
  25. data/lib/nugrant/vagrant/v2/helper.rb +96 -96
  26. data/lib/nugrant/vagrant/v2/plugin.rb +34 -34
  27. data/lib/nugrant/version.rb +3 -3
  28. data/lib/nugrant.rb +31 -31
  29. data/locales/en.yml +24 -24
  30. data/locales/fr.yml +24 -24
  31. data/nugrant.gemspec +32 -32
  32. data/test/lib/nugrant/helper/env/test_exporter.rb +238 -238
  33. data/test/lib/nugrant/helper/test_bag.rb +16 -16
  34. data/test/lib/nugrant/helper/test_parameters.rb +17 -17
  35. data/test/lib/nugrant/helper/test_stack.rb +152 -152
  36. data/test/lib/nugrant/test_bag.rb +450 -450
  37. data/test/lib/nugrant/test_config.rb +201 -201
  38. data/test/lib/nugrant/test_parameters.rb +438 -438
  39. data/test/lib/test_helper.rb +3 -3
  40. data/test/resources/README.md +52 -52
  41. data/test/resources/json/params_current_1.json +6 -6
  42. data/test/resources/json/params_current_2.json +29 -29
  43. data/test/resources/json/params_user_nil_values.json +9 -9
  44. data/test/resources/vagrantfiles/v2.auto_export +13 -13
  45. data/test/resources/vagrantfiles/v2.bag_inside_array +15 -15
  46. data/test/resources/vagrantfiles/v2.defaults_mixed_string_symbols +18 -18
  47. data/test/resources/vagrantfiles/v2.defaults_null_values_in_vagrantuser +23 -23
  48. data/test/resources/vagrantfiles/v2.defaults_using_string +18 -18
  49. data/test/resources/vagrantfiles/v2.defaults_using_symbol +18 -18
  50. data/test/resources/vagrantfiles/v2.empty +2 -2
  51. data/test/resources/vagrantfiles/v2.fake +29 -29
  52. data/test/resources/vagrantfiles/v2.missing_parameter +3 -3
  53. data/test/resources/vagrantfiles/v2.real +22 -22
  54. data/test/resources/yaml/params_array.yml +5 -5
  55. data/test/resources/yaml/params_boolean.yml +1 -1
  56. data/test/resources/yaml/params_combinations.yml +72 -72
  57. data/test/resources/yaml/params_current_1.yml +4 -4
  58. data/test/resources/yaml/params_current_2.yml +23 -23
  59. data/test/resources/yaml/params_defaults_at_root.yml +1 -1
  60. data/test/resources/yaml/params_defaults_not_at_root.yml +2 -2
  61. data/test/resources/yaml/params_list.yml +2 -2
  62. data/test/resources/yaml/params_numeric_key.yml +3 -3
  63. data/test/resources/yaml/params_simple.yml +1 -1
  64. data/test/resources/yaml/params_system_1.yml +4 -4
  65. data/test/resources/yaml/params_system_2.yml +25 -25
  66. data/test/resources/yaml/params_unix_eol.yml +3 -3
  67. data/test/resources/yaml/params_user_1.yml +4 -4
  68. data/test/resources/yaml/params_user_2.yml +23 -23
  69. data/test/resources/yaml/params_user_nil_values.yml +5 -5
  70. data/test/resources/yaml/params_windows_eol.yml +3 -3
  71. metadata +12 -13
@@ -1,3 +1,3 @@
1
- require "minitest/reporters"
2
-
3
- Minitest::Reporters.use!
1
+ require "minitest/reporters"
2
+
3
+ Minitest::Reporters.use!
@@ -1,52 +1,52 @@
1
- This readme give information on how to read resources file
2
- that test merge possibilities.
3
-
4
- Naming conventions
5
- -----------------
6
-
7
- The filename uses a specific convention:
8
-
9
- params_*kind*_*level*.[yml|json]
10
-
11
- The kind is one of: [`current`|`user`|`system`] and defines which
12
- responsibility they will hold. The order is `current` overrides
13
- `user` overrides `system`.
14
-
15
- Inside file, keys have special meaning. They define how
16
- the overrides take place. We used the binary format
17
- to represent each possibilities.
18
-
19
- key = "1.1.1"
20
-
21
- Each element represent a specific kind. Read from left to
22
- right, they are assigned to `current`, `user` and `system`
23
- respectively.
24
-
25
- So,
26
-
27
- `current` `user` `system`
28
- 1 . 1 . 1
29
-
30
- A 1 signify that the file kind *column* will have a key "1.1.1" set
31
- to value *kind*. A 0 means the key is not set. With this in mind,
32
- it is easy to reason about the value that will need to be asserted
33
- for key "1.1.1" on level file *level*.
34
-
35
- # params_current_1.yml file
36
- "1.1.1": "current"
37
-
38
- # params_user_1.yml file
39
- "1.1.1": "user"
40
-
41
- # params_system_1.yml file
42
- "1.1.1": "system"
43
-
44
- # Value to assert
45
- assert("current", parameters.get("1.1.1"))
46
-
47
- With the help of params_combinations, it is easy to create test file
48
- either for other formats or for more level. Copy the all keys expect
49
- "0.0.0" to the file. Say the file is of kind `current`, then for
50
- column `current`, each time a one is there, replace `base` by the
51
- kind (here `current`). The line that still have value base as the
52
- value must be deleted.
1
+ This readme give information on how to read resources file
2
+ that test merge possibilities.
3
+
4
+ Naming conventions
5
+ -----------------
6
+
7
+ The filename uses a specific convention:
8
+
9
+ params_*kind*_*level*.[yml|json]
10
+
11
+ The kind is one of: [`current`|`user`|`system`] and defines which
12
+ responsibility they will hold. The order is `current` overrides
13
+ `user` overrides `system`.
14
+
15
+ Inside file, keys have special meaning. They define how
16
+ the overrides take place. We used the binary format
17
+ to represent each possibilities.
18
+
19
+ key = "1.1.1"
20
+
21
+ Each element represent a specific kind. Read from left to
22
+ right, they are assigned to `current`, `user` and `system`
23
+ respectively.
24
+
25
+ So,
26
+
27
+ `current` `user` `system`
28
+ 1 . 1 . 1
29
+
30
+ A 1 signify that the file kind *column* will have a key "1.1.1" set
31
+ to value *kind*. A 0 means the key is not set. With this in mind,
32
+ it is easy to reason about the value that will need to be asserted
33
+ for key "1.1.1" on level file *level*.
34
+
35
+ # params_current_1.yml file
36
+ "1.1.1": "current"
37
+
38
+ # params_user_1.yml file
39
+ "1.1.1": "user"
40
+
41
+ # params_system_1.yml file
42
+ "1.1.1": "system"
43
+
44
+ # Value to assert
45
+ assert("current", parameters.get("1.1.1"))
46
+
47
+ With the help of params_combinations, it is easy to create test file
48
+ either for other formats or for more level. Copy the all keys expect
49
+ "0.0.0" to the file. Say the file is of kind `current`, then for
50
+ column `current`, each time a one is there, replace `base` by the
51
+ kind (here `current`). The line that still have value base as the
52
+ value must be deleted.
@@ -1,6 +1,6 @@
1
- {
2
- "1.1.1": "current",
3
- "1.1.0": "current",
4
- "1.0.1": "current",
5
- "1.0.0": "current"
6
- }
1
+ {
2
+ "1.1.1": "current",
3
+ "1.1.0": "current",
4
+ "1.0.1": "current",
5
+ "1.0.0": "current"
6
+ }
@@ -1,29 +1,29 @@
1
- {
2
- "1.1.1": {
3
- "1.1.1": "current",
4
- "1.1.0": "current",
5
- "1.0.1": "current",
6
- "1.0.0": "current"
7
- },
8
-
9
- "1.1.0": {
10
- "1.1.1": "current",
11
- "1.1.0": "current",
12
- "1.0.1": "current",
13
- "1.0.0": "current"
14
- },
15
-
16
- "1.0.1": {
17
- "1.1.1": "current",
18
- "1.1.0": "current",
19
- "1.0.1": "current",
20
- "1.0.0": "current"
21
- },
22
-
23
- "1.0.0": {
24
- "1.1.1": "current",
25
- "1.1.0": "current",
26
- "1.0.1": "current",
27
- "1.0.0": "current"
28
- }
29
- }
1
+ {
2
+ "1.1.1": {
3
+ "1.1.1": "current",
4
+ "1.1.0": "current",
5
+ "1.0.1": "current",
6
+ "1.0.0": "current"
7
+ },
8
+
9
+ "1.1.0": {
10
+ "1.1.1": "current",
11
+ "1.1.0": "current",
12
+ "1.0.1": "current",
13
+ "1.0.0": "current"
14
+ },
15
+
16
+ "1.0.1": {
17
+ "1.1.1": "current",
18
+ "1.1.0": "current",
19
+ "1.0.1": "current",
20
+ "1.0.0": "current"
21
+ },
22
+
23
+ "1.0.0": {
24
+ "1.1.1": "current",
25
+ "1.1.0": "current",
26
+ "1.0.1": "current",
27
+ "1.0.0": "current"
28
+ }
29
+ }
@@ -1,9 +1,9 @@
1
- {
2
- "nil": null,
3
- "deep": {
4
- "nil": null,
5
- "deeper": {
6
- "nil": null
7
- }
8
- }
9
- }
1
+ {
2
+ "nil": null,
3
+ "deep": {
4
+ "nil": null,
5
+ "deeper": {
6
+ "nil": null
7
+ }
8
+ }
9
+ }
@@ -1,13 +1,13 @@
1
- Vagrant.configure("2") do |config|
2
- config.user.auto_export = [:autoenv, :script]
3
-
4
- config.user.defaults = {
5
- 'local' => {
6
- 'first' => "value1",
7
- },
8
- }
9
-
10
- #config.vm.box = "opscode_centos-7.0_x86-64"
11
-
12
- raise "You need to define `config.vm.box` for this test"
13
- end
1
+ Vagrant.configure("2") do |config|
2
+ config.user.auto_export = [:autoenv, :script]
3
+
4
+ config.user.defaults = {
5
+ 'local' => {
6
+ 'first' => "value1",
7
+ },
8
+ }
9
+
10
+ #config.vm.box = "opscode_centos-7.0_x86-64"
11
+
12
+ raise "You need to define `config.vm.box` for this test"
13
+ end
@@ -1,15 +1,15 @@
1
- Vagrant.configure("2") do |config|
2
- config.user.defaults = {
3
- nodes: [
4
- {ip: '192.168.100.10'},
5
- {ip: '192.168.100.11'}
6
- ]
7
- }
8
-
9
- config.user.nodes.each_with_index do |node, index|
10
- puts "Node ##{index}, string: #{node['ip']}"
11
- puts "Node ##{index}, symbol: #{node[:ip]}"
12
- puts "Node ##{index}, method: #{node.ip}"
13
- puts ""
14
- end
15
- end
1
+ Vagrant.configure("2") do |config|
2
+ config.user.defaults = {
3
+ nodes: [
4
+ {ip: '192.168.100.10'},
5
+ {ip: '192.168.100.11'}
6
+ ]
7
+ }
8
+
9
+ config.user.nodes.each_with_index do |node, index|
10
+ puts "Node ##{index}, string: #{node['ip']}"
11
+ puts "Node ##{index}, symbol: #{node[:ip]}"
12
+ puts "Node ##{index}, method: #{node.ip}"
13
+ puts ""
14
+ end
15
+ end
@@ -1,18 +1,18 @@
1
- Vagrant.configure("2") do |config|
2
- config.user.defaults = {
3
- 'single' => 1,
4
- :local => {
5
- 'first' => "value1",
6
- :second => "value2"
7
- }
8
- }
9
-
10
- puts config.user.single
11
- puts config.user[:single]
12
-
13
- puts config.user.local.first
14
- puts config.user[:local]["first"]
15
-
16
- puts config.user.local.second
17
- puts config.user["local"][:second]
18
- end
1
+ Vagrant.configure("2") do |config|
2
+ config.user.defaults = {
3
+ 'single' => 1,
4
+ :local => {
5
+ 'first' => "value1",
6
+ :second => "value2"
7
+ }
8
+ }
9
+
10
+ puts config.user.single
11
+ puts config.user[:single]
12
+
13
+ puts config.user.local.first
14
+ puts config.user[:local]["first"]
15
+
16
+ puts config.user.local.second
17
+ puts config.user["local"][:second]
18
+ end
@@ -1,23 +1,23 @@
1
- # Source from https://github.com/maoueh/nugrant/issues/12#issuecomment-27054150
2
- # but slightly modified
3
- Vagrant.configure('2') do |config|
4
- config.user.defaults = {
5
- "host" => {
6
- "rails_server_port" => 3000,
7
- "apps_folder" => "../../rails-apps/" },
8
- "plugins" => {
9
- "vagrant_cachier" => {
10
- "enabled" => false
11
- }
12
- }
13
- }
14
-
15
- puts "Host Rails Server Port: #{config.user.host.rails_server_port}"
16
- puts "Host App Folder: #{config.user.host.apps_folder}"
17
- puts "Gitconfig Name: #{config.user.gitconfig.name}"
18
- puts "Gitconfig Email: #{config.user.gitconfig.email}"
19
-
20
- if config.user.plugins.vagrant_cachier.enabled
21
- puts "Vagrant Cachier is Enabled!"
22
- end
23
- end
1
+ # Source from https://github.com/maoueh/nugrant/issues/12#issuecomment-27054150
2
+ # but slightly modified
3
+ Vagrant.configure('2') do |config|
4
+ config.user.defaults = {
5
+ "host" => {
6
+ "rails_server_port" => 3000,
7
+ "apps_folder" => "../../rails-apps/" },
8
+ "plugins" => {
9
+ "vagrant_cachier" => {
10
+ "enabled" => false
11
+ }
12
+ }
13
+ }
14
+
15
+ puts "Host Rails Server Port: #{config.user.host.rails_server_port}"
16
+ puts "Host App Folder: #{config.user.host.apps_folder}"
17
+ puts "Gitconfig Name: #{config.user.gitconfig.name}"
18
+ puts "Gitconfig Email: #{config.user.gitconfig.email}"
19
+
20
+ if config.user.plugins.vagrant_cachier.enabled
21
+ puts "Vagrant Cachier is Enabled!"
22
+ end
23
+ end
@@ -1,18 +1,18 @@
1
- Vagrant.configure("2") do |config|
2
- config.user.defaults = {
3
- 'single' => 1,
4
- 'local' => {
5
- 'first' => "value1",
6
- 'second' => "value2"
7
- }
8
- }
9
-
10
- puts config.user.single
11
- puts config.user[:single]
12
-
13
- puts config.user.local.first
14
- puts config.user[:local]["first"]
15
-
16
- puts config.user.local.second
17
- puts config.user["local"][:second]
18
- end
1
+ Vagrant.configure("2") do |config|
2
+ config.user.defaults = {
3
+ 'single' => 1,
4
+ 'local' => {
5
+ 'first' => "value1",
6
+ 'second' => "value2"
7
+ }
8
+ }
9
+
10
+ puts config.user.single
11
+ puts config.user[:single]
12
+
13
+ puts config.user.local.first
14
+ puts config.user[:local]["first"]
15
+
16
+ puts config.user.local.second
17
+ puts config.user["local"][:second]
18
+ end
@@ -1,18 +1,18 @@
1
- Vagrant.configure("2") do |config|
2
- config.user.defaults = {
3
- :single => 1,
4
- :local => {
5
- :first => "value1",
6
- :second => "value2"
7
- }
8
- }
9
-
10
- puts config.user.single
11
- puts config.user[:single]
12
-
13
- puts config.user.local.first
14
- puts config.user[:local]["first"]
15
-
16
- puts config.user.local.second
17
- puts config.user["local"][:second]
18
- end
1
+ Vagrant.configure("2") do |config|
2
+ config.user.defaults = {
3
+ :single => 1,
4
+ :local => {
5
+ :first => "value1",
6
+ :second => "value2"
7
+ }
8
+ }
9
+
10
+ puts config.user.single
11
+ puts config.user[:single]
12
+
13
+ puts config.user.local.first
14
+ puts config.user[:local]["first"]
15
+
16
+ puts config.user.local.second
17
+ puts config.user["local"][:second]
18
+ end
@@ -1,2 +1,2 @@
1
- Vagrant.configure("2") do |config|
2
- end
1
+ Vagrant.configure("2") do |config|
2
+ end
@@ -1,29 +1,29 @@
1
- Vagrant.configure("2") do |config|
2
- config.user.defaults = {
3
- 'local' => {
4
- 'first' => "value1",
5
- },
6
- 'array' => {
7
- 'level1' => [1, 2]
8
- },
9
- 'application' => {
10
- 'users' => {
11
- "joe" => {
12
- :full => "Joe Plumber"
13
- },
14
- "jane" => {
15
- :full => "Jane Cook"
16
- },
17
- }
18
- }
19
- }
20
-
21
- config.user.application.users.each do |key, data|
22
- puts "Key #{key}: #{data}"
23
- end
24
-
25
- config.user.array_merge_strategy = :concat
26
- config.user.auto_export = [:autoenv, :script]
27
-
28
- config.vm.box = "opscode_centos-7.0_x86-64"
29
- end
1
+ Vagrant.configure("2") do |config|
2
+ config.user.defaults = {
3
+ 'local' => {
4
+ 'first' => "value1",
5
+ },
6
+ 'array' => {
7
+ 'level1' => [1, 2]
8
+ },
9
+ 'application' => {
10
+ 'users' => {
11
+ "joe" => {
12
+ :full => "Joe Plumber"
13
+ },
14
+ "jane" => {
15
+ :full => "Jane Cook"
16
+ },
17
+ }
18
+ }
19
+ }
20
+
21
+ config.user.application.users.each do |key, data|
22
+ puts "Key #{key}: #{data}"
23
+ end
24
+
25
+ config.user.array_merge_strategy = :concat
26
+ config.user.auto_export = [:autoenv, :script]
27
+
28
+ config.vm.box = "opscode_centos-7.0_x86-64"
29
+ end
@@ -1,3 +1,3 @@
1
- Vagrant.configure("2") do |config|
2
- puts config.user.unkown_for_sure
3
- end
1
+ Vagrant.configure("2") do |config|
2
+ puts config.user.unkown_for_sure
3
+ end
@@ -1,22 +1,22 @@
1
- Vagrant.configure("2") do |config|
2
- config.vm.box = "base"
3
- config.vm.box_url = "http://domain.com/path/to/above.box"
4
-
5
- config.vm.network :forwarded_port, guest: 80, host: 8080
6
- config.vm.network :private_network, ip: "10.0.0.2"
7
-
8
- config.vm.synced_folder "C:/Users/Matt/nugrant", "/vagrant_data"
9
-
10
- config.vm.provider :virtualbox do |virtualbox|
11
- virtualbox.customize ["modifyvm", :id, "--memory", "256"]
12
- end
13
-
14
- config.vm.provision :chef_solo do |chef|
15
- chef.cookbooks_path = "C:\Users\Matt\Work\kitchen\cookbooks"
16
- chef.roles_path = "C:\Users\Matt\Work\kitchen\roles"
17
- chef.nodes_path = "C:\Users\Matt\Work\kitchen\nodes"
18
-
19
- chef.add_recipe "mysql"
20
- chef.add_role "web"
21
- end
22
- end
1
+ Vagrant.configure("2") do |config|
2
+ config.vm.box = "base"
3
+ config.vm.box_url = "http://domain.com/path/to/above.box"
4
+
5
+ config.vm.network :forwarded_port, guest: 80, host: 8080
6
+ config.vm.network :private_network, ip: "10.0.0.2"
7
+
8
+ config.vm.synced_folder "C:/Users/Matt/nugrant", "/vagrant_data"
9
+
10
+ config.vm.provider :virtualbox do |virtualbox|
11
+ virtualbox.customize ["modifyvm", :id, "--memory", "256"]
12
+ end
13
+
14
+ config.vm.provision :chef_solo do |chef|
15
+ chef.cookbooks_path = "C:\Users\Matt\Work\kitchen\cookbooks"
16
+ chef.roles_path = "C:\Users\Matt\Work\kitchen\roles"
17
+ chef.nodes_path = "C:\Users\Matt\Work\kitchen\nodes"
18
+
19
+ chef.add_recipe "mysql"
20
+ chef.add_role "web"
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
- level1:
2
- level2:
3
- - "1"
4
- - "2"
5
- - "3"
1
+ level1:
2
+ level2:
3
+ - "1"
4
+ - "2"
5
+ - "3"
@@ -1 +1 @@
1
- false
1
+ false