Module: Pekky

Defined in:
lib/pekky.rb,
lib/pekky/tree.rb,
lib/pekky/pages.rb,
lib/pekky/config.rb,
lib/pekky/format.rb,
lib/pekky/server.rb,
lib/pekky/builder.rb,
lib/pekky/console.rb,
lib/pekky/content.rb,
lib/pekky/context.rb

Overview

# Pekky! The main module, which contains all the various kick-off methods. The majority of the actual logic is defined in the other source files. This module just serves as a container and shortcut.

Defined Under Namespace

Modules: Builder, Config, Console, Format, Server, Tree Classes: Content, Context, Directory, Page, PekkyError

Constant Summary collapse

VERSION =

The third release, dedicated to stunt-men everywhere.

'0.4.1'
VERSION_NAME =
"Still Shit-scared"

Class Method Summary collapse

Class Method Details

.buildObject

Builds the site on disk.



95
96
97
# File 'lib/pekky.rb', line 95

def self.build
  Builder.build
end

.build!Object

First clears the existing output, then rebuilds the site.



100
101
102
# File 'lib/pekky.rb', line 100

def self.build!
  Builder.build!
end

.consoleObject

Builds the site and starts a console session.



70
71
72
# File 'lib/pekky.rb', line 70

def self.console
  Console.start
end

.exportObject

Creates an export of the site ready to go up onto a server.



107
108
109
110
# File 'lib/pekky.rb', line 107

def self.export
  @exporting = true
  build!
end

.exporting?Boolean

Used within the app to indicate if we are doing a developmental build or a proper build. This will effect helpers, which will use things like the domain and path prefix

Returns:

  • (Boolean)


115
116
117
# File 'lib/pekky.rb', line 115

def self.exporting?
  @exporting == true
end

.generate(destination) ⇒ Object

Stubs out a site on disk. Is generally called with the Pekky binary.



60
61
62
# File 'lib/pekky.rb', line 60

def self.generate(destination)
  Builder.generate(destination)
end

.helpers(&blk) ⇒ Object

Used bu the helpers.rb file to define additional helpers.



90
91
92
# File 'lib/pekky.rb', line 90

def self.helpers(&blk)
  Context.class_eval(&blk)
end

.load(root = Dir.pwd) ⇒ Object

Requires the site file and if defined the helpers file. #load can be called with an optional root. This is generally not necessary and is mainly used when testing.



77
78
79
80
81
82
# File 'lib/pekky.rb', line 77

def self.load(root = Dir.pwd)    
  Config.load(root)
  require File.join(root, 'site')
  helpers_path = File.join(root, 'helpers.rb')
  require helpers_path if File.exists?(helpers_path)
end

.server(port) ⇒ Object

Starts up the server on the specified port.



65
66
67
# File 'lib/pekky.rb', line 65

def self.server(port)    
  Server.start(port)
end

.site(&blk) ⇒ Object

Used by the site.rb file to define all the options in the site.



85
86
87
# File 'lib/pekky.rb', line 85

def self.site(&blk)    
  Config.class_eval(&blk)
end

.treeObject

Returns the tree module. The tree module represents the sites pages and contents arranged into a tree.



55
56
57
# File 'lib/pekky.rb', line 55

def self.tree
  Tree
end