trabajo-afectivo/lib/tasks/zammad/package/uninstall.rb
2022-01-01 14:38:12 +01:00

34 lines
942 B
Ruby

# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
require_dependency 'tasks/zammad/command.rb'
module Tasks
module Zammad
module Package
class Uninstall < Tasks::Zammad::Command
def self.usage
"#{super} MyPackage"
end
ARGUMENT_COUNT = 1
def self.task_handler
name = ARGV[1]
if name.blank?
abort "Error: please provide a package name: #{ARGV[0]} MyPackage"
end
# Find the package so that we don't need to require the version from the command line.
package = ::Package.find_by(name: name)
if package.blank?
abort "Error: package #{name} was not found."
end
puts "Uninstalling #{package.name} #{package.version}..."
::Package.uninstall(name: package.name, version: package.version)
puts 'done.'
end
end
end
end
end