Module: Plankton::Command::Rmtag

Defined in:
lib/plankton/commands/rmtag.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/plankton/commands/rmtag.rb', line 2

def self.included(base)
  base.class_eval do
    desc 'rmtag REPO TAG', 'Delete a given tag'
    def rmtag(repo, tag)
      if confirm?
        answer = ask("Delete #{repo}:#{tag}?", limited_to: ['yes', 'no'])
        exit if answer == 'no'
      end
      registry.rmtag(repo: repo, tag: tag)
      puts "Tag #{tag} was successfully deleted."
    rescue RestClient::NotFound => e
      puts "Tag #{tag} was not found. (#{e.message})"
      exit 1
    end
  end
end