chef-config 12.7.2 → 12.8.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.
@@ -1,26 +1,26 @@
1
- #
2
- # Copyright:: Copyright 2015-2016, Chef Software, Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- require "chef-config/windows"
19
- require "chef-config/logger"
20
-
21
- module ChefConfig
22
-
23
- class ConfigurationError < ArgumentError; end
24
- class InvalidPath < StandardError; end
25
-
26
- end
1
+ #
2
+ # Copyright:: Copyright 2015-2016, Chef Software, Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require "chef-config/windows"
19
+ require "chef-config/logger"
20
+
21
+ module ChefConfig
22
+
23
+ class ConfigurationError < ArgumentError; end
24
+ class InvalidPath < StandardError; end
25
+
26
+ end
@@ -1,59 +1,59 @@
1
- #
2
- # Copyright:: Copyright 2015-2016, Chef Software, Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- module ChefConfig
19
-
20
- # Implements enough of Logger's API that we can use it in place of a real
21
- # logger for `ChefConfig.logger`
22
- class NullLogger
23
-
24
- def <<(_msg)
25
- end
26
-
27
- def add(_severity, _message = nil, _progname = nil)
28
- end
29
-
30
- def debug(_progname = nil, &block)
31
- end
32
-
33
- def info(_progname = nil, &block)
34
- end
35
-
36
- def warn(_progname = nil, &block)
37
- end
38
-
39
- def deprecation(_progname = nil, &block)
40
- end
41
-
42
- def error(_progname = nil, &block)
43
- end
44
-
45
- def fatal(_progname = nil, &block)
46
- end
47
-
48
- end
49
-
50
- @logger = NullLogger.new
51
-
52
- def self.logger=(new_logger)
53
- @logger = new_logger
54
- end
55
-
56
- def self.logger
57
- @logger
58
- end
59
- end
1
+ #
2
+ # Copyright:: Copyright 2015-2016, Chef Software, Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ module ChefConfig
19
+
20
+ # Implements enough of Logger's API that we can use it in place of a real
21
+ # logger for `ChefConfig.logger`
22
+ class NullLogger
23
+
24
+ def <<(_msg)
25
+ end
26
+
27
+ def add(_severity, _message = nil, _progname = nil)
28
+ end
29
+
30
+ def debug(_progname = nil, &block)
31
+ end
32
+
33
+ def info(_progname = nil, &block)
34
+ end
35
+
36
+ def warn(_progname = nil, &block)
37
+ end
38
+
39
+ def deprecation(_progname = nil, &block)
40
+ end
41
+
42
+ def error(_progname = nil, &block)
43
+ end
44
+
45
+ def fatal(_progname = nil, &block)
46
+ end
47
+
48
+ end
49
+
50
+ @logger = NullLogger.new
51
+
52
+ def self.logger=(new_logger)
53
+ @logger = new_logger
54
+ end
55
+
56
+ def self.logger
57
+ @logger
58
+ end
59
+ end
@@ -0,0 +1,38 @@
1
+ #
2
+ # Copyright:: Copyright 2016, Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require "chef-config/path_helper"
18
+
19
+ module ChefConfig
20
+ module Mixin
21
+ module DotD
22
+ def load_dot_d(path)
23
+ dot_d_files =
24
+ begin
25
+ entries = Array.new
26
+ entries << Dir.glob(File.join(
27
+ ChefConfig::PathHelper.escape_glob_dir(path), "*.rb"))
28
+ entries.flatten.select do |entry|
29
+ File.file?(entry)
30
+ end
31
+ end
32
+ dot_d_files.sort.map do |conf|
33
+ apply_config(IO.read(conf), conf)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,222 +1,222 @@
1
- #
2
- # Author:: Kartik Null Cating-Subramanian (<ksubramanian@chef.io>)
3
- # Copyright:: Copyright 2015-2016, Chef, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "rake"
20
- require "rubygems"
21
- require "rubygems/package_task"
22
-
23
- module ChefConfig
24
- class PackageTask < Rake::TaskLib
25
-
26
- # Full path to root of top-level repository. All other files (like VERSION or
27
- # lib/<module_path>/version.rb are rooted at this path).
28
- attr_accessor :root_path
29
-
30
- # Name of the top-level module/library build built. This is used to define
31
- # the top level module which contains VERSION and MODULE_ROOT.
32
- attr_accessor :module_name
33
-
34
- # Should the generated version.rb be in a class or module? Default is false (module).
35
- attr_accessor :generate_version_class
36
-
37
- # Paths to the roots of any components that also support ChefPackageTask.
38
- # If relative paths are provided, they are rooted against root_path.
39
- attr_accessor :component_paths
40
-
41
- # This is the module name as it appears on the path "lib/module/".
42
- # e.g. for module_name "ChefDK", you'd want module_path to be "chef-dk".
43
- # The default is module_name but lower-cased.
44
- attr_writer :module_path
45
-
46
- def module_path
47
- @module_path || module_name.downcase
48
- end
49
-
50
- # Directory used to store package files and output that is generated.
51
- # This has the same meaning (or lack thereof) as package_dir in
52
- # rake/packagetask.
53
- attr_accessor :package_dir
54
-
55
- # Name of git remote used to push tags during a release. Default is origin.
56
- attr_accessor :git_remote
57
-
58
- def initialize(root_path = nil, module_name = nil)
59
- init(root_path, module_name)
60
- yield self if block_given?
61
- define unless root_path.nil? || module_name.nil?
62
- end
63
-
64
- def init(root_path, module_name)
65
- @root_path = root_path
66
- @module_name = module_name
67
- @component_paths = []
68
- @module_path = nil
69
- @package_dir = "pkg"
70
- @git_remote = "origin"
71
- @generate_version_class = false
72
- end
73
-
74
- def component_full_paths
75
- component_paths.map { |path| File.expand_path(path, root_path) }
76
- end
77
-
78
- def version_rb_path
79
- File.expand_path("lib/#{module_path}/version.rb", root_path)
80
- end
81
-
82
- def chef_root_path
83
- module_name == "Chef" ? root_path : File.dirname(root_path)
84
- end
85
-
86
- def version
87
- IO.read(File.join(chef_root_path, "VERSION")).strip
88
- end
89
-
90
- def full_package_dir
91
- File.expand_path(package_dir, root_path)
92
- end
93
-
94
- def class_or_module
95
- generate_version_class ? "class" : "module"
96
- end
97
-
98
- def with_clean_env(&block)
99
- if defined?(Bundler)
100
- Bundler.with_clean_env(&block)
101
- else
102
- block.call
103
- end
104
- end
105
-
106
- def define
107
- raise "Need to provide package root and module name" if root_path.nil? || module_name.nil?
108
-
109
- desc "Build Gems of component dependencies"
110
- task :package_components do
111
- component_full_paths.each do |component_path|
112
- Dir.chdir(component_path) do
113
- sh "rake package"
114
- end
115
- end
116
- end
117
-
118
- task :package => :package_components
119
-
120
- desc "Build and install component dependencies"
121
- task :install_components => :package_components do
122
- component_full_paths.each do |component_path|
123
- Dir.chdir(component_path) do
124
- sh "rake install"
125
- end
126
- end
127
- end
128
-
129
- task :install => :install_components
130
-
131
- desc "Clean up builds of component dependencies"
132
- task :clobber_component_packages do
133
- component_full_paths.each do |component_path|
134
- Dir.chdir(component_path) do
135
- sh "rake clobber_package"
136
- end
137
- end
138
- end
139
-
140
- task :clobber_package => :clobber_component_packages
141
-
142
- desc "Update the version number for component dependencies"
143
- task :update_components_versions do
144
- component_full_paths.each do |component_path|
145
- Dir.chdir(component_path) do
146
- sh "rake version"
147
- end
148
- end
149
- end
150
-
151
- desc 'Regenerate lib/#{@module_path}/version.rb from VERSION file'
152
- task :version => :update_components_versions do
153
- contents = <<-VERSION_RB
154
- # Copyright:: Copyright 2010-2016, Chef Software, Inc.
155
- # License:: Apache License, Version 2.0
156
- #
157
- # Licensed under the Apache License, Version 2.0 (the "License");
158
- # you may not use this file except in compliance with the License.
159
- # You may obtain a copy of the License at
160
- #
161
- # http://www.apache.org/licenses/LICENSE-2.0
162
- #
163
- # Unless required by applicable law or agreed to in writing, software
164
- # distributed under the License is distributed on an "AS IS" BASIS,
165
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
166
- # See the License for the specific language governing permissions and
167
- # limitations under the License.
168
-
169
- #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
170
- # NOTE: This file is generated by running `rake version` in the top level of
171
- # this repo. Do not edit this manually. Edit the VERSION file and run the rake
172
- # task instead.
173
- #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
174
-
175
- #{class_or_module} #{module_name}
176
- #{module_name.upcase}_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
177
- VERSION = "#{version}"
178
- end
179
-
180
- #
181
- # NOTE: the Chef::Version class is defined in version_class.rb
182
- #
183
- # NOTE: DO NOT Use the Chef::Version class on #{module_name}::VERSIONs. The
184
- # Chef::Version class is for _cookbooks_ only, and cannot handle
185
- # pre-release versions like "10.14.0.rc.2". Please use Rubygem's
186
- # Gem::Version class instead.
187
- #
188
- VERSION_RB
189
- IO.write(version_rb_path, contents)
190
- end
191
-
192
- Dir[File.expand_path("*gemspec", root_path)].reverse.each do |gemspec_path|
193
- gemspec = eval(IO.read(gemspec_path))
194
- Gem::PackageTask.new(gemspec) do |task|
195
- task.package_dir = full_package_dir
196
- end
197
- end
198
-
199
- desc "Build and install a #{module_path} gem"
200
- task :install => [:package] do
201
- with_clean_env do
202
- full_module_path = File.join(full_package_dir, module_path)
203
- sh %{gem install #{full_module_path}-#{version}.gem --no-rdoc --no-ri}
204
- end
205
- end
206
-
207
- task :uninstall do
208
- sh %{gem uninstall #{module_path} -x -v #{version} }
209
- end
210
-
211
- desc "Build it, tag it and ship it"
212
- task :ship => [:clobber_package, :gem] do
213
- sh("git tag #{version}")
214
- sh("git push #{git_remote} --tags")
215
- Dir[File.expand_path("*.gem", full_package_dir)].reverse.each do |built_gem|
216
- sh("gem push #{built_gem}")
217
- end
218
- end
219
- end
220
- end
221
-
222
- end
1
+ #
2
+ # Author:: Kartik Null Cating-Subramanian (<ksubramanian@chef.io>)
3
+ # Copyright:: Copyright 2015-2016, Chef, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require "rake"
20
+ require "rubygems"
21
+ require "rubygems/package_task"
22
+
23
+ module ChefConfig
24
+ class PackageTask < Rake::TaskLib
25
+
26
+ # Full path to root of top-level repository. All other files (like VERSION or
27
+ # lib/<module_path>/version.rb are rooted at this path).
28
+ attr_accessor :root_path
29
+
30
+ # Name of the top-level module/library build built. This is used to define
31
+ # the top level module which contains VERSION and MODULE_ROOT.
32
+ attr_accessor :module_name
33
+
34
+ # Should the generated version.rb be in a class or module? Default is false (module).
35
+ attr_accessor :generate_version_class
36
+
37
+ # Paths to the roots of any components that also support ChefPackageTask.
38
+ # If relative paths are provided, they are rooted against root_path.
39
+ attr_accessor :component_paths
40
+
41
+ # This is the module name as it appears on the path "lib/module/".
42
+ # e.g. for module_name "ChefDK", you'd want module_path to be "chef-dk".
43
+ # The default is module_name but lower-cased.
44
+ attr_writer :module_path
45
+
46
+ def module_path
47
+ @module_path || module_name.downcase
48
+ end
49
+
50
+ # Directory used to store package files and output that is generated.
51
+ # This has the same meaning (or lack thereof) as package_dir in
52
+ # rake/packagetask.
53
+ attr_accessor :package_dir
54
+
55
+ # Name of git remote used to push tags during a release. Default is origin.
56
+ attr_accessor :git_remote
57
+
58
+ def initialize(root_path = nil, module_name = nil)
59
+ init(root_path, module_name)
60
+ yield self if block_given?
61
+ define unless root_path.nil? || module_name.nil?
62
+ end
63
+
64
+ def init(root_path, module_name)
65
+ @root_path = root_path
66
+ @module_name = module_name
67
+ @component_paths = []
68
+ @module_path = nil
69
+ @package_dir = "pkg"
70
+ @git_remote = "origin"
71
+ @generate_version_class = false
72
+ end
73
+
74
+ def component_full_paths
75
+ component_paths.map { |path| File.expand_path(path, root_path) }
76
+ end
77
+
78
+ def version_rb_path
79
+ File.expand_path("lib/#{module_path}/version.rb", root_path)
80
+ end
81
+
82
+ def chef_root_path
83
+ module_name == "Chef" ? root_path : File.dirname(root_path)
84
+ end
85
+
86
+ def version
87
+ IO.read(File.join(chef_root_path, "VERSION")).strip
88
+ end
89
+
90
+ def full_package_dir
91
+ File.expand_path(package_dir, root_path)
92
+ end
93
+
94
+ def class_or_module
95
+ generate_version_class ? "class" : "module"
96
+ end
97
+
98
+ def with_clean_env(&block)
99
+ if defined?(Bundler)
100
+ Bundler.with_clean_env(&block)
101
+ else
102
+ yield
103
+ end
104
+ end
105
+
106
+ def define
107
+ raise "Need to provide package root and module name" if root_path.nil? || module_name.nil?
108
+
109
+ desc "Build Gems of component dependencies"
110
+ task :package_components do
111
+ component_full_paths.each do |component_path|
112
+ Dir.chdir(component_path) do
113
+ sh "rake package"
114
+ end
115
+ end
116
+ end
117
+
118
+ task :package => :package_components
119
+
120
+ desc "Build and install component dependencies"
121
+ task :install_components => :package_components do
122
+ component_full_paths.each do |component_path|
123
+ Dir.chdir(component_path) do
124
+ sh "rake install"
125
+ end
126
+ end
127
+ end
128
+
129
+ task :install => :install_components
130
+
131
+ desc "Clean up builds of component dependencies"
132
+ task :clobber_component_packages do
133
+ component_full_paths.each do |component_path|
134
+ Dir.chdir(component_path) do
135
+ sh "rake clobber_package"
136
+ end
137
+ end
138
+ end
139
+
140
+ task :clobber_package => :clobber_component_packages
141
+
142
+ desc "Update the version number for component dependencies"
143
+ task :update_components_versions do
144
+ component_full_paths.each do |component_path|
145
+ Dir.chdir(component_path) do
146
+ sh "rake version"
147
+ end
148
+ end
149
+ end
150
+
151
+ desc 'Regenerate lib/#{@module_path}/version.rb from VERSION file'
152
+ task :version => :update_components_versions do
153
+ contents = <<-VERSION_RB
154
+ # Copyright:: Copyright 2010-2016, Chef Software, Inc.
155
+ # License:: Apache License, Version 2.0
156
+ #
157
+ # Licensed under the Apache License, Version 2.0 (the "License");
158
+ # you may not use this file except in compliance with the License.
159
+ # You may obtain a copy of the License at
160
+ #
161
+ # http://www.apache.org/licenses/LICENSE-2.0
162
+ #
163
+ # Unless required by applicable law or agreed to in writing, software
164
+ # distributed under the License is distributed on an "AS IS" BASIS,
165
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
166
+ # See the License for the specific language governing permissions and
167
+ # limitations under the License.
168
+
169
+ #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
170
+ # NOTE: This file is generated by running `rake version` in the top level of
171
+ # this repo. Do not edit this manually. Edit the VERSION file and run the rake
172
+ # task instead.
173
+ #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
174
+
175
+ #{class_or_module} #{module_name}
176
+ #{module_name.upcase}_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
177
+ VERSION = "#{version}"
178
+ end
179
+
180
+ #
181
+ # NOTE: the Chef::Version class is defined in version_class.rb
182
+ #
183
+ # NOTE: DO NOT Use the Chef::Version class on #{module_name}::VERSIONs. The
184
+ # Chef::Version class is for _cookbooks_ only, and cannot handle
185
+ # pre-release versions like "10.14.0.rc.2". Please use Rubygem's
186
+ # Gem::Version class instead.
187
+ #
188
+ VERSION_RB
189
+ IO.write(version_rb_path, contents)
190
+ end
191
+
192
+ Dir[File.expand_path("*gemspec", root_path)].reverse_each do |gemspec_path|
193
+ gemspec = eval(IO.read(gemspec_path))
194
+ Gem::PackageTask.new(gemspec) do |task|
195
+ task.package_dir = full_package_dir
196
+ end
197
+ end
198
+
199
+ desc "Build and install a #{module_path} gem"
200
+ task :install => [:package] do
201
+ with_clean_env do
202
+ full_module_path = File.join(full_package_dir, module_path)
203
+ sh %{gem install #{full_module_path}-#{version}.gem --no-rdoc --no-ri}
204
+ end
205
+ end
206
+
207
+ task :uninstall do
208
+ sh %{gem uninstall #{module_path} -x -v #{version} }
209
+ end
210
+
211
+ desc "Build it, tag it and ship it"
212
+ task :ship => [:clobber_package, :gem] do
213
+ sh("git tag #{version}")
214
+ sh("git push #{git_remote} --tags")
215
+ Dir[File.expand_path("*.gem", full_package_dir)].reverse_each do |built_gem|
216
+ sh("gem push #{built_gem}")
217
+ end
218
+ end
219
+ end
220
+ end
221
+
222
+ end