Class: Stove::Supermarket
- Inherits:
-
Object
- Object
- Stove::Supermarket
- Includes:
- Mixin::Instanceable, Mixin::Optionable
- Defined in:
- lib/stove/supermarket.rb
Constant Summary collapse
- DEFAULT_ENDPOINT =
The default endpoint where the Supermarket lives.
'https://supermarket.chef.io/api/v1'
Instance Method Summary collapse
-
#cookbook(name, version = nil) ⇒ Hash
Get and cache a community cookbook’s JSON response from the given name and version.
-
#upload(cookbook, extended_metadata = false) ⇒ Object
Upload a cookbook to the community site.
Methods included from Mixin::Optionable
Methods included from Mixin::Instanceable
Instance Method Details
#cookbook(name, version = nil) ⇒ Hash
Get and cache a community cookbook’s JSON response from the given name and version.
39 40 41 42 43 44 45 |
# File 'lib/stove/supermarket.rb', line 39 def cookbook(name, version = nil) if version.nil? connection.get("cookbooks/#{name}") else connection.get("cookbooks/#{name}/versions/#{Util.version_for_url(version)}") end end |
#upload(cookbook, extended_metadata = false) ⇒ Object
Upload a cookbook to the community site.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/stove/supermarket.rb', line 53 def upload(cookbook, = false) connection.post('cookbooks', { 'tarball' => cookbook.tarball(), # This is for legacy, backwards-compatability reasons. The new # Supermarket site does not require a category, but many of the testing # tools still assume a cookbook category is present. We just hardcode # "Other" here. 'cookbook' => JSON.fast_generate(category: 'Other'), }) end |