rack-blogengine 0.0.1 → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bd1b8e37482f8cd95c294489db394f439206333
|
4
|
+
data.tar.gz: 561ba12dc36433557caf33dcf8496d460ea7d8b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7201c5742f32fc2f9ed07793b72aec14b30c628afd1bb6d3305d716b9de08fb952930f4fff71daee10c16c0794cae8073ed351e0fb19652c0fc4084cc86a6ec
|
7
|
+
data.tar.gz: a1ef385672e8ce3d1ef369d43900c742e54125a918b21e427e3ad1c0870086960c4d1117dddaa47baced3377b2a30566baae2184335cb9214e76f2f17c1a6bb3
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module Rack
|
2
2
|
module Blogengine
|
3
3
|
class Application
|
4
|
+
|
5
|
+
# Call Method for run this method as Rack Middleware.
|
6
|
+
# @param env, Environment contains information such as path, headers etc...
|
4
7
|
def self.call(env)
|
5
8
|
# Router for map docs to routes
|
6
9
|
route = ApplicationRouter.map_route(env, $targetfolder)
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Rack
|
2
2
|
module Blogengine
|
3
|
-
class ApplicationRouter
|
3
|
+
class ApplicationRouter
|
4
|
+
# Maps documents to routes.
|
5
|
+
# @param env, @param target (Target folder).
|
4
6
|
def self.map_route(env, target)
|
5
7
|
status = 200
|
6
8
|
header = {"Content-Type" => "text/html; charset=UTF-8"}
|
@@ -9,6 +9,9 @@ module Rack
|
|
9
9
|
# }]
|
10
10
|
#
|
11
11
|
# HTML contains Content, Style, JS etc...
|
12
|
+
|
13
|
+
# Parse in .content Documents.
|
14
|
+
# @param target.
|
12
15
|
def self.parseInDocuments(target)
|
13
16
|
@target = target
|
14
17
|
documents = []
|
@@ -35,6 +38,8 @@ module Rack
|
|
35
38
|
return documents
|
36
39
|
end
|
37
40
|
|
41
|
+
# Get File Contents (path, title, content)
|
42
|
+
# @param file
|
38
43
|
def self.getFileContents(file)
|
39
44
|
# do work on real items
|
40
45
|
content_file = ::File.open("#{@target}/#{file}");
|
@@ -60,6 +65,8 @@ module Rack
|
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
68
|
+
# Replace layout placeholder with content from .content file
|
69
|
+
# @param layout
|
63
70
|
def self.fillFileContents(layout)
|
64
71
|
layout.gsub! "{title}", @title
|
65
72
|
layout["{content}"] = @content
|