cookbook-omnifetch 0.8.0 → 0.10.1

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.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/lib/cookbook-omnifetch.rb +13 -13
  3. data/lib/cookbook-omnifetch/artifactory.rb +12 -7
  4. data/lib/cookbook-omnifetch/artifactserver.rb +3 -3
  5. data/lib/cookbook-omnifetch/base.rb +1 -1
  6. data/lib/cookbook-omnifetch/chef_server.rb +2 -2
  7. data/lib/cookbook-omnifetch/chef_server_artifact.rb +2 -2
  8. data/lib/cookbook-omnifetch/git.rb +4 -4
  9. data/lib/cookbook-omnifetch/integration.rb +1 -1
  10. data/lib/cookbook-omnifetch/metadata_based_installer.rb +14 -13
  11. data/lib/cookbook-omnifetch/path.rb +1 -1
  12. data/lib/cookbook-omnifetch/threaded_job_queue.rb +1 -1
  13. data/lib/cookbook-omnifetch/version.rb +1 -1
  14. metadata +15 -85
  15. data/.gitignore +0 -23
  16. data/.rspec +0 -1
  17. data/.travis.yml +0 -11
  18. data/Gemfile +0 -8
  19. data/README.md +0 -90
  20. data/Rakefile +0 -19
  21. data/cookbook-omnifetch.gemspec +0 -39
  22. data/spec/fixtures/cookbooks/example_cookbook-0.5.0/README.md +0 -12
  23. data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +0 -3
  24. data/spec/fixtures/cookbooks/example_cookbook-0.5.0/recipes/default.rb +0 -8
  25. data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
  26. data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +0 -26
  27. data/spec/fixtures/cookbooks/example_cookbook/Berksfile +0 -1
  28. data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +0 -3
  29. data/spec/fixtures/cookbooks/example_cookbook/README.md +0 -12
  30. data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +0 -3
  31. data/spec/fixtures/cookbooks/example_cookbook/recipes/default.rb +0 -8
  32. data/spec/spec_helper.rb +0 -43
  33. data/spec/unit/artifactory_spec.rb +0 -64
  34. data/spec/unit/artifactserver_spec.rb +0 -116
  35. data/spec/unit/base_spec.rb +0 -87
  36. data/spec/unit/chef_server_artifact_spec.rb +0 -110
  37. data/spec/unit/chef_server_spec.rb +0 -108
  38. data/spec/unit/exceptions_spec.rb +0 -87
  39. data/spec/unit/git_spec.rb +0 -290
  40. data/spec/unit/metadata_based_installer_spec.rb +0 -137
  41. data/spec/unit/path_spec.rb +0 -119
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 43c39456987fef3b32d9b037565804e5293bd8ed
4
- data.tar.gz: 776b3865d04123606bdafb1f4f7c7412b993724b
2
+ SHA256:
3
+ metadata.gz: 4df0a66a67a46dc690434e1bc71a7cf0020496214b51b6639236fa3a9843873a
4
+ data.tar.gz: 3c1d54feae73211f2977a1c4b04fa5c294bd62aa0ace636e9b447175380b7b7b
5
5
  SHA512:
6
- metadata.gz: 1dea15259b08c5de8a97f111c103f9f8a54d6ad6499806c4659b9870f6b73fb587a57b1297d1fb52faa146904b643e698f18572c393f7fd2c334b3f71484d9b2
7
- data.tar.gz: 1005b451253f385241b319c7601f7bb2594502c712d7583f0c92761836acdda45dde4a027aafd303d6a730fa344ece4fb8276bcad1fbec58d6b2d07bda6d5e14
6
+ metadata.gz: 6dcfe66630ecb1af6dabce0f37b5d92454afe523ff22755ec4ebacdb047d6dbfc3fb17ad9cff5d1440d9ebca9d4811663054f344e65e45f81339e530a48250a6
7
+ data.tar.gz: 94edbbeba3fc3d31a9789a1461cdf878073ed2bfb8d632a52e6ba1b16092331e680d7d720ea01ab2b0d069a70678c3ed20d849453fd1da42f80873535b822f88
@@ -1,14 +1,14 @@
1
- require "cookbook-omnifetch/version"
2
- require "cookbook-omnifetch/integration"
3
-
4
- require "cookbook-omnifetch/base"
5
- require "cookbook-omnifetch/git"
6
- require "cookbook-omnifetch/github"
7
- require "cookbook-omnifetch/path"
8
- require "cookbook-omnifetch/artifactserver"
9
- require "cookbook-omnifetch/artifactory"
10
- require "cookbook-omnifetch/chef_server"
11
- require "cookbook-omnifetch/chef_server_artifact"
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
@@ -135,7 +135,7 @@ module CookbookOmnifetch
135
135
  #
136
136
  # @return [Boolean]
137
137
  def self.cookbook?(path)
138
- File.exists?(File.join(path, "metadata.json")) || File.exists?(File.join(path, "metadata.rb"))
138
+ File.exist?(File.join(path, "metadata.json")) || File.exist?(File.join(path, "metadata.rb"))
139
139
  end
140
140
 
141
141
  class << self
@@ -1,7 +1,7 @@
1
- require "cookbook-omnifetch/base"
1
+ require_relative "base"
2
2
 
3
- require "mixlib/archive"
4
- require "tmpdir"
3
+ require "mixlib/archive" unless defined?(Mixlib::Archive)
4
+ require "tmpdir" unless defined?(Dir.mktmpdir)
5
5
 
6
6
  module CookbookOmnifetch
7
7
 
@@ -15,7 +15,12 @@ module CookbookOmnifetch
15
15
  super
16
16
  @uri ||= options[:artifactory]
17
17
  @cookbook_version = options[:version]
18
- @http_client = options[:http_client]
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 artifactserver are held.
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", "artifactserver")
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", "artifactserver")
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,7 +1,7 @@
1
- require "cookbook-omnifetch/base"
1
+ require_relative "base"
2
2
 
3
- require "mixlib/archive"
4
- require "tmpdir"
3
+ require "mixlib/archive" unless defined?(Mixlib::Archive)
4
+ require "tmpdir" unless defined?(Dir.mktmpdir)
5
5
 
6
6
  module CookbookOmnifetch
7
7
 
@@ -1,4 +1,4 @@
1
- require "cookbook-omnifetch/exceptions"
1
+ require_relative "exceptions"
2
2
 
3
3
  module CookbookOmnifetch
4
4
  class BaseLocation
@@ -1,5 +1,5 @@
1
- require "cookbook-omnifetch/base"
2
- require "cookbook-omnifetch/metadata_based_installer"
1
+ require_relative "base"
2
+ require_relative "metadata_based_installer"
3
3
 
4
4
  module CookbookOmnifetch
5
5
  class ChefServerLocation < BaseLocation
@@ -1,5 +1,5 @@
1
- require "cookbook-omnifetch/base"
2
- require "cookbook-omnifetch/metadata_based_installer"
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
@@ -1,7 +1,7 @@
1
- require "tmpdir"
2
- require "cookbook-omnifetch"
3
- require "cookbook-omnifetch/base"
4
- require "cookbook-omnifetch/exceptions"
1
+ require "tmpdir" unless defined?(Dir.mktmpdir)
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
- require "cookbook-omnifetch/exceptions"
1
+ require_relative "exceptions"
2
2
 
3
3
  module CookbookOmnifetch
4
4
 
@@ -1,21 +1,22 @@
1
- require "cookbook-omnifetch/threaded_job_queue"
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
- :resources,
10
- :providers,
11
- :recipes,
12
- :definitions,
13
- :libraries,
14
- :attributes,
15
- :files,
16
- :templates,
17
- :root_files,
18
- ].freeze
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.has_key?(type.to_s)
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"]
@@ -1,4 +1,4 @@
1
- require "cookbook-omnifetch/base"
1
+ require_relative "base"
2
2
 
3
3
  module CookbookOmnifetch
4
4
  class PathLocation < BaseLocation
@@ -40,7 +40,7 @@ module CookbookOmnifetch
40
40
  end
41
41
  end
42
42
  workers.each { |worker| self << Thread.method(:exit) }
43
- workers.each { |worker| worker.join }
43
+ workers.each(&:join)
44
44
  end
45
45
  end
46
46
  end
@@ -1,3 +1,3 @@
1
1
  module CookbookOmnifetch
2
- VERSION = "0.8.0"
2
+ VERSION = "0.10.1".freeze
3
3
  end
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.8.0
4
+ version: 0.10.1
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: 2017-11-06 00:00:00.000000000 Z
16
+ date: 2020-08-21 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
- - !ruby/object:Gem::Dependency
33
- name: rake
34
- requirement: !ruby/object:Gem::Requirement
35
- requirements:
36
- - - ">="
25
+ - - "<"
37
26
  - !ruby/object:Gem::Version
38
- version: '0'
39
- type: :development
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
- - !ruby/object:Gem::Dependency
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: '3.0'
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@getchef.com
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
- - spec/fixtures/cookbooks/example_cookbook-0.5.0/README.md
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 2.0
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: '0'
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
- rubyforge_project:
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: []
data/.gitignore DELETED
@@ -1,23 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
23
- .idea/*
data/.rspec DELETED
@@ -1 +0,0 @@
1
- -c -f documentation
@@ -1,11 +0,0 @@
1
- branches:
2
- only:
3
- master
4
-
5
- language: ruby
6
- rvm:
7
- - 2.2
8
- - 2.3.3
9
- - 2.4.1
10
- before_install: gem install bundler -v 1.14.6
11
- script: bundle exec rake ci
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- group :development, :test do
6
- gem "minitar"
7
- gem "chefstyle"
8
- end
data/README.md DELETED
@@ -1,90 +0,0 @@
1
- # CookbookOmnifetch
2
-
3
- `CookbookOmnifetch` provides library code for fetching Chef cookbooks
4
- from an artifact server (usually https://supermarket.chef.io),
5
- git/github, a local path, or a chef-server to a local cache for
6
- developement.
7
-
8
- ## Installation
9
-
10
- Add this line to your application's Gemfile:
11
-
12
- gem 'cookbook-omnifetch'
13
-
14
- And then execute:
15
-
16
- $ bundle
17
-
18
- Or install it yourself as:
19
-
20
- $ gem install cookbook-omnifetch
21
-
22
- ## Usage
23
-
24
- #### Inject Dependencies and Configure
25
-
26
- Cookbook Omnifetch is designed to work with utilities from both the
27
- Berkshelf and Chef Software ecosystems, so you have to configure it
28
- before you can use it. In ChefDK, we do this:
29
-
30
- ```ruby
31
- # Configure CookbookOmnifetch's dependency injection settings to use our classes and config.
32
- CookbookOmnifetch.configure do |c|
33
- c.cache_path = File.expand_path('~/.chefdk/cache')
34
- c.storage_path = Pathname.new(File.expand_path('~/.chefdk/cache/cookbooks'))
35
- c.shell_out_class = ChefDK::ShellOut
36
- c.cached_cookbook_class = ChefDK::CookbookMetadata
37
- end
38
- ```
39
-
40
- #### Fetching Cookbooks
41
-
42
- To download a cookbook:
43
-
44
- ```ruby
45
- fetcher = CookbookOmnifetch.init(dependency, source_options)
46
- fetcher.install
47
- ```
48
-
49
- To specify the cookbook you want, you give CookbookOmnifetch a
50
- dependency object that responds to `#name` and `#version_constraint`,
51
- e.g.:
52
-
53
- ```ruby
54
- require 'semverse'
55
-
56
- Dependency = Struct.new(:name, :version_constraint)
57
-
58
- my_dep = Dependency.new("apache2", Semverse::Constraint.new("~> 1.0"))
59
- ```
60
-
61
- The source options for the cookbook are given as a Hash; the keys and
62
- values vary based on the kind of storage location. As with Bundler's
63
- `gem` options, one key specifies the type of upstream service for the
64
- cookbook while other keys specify other options specific to that type.
65
- For example:
66
-
67
- ```ruby
68
- CookbookOmnifetch.init(dependency, artifact_server: "https://supermarket.chef.io/api/v1/cookbooks/apache2/versions/3.0.1/download")
69
- CookbookOmnifetch.init(dependency, git: "git@github.com:svanzoest/apache2-cookbook.git", tag: "v3.0.1")
70
- CookbookOmnifetch.init(dependency, github: "svanzoest/apache2-cookbook", tag: "v3.0.1")
71
- CookbookOmnifetch.init(dependency, path: "~/chef-cookbooks/apache2")
72
- ```
73
-
74
- ## Contributing
75
-
76
- For information on contributing to this project, see https://github.com/chef/chef/blob/master/CONTRIBUTING.md
77
-
78
- After that:
79
-
80
- 1. Fork it
81
- 2. Create your feature branch (`git checkout -b my-new-feature`)
82
- 3. Commit your changes (`git commit -asm 'Add some feature'`)
83
- 4. Push to the branch (`git push origin my-new-feature`)
84
- 5. Create a new Pull Request
85
-
86
- ## Thanks
87
-
88
- This code was initially extracted from Berkshelf. Thanks to the
89
- Berkshelf core teams and contributors.
90
-