compat_resource 12.5.21 → 12.5.22

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: eff5ddf88ce177c1c9067a498e69aefd56d37cf6
4
- data.tar.gz: d2f1236fa122a2b037b564abe7eafa54ad5f1603
3
+ metadata.gz: 56f5605c8ca73b413ec75b669cf3549c4de2f505
4
+ data.tar.gz: f921bee4348789f9273c7f2b957e6ecd2f27e0d9
5
5
  SHA512:
6
- metadata.gz: bc5171040ed184cf6128a0b8e0e40ef74cc097d77512913176780e0f4aefab901e941e18215a79295ac5274682f2a769a4949afca8f2f1400aaf1ff773059bcb
7
- data.tar.gz: 1fc2f3a86268a9cad816397082f112497f669d99a36a2a44d293c8d455bfaee1efa3b5a3f3944a538f14d54fc4b40d9162895caba78086d214c1ca36e90cf323
6
+ metadata.gz: ed1175035f86084a16308023862e78a0fb629e69658a535a00eca05655e46b70c4057af23eb22f2131f75ac7ef46a4fccfde1eb080b09a6debbb217207898ad0
7
+ data.tar.gz: 436e9ccc5fedd5f05c6968f7f8b16b0e335fc85fbc4408bcc6348b15d8d85fa264d13ac2360ba596a58271c84b370b884b4062ebce13c737df9be7e9006f0864
data/Rakefile CHANGED
@@ -25,6 +25,7 @@ CHEF_FILES = %w(
25
25
  chef/resource
26
26
  chef/resource_builder
27
27
  chef/resource/action_class
28
+ chef/log
28
29
  )
29
30
  SPEC_FILES = %w(
30
31
  unit/mixin/properties_spec.rb
@@ -0,0 +1,69 @@
1
+ require 'chef_compat/copied_from_chef'
2
+ class Chef
3
+ module ::ChefCompat
4
+ module CopiedFromChef
5
+ #
6
+ # Author:: Adam Jacob (<adam@opscode.com>)
7
+ # Author:: AJ Christensen (<@aj@opscode.com>)
8
+ # Author:: Christopher Brown (<cb@opscode.com>)
9
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
10
+ # License:: Apache License, Version 2.0
11
+ #
12
+ # Licensed under the Apache License, Version 2.0 (the "License");
13
+ # you may not use this file except in compliance with the License.
14
+ # You may obtain a copy of the License at
15
+ #
16
+ # http://www.apache.org/licenses/LICENSE-2.0
17
+ #
18
+ # Unless required by applicable law or agreed to in writing, software
19
+ # distributed under the License is distributed on an "AS IS" BASIS,
20
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ # See the License for the specific language governing permissions and
22
+ # limitations under the License.
23
+
24
+
25
+ class Chef < (defined?(::Chef) ? ::Chef : Object)
26
+ class Log < (defined?(::Chef::Log) ? ::Chef::Log : Object)
27
+ extend Mixlib::Log
28
+
29
+ # Force initialization of the primary log device (@logger)
30
+ init(MonoLogger.new(STDOUT))
31
+
32
+ class Formatter < (defined?(::Chef::Log::Formatter) ? ::Chef::Log::Formatter : Object)
33
+ def self.show_time=(*args)
34
+ Mixlib::Log::Formatter.show_time = *args
35
+ end
36
+ end
37
+
38
+ #
39
+ # Get the location of the caller (from the recipe). Grabs the first caller
40
+ # that is *not* in the chef gem proper (allowing us to weed out internal
41
+ # calls and give the user a more useful perspective).
42
+ #
43
+ # @return [String] The location of the caller (file:line#) from caller(0..20), or nil if no non-chef caller is found.
44
+ #
45
+ def self.caller_location
46
+ # Pick the first caller that is *not* part of the Chef gem, that's the
47
+ # thing the user wrote.
48
+ chef_gem_path = File.expand_path("../..", __FILE__)
49
+ caller(0..20).select { |c| !c.start_with?(chef_gem_path) }.first
50
+ end
51
+
52
+ def self.deprecation(msg=nil, location=caller(2..2)[0], &block)
53
+ if msg
54
+ msg << " at #{Array(location).join("\n")}"
55
+ msg = msg.join("") if msg.respond_to?(:join)
56
+ end
57
+ if Chef::Config[:treat_deprecation_warnings_as_errors]
58
+ error(msg, &block)
59
+ raise Chef::Exceptions::DeprecatedFeatureError.new(msg)
60
+ else
61
+ warn(msg, &block)
62
+ end
63
+ end
64
+
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -21,6 +21,7 @@ module CopiedFromChef
21
21
  #
22
22
 
23
23
  require 'chef_compat/copied_from_chef/chef/delayed_evaluator'
24
+ require 'chef_compat/copied_from_chef/chef/log'
24
25
 
25
26
  class Chef < (defined?(::Chef) ? ::Chef : Object)
26
27
  #
@@ -145,6 +145,7 @@ super if defined?(::Chef::ResourceBuilder)
145
145
  end
146
146
 
147
147
  require 'chef_compat/copied_from_chef/chef/resource'
148
+ require 'chef_compat/copied_from_chef/chef/log'
148
149
  end
149
150
  end
150
151
  end
@@ -1,3 +1,3 @@
1
1
  module CompatResource
2
- VERSION = '12.5.21'
2
+ VERSION = '12.5.22'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compat_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.5.21
4
+ version: 12.5.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
@@ -96,6 +96,7 @@ files:
96
96
  - files/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb
97
97
  - files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb
98
98
  - files/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb
99
+ - files/lib/chef_compat/copied_from_chef/chef/log.rb
99
100
  - files/lib/chef_compat/copied_from_chef/chef/mixin/params_validate.rb
100
101
  - files/lib/chef_compat/copied_from_chef/chef/mixin/properties.rb
101
102
  - files/lib/chef_compat/copied_from_chef/chef/property.rb