Class: Staticky::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/staticky/generator.rb

Defined Under Namespace

Classes: ViewContext

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Generator

Returns a new instance of Generator.



20
21
22
23
# File 'lib/staticky/generator.rb', line 20

def initialize(**kwargs)
  super
  @path = GEM_ROOT.join("site_template")
end

Instance Method Details

#call(output_dir) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/staticky/generator.rb', line 25

def call(output_dir, **)
  view_context = ViewContext.new(**)
  output_dir = Pathname.new(output_dir).expand_path

  Pathname.glob(@path.join("**/*"), File::FNM_DOTMATCH).each do |file|
    build_file(file:, output_dir:, view_context:)
  end
end