homeostasis 0.0.20 → 0.0.21
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.
- checksums.yaml +4 -4
- data/README.md +13 -16
- data/lib/homeostasis.rb +26 -4
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12c95184f9983ac06cca28cc11a27e7acab74338
|
4
|
+
data.tar.gz: 63e56268c6c1e9c42281b488d6c96aa37ee68e7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4949df202ff2c5d964240bf8b012b327cba2951283d85d2bd8bf1cd854dfffd55cc60b338022592562f6a5b70c3db911561a3413f18defff0a5c81027aa79b07
|
7
|
+
data.tar.gz: 5bc4dd41335f0525ae052ce70622b3f618f404ab48f5784c27ae6843a8f3e506252b641b8ed3a402db1b9ad4112f5cbcf88b37112fca4e7ca3b151e14144cb13
|
data/README.md
CHANGED
@@ -74,19 +74,19 @@ In your controller:
|
|
74
74
|
:desc => 'Blog Description for RSS feed')
|
75
75
|
|
76
76
|
Post files should be in the format `yyyy-mm-dd-permalink.*`. Use YAML
|
77
|
-
front-matter for any metadata you want.
|
77
|
+
front-matter for any metadata you want. `date` and `path` will be added
|
78
78
|
automatically for you.
|
79
79
|
|
80
80
|
---
|
81
|
-
|
81
|
+
title: Title Goes Here
|
82
82
|
---
|
83
83
|
|
84
84
|
You'll have to create your own `blog/index.html`. Use the `blog_posts` helper
|
85
85
|
to construct it:
|
86
86
|
|
87
87
|
- blog_posts.each do |post|
|
88
|
-
%span.date post[
|
89
|
-
%a{:href => post[
|
88
|
+
%span.date post['date'].strftime("%m/%d/%Y")
|
89
|
+
%a{:href => post['path']}= post['title']
|
90
90
|
|
91
91
|
Front-Matter YAML
|
92
92
|
=================
|
@@ -94,13 +94,13 @@ Front-Matter YAML
|
|
94
94
|
In your views:
|
95
95
|
|
96
96
|
---
|
97
|
-
|
98
|
-
|
97
|
+
title: Lorem Ipsum
|
98
|
+
desc: Quick fox over lazy dog.
|
99
99
|
---
|
100
100
|
%div
|
101
101
|
Page continues as normal here
|
102
|
-
%h1= front[
|
103
|
-
%p= front[
|
102
|
+
%h1= front['title']
|
103
|
+
%p= front['desc']
|
104
104
|
|
105
105
|
You can configure which files to check in `controller.rb`. Here's the default:
|
106
106
|
|
@@ -111,7 +111,7 @@ data will be available from the `front` method in your views and controller.
|
|
111
111
|
There's also a `front_site` helper which contains the data for all pages for
|
112
112
|
cross-page access.
|
113
113
|
|
114
|
-
Note that
|
114
|
+
Note that `path` is automatically assigned if left blank. Its value will be
|
115
115
|
the public path to the page.
|
116
116
|
|
117
117
|
Multi Templates
|
@@ -142,14 +142,14 @@ to set the root URL for this to happen:
|
|
142
142
|
`changefreq` or `priority`:
|
143
143
|
|
144
144
|
---
|
145
|
-
|
146
|
-
|
145
|
+
changefreq: monthly
|
146
|
+
priority: 0.9
|
147
147
|
---
|
148
148
|
|
149
149
|
Use the key `private` to avoid generating an entry:
|
150
150
|
|
151
151
|
---
|
152
|
-
|
152
|
+
private: true
|
153
153
|
---
|
154
154
|
|
155
155
|
Trailing Slash
|
@@ -174,13 +174,10 @@ slashes to URLs.
|
|
174
174
|
TODO
|
175
175
|
====
|
176
176
|
|
177
|
-
*
|
177
|
+
* fix work on templates without front-matter yaml
|
178
178
|
* fix directory structure to use standard gem directories
|
179
|
-
* fix front matter yaml to handle symbols/strings (look into Hashie)
|
180
179
|
* fix filenames like 'jquery-1.9.1.js'
|
181
180
|
* fix `render` to work with Front/Multi plugins (maybe override Tilt#render? instead of using hooks)
|
182
|
-
* fix `render` to handle multi rendering
|
183
|
-
* fix sitemap "." in URL
|
184
181
|
* fix images in RSS
|
185
182
|
* fix plugin architecture to make each optional
|
186
183
|
|
data/lib/homeostasis.rb
CHANGED
@@ -6,6 +6,7 @@ require 'cgi'
|
|
6
6
|
require 'uri'
|
7
7
|
require 'tilt'
|
8
8
|
require 'tempfile'
|
9
|
+
require 'pathname'
|
9
10
|
require 'preamble'
|
10
11
|
|
11
12
|
module Homeostasis
|
@@ -223,7 +224,7 @@ module Homeostasis
|
|
223
224
|
|
224
225
|
def initialize(stasis)
|
225
226
|
@stasis = stasis
|
226
|
-
@@front_site =
|
227
|
+
@@front_site = FrontHash.new
|
227
228
|
@@matcher = /\.erb|\.haml|\.html|\.md$/
|
228
229
|
end
|
229
230
|
|
@@ -241,7 +242,7 @@ module Homeostasis
|
|
241
242
|
relative
|
242
243
|
yaml[:path] = trailify(Multi.drop_tilt_exts(dest))
|
243
244
|
end
|
244
|
-
@@front_site[front_key(path)] = yaml
|
245
|
+
@@front_site[front_key(path)] = FrontHash.from_hash(yaml)
|
245
246
|
end
|
246
247
|
end
|
247
248
|
|
@@ -267,7 +268,7 @@ module Homeostasis
|
|
267
268
|
end
|
268
269
|
|
269
270
|
def front
|
270
|
-
@@front_site[front_key(Helpers.stasis_path || @stasis.path)] ||
|
271
|
+
@@front_site[front_key(Helpers.stasis_path || @stasis.path)] || FrontHash.new
|
271
272
|
end
|
272
273
|
|
273
274
|
def front_site
|
@@ -301,7 +302,8 @@ module Homeostasis
|
|
301
302
|
|
302
303
|
def trailify(filename)
|
303
304
|
@trail_included ||= @stasis.plugins.any? { |plugin| plugin.is_a?(Homeostasis::Trail) }
|
304
|
-
|
305
|
+
filename = Pathname.new(filename.to_s).cleanpath.to_s
|
306
|
+
path = if filename == 'index.html'
|
305
307
|
'/'
|
306
308
|
elsif File.basename(filename) == 'index.html'
|
307
309
|
"/#{File.dirname(filename)}/"
|
@@ -527,6 +529,26 @@ module Homeostasis
|
|
527
529
|
@@posts
|
528
530
|
end
|
529
531
|
end
|
532
|
+
|
533
|
+
class FrontHash < Hash
|
534
|
+
def [](key)
|
535
|
+
super(key.to_s)
|
536
|
+
end
|
537
|
+
|
538
|
+
def []=(key, value)
|
539
|
+
super(key.to_s, value)
|
540
|
+
end
|
541
|
+
|
542
|
+
def has_key?(key)
|
543
|
+
super(key.to_s)
|
544
|
+
end
|
545
|
+
|
546
|
+
def self.from_hash(hash)
|
547
|
+
front_hash = self.new
|
548
|
+
hash.each { |k,v| front_hash[k] = v }
|
549
|
+
front_hash
|
550
|
+
end
|
551
|
+
end
|
530
552
|
end
|
531
553
|
|
532
554
|
if !ENV['HOMEOSTASIS_UNREGISTER']
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: homeostasis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hugh Bien
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stasis
|