Skip to content

Commit

Permalink
Rename Community Site -> Supermarket
Browse files Browse the repository at this point in the history
Including the classes and the plugins. Rename all the things

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 committed Sep 12, 2017
1 parent d4a4ad1 commit 5db6db1
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 57 deletions.
14 changes: 7 additions & 7 deletions features/plugins/community.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Feature: Community
Feature: Supermarket
Background:
* I have a cookbook named "bacon"

Expand All @@ -13,25 +13,25 @@ Feature: Community
* it should fail with "requires a private key"

Scenario: With the default parameters
* the community server has the cookbook:
* the supermarket has the cookbook:
| bacon | 1.2.3 |
* I successfully run `stove --no-git`
* the community server will have the cookbooks:
* the supermarket will have the cookbooks:
| bacon | 0.0.0 |

Scenario: Yanking a cookbook
* the community server has the cookbooks:
* the supermarket has the cookbooks:
| bacon | 1.2.3 |
* I successfully run `stove yank -l debug`
* the community server will not have the cookbooks:
* the supermarket will not have the cookbooks:
| bacon | 1.2.3 |
* the output should contain "Successfully yanked bacon!"

Scenario: Yanking a cookbook by name
* the community server has the cookbooks:
* the supermarket has the cookbooks:
| eggs | 4.5.6 |
* I successfully run `stove yank eggs`
* the community server will not have the cookbooks:
* the supermarket will not have the cookbooks:
| eggs | 4.5.6 |
* the output should not contain "Successfully yanked bacon!"
* the output should contain "Successfully yanked eggs!"
Expand Down
2 changes: 1 addition & 1 deletion features/plugins/git.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: git Plugin
Background:
* I have a cookbook named "bacon"
* the community server has the cookbooks:
* the supermarket has the cookbooks:
| bacon | 1.0.0 |

Scenario: When the directory is not a git repository
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/community_steps.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Given /^the community server has the cookbooks?:$/ do |table|
Given /^the supermarket has the cookbooks?:$/ do |table|
table.raw.each do |name, version|
version ||= '0.0.0'

Expand All @@ -10,7 +10,7 @@
end
end

Then /^the community server will( not)? have the cookbooks?:$/ do |negate, table|
Then /^the supermarket will( not)? have the cookbooks?:$/ do |negate, table|
table.raw.each do |name, version|
cookbook = CommunityZero::RSpec.store.find(name, version)

Expand Down
4 changes: 2 additions & 2 deletions lib/stove.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Stove
autoload :Artifactory, 'stove/artifactory'
autoload :Community, 'stove/community'
autoload :Supermarket, 'stove/supermarket'
autoload :Config, 'stove/config'
autoload :Cookbook, 'stove/cookbook'
autoload :Cli, 'stove/cli'
Expand Down Expand Up @@ -31,7 +31,7 @@ module Mixin
module Plugin
autoload :Artifactory, 'stove/plugins/artifactory'
autoload :Base, 'stove/plugins/base'
autoload :Community, 'stove/plugins/community'
autoload :Supermarket, 'stove/plugins/supermarket'
autoload :Git, 'stove/plugins/git'
end

Expand Down
4 changes: 2 additions & 2 deletions lib/stove/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def execute!
if @argv.first == 'yank'
name = @argv[1] || Cookbook.new(options[:path]).name

if Community.yank(name)
if Supermarket.yank(name)
@stdout.puts "Successfully yanked #{name}!"
@kernel.exit(0)
else
Expand Down Expand Up @@ -108,7 +108,7 @@ def option_parser
opts.separator ''
opts.separator 'Upload Options:'

opts.on('--endpoint [URL]', 'Upload URL endpoint') do |v|
opts.on('--endpoint [URL]', 'Supermarket endpoint') do |v|
options[:endpoint] = v
end

Expand Down
6 changes: 3 additions & 3 deletions lib/stove/cookbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Cookbook

#
# The name of the cookbook (must correspond to the name of the
# cookbook on the community site).
# cookbook on the Supermarket).
#
# @return [String]
#
Expand Down Expand Up @@ -71,7 +71,7 @@ def tag_version
end

#
# Deterine if this cookbook version is released on the community site
# Deterine if this cookbook version is released on the Supermarket
#
# @warn
# This is a fairly expensive operation and the result cannot be
Expand All @@ -82,7 +82,7 @@ def tag_version
# site, false otherwise
#
def released?
Community.cookbook(name, version)
Supermarket.cookbook(name, version)
true
rescue ChefAPI::Error::HTTPNotFound
false
Expand Down
2 changes: 1 addition & 1 deletion lib/stove/cookbook/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Cookbook
# Borrowed and modified from:
# {https://raw.github.com/opscode/chef/11.4.0/lib/chef/cookbook/metadata.rb}
#
# Copyright:: Copyright 2008-2010 Opscode, Inc.
# Copyright:: Copyright 2008-2017 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions lib/stove/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class CookbookAlreadyExists < StoveError; end

# Validations
class ValidationFailed < StoveError; end
class CommunityCategoryValidationFailed < ValidationFailed; end
class CommunityKeyValidationFailed < ValidationFailed; end
class CommunityUsernameValidationFailed < ValidationFailed; end
class SupermarketCategoryValidationFailed < ValidationFailed; end
class SupermarketKeyValidationFailed < ValidationFailed; end
class SupermarketUsernameValidationFailed < ValidationFailed; end
class GitCleanValidationFailed < ValidationFailed; end
class GitRepositoryValidationFailed < ValidationFailed; end
class GitUpToDateValidationFailed < ValidationFailed; end
Expand Down
18 changes: 0 additions & 18 deletions lib/stove/plugins/community.rb

This file was deleted.

18 changes: 18 additions & 0 deletions lib/stove/plugins/supermarket.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Stove
class Plugin::Supermarket < Plugin::Base
id 'supermarket'
description 'Publish the release to the Chef Supermarket'

validate(:username) do
Config.username
end

validate(:key) do
Config.key
end

run('Publishing the release to the Chef Supermarket') do
Supermarket.upload(cookbook, options[:extended_metadata])
end
end
end
2 changes: 1 addition & 1 deletion lib/stove/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def run
if Config.artifactory
run_plugin :artifactory
else
run_plugin :community
run_plugin :supermarket
end
end

Expand Down
18 changes: 9 additions & 9 deletions lib/stove/community.rb → lib/stove/supermarket.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'chef-api'

module Stove
class Community
class Supermarket
include Mixin::Instanceable
include Mixin::Optionable

#
# The default endpoint where the community site lives.
# The default endpoint where the Supermarket lives.
#
# @return [String]
#
Expand All @@ -17,19 +17,19 @@ class Community
# and version.
#
# @example Find a cookbook by name
# Community.cookbook('apache2') #=> {...}
# Supermarket.cookbook('apache2') #=> {...}
#
# @example Find a cookbook by name and version
# Community.cookbook('apache2', '1.0.0') #=> {...}
# Supermarket.cookbook('apache2', '1.0.0') #=> {...}
#
# @example Find a non-existent cookbook
# Community.cookbook('not-real') #=> Community::BadResponse
# Supermarket.cookbook('not-real') #=> Community::BadResponse
#
# @raise [Community::BadResponse]
# if the given cookbook (or cookbook version) does not exist on the community site
# @raise [Supermarket::BadResponse]
# if the given cookbook (or cookbook version) does not exist on the Supermarket
#
# @param [String] name
# the name of the cookbook on the community site
# the name of the cookbook on the Supermarket
# @param [String] version (optional)
# the version of the cookbook to find
#
Expand Down Expand Up @@ -63,7 +63,7 @@ def upload(cookbook, extended_metadata = false)
end

#
# Delete the given cookbook from the community site.
# Delete the given cookbook from the supermarket.
#
# @param [String] name
# the name of the cookbook to delete
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ module Stove::Error
end
end

describe CommunityKeyValidationFailed do
describe SupermarketKeyValidationFailed do
it 'raises an exception with the correct message' do
expect { raise described_class }.to raise_error { |error|
expect(error).to be_a(described_class)
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
You did not specify the path to a private key! The Chef community site requires a private key for authentication:
You did not specify the path to a private key! The Chef Supermarket requires a private key for authentication:
stove --key ~/.chef/sethvargo.pem
EOH
}
end
end

describe CommunityUsernameValidationFailed do
describe SupermarketUsernameValidationFailed do
it 'raises an exception with the correct message' do
expect { raise described_class }.to raise_error { |error|
expect(error).to be_a(described_class)
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
You did not specify the username to authenticate with! The Chef community site requires a username for authentication:
You did not specify the username to authenticate with! The Chef Supermarket requires a username for authentication:
stove --username sethvargo
EOH
Expand Down
3 changes: 0 additions & 3 deletions templates/errors/community_key_validation_failed.erb

This file was deleted.

3 changes: 3 additions & 0 deletions templates/errors/supermarket_key_validation_failed.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
You did not specify the path to a private key! The Chef Supermarket requires a private key for authentication:

stove --key ~/.chef/sethvargo.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
You did not specify the username to authenticate with! The Chef community site requires a username for authentication:
You did not specify the username to authenticate with! The Chef Supermarket requires a username for authentication:

stove --username sethvargo

0 comments on commit 5db6db1

Please sign in to comment.