Class: EasyCaddy::Commands::Up
- Inherits:
-
Object
- Object
- EasyCaddy::Commands::Up
- Defined in:
- lib/easy_caddy/commands/up.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name:) ⇒ Up
constructor
A new instance of Up.
Constructor Details
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/easy_caddy/commands/up.rb', line 16 def call site = @registry.find(@name) unless site warn " Site '#{@name}' is not registered." exit 1 end if site.enabled puts " '#{@name}' is already up." return end disabled = Paths.disabled_file(@name) unless disabled.exist? warn " Fragment not found in disabled/: #{disabled}" exit 1 end disabled.rename(Paths.site_file(@name)) @registry.update(Site.new(name: site.name, enabled: true, source_path: site.source_path)) Caddy.validate!(Paths.caddyfile) Caddy.reload(Paths.caddyfile) puts " '#{@name}' is up." end |