ridley 4.3.2 → 4.4.0

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: 4c73bbc35f580f839090a95c36596b1bdfb4b964
4
- data.tar.gz: 4b49aefdc9fc5131405180c6d7bc5eeea7538b4d
3
+ metadata.gz: 531224a1d42a7dd8d9945c1f096fbe18260d33b5
4
+ data.tar.gz: 4e91e3700b180e136ee36071f2c7296da865adf8
5
5
  SHA512:
6
- metadata.gz: 3310169e9d3883306db759fc9b3374407bf41ccbde8e2c9f8e56c9771b0ac0483d7211537d59c9eeb54ccbec88af4743591d97308bd92130d4b2dbf80f9cc82f
7
- data.tar.gz: 97e67adf132b721fe9f3d99faf96d4262b488b93e43f26a9e16374a71e391448cc8172e074028859d790629bb1965c90fa9f2c5ff04fd04ec27fa93c28c75de8
6
+ metadata.gz: ae4f2904466cce0a7cd08d3716ebf53bc18c895e853edf67ded955e93aec49284a8fca8601e6c0f5c8f100226843cc61773d72c60a96708bd003481773269bd8
7
+ data.tar.gz: 97970ba2a5368760cdb8fb32df2546da2775f5cf833fd6359d64801086bbccf783a48df2a7f0407078d544ffe8ddfea5d31aad048ce8a61942da475889b63ee7
@@ -1,3 +1,8 @@
1
+ # 4.4.0
2
+
3
+ * Enhancements
4
+ * Use chef-config gem for Chef configuration, including proxy improvements
5
+
1
6
  # 4.3.2
2
7
 
3
8
  * Bug Fixes
@@ -1,86 +1,23 @@
1
- require 'buff/config/ruby'
1
+ require 'chef-config/config'
2
+ require 'chef-config/workstation_config_loader'
2
3
  require 'socket'
3
4
 
4
5
  module Ridley::Chef
5
- class Config < Buff::Config::Ruby
6
- class << self
7
- # Return the most sensible path to the Chef configuration file. This can
8
- # be configured by setting a value for the 'RIDLEY_CHEF_CONFIG' environment
9
- # variable.
10
- #
11
- # @return [String, nil]
12
- def location
13
- possibles = []
14
-
15
- possibles << ENV['RIDLEY_CHEF_CONFIG'] if ENV['RIDLEY_CHEF_CONFIG']
16
- possibles << File.join(ENV['KNIFE_HOME'], 'knife.rb') if ENV['KNIFE_HOME']
17
- possibles << File.join(working_dir, 'knife.rb') if working_dir
18
-
19
- # Ascending search for .chef directory siblings
20
- Pathname.new(working_dir).ascend do |file|
21
- sibling_chef = File.join(file, '.chef')
22
- possibles << File.join(sibling_chef, 'knife.rb')
23
- end if working_dir
24
-
25
- possibles << File.join(ENV['HOME'], '.chef', 'knife.rb') if ENV['HOME']
26
- possibles.compact!
27
-
28
- location = possibles.find { |loc| File.exists?(File.expand_path(loc)) }
29
-
30
- File.expand_path(location) unless location.nil?
31
- end
32
-
33
- private
34
-
35
- # The current working directory
36
- #
37
- # @return [String]
38
- def working_dir
39
- ENV['PWD'] || Dir.pwd
40
- end
41
- end
42
-
43
- set_assignment_mode :carefree
44
-
45
- attribute :node_name,
46
- default: -> { Socket.gethostname }
47
- attribute :chef_server_url,
48
- default: 'http://localhost:4000'
49
- attribute :client_key,
50
- default: -> { platform_specific_path('/etc/chef/client.pem') }
51
- attribute :validation_key,
52
- default: -> { platform_specific_path('/etc/chef/validation.pem') }
53
- attribute :validation_client_name,
54
- default: 'chef-validator'
55
-
56
- attribute :cookbook_copyright,
57
- default: 'YOUR_NAME'
58
- attribute :cookbook_email,
59
- default: 'YOUR_EMAIL'
60
- attribute :cookbook_license,
61
- default: 'reserved'
62
-
63
- attribute :knife,
64
- default: {}
65
-
66
- # Prior to Chef 11, the cache implementation was based on
67
- # moneta and configured via cache_options[:path]. Knife configs
68
- # generated with Chef 11 will have `syntax_check_cache_path`, but older
69
- # configs will have `cache_options[:path]`. `cache_options` is marked
70
- # deprecated in chef/config.rb but doesn't currently trigger a warning.
71
- # See also: CHEF-3715
72
- attribute :syntax_check_cache_path,
73
- default: -> { Dir.mktmpdir }
74
- attribute :cache_options,
75
- default: -> { { path: defined?(syntax_check_cache_path) ? syntax_check_cache_path : Dir.mktmpdir } }
76
-
6
+ class Config
77
7
  # Create a new Chef Config object.
78
8
  #
79
9
  # @param [#to_s] path
80
10
  # the path to the configuration file
81
11
  # @param [Hash] options
82
12
  def initialize(path, options = {})
83
- super(path || self.class.location, options)
13
+ ChefConfig::WorkstationConfigLoader.new(path).load
14
+ ChefConfig::Config.merge!(options)
15
+ ChefConfig::Config.export_proxies # Set proxy settings as environment variables
16
+ end
17
+
18
+ # The configuration as a hash
19
+ def to_hash
20
+ ChefConfig::Config.save(true)
84
21
  end
85
22
  end
86
23
  end
@@ -255,8 +255,8 @@ module Ridley::Chef
255
255
  def load_files
256
256
  load_shallow(:recipes, 'recipes', '*.rb')
257
257
  load_shallow(:definitions, 'definitions', '*.rb')
258
- load_shallow(:libraries, 'libraries', '*.rb')
259
258
  load_shallow(:attributes, 'attributes', '*.rb')
259
+ load_recursively(:libraries, 'libraries', '*.rb')
260
260
  load_recursively(:files, "files", "*")
261
261
  load_recursively(:templates, "templates", "*")
262
262
  load_recursively(:resources, "resources", "*.rb")
@@ -1,3 +1,3 @@
1
1
  module Ridley
2
- VERSION = "4.3.2"
2
+ VERSION = "4.4.0"
3
3
  end
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'buff-shell_out', '~> 0.1'
26
26
  s.add_dependency 'celluloid', '~> 0.16.0'
27
27
  s.add_dependency 'celluloid-io', '~> 0.16.1'
28
+ s.add_dependency 'chef-config'
28
29
  s.add_dependency 'erubis'
29
30
  s.add_dependency 'faraday', '~> 0.9.0'
30
31
  s.add_dependency 'hashie', '>= 2.0.2', '< 4.0.0'
@@ -37,43 +37,29 @@ describe Ridley do
37
37
  end
38
38
 
39
39
  it "creates a Ridley connection from the Chef config" do
40
- expect(Ridley::Client).to receive(:new).with({
40
+ expect(Ridley::Client).to receive(:new).with(hash_including(
41
41
  client_key: 'username.pem',
42
42
  client_name: 'username',
43
43
  validator_client: 'validator',
44
44
  validator_path: 'validator.pem',
45
45
  server_url: 'https://api.opscode.com',
46
-
47
- cookbook_copyright: 'YOUR_NAME',
48
- cookbook_email: 'YOUR_EMAIL',
49
- cookbook_license: 'reserved',
50
-
51
- knife: {},
52
-
53
46
  syntax_check_cache_path: "/foo/bar",
54
47
  cache_options: { path: "~/.chef/checksums" },
55
- }).and_return(nil)
48
+ )).and_return(nil)
56
49
 
57
50
  subject.from_chef_config(path)
58
51
  end
59
52
 
60
53
  it "allows the user to override attributes" do
61
- expect(Ridley::Client).to receive(:new).with({
54
+ expect(Ridley::Client).to receive(:new).with(hash_including(
62
55
  client_key: 'bacon.pem',
63
56
  client_name: 'bacon',
64
57
  validator_client: 'validator',
65
58
  validator_path: 'validator.pem',
66
59
  server_url: 'https://api.opscode.com',
67
-
68
- cookbook_copyright: 'YOUR_NAME',
69
- cookbook_email: 'YOUR_EMAIL',
70
- cookbook_license: 'reserved',
71
-
72
- knife: {},
73
-
74
60
  syntax_check_cache_path: "/foo/bar",
75
61
  cache_options: { path: "~/.chef/checksums" },
76
- })
62
+ ))
77
63
 
78
64
  subject.from_chef_config(path, client_key: 'bacon.pem', client_name: 'bacon')
79
65
  end
@@ -88,22 +74,15 @@ describe Ridley do
88
74
  end
89
75
 
90
76
  it "does a knife.rb search" do
91
- expect(Ridley::Client).to receive(:new).with({
77
+ expect(Ridley::Client).to receive(:new).with(hash_including(
92
78
  client_key: 'username.pem',
93
79
  client_name: 'username',
94
80
  validator_client: 'validator',
95
81
  validator_path: 'validator.pem',
96
82
  server_url: 'https://api.opscode.com',
97
-
98
- cookbook_copyright: 'YOUR_NAME',
99
- cookbook_email: 'YOUR_EMAIL',
100
- cookbook_license: 'reserved',
101
-
102
- knife: {},
103
-
104
83
  syntax_check_cache_path: "/foo/bar",
105
84
  cache_options: { path: "~/.chef/checksums" },
106
- }).and_return(nil)
85
+ )).and_return(nil)
107
86
 
108
87
  Dir.chdir(tmp_path) do
109
88
  ENV['PWD'] = Dir.pwd
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridley
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.2
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-08 00:00:00.000000000 Z
12
+ date: 2016-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable
@@ -123,6 +123,20 @@ dependencies:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: 0.16.1
126
+ - !ruby/object:Gem::Dependency
127
+ name: chef-config
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
126
140
  - !ruby/object:Gem::Dependency
127
141
  name: erubis
128
142
  requirement: !ruby/object:Gem::Requirement
@@ -415,7 +429,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
415
429
  version: '0'
416
430
  requirements: []
417
431
  rubyforge_project:
418
- rubygems_version: 2.2.2
432
+ rubygems_version: 2.5.0
419
433
  signing_key:
420
434
  specification_version: 4
421
435
  summary: A reliable Chef API client with a clean syntax