rack_ssi 0.0.2 → 0.0.3
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/.gitignore +1 -0
- data/README.md +15 -15
- data/lib/compatibility.rb +12 -0
- data/lib/rack_ssi.rb +2 -1
- data/lib/ssi_processor.rb +1 -1
- data/rack-ssi.gemspec +1 -1
- data/spec/ssi_processor_spec.rb +28 -1
- metadata +37 -51
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Directives currently supported: `block` and `include`
|
|
7
7
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
|
-
gem 'rack_ssi'
|
10
|
+
gem 'rack_ssi'
|
11
11
|
|
12
12
|
And then execute:
|
13
13
|
|
@@ -22,18 +22,18 @@ Or install it yourself as:
|
|
22
22
|
require 'rack_ssi'
|
23
23
|
|
24
24
|
### Sinatra
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
```ruby
|
26
|
+
configure do
|
27
|
+
use Rack::SSI, {
|
28
|
+
:logging => :on,
|
29
|
+
:when => lambda {|env| not env['SOME_CUSTOM_HEADER'] == 'ON'},
|
30
|
+
:locations => {
|
31
|
+
%r{^/includes} => "http://includes.mydomain.com"
|
32
|
+
}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
```
|
36
36
|
### Rails
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
```ruby
|
38
|
+
config.middleware.use Rack::SSI, { ... }
|
39
|
+
```
|
data/lib/rack_ssi.rb
CHANGED
data/lib/ssi_processor.rb
CHANGED
data/rack-ssi.gemspec
CHANGED
data/spec/ssi_processor_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require File.expand_path('../spec_helper', __FILE__)
|
2
4
|
|
3
5
|
describe Rack::SSIProcessor do
|
@@ -150,7 +152,32 @@ describe Rack::SSIProcessor do
|
|
150
152
|
processed.gsub(/\s+/, "").should == "<html><body><bang></body></html>"
|
151
153
|
end
|
152
154
|
end
|
153
|
-
|
155
|
+
|
156
|
+
context "the SSI include request returns a response with a different encoding than the context" do
|
157
|
+
it "should force the encoding of the context" do
|
158
|
+
html = <<-eos
|
159
|
+
<html>
|
160
|
+
<body>
|
161
|
+
<!--# include virtual="/some/location" -->
|
162
|
+
</body>
|
163
|
+
</html>
|
164
|
+
eos
|
165
|
+
|
166
|
+
expected = <<-eos.gsub /\s+/, ""
|
167
|
+
<html>
|
168
|
+
<body>
|
169
|
+
<p>€254</p>
|
170
|
+
</body>
|
171
|
+
</html>
|
172
|
+
eos
|
173
|
+
|
174
|
+
ssi = Rack::SSIProcessor.new
|
175
|
+
ssi.stub(:fetch).with("/some/location").and_return([200, {}, "<p>€254</p>".force_encoding("ASCII-8BIT")])
|
176
|
+
|
177
|
+
processed = ssi.process_include(html, {})
|
178
|
+
processed.gsub(/\s+/, "").should == expected
|
179
|
+
end
|
180
|
+
end
|
154
181
|
end
|
155
182
|
|
156
183
|
describe "#fetch" do
|
metadata
CHANGED
@@ -1,51 +1,46 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack_ssi
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Thibaut Sacreste
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rest-client
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
|
34
|
-
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: ! " Rack middleware for processing SSI based on the nginx HttpSsiModule.\n
|
31
|
+
\ Directives currently supported: 'block' and 'include'\n"
|
32
|
+
email:
|
36
33
|
- thibaut.sacreste@gmail.com
|
37
34
|
executables: []
|
38
|
-
|
39
35
|
extensions: []
|
40
|
-
|
41
36
|
extra_rdoc_files: []
|
42
|
-
|
43
|
-
files:
|
37
|
+
files:
|
44
38
|
- .gitignore
|
45
39
|
- Gemfile
|
46
40
|
- LICENSE
|
47
41
|
- README.md
|
48
42
|
- Rakefile
|
43
|
+
- lib/compatibility.rb
|
49
44
|
- lib/rack_ssi.rb
|
50
45
|
- lib/ssi_processor.rb
|
51
46
|
- rack-ssi.gemspec
|
@@ -54,38 +49,29 @@ files:
|
|
54
49
|
- spec/ssi_processor_spec.rb
|
55
50
|
homepage: https://github.com/forward/rack-ssi
|
56
51
|
licenses: []
|
57
|
-
|
58
52
|
post_install_message:
|
59
53
|
rdoc_options: []
|
60
|
-
|
61
|
-
require_paths:
|
54
|
+
require_paths:
|
62
55
|
- lib
|
63
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
57
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
|
70
|
-
- 0
|
71
|
-
version: "0"
|
72
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
63
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
segments:
|
79
|
-
- 0
|
80
|
-
version: "0"
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
81
68
|
requirements: []
|
82
|
-
|
83
69
|
rubyforge_project:
|
84
|
-
rubygems_version: 1.8.
|
70
|
+
rubygems_version: 1.8.23
|
85
71
|
signing_key:
|
86
72
|
specification_version: 3
|
87
73
|
summary: Rack middleware for processing SSI based on the nginx HttpSsiModule.
|
88
|
-
test_files:
|
74
|
+
test_files:
|
89
75
|
- spec/rack_ssi_spec.rb
|
90
76
|
- spec/spec_helper.rb
|
91
77
|
- spec/ssi_processor_spec.rb
|