nugrant 2.1.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16c6ab3c8e5e927d721709d9ef50c994386f71be
4
- data.tar.gz: 5b07b32caedb79df6a879906c302a1512baaccaa
3
+ metadata.gz: 36479d2a076b5dfd5f938969edcdc48f12ea9501
4
+ data.tar.gz: 162d0feefe4e742beeef2561187335ef313d79cd
5
5
  SHA512:
6
- metadata.gz: 008a2bf813159fd4676e722658aa817589284092d437269501b7316aea71c927cecb5268935b9614b3c6ef152324c2a9e880216670fbe4afc95e77d762abe5c0
7
- data.tar.gz: 159c9c629ae3e3db4c6ecbf79754a4108a1fb5e5df51109d33908e1f893c1413d7dbfd40530623cd70c14089fe4cc412f2b1cc427bd04325ada59fe56b984bf8
6
+ metadata.gz: 0b5d3e769d89e6f527b39aa90696c19c1425a4058c08378dc89f6da33927599d1ce2566b883a012c185c6559b99575abe64863b2b9cf339752cbf72272284841
7
+ data.tar.gz: 96f6cb2405b5ea6a8a501662f3c36e78d6d9285fbf4b28ba834fff8fa9e7f22ce878cf96c5b4d194fd565ccd6d00c7583c4e97b482409502c4c84c4f4df54b3e
@@ -1,9 +1,10 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - "1.9.3"
5
- - "2.0.0"
6
- - "2.1.0"
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1
7
7
 
8
- before_install:
9
- - gem install bundler -v '= 1.6.7'
8
+ bundler_args: --without doc guard --jobs 7
9
+
10
+ script: bundle exec rake
@@ -1,3 +1,23 @@
1
+ # 2.1.1 (December 2nd, 2014)
2
+
3
+ * Permit numeric keys in bag. They are converted to symbol
4
+ like others.
5
+
6
+ Fixes [issue #26](https://github.com/maoueh/nugrant/issues/26) again.
7
+
8
+ * Removed old code that was switching YAML engine to `syck` when
9
+ it was available.
10
+
11
+ Fixes [issue #14](https://github.com/maoueh/nugrant/issues/14) again.
12
+
13
+ * Fixed auto export variables on `vagrant provision` feature. The
14
+ initial release is not working correctly.
15
+
16
+ * Changed how module shortcut is defined. The shortcut is now defined
17
+ inside the class using it to avoid already defined warnings.
18
+
19
+ Fixes [issue #24](https://github.com/maoueh/nugrant/issues/24).
20
+
1
21
  # 2.1.0 (November 1st, 2014)
2
22
 
3
23
  * Added possibility to specify the script path where to generate
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ group :development do
5
5
  gem "minitest", "~> 5.3"
6
6
  gem "minitest-reporters", "~> 1.0"
7
7
 
8
- gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :tag => "v1.6.2"
8
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :branch => "master"
9
9
  end
10
10
 
11
11
  group :plugins do
@@ -166,8 +166,9 @@ module Nugrant
166
166
  private
167
167
 
168
168
  def __convert_key(key)
169
- return key.to_sym() if key.respond_to?(:to_sym)
169
+ return key.to_s().to_sym() if !key.nil? && key.respond_to?(:to_s)
170
170
 
171
+ raise ArgumentError, "Key cannot be nil" if key.nil?
171
172
  raise ArgumentError, "Key cannot be converted to symbol, current value [#{key}] (#{key.class.name})"
172
173
  end
173
174
 
@@ -31,8 +31,6 @@ module Nugrant
31
31
  end
32
32
 
33
33
  def self.parse_yaml(io)
34
- YAML::ENGINE.yamler = 'syck' if (defined?(Syck) || defined?(YAML::Syck)) && defined?(YAML::ENGINE)
35
-
36
34
  YAML.load(io.read())
37
35
  end
38
36
  end
@@ -2,12 +2,12 @@ require 'nugrant'
2
2
  require 'nugrant/helper/env/exporter'
3
3
  require 'nugrant/parameters'
4
4
 
5
- EnvExporter = Nugrant::Helper::Env::Exporter
6
-
7
5
  module Nugrant
8
6
  module Vagrant
9
7
  module V2
10
8
  module Action
9
+ EnvExporter = Nugrant::Helper::Env::Exporter
10
+
11
11
  class AutoExport
12
12
  def initialize(app, env)
13
13
  @app = app
@@ -24,16 +24,16 @@ module Nugrant
24
24
 
25
25
  Array(@config.user.auto_export).each do |exporter|
26
26
  if exporter == :terminal or not EnvExporter.valid?(exporter)
27
- env[:ui].warn("ERROR: Invalid config.user.auto_export value '#{format}'", :prefix => false)
27
+ env[:ui].warn("ERROR: Invalid config.user.auto_export value '#{exporter}'", :prefix => false)
28
28
  next
29
29
  end
30
30
 
31
- env[:ui].info("Configuration exported '#{format}'", :prefix => false)
31
+ env[:ui].info("Configuration exported '#{exporter}'", :prefix => false)
32
32
 
33
33
  case
34
- when format == :script
34
+ when exporter == :script
35
35
  EnvExporter.script_exporter(@config.user.__all, options)
36
- when format == :autoenv
36
+ when exporter == :autoenv
37
37
  EnvExporter.autoenv_exporter(@config.user.__all, options)
38
38
  end
39
39
  end
@@ -2,13 +2,13 @@ require 'nugrant'
2
2
  require 'nugrant/helper/env/exporter'
3
3
  require 'nugrant/parameters'
4
4
 
5
- EnvExporter = Nugrant::Helper::Env::Exporter
6
-
7
5
  module Nugrant
8
6
  module Vagrant
9
7
  module V2
10
8
  module Command
11
9
  class Env < ::Vagrant.plugin("2", :command)
10
+ EnvExporter = Nugrant::Helper::Env::Exporter
11
+
12
12
  def self.synopsis
13
13
  "env utilities to export config.user as environment variables in host machine"
14
14
  end
@@ -34,13 +34,6 @@ module Nugrant
34
34
  "Changing the format will also change where they are displayed.\n"
35
35
  parser.separator ""
36
36
 
37
- parser.separator "Available formats:"
38
- parser.separator " autoenv => Write commands to a file named `.env` in the current directory.\n" +
39
- " See https://github.com/kennethreitz/autoenv for more info."
40
- parser.separator " terminal => Display commands to terminal so they can be sourced."
41
- parser.separator " script => Write commands to a bash script named `nugrant2env.sh` so it can be sourced."
42
- parser.separator ""
43
-
44
37
  parser.separator "Available options:"
45
38
  parser.separator ""
46
39
 
@@ -59,6 +52,14 @@ module Nugrant
59
52
  parser.on("-h", "--help", "Prints this help") do
60
53
  @show_help = true
61
54
  end
55
+
56
+ parser.separator ""
57
+ parser.separator "Available formats:"
58
+ parser.separator " autoenv Write commands to a file named `.env` in the current directory."
59
+ parser.separator " See https://github.com/kennethreitz/autoenv for more info."
60
+ parser.separator " terminal Write commands to terminal so they can be sourced."
61
+ parser.separator " script Write commands to a bash script named `nugrant2env.sh` so it can be sourced."
62
+ parser.separator ""
62
63
  end
63
64
  end
64
65
 
@@ -1,3 +1,3 @@
1
1
  module Nugrant
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -214,6 +214,12 @@ module Nugrant
214
214
  end
215
215
  end
216
216
 
217
+ def test_numeric_keys_converted_to_string
218
+ bag1 = create_bag({1 => "value1"})
219
+
220
+ assert_all_access_equal("value1", bag1, :'1')
221
+ end
222
+
217
223
  def test_custom_key_error_handler
218
224
  bag = create_bag({:value => "one"}, :key_error => Proc.new do |key|
219
225
  raise IndexError
@@ -11,10 +11,10 @@ module Nugrant
11
11
  @@INVALID_PATH = "impossible_file_path.yamljson.impossible"
12
12
 
13
13
  def create_parameters(format, current_filename, user_filename, system_filename, defaults = {}, options = {})
14
- extension = case
15
- when format = :json
14
+ extension = case format
15
+ when :json
16
16
  "json"
17
- when format = :yaml
17
+ when :yml, :yaml
18
18
  "yml"
19
19
  else
20
20
  raise ArgumentError, "Format [#{format}] is currently not supported"
@@ -419,6 +419,12 @@ module Nugrant
419
419
  assert_equal(["1", "2", "3", "3", "6", "7"], parameters3.level1.level2)
420
420
  end
421
421
 
422
+ def test_numeric_key_in_yaml_converted_to_symbol()
423
+ parameters = create_parameters(:yaml, "params_numeric_key", invalid_path, invalid_path)
424
+
425
+ assert_equal("value1", parameters.servers[:'1'])
426
+ end
427
+
422
428
  def formats()
423
429
  @@FORMATS
424
430
  end
@@ -0,0 +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 +1 @@
1
- true
1
+ false
@@ -0,0 +1,3 @@
1
+ servers:
2
+ 1: "value1"
3
+ 2: "value2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nugrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu Vachon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-01 00:00:00.000000000 Z
11
+ date: 2014-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -103,6 +103,7 @@ files:
103
103
  - test/resources/json/params_user_2.json
104
104
  - test/resources/json/params_user_nil_values.json
105
105
  - test/resources/json/params_windows_eol.json
106
+ - test/resources/vagrantfiles/v2.auto_export
106
107
  - test/resources/vagrantfiles/v2.defaults_mixed_string_symbols
107
108
  - test/resources/vagrantfiles/v2.defaults_null_values_in_vagrantuser
108
109
  - test/resources/vagrantfiles/v2.defaults_using_string
@@ -120,6 +121,7 @@ files:
120
121
  - test/resources/yaml/params_defaults_not_at_root.yml
121
122
  - test/resources/yaml/params_empty.yml
122
123
  - test/resources/yaml/params_list.yml
124
+ - test/resources/yaml/params_numeric_key.yml
123
125
  - test/resources/yaml/params_simple.yml
124
126
  - test/resources/yaml/params_system_1.yml
125
127
  - test/resources/yaml/params_system_2.yml