diff --git a/Steepfile b/Steepfile index 752f598..ee191dc 100644 --- a/Steepfile +++ b/Steepfile @@ -6,6 +6,7 @@ target :lib do check "lib" # Directory name # ignore "lib/templates/*.rb" + library "fileutils" # library "pathname" # Standard libraries # library "strong_json" # Gems # library "phlex" diff --git a/lib/phlexite/router.rb b/lib/phlexite/router.rb index 6f14490..2363b53 100644 --- a/lib/phlexite/router.rb +++ b/lib/phlexite/router.rb @@ -17,6 +17,12 @@ class Phlexite::Router File::write(out, component.call) end + def mount(local_directory, on:) + out = full_out_path(on) + FileUtils::mkdir_p out + FileUtils::cp_r File::join(local_directory, "."), out + end + private def full_out_path(out_path) diff --git a/sig/phlexite.rbs b/sig/phlexite.rbs index 5eedd1f..3710de4 100644 --- a/sig/phlexite.rbs +++ b/sig/phlexite.rbs @@ -8,6 +8,7 @@ module Phlexite def initialize: (String, Site) -> void def page: (String, untyped) -> void def group: (String) { (Router) -> void } -> void + def mount: (String, on: String) -> void private def full_out_path: (String) -> String