hiera 3.3.1 → 3.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/hiera.rb CHANGED
@@ -5,6 +5,7 @@ class Hiera
5
5
  require "hiera/version"
6
6
  require "hiera/config"
7
7
  require "hiera/util"
8
+ require "hiera/util/win32"
8
9
  require "hiera/backend"
9
10
  require "hiera/console_logger"
10
11
  require "hiera/puppet_logger"
data/lib/hiera/util.rb CHANGED
@@ -13,15 +13,7 @@ class Hiera
13
13
  end
14
14
 
15
15
  def microsoft_windows?
16
- return false unless file_alt_separator
17
-
18
- begin
19
- require 'win32/dir'
20
- true
21
- rescue LoadError => err
22
- warn "Cannot run on Microsoft Windows without the win32-dir gem: #{err}"
23
- false
24
- end
16
+ !!file_alt_separator
25
17
  end
26
18
 
27
19
  def config_dir
@@ -49,7 +41,7 @@ class Hiera
49
41
  end
50
42
 
51
43
  def common_appdata
52
- Dir::COMMON_APPDATA
44
+ @common_appdata ||= Hiera::Util::Win32.get_common_appdata()
53
45
  end
54
46
 
55
47
  def split_key(key)
@@ -0,0 +1,40 @@
1
+ class Hiera
2
+ module Util
3
+ module Win32
4
+ if !!File::ALT_SEPARATOR
5
+ require 'fiddle/import'
6
+ require 'fiddle/types'
7
+
8
+ # import, dlload, include and typealias must be ordered this way
9
+ extend Fiddle::Importer
10
+ dlload 'shell32'
11
+ include Fiddle::Win32Types # adds HWND, HANDLE, DWORD type aliases
12
+ typealias 'LPWSTR', 'wchar_t*'
13
+ typealias 'LONG', 'long'
14
+ typealias 'HRESULT','LONG'
15
+
16
+ # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
17
+ # HRESULT SHGetFolderPath(
18
+ # _In_ HWND hwndOwner,
19
+ # _In_ int nFolder,
20
+ # _In_ HANDLE hToken,
21
+ # _In_ DWORD dwFlags,
22
+ # _Out_ LPTSTR pszPath
23
+ # );
24
+ extern 'HRESULT SHGetFolderPathW(HWND, int, HANDLE, DWORD, LPWSTR)'
25
+
26
+ COMMON_APPDATA = 0x0023
27
+ S_OK = 0x0
28
+ MAX_PATH = 260;
29
+
30
+ def self.get_common_appdata
31
+ # null terminated MAX_PATH string in wchar (i.e. 2 bytes per char)
32
+ buffer = 0.chr * ((MAX_PATH + 1) * 2)
33
+ result = SHGetFolderPathW(0, COMMON_APPDATA, 0, 0, buffer)
34
+ raise "Could not find COMMON_APPDATA path - HRESULT: #{result}" unless result == S_OK
35
+ buffer.force_encoding(Encoding::UTF_16LE).encode(Encoding::UTF_8).strip
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
data/lib/hiera/version.rb CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  class Hiera
10
- VERSION = "3.3.1"
10
+ VERSION = "3.3.3"
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
data/spec/spec_helper.rb CHANGED
@@ -9,13 +9,6 @@ require 'tmpdir'
9
9
  RSpec.configure do |config|
10
10
  config.mock_with :mocha
11
11
 
12
- if Hiera::Util.microsoft_windows? && RUBY_VERSION =~ /^1\./
13
- require 'win32console'
14
- config.output_stream = $stdout
15
- config.error_stream = $stderr
16
- config.formatters.each { |f| f.instance_variable_set(:@output, $stdout) }
17
- end
18
-
19
12
  config.after :suite do
20
13
  # Log the spec order to a file, but only if the LOG_SPEC_ORDER environment variable is
21
14
  # set. This should be enabled on Jenkins runs, as it can be used with Nick L.'s bisect
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.3.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Puppet Labs
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
12
+ date: 2018-04-09 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: A pluggable data store for hierarcical data
14
15
  email: info@puppetlabs.com
@@ -18,105 +19,107 @@ extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
21
  - bin/hiera
21
- - lib/hiera/backend.rb
22
- - lib/hiera/backend/json_backend.rb
23
- - lib/hiera/backend/yaml_backend.rb
24
- - lib/hiera/config.rb
25
- - lib/hiera/console_logger.rb
22
+ - lib/hiera/version.rb
23
+ - lib/hiera/noop_logger.rb
26
24
  - lib/hiera/error.rb
25
+ - lib/hiera/util/win32.rb
27
26
  - lib/hiera/fallback_logger.rb
27
+ - lib/hiera/recursive_guard.rb
28
+ - lib/hiera/backend/yaml_backend.rb
29
+ - lib/hiera/backend/json_backend.rb
30
+ - lib/hiera/config.rb
28
31
  - lib/hiera/filecache.rb
29
32
  - lib/hiera/interpolate.rb
30
- - lib/hiera/noop_logger.rb
33
+ - lib/hiera/console_logger.rb
31
34
  - lib/hiera/puppet_logger.rb
32
- - lib/hiera/recursive_guard.rb
33
35
  - lib/hiera/util.rb
34
- - lib/hiera/version.rb
36
+ - lib/hiera/backend.rb
35
37
  - lib/hiera.rb
36
38
  - COPYING
37
39
  - README.md
38
40
  - LICENSE
39
- - spec/spec_helper.rb
40
- - spec/unit/backend/json_backend_spec.rb
41
- - spec/unit/backend/yaml_backend_spec.rb
42
- - spec/unit/backend_spec.rb
43
- - spec/unit/config_spec.rb
44
- - spec/unit/console_logger_spec.rb
45
- - spec/unit/fallback_logger_spec.rb
46
- - spec/unit/filecache_spec.rb
47
- - spec/unit/fixtures/badconfig/config/hiera.yaml
48
- - spec/unit/fixtures/badconfig/data/common.yaml
49
- - spec/unit/fixtures/interpolate/config/hiera.yaml
41
+ - spec/unit/interpolate_spec.rb
42
+ - spec/unit/fixtures/override/config/hiera.yaml
43
+ - spec/unit/fixtures/override/data/alternate.yaml
44
+ - spec/unit/fixtures/override/data/common.yaml
50
45
  - spec/unit/fixtures/interpolate/config/hiera_iplm_hiera.yaml
51
46
  - spec/unit/fixtures/interpolate/config/hiera_iplm_hiera_bad.yaml
52
- - spec/unit/fixtures/interpolate/data/bad_interpolation.yaml
47
+ - spec/unit/fixtures/interpolate/config/hiera.yaml
48
+ - spec/unit/fixtures/interpolate/data/niltest.yaml
53
49
  - spec/unit/fixtures/interpolate/data/complex.yaml
54
- - spec/unit/fixtures/interpolate/data/dotted_keys.yaml
55
- - spec/unit/fixtures/interpolate/data/empty_interpolation.yaml
56
50
  - spec/unit/fixtures/interpolate/data/frontend.json
57
- - spec/unit/fixtures/interpolate/data/niltest.yaml
58
- - spec/unit/fixtures/interpolate/data/recursive.yaml
59
51
  - spec/unit/fixtures/interpolate/data/role.json
52
+ - spec/unit/fixtures/interpolate/data/bad_interpolation.yaml
53
+ - spec/unit/fixtures/interpolate/data/dotted_keys.yaml
60
54
  - spec/unit/fixtures/interpolate/data/weird_keys.yaml
61
- - spec/unit/fixtures/override/config/hiera.yaml
62
- - spec/unit/fixtures/override/data/alternate.yaml
63
- - spec/unit/fixtures/override/data/common.yaml
64
- - spec/unit/hiera_spec.rb
65
- - spec/unit/interpolate_spec.rb
55
+ - spec/unit/fixtures/interpolate/data/empty_interpolation.yaml
56
+ - spec/unit/fixtures/interpolate/data/recursive.yaml
57
+ - spec/unit/fixtures/badconfig/config/hiera.yaml
58
+ - spec/unit/fixtures/badconfig/data/common.yaml
59
+ - spec/unit/backend_spec.rb
60
+ - spec/unit/filecache_spec.rb
61
+ - spec/unit/config_spec.rb
62
+ - spec/unit/backend/yaml_backend_spec.rb
63
+ - spec/unit/backend/json_backend_spec.rb
66
64
  - spec/unit/puppet_logger_spec.rb
67
- - spec/unit/util_spec.rb
65
+ - spec/unit/console_logger_spec.rb
68
66
  - spec/unit/version_spec.rb
67
+ - spec/unit/fallback_logger_spec.rb
68
+ - spec/unit/util_spec.rb
69
+ - spec/unit/hiera_spec.rb
70
+ - spec/spec_helper.rb
69
71
  homepage: https://github.com/puppetlabs/hiera
70
72
  licenses: []
71
- metadata: {}
72
73
  post_install_message:
73
74
  rdoc_options: []
74
75
  require_paths:
75
76
  - lib
76
77
  required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
77
79
  requirements:
78
- - - '>='
80
+ - - ! '>='
79
81
  - !ruby/object:Gem::Version
80
82
  version: '0'
81
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
82
85
  requirements:
83
- - - '>='
86
+ - - ! '>='
84
87
  - !ruby/object:Gem::Version
85
88
  version: '0'
86
89
  requirements: []
87
90
  rubyforge_project:
88
- rubygems_version: 2.0.14
91
+ rubygems_version: 1.8.23
89
92
  signing_key:
90
- specification_version: 4
93
+ specification_version: 3
91
94
  summary: Light weight hierarchical data store
92
95
  test_files:
93
- - spec/spec_helper.rb
94
- - spec/unit/backend/json_backend_spec.rb
95
- - spec/unit/backend/yaml_backend_spec.rb
96
- - spec/unit/backend_spec.rb
97
- - spec/unit/config_spec.rb
98
- - spec/unit/console_logger_spec.rb
99
- - spec/unit/fallback_logger_spec.rb
100
- - spec/unit/filecache_spec.rb
101
- - spec/unit/fixtures/badconfig/config/hiera.yaml
102
- - spec/unit/fixtures/badconfig/data/common.yaml
103
- - spec/unit/fixtures/interpolate/config/hiera.yaml
96
+ - spec/unit/interpolate_spec.rb
97
+ - spec/unit/fixtures/override/config/hiera.yaml
98
+ - spec/unit/fixtures/override/data/alternate.yaml
99
+ - spec/unit/fixtures/override/data/common.yaml
104
100
  - spec/unit/fixtures/interpolate/config/hiera_iplm_hiera.yaml
105
101
  - spec/unit/fixtures/interpolate/config/hiera_iplm_hiera_bad.yaml
106
- - spec/unit/fixtures/interpolate/data/bad_interpolation.yaml
102
+ - spec/unit/fixtures/interpolate/config/hiera.yaml
103
+ - spec/unit/fixtures/interpolate/data/niltest.yaml
107
104
  - spec/unit/fixtures/interpolate/data/complex.yaml
108
- - spec/unit/fixtures/interpolate/data/dotted_keys.yaml
109
- - spec/unit/fixtures/interpolate/data/empty_interpolation.yaml
110
105
  - spec/unit/fixtures/interpolate/data/frontend.json
111
- - spec/unit/fixtures/interpolate/data/niltest.yaml
112
- - spec/unit/fixtures/interpolate/data/recursive.yaml
113
106
  - spec/unit/fixtures/interpolate/data/role.json
107
+ - spec/unit/fixtures/interpolate/data/bad_interpolation.yaml
108
+ - spec/unit/fixtures/interpolate/data/dotted_keys.yaml
114
109
  - spec/unit/fixtures/interpolate/data/weird_keys.yaml
115
- - spec/unit/fixtures/override/config/hiera.yaml
116
- - spec/unit/fixtures/override/data/alternate.yaml
117
- - spec/unit/fixtures/override/data/common.yaml
118
- - spec/unit/hiera_spec.rb
119
- - spec/unit/interpolate_spec.rb
110
+ - spec/unit/fixtures/interpolate/data/empty_interpolation.yaml
111
+ - spec/unit/fixtures/interpolate/data/recursive.yaml
112
+ - spec/unit/fixtures/badconfig/config/hiera.yaml
113
+ - spec/unit/fixtures/badconfig/data/common.yaml
114
+ - spec/unit/backend_spec.rb
115
+ - spec/unit/filecache_spec.rb
116
+ - spec/unit/config_spec.rb
117
+ - spec/unit/backend/yaml_backend_spec.rb
118
+ - spec/unit/backend/json_backend_spec.rb
120
119
  - spec/unit/puppet_logger_spec.rb
121
- - spec/unit/util_spec.rb
120
+ - spec/unit/console_logger_spec.rb
122
121
  - spec/unit/version_spec.rb
122
+ - spec/unit/fallback_logger_spec.rb
123
+ - spec/unit/util_spec.rb
124
+ - spec/unit/hiera_spec.rb
125
+ - spec/spec_helper.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7c13650072ce82f7b941ac80e14c8a04c78e4b8e
4
- data.tar.gz: 374ab47d4d1cb6462246d61dc1c4e6235a29a4f0
5
- SHA512:
6
- metadata.gz: 0710bac409a578923260a095d31aa1bf355ee77e3ce4696973bd463a567a82551f5600bf92d2b081a32f2af10e2b505c4a26b7e187e82bc296774dd49268cd0d
7
- data.tar.gz: c0e7e3b8c6a8adbd8d30e850a29a8523d2b61f48f03af50768bf76d53445e442098e81b6256b87b3bbf7091200e9e271ef8ccbbd44f7a1628a57446f0884df62