rabl 0.11.7 → 0.11.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/rabl.rb +3 -3
- data/lib/rabl/engine.rb +9 -9
- data/lib/rabl/railtie.rb +1 -1
- data/lib/rabl/template.rb +2 -2
- data/lib/rabl/version.rb +1 -1
- data/test/engine_test.rb +12 -16
- data/test/partials_test.rb +1 -1
- metadata +24 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b439f70f7961cc5628e6c50d459a81c90fdaee2e
|
4
|
+
data.tar.gz: afad5d0e094bcd451836d4259b000f9005c064a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a36b30e99c2c4ca01fa854c3df4cffea66d7f5105605daf5a830a5a7d605d732773cf6ff4df61fb6abddad49babe85c8e7a5d000f752c05a76da6ecce36b4165
|
7
|
+
data.tar.gz: 2e84dd02306eb127ca1f194df81db1af946eded722ff7ff72e7385bf5556fb23dd8300a01f2b7d4edf4cd3a220170a9eb07cd9e13e94cbee4ec438481af417c8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.11.8 (January 10th, 2016)
|
4
|
+
|
5
|
+
* Check that the Rails module has the .version method before invocation (@caldwecr)
|
6
|
+
* Adds nominal rails5 support (@lsylvester)
|
7
|
+
|
3
8
|
## 0.11.7 (December 6th, 2015)
|
4
9
|
|
5
10
|
* Use empty hash as default cache options (@infertux)
|
data/lib/rabl.rb
CHANGED
@@ -17,9 +17,9 @@ require 'rabl/renderer'
|
|
17
17
|
require 'rabl/cache_engine'
|
18
18
|
|
19
19
|
if defined?(Rails)
|
20
|
-
require 'rabl/tracker' if Rails.version =~ /^[
|
21
|
-
require 'rabl/digestor' if Rails.version =~ /^[
|
22
|
-
require 'rabl/railtie' if Rails.version =~ /^[
|
20
|
+
require 'rabl/tracker' if Rails.version =~ /^[45]/
|
21
|
+
require 'rabl/digestor' if Rails.version =~ /^[45]/
|
22
|
+
require 'rabl/railtie' if Rails.version =~ /^[345]/
|
23
23
|
end
|
24
24
|
|
25
25
|
# Rabl.register!
|
data/lib/rabl/engine.rb
CHANGED
@@ -16,7 +16,7 @@ module Rabl
|
|
16
16
|
|
17
17
|
@_view_path = options[:view_path]
|
18
18
|
@_context_scope = options[:scope]
|
19
|
-
|
19
|
+
|
20
20
|
@_cache_read_on_render = true
|
21
21
|
end
|
22
22
|
|
@@ -94,7 +94,7 @@ module Rabl
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def to_dumpable(options = {})
|
97
|
-
options = {
|
97
|
+
options = {
|
98
98
|
:child_root => Rabl.configuration.include_child_root
|
99
99
|
}.merge(options)
|
100
100
|
|
@@ -132,7 +132,7 @@ module Rabl
|
|
132
132
|
# to_xml(:root => true)
|
133
133
|
def to_xml(options = {})
|
134
134
|
options = {
|
135
|
-
:root => (include_root = Rabl.configuration.include_xml_root),
|
135
|
+
:root => (include_root = Rabl.configuration.include_xml_root),
|
136
136
|
:child_root => include_root && Rabl.configuration.include_child_root
|
137
137
|
}.merge(options)
|
138
138
|
|
@@ -228,12 +228,12 @@ module Rabl
|
|
228
228
|
attr_aliases = args.first.except(:if, :unless)
|
229
229
|
conditions = args.first.slice(:if, :unless)
|
230
230
|
|
231
|
-
attr_aliases.each do |key, as|
|
231
|
+
attr_aliases.each do |key, as|
|
232
232
|
attribute(key, conditions.merge(:as => as))
|
233
233
|
end
|
234
234
|
else # array of attributes i.e :foo, :bar, :baz
|
235
235
|
options = args.extract_options!
|
236
|
-
args.each do |name|
|
236
|
+
args.each do |name|
|
237
237
|
@_settings[:attributes] << { :name => name, :options => options }
|
238
238
|
end
|
239
239
|
end
|
@@ -389,18 +389,18 @@ module Rabl
|
|
389
389
|
end
|
390
390
|
|
391
391
|
def digestor_available?
|
392
|
-
defined?(Rails) && Rails.version =~ /^[
|
392
|
+
defined?(Rails) && Rails.version =~ /^[45]/
|
393
393
|
end
|
394
394
|
|
395
395
|
def set_instance_variables!(context_scope, locals)
|
396
396
|
@_context_scope = context_scope
|
397
|
-
@_locals = locals
|
397
|
+
@_locals = locals || {}
|
398
398
|
|
399
399
|
copy_instance_variables_from(context_scope, [:@assigns, :@helpers])
|
400
400
|
|
401
401
|
@_options[:format] ||= request_format
|
402
402
|
|
403
|
-
set_locals(
|
403
|
+
set_locals(@_locals)
|
404
404
|
end
|
405
405
|
|
406
406
|
def set_locals(locals)
|
@@ -410,7 +410,7 @@ module Rabl
|
|
410
410
|
|
411
411
|
def eval_source(locals, &block)
|
412
412
|
# Note: locals and block may be used by the eval'ed source
|
413
|
-
|
413
|
+
|
414
414
|
return unless @_source.present?
|
415
415
|
|
416
416
|
if @_options[:source_location]
|
data/lib/rabl/railtie.rb
CHANGED
data/lib/rabl/template.rb
CHANGED
@@ -20,7 +20,7 @@ if defined?(Tilt)
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# Rails 2.X Template
|
23
|
-
if defined?(ActionView) && defined?(Rails) && Rails.version.to_s =~ /^2/
|
23
|
+
if defined?(ActionView) && defined?(Rails) && Rails.respond_to?(:version) && Rails.version.to_s =~ /^2/
|
24
24
|
require 'action_view/base'
|
25
25
|
require 'action_view/template'
|
26
26
|
|
@@ -41,7 +41,7 @@ if defined?(ActionView) && defined?(Rails) && Rails.version.to_s =~ /^2/
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# Rails 3.X / 4.X Template
|
44
|
-
if defined?(ActionView) && defined?(Rails) && Rails.version.to_s =~ /^[
|
44
|
+
if defined?(ActionView) && defined?(Rails) && Rails.respond_to?(:version) && Rails.version.to_s =~ /^[345]/
|
45
45
|
module ActionView
|
46
46
|
module Template::Handlers
|
47
47
|
class Rabl
|
data/lib/rabl/version.rb
CHANGED
data/test/engine_test.rb
CHANGED
@@ -26,35 +26,31 @@ context "Rabl::Engine" do
|
|
26
26
|
context "#request_format" do
|
27
27
|
context "is json by default" do
|
28
28
|
setup do
|
29
|
-
template = RablTemplate.new("code") { "" }
|
29
|
+
template = RablTemplate.new("code") { 'node(:foo) { "bar" }' }
|
30
30
|
template.render(Object.new)
|
31
|
-
engine = template.instance_eval('@engine')
|
32
|
-
engine.instance_eval('@_options')[:format]
|
33
31
|
end
|
34
32
|
|
35
|
-
asserts_topic.
|
33
|
+
asserts_topic.equivalent_to('{"foo":"bar"}')
|
36
34
|
end
|
37
35
|
|
38
36
|
context "with a specified format" do
|
39
37
|
setup do
|
40
|
-
template = RablTemplate.new("code", :format => 'xml') { "" }
|
38
|
+
template = RablTemplate.new("code", :format => 'xml') { 'node(:foo) { "bar" }' }
|
41
39
|
template.render(Object.new)
|
42
|
-
engine = template.instance_eval('@engine')
|
43
|
-
engine.instance_eval('@_options')[:format]
|
44
40
|
end
|
45
41
|
|
46
|
-
asserts_topic.
|
42
|
+
asserts_topic.includes('<foo>bar</foo>')
|
47
43
|
end
|
48
44
|
end
|
49
45
|
|
50
46
|
context "#cache" do
|
51
47
|
context "with cache" do
|
52
48
|
setup do
|
53
|
-
template =
|
49
|
+
template = Rabl::Engine.new(%q{
|
54
50
|
cache 'foo'
|
55
|
-
}
|
51
|
+
})
|
56
52
|
template.render(Object.new)
|
57
|
-
template
|
53
|
+
template
|
58
54
|
end
|
59
55
|
|
60
56
|
asserts_topic.assigns(:_cache_key) { 'foo' }
|
@@ -62,11 +58,11 @@ context "Rabl::Engine" do
|
|
62
58
|
|
63
59
|
context "with cache and options" do
|
64
60
|
setup do
|
65
|
-
template =
|
61
|
+
template = Rabl::Engine.new(%q{
|
66
62
|
cache 'foo', :expires_in => 'bar'
|
67
|
-
}
|
63
|
+
})
|
68
64
|
template.render(Object.new)
|
69
|
-
template
|
65
|
+
template
|
70
66
|
end
|
71
67
|
|
72
68
|
asserts_topic.assigns(:_cache_key) { 'foo' }
|
@@ -75,9 +71,9 @@ context "Rabl::Engine" do
|
|
75
71
|
|
76
72
|
context "without cache" do
|
77
73
|
setup do
|
78
|
-
template =
|
74
|
+
template = Rabl::Engine.new("")
|
79
75
|
template.render(Object.new)
|
80
|
-
template
|
76
|
+
template
|
81
77
|
end
|
82
78
|
|
83
79
|
denies(:instance_variable_defined?, :@_cache_key)
|
data/test/partials_test.rb
CHANGED
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Esquenazi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.3.14
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.3.14
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: riot
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.12.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.12.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rr
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.0.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: tilt
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: oj
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: msgpack
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 0.4.5
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.4.5
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: bson
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.7.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.7.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: plist
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: General ruby templating with json, bson, xml and msgpack support
|
@@ -143,8 +143,8 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
-
- .gitignore
|
147
|
-
- .travis.yml
|
146
|
+
- ".gitignore"
|
147
|
+
- ".travis.yml"
|
148
148
|
- CHANGELOG.md
|
149
149
|
- CONTRIBUTING.md
|
150
150
|
- Gemfile
|
@@ -458,12 +458,12 @@ require_paths:
|
|
458
458
|
- lib
|
459
459
|
required_ruby_version: !ruby/object:Gem::Requirement
|
460
460
|
requirements:
|
461
|
-
- -
|
461
|
+
- - ">="
|
462
462
|
- !ruby/object:Gem::Version
|
463
463
|
version: '0'
|
464
464
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
465
465
|
requirements:
|
466
|
-
- -
|
466
|
+
- - ">="
|
467
467
|
- !ruby/object:Gem::Version
|
468
468
|
version: '0'
|
469
469
|
requirements: []
|
@@ -496,4 +496,3 @@ test_files:
|
|
496
496
|
- test/template_test.rb
|
497
497
|
- test/teststrap.rb
|
498
498
|
- test/xml_test.rb
|
499
|
-
has_rdoc:
|