plate 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ module Plate
2
+ # A static page is left unmodified and is transferred over to the published
3
+ # site exactly as it is.
4
+ class StaticPage < Page
5
+ def file_path
6
+ base = Pathname.new(File.join(self.site.source, 'content'))
7
+ current = Pathname.new(self.file)
8
+
9
+ dirs = current.relative_path_from(base)
10
+
11
+ "/#{dirs}"
12
+ end
13
+
14
+ def layout
15
+ nil
16
+ end
17
+
18
+ # If we need for some reason, read this file's contents
19
+ def rendered_content
20
+ @rendered_content ||= File.read(self.file)
21
+ end
22
+
23
+ # Write this page to the destination. For static files this just results
24
+ # in copying the file over to the destination
25
+ def write!
26
+ path = File.join(site.build_destination, file_path)
27
+ FileUtils.mkdir_p(File.dirname(path))
28
+ FileUtils.cp(self.file, path)
29
+ end
30
+
31
+ protected
32
+ # Don't read any meta data for static files, leave them as-is.
33
+ def read_metadata!
34
+ self.meta = {}
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module Plate
2
+ VERSION = "0.5.0" unless defined?(::Plate::VERSION)
3
+ end
data/lib/plate/view.rb ADDED
@@ -0,0 +1,48 @@
1
+ module Plate
2
+ # Views are utility classes that are only called within a page or layout file to be able to access
3
+ # site or page specific variables.
4
+ class View
5
+ include BloggingHelper
6
+ include MetaHelper
7
+ include URLHelper
8
+
9
+ attr_reader :site, :page
10
+
11
+ def initialize(site, page)
12
+ @site = site
13
+ @page = page
14
+ end
15
+
16
+ # The full list of assets for this site.
17
+ def assets
18
+ self.site.assets
19
+ end
20
+
21
+ # Dump out information about this view.
22
+ def inspect
23
+ "#<#{self.class}:0x#{object_id.to_s(16)} site=#{site ? site.source : nil} page=#{page ? page.file : nil}>"
24
+ end
25
+
26
+ # Reference to all pages and static files in this site.
27
+ def pages
28
+ self.site.pages
29
+ end
30
+
31
+ # Reference to the current post, if this view is rendered with a blog post.
32
+ def post
33
+ self.page
34
+ end
35
+
36
+ # Reference to all posts in this site.
37
+ def posts
38
+ self.site.posts
39
+ end
40
+
41
+ # Allow this class to pass through to access attributes on the page
42
+ def method_missing(method, *args, &block)
43
+ self.page.send(method, *args, &block)
44
+ rescue NoMethodError
45
+ super
46
+ end
47
+ end
48
+ end
@@ -0,0 +1 @@
1
+ permalink: '/posts/:year/:month/:slug'
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: "Home"
3
+
4
+ # Home
5
+
6
+ Welcome to my new site.
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= title %></title>
6
+ <meta name="keywords" content="<%= keywords %>">
7
+ <meta name="description" content="<%= description %>">
8
+ </head>
9
+ <body>
10
+ <%= yield %>
11
+ </body>
12
+ </html>
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: plate
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - John Tornow
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-11 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: &70223080715580 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70223080715580
25
+ - !ruby/object:Gem::Dependency
26
+ name: directory_watcher
27
+ requirement: &70223080715200 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70223080715200
36
+ - !ruby/object:Gem::Dependency
37
+ name: i18n
38
+ requirement: &70223080714660 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '0.6'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70223080714660
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: &70223080714240 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70223080714240
58
+ - !ruby/object:Gem::Dependency
59
+ name: redcarpet
60
+ requirement: &70223080713700 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '2'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70223080713700
69
+ - !ruby/object:Gem::Dependency
70
+ name: tilt
71
+ requirement: &70223080713200 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '1.3'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *70223080713200
80
+ description: Plate is a simple Ruby-based static blogging engine.
81
+ email:
82
+ - john@johntornow.com
83
+ executables:
84
+ - plate
85
+ extensions: []
86
+ extra_rdoc_files: []
87
+ files:
88
+ - bin/plate
89
+ - lib/plate/asset.rb
90
+ - lib/plate/builder.rb
91
+ - lib/plate/callbacks.rb
92
+ - lib/plate/cli.rb
93
+ - lib/plate/dynamic_page.rb
94
+ - lib/plate/engine.rb
95
+ - lib/plate/errors.rb
96
+ - lib/plate/haml_template.rb
97
+ - lib/plate/helpers/blogging_helper.rb
98
+ - lib/plate/helpers/meta_helper.rb
99
+ - lib/plate/helpers/url_helper.rb
100
+ - lib/plate/layout.rb
101
+ - lib/plate/markdown_template.rb
102
+ - lib/plate/page.rb
103
+ - lib/plate/post.rb
104
+ - lib/plate/post_collection.rb
105
+ - lib/plate/sass_template.rb
106
+ - lib/plate/scss_template.rb
107
+ - lib/plate/site.rb
108
+ - lib/plate/static_page.rb
109
+ - lib/plate/version.rb
110
+ - lib/plate/view.rb
111
+ - lib/plate.rb
112
+ - lib/templates/config.yml
113
+ - lib/templates/index.md
114
+ - lib/templates/layout.erb
115
+ - Rakefile
116
+ - README.md
117
+ - CHANGELOG.md
118
+ - LICENSE
119
+ homepage: http://platerb.com
120
+ licenses: []
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: 1.8.12
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 1.8.15
140
+ signing_key:
141
+ specification_version: 3
142
+ summary: A simple static blogging engine.
143
+ test_files: []