rack-blogengine 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d1d461e13788b067f570f69315af3379f17c89d
4
- data.tar.gz: bac62b1d82b17e8cc097ebc83f94b23bfe077a20
3
+ metadata.gz: be673f3f32e05e24da51c8cf90e8ef3904df61b8
4
+ data.tar.gz: c960faa025ed506ae5c96737de9126de91bdd356
5
5
  SHA512:
6
- metadata.gz: 21729aaf42d0acee7106f1789c4aa0cac38837aa28668b1ce1fd84d29adeb3e70c5b9514fcd8e401e9bfd4e16767588e82039af8d594972ba87799cd66ac5c4c
7
- data.tar.gz: 6ecb1d38bd634db4f40be15f27fc512b003208c8c3f7a5a9ea7c775c5d5310272e1151eb6e576e36273a3f57f20c84e372f60b0af3e5958377aaa430289aa113
6
+ metadata.gz: 5003c80502f0b50d63c1157fbec62be65fd530417a21c03b8cbbf83a0058b8f4213bc1664187fb4f84e834494465fc85610f9490cb8c461af2c91f6d33a8f30b
7
+ data.tar.gz: 82c214bc379dea1aa34092306f99966e4e6ec087e15244122bac5f800722ad5d9ad1889317e8ff5a3f0146187167a9e6d3e763e1974981c2f0a130a13b8b82e4
@@ -28,9 +28,14 @@ module Rack
28
28
  end
29
29
  end
30
30
 
31
- { 'path' => '/error',
31
+ # if no document matches -> return error page
32
+ return errorpage(env, documents)
33
+ end
34
+
35
+ def errorpage(env, documents)
36
+ { 'path' => env['PATH_INFO'],
32
37
  'response' =>
33
- [404, { 'Content-Type' => 'text/html; charset=UTF-8' }, ['Page not found && no error page found']]
38
+ [404, { 'Content-Type' => 'text/html; charset=UTF-8' }, ['Page not found']]
34
39
  }
35
40
  end
36
41
  end
@@ -68,22 +68,34 @@ module Rack
68
68
 
69
69
  if contentblock.include? '[title]:'
70
70
  contentblock['[title]:'] = ''
71
- @title = contentblock.strip
71
+ if contentblock.empty?
72
+ raise "Title in #{file} is empty"
73
+ else
74
+ @title = contentblock.strip
75
+ end
72
76
  end
73
77
 
74
78
  if contentblock.include? '[content]:'
75
79
  contentblock['[content]:'] = ''
76
- @content = contentblock.strip
80
+ if contentblock.empty?
81
+ raise "Content in #{file} is empty"
82
+ else
83
+ @content = contentblock.strip
84
+ end
77
85
  end
78
86
 
79
87
  if contentblock.include? '[date]:'
80
88
  contentblock['[date]:'] = ''
81
- datearray = contentblock.split(',')
82
- datearray = datearray.map do |date|
83
- date.to_i
89
+ if /\d/.match( contentblock )
90
+ datearray = contentblock.split(',')
91
+ datearray = datearray.map do |date|
92
+ date.to_i
93
+ end
94
+
95
+ @date = Date.new(datearray[0], datearray[1], datearray[2])
96
+ else
97
+ raise "Invalid Date in #{file}\n [date]:#{contentblock}[/date]"
84
98
  end
85
-
86
- @date = Date.new(datearray[0], datearray[1], datearray[2])
87
99
  end
88
100
  end
89
101
  end
@@ -9,7 +9,7 @@ class Operator
9
9
  Dir.foreach("#{target}/operator/") do |item|
10
10
  extension = item.split('.')[1]
11
11
  next if item == '.' || item == '..' || extension != 'rb'
12
- require "#{Dir.pwd}/#{target}/operator/#{item}"
12
+ require "#{target}/operator/#{item}"
13
13
  end
14
14
 
15
15
  extend UserOperator # load user operators
@@ -6,6 +6,6 @@ module Rack
6
6
  # @author [benny]
7
7
  #
8
8
  module Blogengine
9
- VERSION = '0.2.2'.freeze
9
+ VERSION = '0.2.3'.freeze
10
10
  end
11
11
  end
@@ -39,7 +39,7 @@ class DocumentTest < MiniTest::Unit::TestCase
39
39
  document = Rack::Blogengine::Document.new
40
40
  document.html = '{% test_operator %}'
41
41
 
42
- document.exec_content_operator(document, 'testfolder')
42
+ document.exec_content_operator(document, "#{testpath}")
43
43
 
44
44
  assert_equal('test', document.html, 'Documents html should contain test_operators return value')
45
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-blogengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benny1992
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-02-16 00:00:00 Z
12
+ date: 2014-02-17 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: &id001 !ruby/object:Gem::Requirement