hydeweb 0.1.4 → 0.1.5

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.
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
@@ -3,3 +3,9 @@ task :test do
3
3
  end
4
4
 
5
5
  task :default => :test
6
+
7
+ task :gembuild do
8
+ require './lib/hyde'
9
+ v = Hyde.version
10
+ system "joe build && git commit -a -m \"Update to version #{v}.\" && git tag v#{v}"
11
+ end
data/lib/hyde/config.rb CHANGED
@@ -13,7 +13,9 @@ class Config < OpenStruct
13
13
  end
14
14
 
15
15
  def initialize(options={})
16
- super DEFAULTS.merge(options)
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
@@ -4,6 +4,7 @@ class Meta < OpenStruct
4
4
  @table.merge(hash)
5
5
  end
6
6
 
7
+ # For Ruby 1.8.6 compatibility ([:type] instead of .type)
7
8
  def [](id)
8
9
  @table[id.to_sym]
9
10
  end
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.type
28
- klass = Page.get_type(page.meta.type)
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 = parts.first.count("\n") + 2
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.force_encoding('UTF-8')
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', '~> 0.1'
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.4"
16
+ VERSION = "0.1.5"
16
17
  PREFIX = File.expand_path('../', __FILE__)
17
18
 
18
19
  Error = Class.new(StandardError)
@@ -1,3 +1,3 @@
1
1
  Parent:
2
2
  - if parent
3
- %a{href: parent.path} Back to parent
3
+ %a{:href => parent.path} Back to parent
@@ -1,3 +1,3 @@
1
1
  Parent:
2
2
  - if parent
3
- %a{href: parent.path} Back to parent
3
+ %a{:href => parent.path} Back to parent
data/test/helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  $:.push File.expand_path('../../lib', __FILE__)
2
2
 
3
+ gem "contest", "~> 0.1"
4
+
3
5
  require 'hyde'
4
6
  require 'contest'
5
7
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hydeweb
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.4
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: "0.1"
24
+ version: 0.1.2
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency