hydeweb 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +6 -0
- data/Rakefile +6 -0
- data/lib/hyde/config.rb +3 -1
- data/lib/hyde/meta.rb +1 -0
- data/lib/hyde/page.rb +7 -4
- data/lib/hyde.rb +3 -2
- data/test/fixture/parent/site/about/index.haml +1 -1
- data/test/fixture/parent/site/about/us.haml +1 -1
- data/test/helper.rb +2 -0
- metadata +3 -3
data/HISTORY.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
v0.1.5
|
2
|
+
------
|
3
|
+
|
4
|
+
- Ruby 1.8 compatibility.
|
5
|
+
|
1
6
|
v0.1.4
|
2
7
|
------
|
3
8
|
|
@@ -38,6 +43,7 @@ v0.1.1
|
|
38
43
|
- All options in `hyde.conf` are now optional (even `hyde_requirement`).
|
39
44
|
- Page metadata can now only be a hash.
|
40
45
|
- Fix `hyde start`.
|
46
|
+
- Minimum Ruby version is now at 1.8.6.
|
41
47
|
|
42
48
|
v0.1.0
|
43
49
|
------
|
data/Rakefile
CHANGED
data/lib/hyde/config.rb
CHANGED
@@ -13,7 +13,9 @@ class Config < OpenStruct
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize(options={})
|
16
|
-
|
16
|
+
# Try to emulate proper .merge behavior in Ruby 1.8
|
17
|
+
options.each { |k, v| options[k] ||= DEFAULTS[k] if DEFAULTS.keys.include?(k) }
|
18
|
+
super options
|
17
19
|
end
|
18
20
|
|
19
21
|
# Returns tilt options for a given file.
|
data/lib/hyde/meta.rb
CHANGED
data/lib/hyde/page.rb
CHANGED
@@ -24,8 +24,8 @@ class Page
|
|
24
24
|
page ||= try[Dir[site[id, "index.*"]].first]
|
25
25
|
|
26
26
|
# Subclass
|
27
|
-
if page && page.tilt? && page.meta
|
28
|
-
klass = Page.get_type(page.meta
|
27
|
+
if page && page.tilt? && page.meta[:type]
|
28
|
+
klass = Page.get_type(page.meta[:type])
|
29
29
|
raise Error, "#{page.filepath}: Class for type '#{page.meta.type}' not found" unless klass
|
30
30
|
page = klass.new(id, project)
|
31
31
|
end
|
@@ -187,9 +187,10 @@ class Page
|
|
187
187
|
def tilt
|
188
188
|
if tilt?
|
189
189
|
begin
|
190
|
+
parts
|
190
191
|
# HAML options and such (like :escape_html)
|
191
192
|
options = project.config.tilt_options_for(@file)
|
192
|
-
offset =
|
193
|
+
offset = @offset || 1
|
193
194
|
@tilt ||= Tilt.new(@file, offset, options) { markup }
|
194
195
|
rescue LoadError => e
|
195
196
|
gem = e.message.split(' ').last
|
@@ -283,12 +284,14 @@ protected
|
|
283
284
|
# Returns the two parts of the markup.
|
284
285
|
def parts
|
285
286
|
@parts ||= begin
|
286
|
-
t = File.open(@file).read
|
287
|
+
t = File.open(@file).read
|
288
|
+
t = t.force_encoding('UTF-8') if t.respond_to?(:force_encoding)
|
287
289
|
m = t.match(/^(.*)--+\n(.*)$/m)
|
288
290
|
|
289
291
|
if m.nil?
|
290
292
|
[{}, t]
|
291
293
|
else
|
294
|
+
@offset = m[1].count("\n") + 2
|
292
295
|
data = YAML::load(m[1])
|
293
296
|
raise ArgumentError unless data.is_a?(Hash)
|
294
297
|
[data, m[2]]
|
data/lib/hyde.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
$:.push *Dir[File.expand_path('../../vendor/*/lib', __FILE__)]
|
2
2
|
|
3
|
-
gem 'shake', '
|
3
|
+
gem 'shake', '>= 0.1.2'
|
4
|
+
gem 'tilt', '>= 1.2.2'
|
4
5
|
|
5
6
|
require 'fileutils'
|
6
7
|
require 'ostruct'
|
@@ -12,7 +13,7 @@ require 'shake'
|
|
12
13
|
Tilt.mappings['html'] = Tilt.mappings['erb']
|
13
14
|
|
14
15
|
class Hyde
|
15
|
-
VERSION = "0.1.
|
16
|
+
VERSION = "0.1.5"
|
16
17
|
PREFIX = File.expand_path('../', __FILE__)
|
17
18
|
|
18
19
|
Error = Class.new(StandardError)
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: hydeweb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Rico Sta. Cruz
|
@@ -19,9 +19,9 @@ dependencies:
|
|
19
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
|
-
- -
|
22
|
+
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
24
|
+
version: 0.1.2
|
25
25
|
type: :runtime
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|