Module: GryphonNest

Defined in:
lib/gryphon_nest.rb,
lib/gryphon_nest/errors.rb,
lib/gryphon_nest/version.rb,
lib/gryphon_nest/renderers.rb,
lib/gryphon_nest/processors.rb,
lib/gryphon_nest/processors/asset_processor.rb,
lib/gryphon_nest/renderers/mustache_renderer.rb,
lib/gryphon_nest/processors/mustache_processor.rb

Defined Under Namespace

Modules: Errors, Processors, Renderers

Constant Summary collapse

BUILD_DIR =
'_site'
CONTENT_DIR =
'content'
DATA_DIR =
'data'
TEMPLATE_EXT =
'.mustache'
LAYOUT_FILE =
'layout.mustache'
VERSION =
'3.0.0'

Class Method Summary collapse

Class Method Details

.build_websiteObject



20
21
22
23
24
25
26
27
28
# File 'lib/gryphon_nest.rb', line 20

def build_website
  raise Errors::NotFoundError, "Content directory doesn't exist in the current directory" unless Dir.exist?(CONTENT_DIR)

  Dir.mkdir(BUILD_DIR) unless Dir.exist?(BUILD_DIR)

  existing_files = glob("#{BUILD_DIR}/**/*")
  existing_files = existing_files.difference(process_content)
  delete_files(existing_files)
end

.serve_website(port) ⇒ Object

Parameters:

  • port (Integer)


31
32
33
34
35
36
37
# File 'lib/gryphon_nest.rb', line 31

def serve_website(port)
  puts "Running local server on #{port}"
  server = WEBrick::HTTPServer.new(Port: port, DocumentRoot: BUILD_DIR)
  # Trap ctrl c so we don't get the horrible stack trace
  trap('INT') { server.shutdown }
  server.start
end