Skip to content

Commit

Permalink
remove the yank command (#133)
Browse files Browse the repository at this point in the history
it deletes the cookbook entirely, not just one version (which would be
bad enough)

Signed-off-by: Lamont Granquist <[email protected]>
  • Loading branch information
lamont-granquist authored and tas50 committed Dec 3, 2018
1 parent b16c968 commit af61d67
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 53 deletions.
21 changes: 0 additions & 21 deletions features/plugins/community.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,3 @@ Feature: Supermarket
* I successfully run `stove --no-git`
* the supermarket will have the cookbooks:
| bacon | 0.0.0 |

Scenario: Yanking a cookbook
* the supermarket has the cookbooks:
| bacon | 1.2.3 |
* I successfully run `stove yank -l debug`
* 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 supermarket has the cookbooks:
| eggs | 4.5.6 |
* I successfully run `stove yank eggs`
* 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!"

Scenario: Yanking a non-existent cookbook
* I run `stove yank ham`
* it should fail with "I could not find a cookbook named ham"
15 changes: 0 additions & 15 deletions lib/stove/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,6 @@ def execute!
log.info("Options: #{options.inspect}")
log.info("ARGV: #{@argv.inspect}")

# Yank command
if @argv.first == 'yank'
name = @argv[1] || Cookbook.new(options[:path]).name

if Supermarket.yank(name)
@stdout.puts "Successfully yanked #{name}!"
@kernel.exit(0)
else
@stderr.puts "I could not find a cookbook named #{name}!"
@kernel.exit(1)
end

return
end

# Make a new cookbook object - this will raise an exception if there is
# no cookbook at the given path
cookbook = Cookbook.new(options[:path])
Expand Down
17 changes: 0 additions & 17 deletions lib/stove/supermarket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,6 @@ def upload(cookbook, extended_metadata = false)
})
end

#
# Delete the given cookbook from the supermarket.
#
# @param [String] name
# the name of the cookbook to delete
#
# @return [true, false]
# true if the cookbook was deleted, false otherwise
#
def yank(name)
connection.delete("/cookbooks/#{name}")
true
rescue ChefAPI::Error::HTTPBadRequest,
ChefAPI::Error::HTTPNotFound,
false
end

private

#
Expand Down

0 comments on commit af61d67

Please sign in to comment.