Class: EasyCaddy::Commands::Remove
- Inherits:
-
Object
- Object
- EasyCaddy::Commands::Remove
- Defined in:
- lib/easy_caddy/commands/remove.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name:, force:, prompt:) ⇒ Remove
constructor
A new instance of Remove.
Constructor Details
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/easy_caddy/commands/remove.rb', line 17 def call site = @registry.find(@name) unless site warn " Site '#{@name}' is not registered." exit 1 end unless @force unless @prompt.yes?("Remove #{@name} and delete its Caddy fragment?") puts ' Aborted.' return end end [Paths.site_file(@name), Paths.disabled_file(@name)].each do |f| f.delete if f.exist? end @registry.remove(@name) Caddy.reload(Paths.caddyfile) puts " Removed '#{@name}'." end |