siteleaf 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/siteleaf/server.rb +12 -7
- data/lib/siteleaf/version.rb +1 -1
- metadata +93 -62
- checksums.yaml +0 -7
data/lib/siteleaf/server.rb
CHANGED
@@ -37,9 +37,11 @@ module Siteleaf
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def call(env)
|
40
|
+
require 'uri'
|
41
|
+
|
40
42
|
site = Siteleaf::Site.new({:id => self.site_id})
|
41
43
|
|
42
|
-
url = env['PATH_INFO']
|
44
|
+
url = URI.unescape(env['PATH_INFO'])
|
43
45
|
path = url.gsub(/\/\z|\A\//, '') #strip beginning and trailing slashes
|
44
46
|
|
45
47
|
if !['sitemap.xml','feed.xml'].include?(path) and !File.directory?(path) and File.exist?(path)
|
@@ -49,10 +51,13 @@ module Siteleaf
|
|
49
51
|
is_asset = /^(?!(sitemap|feed)\.xml)(assets|.*\.)/.match(path)
|
50
52
|
|
51
53
|
if is_asset
|
52
|
-
|
54
|
+
output = site.resolve(url)
|
55
|
+
if output.code == 200
|
53
56
|
require 'open-uri'
|
54
|
-
|
55
|
-
[
|
57
|
+
asset = open(output['file']['url'])
|
58
|
+
[output.code, {'Content-Type' => asset.content_type}, [asset.read]]
|
59
|
+
else
|
60
|
+
[output.code, {'Content-Type' => 'text/html'}, [output.to_s]]
|
56
61
|
end
|
57
62
|
else
|
58
63
|
if template_data = resolve_template(url)
|
@@ -64,10 +69,10 @@ module Siteleaf
|
|
64
69
|
end
|
65
70
|
|
66
71
|
output = site.preview(url, template_data)
|
67
|
-
if output.
|
68
|
-
[
|
72
|
+
if output.code == 200
|
73
|
+
[output.code, {'Content-Type' => output.headers[:content_type]}, [output]]
|
69
74
|
else
|
70
|
-
[
|
75
|
+
[output.code, {'Content-Type' => 'text/html'}, [output]]
|
71
76
|
end
|
72
77
|
end
|
73
78
|
end
|
data/lib/siteleaf/version.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,104 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: siteleaf
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.8
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Siteleaf
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-07-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
19
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
21
21
|
version: 1.7.7
|
22
22
|
type: :runtime
|
23
|
-
version_requirements: *id001
|
24
|
-
- !ruby/object:Gem::Dependency
|
25
|
-
name: httparty
|
26
23
|
prerelease: false
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.7.7
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: httparty
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
33
38
|
type: :runtime
|
34
|
-
version_requirements: *id002
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: httmultiparty
|
37
39
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: httmultiparty
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
41
54
|
type: :runtime
|
42
|
-
version_requirements: *id004
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: zip
|
45
55
|
prerelease: false
|
46
|
-
|
47
|
-
|
48
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: zip
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
49
70
|
type: :runtime
|
50
|
-
version_requirements: *id005
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: rack
|
53
71
|
prerelease: false
|
54
|
-
|
55
|
-
|
56
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rack
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
57
86
|
type: :runtime
|
58
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
59
94
|
description: A Ruby interface and command line utility for the Siteleaf API.
|
60
|
-
email:
|
95
|
+
email:
|
61
96
|
- api@siteleaf.com
|
62
|
-
executables:
|
97
|
+
executables:
|
63
98
|
- siteleaf
|
64
99
|
extensions: []
|
65
|
-
|
66
100
|
extra_rdoc_files: []
|
67
|
-
|
68
|
-
files:
|
101
|
+
files:
|
69
102
|
- .gitignore
|
70
103
|
- Gemfile
|
71
104
|
- LICENSE.txt
|
@@ -84,28 +117,26 @@ files:
|
|
84
117
|
- siteleaf.gemspec
|
85
118
|
homepage: http://siteleaf.com
|
86
119
|
licenses: []
|
87
|
-
|
88
|
-
metadata: {}
|
89
|
-
|
90
120
|
post_install_message:
|
91
121
|
rdoc_options: []
|
92
|
-
|
93
|
-
require_paths:
|
122
|
+
require_paths:
|
94
123
|
- lib
|
95
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '1.8'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
103
136
|
requirements: []
|
104
|
-
|
105
137
|
rubyforge_project:
|
106
|
-
rubygems_version:
|
138
|
+
rubygems_version: 1.8.23
|
107
139
|
signing_key:
|
108
|
-
specification_version:
|
140
|
+
specification_version: 3
|
109
141
|
summary: Siteleaf Ruby interface
|
110
142
|
test_files: []
|
111
|
-
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
data.tar.gz: b05eb5577c086807281dd10c51123f12982811fd
|
4
|
-
metadata.gz: 7fde2f67bb1838330bfe9ca92a3619f7754ccd2e
|
5
|
-
SHA512:
|
6
|
-
data.tar.gz: 39ee781df4d1e71a853033865291f1cbe4059ae4c52e677601dc11819c7abc9b59fafe170d1280623a4bb2e414ecf96b61d5193b0f461d174377bc0205c425e5
|
7
|
-
metadata.gz: da7a9342af8ceddb79652d90279573d34d472f76aff06db6acb6c8413e470e7e3f4b62cbcab019cbf0230d75e5813293ecc5431a789967384f8afc3e76e4dd8c
|