cookbook-omnifetch 0.7.0 → 0.10.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 +5 -5
- data/lib/cookbook-omnifetch.rb +17 -13
- data/lib/cookbook-omnifetch/artifactory.rb +10 -5
- data/lib/cookbook-omnifetch/artifactserver.rb +1 -1
- data/lib/cookbook-omnifetch/base.rb +1 -1
- data/lib/cookbook-omnifetch/chef_server.rb +14 -3
- data/lib/cookbook-omnifetch/chef_server_artifact.rb +15 -4
- data/lib/cookbook-omnifetch/git.rb +3 -3
- data/lib/cookbook-omnifetch/integration.rb +6 -1
- data/lib/cookbook-omnifetch/metadata_based_installer.rb +14 -13
- data/lib/cookbook-omnifetch/path.rb +1 -1
- data/lib/cookbook-omnifetch/threaded_job_queue.rb +1 -1
- data/lib/cookbook-omnifetch/version.rb +1 -1
- metadata +15 -85
- data/.gitignore +0 -23
- data/.rspec +0 -1
- data/.travis.yml +0 -11
- data/Gemfile +0 -8
- data/README.md +0 -90
- data/Rakefile +0 -19
- data/cookbook-omnifetch.gemspec +0 -39
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/README.md +0 -12
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +0 -3
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/recipes/default.rb +0 -8
- data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
- data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +0 -26
- data/spec/fixtures/cookbooks/example_cookbook/Berksfile +0 -1
- data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +0 -3
- data/spec/fixtures/cookbooks/example_cookbook/README.md +0 -12
- data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +0 -3
- data/spec/fixtures/cookbooks/example_cookbook/recipes/default.rb +0 -8
- data/spec/spec_helper.rb +0 -43
- data/spec/unit/artifactory_spec.rb +0 -64
- data/spec/unit/artifactserver_spec.rb +0 -116
- data/spec/unit/base_spec.rb +0 -87
- data/spec/unit/chef_server_artifact_spec.rb +0 -74
- data/spec/unit/chef_server_spec.rb +0 -72
- data/spec/unit/exceptions_spec.rb +0 -87
- data/spec/unit/git_spec.rb +0 -290
- data/spec/unit/metadata_based_installer_spec.rb +0 -137
- data/spec/unit/path_spec.rb +0 -119
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9491fb99bc2194cfb805a87ab4d543be68e51a4fc4c3d27e954c62e96b42df33
|
4
|
+
data.tar.gz: 1f364b47c66fe2c7ac35d45f9a343dc8a14e6eaad3050007db5c4c59f255029b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfe5d751f1891af706db45ebf57867207078876419eaa7f7629ee4ae9b5437897528782062186e2eec04cee2516dae01c602d68581b6b759f7b1a8eb7eea6fea
|
7
|
+
data.tar.gz: 6f1668723a48ca94e337e1aba18138a745b82a65008ad88c41fea1e63318120002a516334d238ad61c3faf8b623f5625220a291fa53fd1e17ae6229151389b8d
|
data/lib/cookbook-omnifetch.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
require_relative "cookbook-omnifetch/version"
|
2
|
+
require_relative "cookbook-omnifetch/integration"
|
3
|
+
|
4
|
+
require_relative "cookbook-omnifetch/base"
|
5
|
+
require_relative "cookbook-omnifetch/git"
|
6
|
+
require_relative "cookbook-omnifetch/github"
|
7
|
+
require_relative "cookbook-omnifetch/path"
|
8
|
+
require_relative "cookbook-omnifetch/artifactserver"
|
9
|
+
require_relative "cookbook-omnifetch/artifactory"
|
10
|
+
require_relative "cookbook-omnifetch/chef_server"
|
11
|
+
require_relative "cookbook-omnifetch/chef_server_artifact"
|
12
12
|
|
13
13
|
module CookbookOmnifetch
|
14
14
|
|
@@ -30,7 +30,7 @@ module CookbookOmnifetch
|
|
30
30
|
#
|
31
31
|
# @return [~BaseLocation, nil]
|
32
32
|
def self.init(dependency, options = {})
|
33
|
-
if klass = klass_from_options(options)
|
33
|
+
if klass = klass_from_options(options) # rubocop: disable Lint/AssignmentInCondition
|
34
34
|
klass.new(dependency, options)
|
35
35
|
else
|
36
36
|
nil
|
@@ -124,6 +124,10 @@ module CookbookOmnifetch
|
|
124
124
|
integration.chef_server_download_concurrency
|
125
125
|
end
|
126
126
|
|
127
|
+
def self.default_chef_server_http_client
|
128
|
+
integration.default_chef_server_http_client
|
129
|
+
end
|
130
|
+
|
127
131
|
# Returns true or false if the given path contains a Chef Cookbook
|
128
132
|
#
|
129
133
|
# @param [#to_s] path
|
@@ -131,7 +135,7 @@ module CookbookOmnifetch
|
|
131
135
|
#
|
132
136
|
# @return [Boolean]
|
133
137
|
def self.cookbook?(path)
|
134
|
-
File.
|
138
|
+
File.exist?(File.join(path, "metadata.json")) || File.exist?(File.join(path, "metadata.rb"))
|
135
139
|
end
|
136
140
|
|
137
141
|
class << self
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "base"
|
2
2
|
|
3
3
|
require "mixlib/archive"
|
4
4
|
require "tmpdir"
|
@@ -15,7 +15,12 @@ module CookbookOmnifetch
|
|
15
15
|
super
|
16
16
|
@uri ||= options[:artifactory]
|
17
17
|
@cookbook_version = options[:version]
|
18
|
-
|
18
|
+
if options[:http_client]
|
19
|
+
@http_client = options[:http_client]
|
20
|
+
else
|
21
|
+
headers = { "X-Jfrog-Art-API" => Chef::Config.artifactory_api_key || ENV["ARTIFACTORY_API_KEY"] }
|
22
|
+
@http_client = Chef::HTTP::Simple.new(uri, headers: headers)
|
23
|
+
end
|
19
24
|
end
|
20
25
|
|
21
26
|
def repo_host
|
@@ -93,13 +98,13 @@ module CookbookOmnifetch
|
|
93
98
|
"#to_lock must be implemented on #{self.class.name}!"
|
94
99
|
end
|
95
100
|
|
96
|
-
# The path where all pristine tarballs from an
|
101
|
+
# The path where all pristine tarballs from an artifactory are held.
|
97
102
|
# Tarballs are moved/swapped into this location once they have been staged
|
98
103
|
# in a co-located staging directory.
|
99
104
|
#
|
100
105
|
# @return [Pathname]
|
101
106
|
def cache_root
|
102
|
-
Pathname.new(CookbookOmnifetch.cache_path).join(".cache", "
|
107
|
+
Pathname.new(CookbookOmnifetch.cache_path).join(".cache", "artifactory")
|
103
108
|
end
|
104
109
|
|
105
110
|
# The path where tarballs are downloaded to and unzipped. On certain platforms
|
@@ -113,7 +118,7 @@ module CookbookOmnifetch
|
|
113
118
|
#
|
114
119
|
# @return [Pathname]
|
115
120
|
def staging_root
|
116
|
-
Pathname.new(CookbookOmnifetch.cache_path).join(".cache_tmp", "
|
121
|
+
Pathname.new(CookbookOmnifetch.cache_path).join(".cache_tmp", "artifactory")
|
117
122
|
end
|
118
123
|
|
119
124
|
# The path where the pristine tarball is cached
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "base"
|
2
|
+
require_relative "metadata_based_installer"
|
3
3
|
|
4
4
|
module CookbookOmnifetch
|
5
5
|
class ChefServerLocation < BaseLocation
|
@@ -10,7 +10,7 @@ module CookbookOmnifetch
|
|
10
10
|
def initialize(dependency, options = {})
|
11
11
|
super
|
12
12
|
@cookbook_version = options[:version]
|
13
|
-
@http_client = options[:http_client]
|
13
|
+
@http_client = options[:http_client] || default_chef_server_http_client
|
14
14
|
@uri ||= options[:chef_server]
|
15
15
|
end
|
16
16
|
|
@@ -57,5 +57,16 @@ module CookbookOmnifetch
|
|
57
57
|
"#{dependency.name}-#{cookbook_version}"
|
58
58
|
end
|
59
59
|
|
60
|
+
# @see BaseLocation#cached_cookbook
|
61
|
+
def cached_cookbook
|
62
|
+
@cached_cookbook ||= CookbookOmnifetch.cached_cookbook_class.from_path(install_path)
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def default_chef_server_http_client
|
68
|
+
CookbookOmnifetch.default_chef_server_http_client
|
69
|
+
end
|
70
|
+
|
60
71
|
end
|
61
72
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "base"
|
2
|
+
require_relative "metadata_based_installer"
|
3
3
|
|
4
4
|
module CookbookOmnifetch
|
5
5
|
# This location allows fetching from the `cookbook_artifacts/` API where Chef
|
@@ -17,7 +17,7 @@ module CookbookOmnifetch
|
|
17
17
|
def initialize(dependency, options = {})
|
18
18
|
super
|
19
19
|
@cookbook_identifier = options[:identifier]
|
20
|
-
@http_client = options[:http_client]
|
20
|
+
@http_client = options[:http_client] || default_chef_server_http_client
|
21
21
|
@uri ||= options[:chef_server_artifact]
|
22
22
|
end
|
23
23
|
|
@@ -61,12 +61,23 @@ module CookbookOmnifetch
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def lock_data
|
64
|
-
{ "
|
64
|
+
{ "chef_server_artifact" => uri, "identifier" => cookbook_identifier }
|
65
65
|
end
|
66
66
|
|
67
67
|
def cache_key
|
68
68
|
"#{dependency.name}-#{cookbook_identifier}"
|
69
69
|
end
|
70
70
|
|
71
|
+
# @see BaseLocation#cached_cookbook
|
72
|
+
def cached_cookbook
|
73
|
+
@cached_cookbook ||= CookbookOmnifetch.cached_cookbook_class.from_path(install_path)
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def default_chef_server_http_client
|
79
|
+
CookbookOmnifetch.default_chef_server_http_client
|
80
|
+
end
|
81
|
+
|
71
82
|
end
|
72
83
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "tmpdir"
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
require_relative "../cookbook-omnifetch"
|
3
|
+
require_relative "base"
|
4
|
+
require_relative "exceptions"
|
5
5
|
|
6
6
|
module CookbookOmnifetch
|
7
7
|
class GitLocation < BaseLocation
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "exceptions"
|
2
2
|
|
3
3
|
module CookbookOmnifetch
|
4
4
|
|
@@ -39,6 +39,11 @@ module CookbookOmnifetch
|
|
39
39
|
# commentary in cookbook_omnifetch.rb
|
40
40
|
configurable :chef_server_download_concurrency
|
41
41
|
|
42
|
+
# HTTP client object that will be used for source option `http_client` by
|
43
|
+
# `ChefServerLocation` and `ChefServerArtifactLocation` if not explicitly
|
44
|
+
# passed
|
45
|
+
configurable :default_chef_server_http_client
|
46
|
+
|
42
47
|
def initialize
|
43
48
|
self.class.configurables.each do |configurable|
|
44
49
|
instance_variable_set("@#{configurable}".to_sym, NullValue.new)
|
@@ -1,21 +1,22 @@
|
|
1
|
-
|
1
|
+
require_relative "threaded_job_queue"
|
2
2
|
|
3
3
|
module CookbookOmnifetch
|
4
4
|
|
5
5
|
class MetadataBasedInstaller
|
6
6
|
class CookbookMetadata
|
7
7
|
|
8
|
-
FILE_TYPES =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
FILE_TYPES = %i{
|
9
|
+
resources
|
10
|
+
providers
|
11
|
+
recipes
|
12
|
+
definitions
|
13
|
+
libraries
|
14
|
+
attributes
|
15
|
+
files
|
16
|
+
templates
|
17
|
+
root_files
|
18
|
+
all_files
|
19
|
+
}.freeze
|
19
20
|
|
20
21
|
def initialize(metadata)
|
21
22
|
@metadata = metadata
|
@@ -23,7 +24,7 @@ module CookbookOmnifetch
|
|
23
24
|
|
24
25
|
def files(&block)
|
25
26
|
FILE_TYPES.each do |type|
|
26
|
-
next unless @metadata.
|
27
|
+
next unless @metadata.key?(type.to_s)
|
27
28
|
|
28
29
|
@metadata[type.to_s].each do |file|
|
29
30
|
yield file["url"], file["path"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookbook-omnifetch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -13,50 +13,28 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: mixlib-archive
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
|
-
- - "
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '0.4'
|
25
|
-
type: :runtime
|
26
|
-
prerelease: false
|
27
|
-
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
requirements:
|
29
|
-
- - "~>"
|
22
|
+
- - ">="
|
30
23
|
- !ruby/object:Gem::Version
|
31
24
|
version: '0.4'
|
32
|
-
-
|
33
|
-
name: rake
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
35
|
-
requirements:
|
36
|
-
- - ">="
|
25
|
+
- - "<"
|
37
26
|
- !ruby/object:Gem::Version
|
38
|
-
version: '0'
|
39
|
-
type: :
|
27
|
+
version: '2.0'
|
28
|
+
type: :runtime
|
40
29
|
prerelease: false
|
41
30
|
version_requirements: !ruby/object:Gem::Requirement
|
42
31
|
requirements:
|
43
32
|
- - ">="
|
44
33
|
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
|
-
-
|
47
|
-
name: rspec
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - "~>"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '3.0'
|
53
|
-
type: :development
|
54
|
-
prerelease: false
|
55
|
-
version_requirements: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - "~>"
|
34
|
+
version: '0.4'
|
35
|
+
- - "<"
|
58
36
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
37
|
+
version: '2.0'
|
60
38
|
description:
|
61
39
|
email:
|
62
40
|
- jamie@vialstudios.com
|
@@ -64,19 +42,12 @@ email:
|
|
64
42
|
- michael.ivey@riotgames.com
|
65
43
|
- justin@justincampbell.me
|
66
44
|
- sethvargo@gmail.com
|
67
|
-
- dan@
|
45
|
+
- dan@chef.io
|
68
46
|
executables: []
|
69
47
|
extensions: []
|
70
48
|
extra_rdoc_files: []
|
71
49
|
files:
|
72
|
-
- ".gitignore"
|
73
|
-
- ".rspec"
|
74
|
-
- ".travis.yml"
|
75
|
-
- Gemfile
|
76
50
|
- LICENSE
|
77
|
-
- README.md
|
78
|
-
- Rakefile
|
79
|
-
- cookbook-omnifetch.gemspec
|
80
51
|
- lib/cookbook-omnifetch.rb
|
81
52
|
- lib/cookbook-omnifetch/artifactory.rb
|
82
53
|
- lib/cookbook-omnifetch/artifactserver.rb
|
@@ -91,29 +62,9 @@ files:
|
|
91
62
|
- lib/cookbook-omnifetch/path.rb
|
92
63
|
- lib/cookbook-omnifetch/threaded_job_queue.rb
|
93
64
|
- lib/cookbook-omnifetch/version.rb
|
94
|
-
|
95
|
-
- spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb
|
96
|
-
- spec/fixtures/cookbooks/example_cookbook-0.5.0/recipes/default.rb
|
97
|
-
- spec/fixtures/cookbooks/example_cookbook/.gitignore
|
98
|
-
- spec/fixtures/cookbooks/example_cookbook/.kitchen.yml
|
99
|
-
- spec/fixtures/cookbooks/example_cookbook/Berksfile
|
100
|
-
- spec/fixtures/cookbooks/example_cookbook/Berksfile.lock
|
101
|
-
- spec/fixtures/cookbooks/example_cookbook/README.md
|
102
|
-
- spec/fixtures/cookbooks/example_cookbook/metadata.rb
|
103
|
-
- spec/fixtures/cookbooks/example_cookbook/recipes/default.rb
|
104
|
-
- spec/spec_helper.rb
|
105
|
-
- spec/unit/artifactory_spec.rb
|
106
|
-
- spec/unit/artifactserver_spec.rb
|
107
|
-
- spec/unit/base_spec.rb
|
108
|
-
- spec/unit/chef_server_artifact_spec.rb
|
109
|
-
- spec/unit/chef_server_spec.rb
|
110
|
-
- spec/unit/exceptions_spec.rb
|
111
|
-
- spec/unit/git_spec.rb
|
112
|
-
- spec/unit/metadata_based_installer_spec.rb
|
113
|
-
- spec/unit/path_spec.rb
|
114
|
-
homepage: http://www.getchef.com/
|
65
|
+
homepage: https://github.com/chef/cookbook-omnifetch
|
115
66
|
licenses:
|
116
|
-
- Apache
|
67
|
+
- Apache-2.0
|
117
68
|
metadata: {}
|
118
69
|
post_install_message:
|
119
70
|
rdoc_options: []
|
@@ -123,37 +74,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
74
|
requirements:
|
124
75
|
- - ">="
|
125
76
|
- !ruby/object:Gem::Version
|
126
|
-
version: '
|
77
|
+
version: '2.4'
|
127
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
79
|
requirements:
|
129
80
|
- - ">="
|
130
81
|
- !ruby/object:Gem::Version
|
131
82
|
version: '0'
|
132
83
|
requirements: []
|
133
|
-
|
134
|
-
rubygems_version: 2.6.13
|
84
|
+
rubygems_version: 3.0.3
|
135
85
|
signing_key:
|
136
86
|
specification_version: 4
|
137
87
|
summary: Library code to fetch Chef cookbooks from a variety of sources to a local
|
138
88
|
cache
|
139
|
-
test_files:
|
140
|
-
- spec/fixtures/cookbooks/example_cookbook-0.5.0/README.md
|
141
|
-
- spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb
|
142
|
-
- spec/fixtures/cookbooks/example_cookbook-0.5.0/recipes/default.rb
|
143
|
-
- spec/fixtures/cookbooks/example_cookbook/.gitignore
|
144
|
-
- spec/fixtures/cookbooks/example_cookbook/.kitchen.yml
|
145
|
-
- spec/fixtures/cookbooks/example_cookbook/Berksfile
|
146
|
-
- spec/fixtures/cookbooks/example_cookbook/Berksfile.lock
|
147
|
-
- spec/fixtures/cookbooks/example_cookbook/README.md
|
148
|
-
- spec/fixtures/cookbooks/example_cookbook/metadata.rb
|
149
|
-
- spec/fixtures/cookbooks/example_cookbook/recipes/default.rb
|
150
|
-
- spec/spec_helper.rb
|
151
|
-
- spec/unit/artifactory_spec.rb
|
152
|
-
- spec/unit/artifactserver_spec.rb
|
153
|
-
- spec/unit/base_spec.rb
|
154
|
-
- spec/unit/chef_server_artifact_spec.rb
|
155
|
-
- spec/unit/chef_server_spec.rb
|
156
|
-
- spec/unit/exceptions_spec.rb
|
157
|
-
- spec/unit/git_spec.rb
|
158
|
-
- spec/unit/metadata_based_installer_spec.rb
|
159
|
-
- spec/unit/path_spec.rb
|
89
|
+
test_files: []
|