Module: Pacino

Defined in:
lib/pacino/version.rb,
lib/pacino.rb

Overview

Pacino Copyright © 2011-2012 Jack Polgar

Pacino is released under the GPLv3 only license.

Constant Summary collapse

VERSION =
'0.2.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.titleObject

Returns the value of attribute title.



17
18
19
# File 'lib/pacino.rb', line 17

def title
  @title
end

Class Method Details

.runObject

Runs Pacino



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/pacino.rb', line 21

def run
  # Configure the app
  configure do
    @DIR = File.dirname(__FILE__)
    
    # Load the config file
    conf = YAML.load_file Dir.pwd + '/config.yml'
    self.title = conf['title']
    
    set :views => @DIR + '/pacino/views'
  end
  
  # Helpers
  helpers do
    ##
    # Markdown helper
    def mrkdwn(txt)
      ::Markdown.new(txt).to_html
    end
  end
  
  ## Do stuff before every page
  before do
    # Get the posts
    @posts = {}
    Dir.glob('posts/*.yml').reverse.each do |p|
      # Load the post file
      post = YAML.load_file p
      # Add it to the posts hash
      @posts[:"#{post['slug']}"] = post
    end
  end
  
  # Index page
  get '/' do
    erb :index, :layout => :'layouts/default'
  end
  
  # Style file
  get '/css/style.css' do
    scss :'css/style'
  end
end