chef-config 12.11.18 → 12.12.13

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: cc2f06a43b5fc09bba3685a683e0927527edee48
4
- data.tar.gz: 8bbc83bbf7138e6a249e92c8ca1941ef90b65412
3
+ metadata.gz: c42ebaae0fb891524a9aef163819b006e1be9ed6
4
+ data.tar.gz: ef8e35a1c332c6d2f9f0ed9ddaf4742be22f9a6d
5
5
  SHA512:
6
- metadata.gz: ebccfbbbd37b448df12fccaacc9b3cd1d9ffca51a4595e4ebd79b5893da599bc0851c0be5eecdaa930b2ff433a7748a35a3ee074e03466764ba65df7ef059e74
7
- data.tar.gz: 8106a58ccb358ed032c401c058ef05d4e0e67e9b38b9c51e1ec35dad8afe96ee971abc4da9732fae65ab36e8bca9790c7bf0ef0153706fddeef239767371328a
6
+ metadata.gz: 967d4916ea6a4accd15682f18bc8cec25530bf05f54e312ad1f4713b316eb74bc13df7c8784c0c0d04896b198af9f9bbd48a24cbd1db9b08bee2d21d6f7fae0b
7
+ data.tar.gz: 2bb73452a85308ae0b8e2be01586d29a4be9ff60870182ce614cca28d84f6782caf625af04cd79cd8ae235b777aef0e2e3a7bcfc377ceb855a26058b93e045e9
data/Rakefile CHANGED
@@ -1,13 +1,17 @@
1
- require "rspec/core/rake_task"
2
1
  require "chef-config/package_task"
3
2
 
4
- ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "ChefConfig") do |package|
3
+ ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "ChefConfig", "chef-config") do |package|
5
4
  package.module_path = "chef-config"
6
5
  end
7
6
 
8
7
  task :default => :spec
9
8
 
10
- desc "Run standard specs"
11
- RSpec::Core::RakeTask.new(:spec) do |t|
12
- t.pattern = FileList["spec/**/*_spec.rb"]
9
+ begin
10
+ require "rspec/core/rake_task"
11
+ desc "Run standard specs"
12
+ RSpec::Core::RakeTask.new(:spec) do |t|
13
+ t.pattern = FileList["spec/**/*_spec.rb"]
14
+ end
15
+ rescue LoadError
16
+ STDERR.puts "\n*** RSpec not available. (sudo) gem install rspec to run unit tests. ***\n\n"
13
17
  end
@@ -519,7 +519,16 @@ module ChefConfig
519
519
 
520
520
  # Set to true if Chef is to set OpenSSL to run in FIPS mode
521
521
  default(:fips) do
522
- !ENV["CHEF_FIPS"].nil? || ChefConfig.fips?
522
+ # CHEF_FIPS is used in testing to override checking for system level
523
+ # enablement. There are 3 possible values that this variable may have:
524
+ # nil - no override and the system will be checked
525
+ # empty - FIPS is NOT enabled
526
+ # a non empty value - FIPS is enabled
527
+ if ENV["CHEF_FIPS"] == ""
528
+ false
529
+ else
530
+ !ENV["CHEF_FIPS"].nil? || ChefConfig.fips?
531
+ end
523
532
  end
524
533
 
525
534
  # Initialize openssl
@@ -31,6 +31,10 @@ module ChefConfig
31
31
  # the top level module which contains VERSION and MODULE_ROOT.
32
32
  attr_accessor :module_name
33
33
 
34
+ # Name of the gem being built. This is used to find the lines to fix in
35
+ # Gemfile.lock.
36
+ attr_accessor :gem_name
37
+
34
38
  # Should the generated version.rb be in a class or module? Default is false (module).
35
39
  attr_accessor :generate_version_class
36
40
 
@@ -55,15 +59,16 @@ module ChefConfig
55
59
  # Name of git remote used to push tags during a release. Default is origin.
56
60
  attr_accessor :git_remote
57
61
 
58
- def initialize(root_path = nil, module_name = nil)
59
- init(root_path, module_name)
62
+ def initialize(root_path = nil, module_name = nil, gem_name = nil)
63
+ init(root_path, module_name, gem_name)
60
64
  yield self if block_given?
61
65
  define unless root_path.nil? || module_name.nil?
62
66
  end
63
67
 
64
- def init(root_path, module_name)
68
+ def init(root_path, module_name, gem_name)
65
69
  @root_path = root_path
66
70
  @module_name = module_name
71
+ @gem_name = gem_name
67
72
  @component_paths = []
68
73
  @module_path = nil
69
74
  @package_dir = "pkg"
@@ -87,6 +92,10 @@ module ChefConfig
87
92
  File.join(chef_root_path, "VERSION")
88
93
  end
89
94
 
95
+ def gemfile_lock_path
96
+ File.join(root_path, "Gemfile.lock")
97
+ end
98
+
90
99
  def version
91
100
  IO.read(version_file_path).strip
92
101
  end
@@ -155,6 +164,26 @@ module ChefConfig
155
164
  namespace :version do
156
165
  desc 'Regenerate lib/#{@module_path}/version.rb from VERSION file'
157
166
  task :update => :update_components_versions do
167
+ update_version_rb
168
+ update_gemfile_lock
169
+ end
170
+
171
+ task :bump => %w{version:bump_patch version:update}
172
+
173
+ task :show do
174
+ puts version
175
+ end
176
+
177
+ # Add 1 to the current patch version in the VERSION file, and write it back out.
178
+ task :bump_patch do
179
+ current_version = version
180
+ new_version = current_version.sub(/^(\d+\.\d+\.)(\d+)/) { "#{$1}#{$2.to_i + 1}" }
181
+ puts "Updating version in #{version_rb_path} from #{current_version.chomp} to #{new_version.chomp}"
182
+ IO.write(version_file_path, new_version)
183
+ end
184
+
185
+ def update_version_rb
186
+ puts "Updating #{version_rb_path} to include version #{version} ..."
158
187
  contents = <<-VERSION_RB
159
188
  # Copyright:: Copyright 2010-2016, Chef Software, Inc.
160
189
  # License:: Apache License, Version 2.0
@@ -194,18 +223,15 @@ end
194
223
  IO.write(version_rb_path, contents)
195
224
  end
196
225
 
197
- task :bump => %w{version:bump_patch version:update}
198
-
199
- task :show do
200
- puts version
201
- end
202
-
203
- # Add 1 to the current patch version in the VERSION file, and write it back out.
204
- task :bump_patch do
205
- current_version = version
206
- new_version = current_version.sub(/^(\d+\.\d+\.)(\d+)/) { "#{$1}#{$2.to_i + 1}" }
207
- puts "Updating version in #{version_rb_path} from #{current_version.chomp} to #{new_version.chomp}"
208
- IO.write(version_file_path, new_version)
226
+ def update_gemfile_lock
227
+ if File.exist?(gemfile_lock_path)
228
+ puts "Updating #{gemfile_lock_path} to include version #{version} ..."
229
+ contents = IO.read(gemfile_lock_path)
230
+ contents.gsub!(/^\s*(chef|chef-config)\s*\((= )?\S+\)\s*$/) do |line|
231
+ line.gsub(/\((= )?\d+(\.\d+)+/) { "(#{$1}#{version}" }
232
+ end
233
+ IO.write(gemfile_lock_path, contents)
234
+ end
209
235
  end
210
236
  end
211
237
 
@@ -21,7 +21,7 @@
21
21
 
22
22
  module ChefConfig
23
23
  CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
24
- VERSION = "12.11.18"
24
+ VERSION = "12.12.13"
25
25
  end
26
26
 
27
27
  #
@@ -186,6 +186,16 @@ RSpec.describe ChefConfig::Config do
186
186
  expect(ChefConfig::Config[:fips]).to eq(false)
187
187
  end
188
188
 
189
+ context "when ENV['CHEF_FIPS'] is empty" do
190
+ before do
191
+ ENV["CHEF_FIPS"] = ""
192
+ end
193
+
194
+ it "returns false" do
195
+ expect(ChefConfig::Config[:fips]).to eq(false)
196
+ end
197
+ end
198
+
189
199
  context "when ENV['CHEF_FIPS'] is set" do
190
200
  before do
191
201
  ENV["CHEF_FIPS"] = "1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.11.18
4
+ version: 12.12.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-08 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout