ridley 4.4.1 → 4.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +39 -6
- data/CHANGELOG.md +4 -0
- data/lib/ridley/chef/config.rb +34 -74
- data/lib/ridley/version.rb +1 -1
- data/ridley.gemspec +1 -0
- data/spec/unit/ridley_spec.rb +6 -27
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35e51257c60219defc486be0fc9d2929a6305cd2
|
4
|
+
data.tar.gz: db145d26c5db49f2a27d9e29085f79c746738d7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 358d50fb89876c479ee20e1d23ba0ba9584a3cb779bea73be43fe9c6a9c088ab320634df555a4c3a8e1c8626e82da942f7ce85ea78bc1dbbc5f4fc224c0804a3
|
7
|
+
data.tar.gz: d9758949f47a21e33b7a5c2f042e9dcd65cf21f88cf558ce63012439e4a696243d3903b992237f21fd0cad263c0d0e15523b4251426119753ae16838d222d866
|
data/.travis.yml
CHANGED
@@ -1,13 +1,46 @@
|
|
1
|
-
|
1
|
+
sudo: false
|
2
2
|
language: ruby
|
3
|
+
addons:
|
4
|
+
apt:
|
5
|
+
packages:
|
6
|
+
- chef
|
7
|
+
- git
|
8
|
+
- graphviz
|
9
|
+
- libarchive12
|
10
|
+
- libarchive-dev
|
11
|
+
- libgecode-dev
|
12
|
+
sources:
|
13
|
+
- chef-stable-precise
|
14
|
+
cache:
|
15
|
+
- apt
|
16
|
+
- bundler
|
17
|
+
dist: precise
|
18
|
+
|
19
|
+
script: "bundle exec thor spec:$TEST_SUITE"
|
20
|
+
before_install:
|
21
|
+
- gem update --system
|
22
|
+
- gem install bundler
|
3
23
|
env:
|
4
24
|
- TEST_SUITE=unit
|
5
25
|
- TEST_SUITE=acceptance
|
6
26
|
rvm:
|
7
|
-
- 1.9
|
8
|
-
- 2.0
|
27
|
+
- 1.9
|
28
|
+
- 2.0
|
9
29
|
- 2.1
|
10
|
-
- jruby-19mode
|
30
|
+
# - jruby-19mode
|
11
31
|
matrix:
|
12
|
-
allow_failures:
|
13
|
-
|
32
|
+
# allow_failures:
|
33
|
+
# - rvm: jruby-19mode
|
34
|
+
include:
|
35
|
+
# Test against master of berkshelf
|
36
|
+
- rvm: 2.2
|
37
|
+
gemfile: berkshelf/Gemfile
|
38
|
+
before_install:
|
39
|
+
- gem update --system
|
40
|
+
- gem install bundler
|
41
|
+
- git clone --depth 1 https://github.com/berkshelf/berkshelf
|
42
|
+
- cd berkshelf
|
43
|
+
- echo "gem 'ridley', :path => '..'" >> Gemfile
|
44
|
+
install: bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
45
|
+
env:
|
46
|
+
script: bundle exec thor spec:ci
|
data/CHANGELOG.md
CHANGED
data/lib/ridley/chef/config.rb
CHANGED
@@ -1,86 +1,46 @@
|
|
1
|
-
require '
|
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
|
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
|
-
|
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
|
+
# Keep defaults that aren't in ChefConfig::Config
|
19
|
+
def cookbook_copyright(*args, &block)
|
20
|
+
ChefConfig::Config.cookbook_copyright(*args, &block) || 'YOUR_NAME'
|
21
|
+
end
|
22
|
+
def cookbook_email(*args, &block)
|
23
|
+
ChefConfig::Config.cookbook_email(*args, &block) || 'YOUR_EMAIL'
|
24
|
+
end
|
25
|
+
def cookbook_license(*args, &block)
|
26
|
+
ChefConfig::Config.cookbook_license(*args, &block) || 'reserved'
|
27
|
+
end
|
28
|
+
|
29
|
+
# The configuration as a hash
|
30
|
+
def to_hash
|
31
|
+
ChefConfig::Config.save(true)
|
32
|
+
end
|
33
|
+
# Load from a file
|
34
|
+
def self.from_file(file)
|
35
|
+
new(file)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Behave just like ChefConfig::Config in general
|
39
|
+
def method_missing(name, *args, &block)
|
40
|
+
ChefConfig::Config.send(name, *args, &block)
|
41
|
+
end
|
42
|
+
def respond_to_missing?(name)
|
43
|
+
ChefConfig::Config.respond_to?(name)
|
84
44
|
end
|
85
45
|
end
|
86
46
|
end
|
data/lib/ridley/version.rb
CHANGED
data/ridley.gemspec
CHANGED
@@ -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'
|
data/spec/unit/ridley_spec.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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.4.
|
4
|
+
version: 4.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -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
|