initial commit
This commit is contained in:
commit
5779c37f5b
19 changed files with 421 additions and 0 deletions
7
lib/phlexite.rb
Normal file
7
lib/phlexite.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative "phlexite/version"
|
||||
|
||||
module Phlexite
|
||||
class Error < StandardError; end
|
||||
end
|
20
lib/phlexite/router.rb
Normal file
20
lib/phlexite/router.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
class Phlexite::Router
|
||||
def initialize(base, site)
|
||||
@base = base
|
||||
@site = site
|
||||
end
|
||||
|
||||
def group(new_base)
|
||||
router = Phlexite::Router.new(File::join(@base, new_base), @site)
|
||||
yield router
|
||||
end
|
||||
|
||||
def page(out_path, component)
|
||||
File::write(full_out_path(out_path), component.call)
|
||||
end
|
||||
|
||||
private
|
||||
def full_out_path(out_path)
|
||||
File::join(@site.build_dir, @site.base_url, @base, out_path)
|
||||
end
|
||||
end
|
13
lib/phlexite/site.rb
Normal file
13
lib/phlexite/site.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'router.rb'
|
||||
|
||||
class Phlexite::Site < Phlexite::Router
|
||||
attr_accessor :build_dir, :base_url
|
||||
|
||||
def initialize
|
||||
super("/", self)
|
||||
base_url = "/"
|
||||
yield self
|
||||
end
|
||||
end
|
5
lib/phlexite/version.rb
Normal file
5
lib/phlexite/version.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Phlexite
|
||||
VERSION = "0.1.0"
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue