Class: Ucode::Commands::SiteCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/ucode/commands/site.rb

Overview

‘ucode site` — init the Vitepress scaffold + build config/pages from the current `output/` tree. Two subactions.

Instance Method Summary collapse

Instance Method Details

#build(output_root:, site_root:, **_unused) ⇒ Hash

Returns the Generator’s build tally.

Parameters:

  • output_root (String, Pathname)
  • site_root (String, Pathname)

Returns:

  • (Hash)

    the Generator’s build tally



24
25
26
27
28
29
30
# File 'lib/ucode/commands/site.rb', line 24

def build(output_root:, site_root:, **_unused)
  gen = Site::Generator.new(
    output_root: Pathname.new(output_root),
    site_root: Pathname.new(site_root),
  )
  gen.build
end

#init(site_root:) ⇒ Hash

Returns { files_copied: }.

Parameters:

  • site_root (String, Pathname)

Returns:

  • (Hash)

    { files_copied: }



15
16
17
18
19
# File 'lib/ucode/commands/site.rb', line 15

def init(site_root:)
  root = Pathname.new(site_root)
  count = Site::Generator.new(output_root: "/", site_root: root).init
  { files_copied: count }
end