jbuilder 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/Gemfile +8 -1
- data/Gemfile.old +8 -1
- data/MIT-LICENSE +2 -2
- data/jbuilder.gemspec +1 -1
- data/lib/jbuilder/dependency_tracker.rb +38 -36
- data/test/jbuilder_dependency_tracker_test.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f70e328fa8dca8b3a98c6d5d87102512f624ce9
|
4
|
+
data.tar.gz: 1d99855c2c28b3752b696ae47298663dd8a5f311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e8b3f0e5f8111b07dbc24fb0fed99bd975358d89dcc1c9fec20fea572c8de756b69c00af85b2b118f85316bdcc78b0c8605c15394692e0829d6178c54fb4063
|
7
|
+
data.tar.gz: 5f599be397203a899995cbe9fcfc67f76b9aaed89a8f9dc50a695adbc805705cf81bae83b431bf83caa9968d96c9d1856946011115bd7a2b6b05e7f0c20956be
|
data/.travis.yml
CHANGED
@@ -3,9 +3,10 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- 1.9.3
|
5
5
|
- 2.0.0
|
6
|
+
- 2.1.0
|
6
7
|
- ruby-head
|
7
8
|
- jruby-19mode
|
8
|
-
- rbx
|
9
|
+
- rbx
|
9
10
|
|
10
11
|
gemfile:
|
11
12
|
- Gemfile.old
|
@@ -13,9 +14,10 @@ gemfile:
|
|
13
14
|
|
14
15
|
matrix:
|
15
16
|
allow_failures:
|
17
|
+
- rvm: 2.1.0
|
16
18
|
- rvm: ruby-head
|
17
19
|
- rvm: jruby-19mode
|
18
|
-
- rvm: rbx
|
20
|
+
- rvm: rbx
|
19
21
|
|
20
22
|
notifications:
|
21
23
|
email: false
|
data/Gemfile
CHANGED
@@ -5,4 +5,11 @@ gemspec
|
|
5
5
|
gem 'rake'
|
6
6
|
gem 'railties', '~> 4.0.0'
|
7
7
|
gem 'actionpack', '~> 4.0.0'
|
8
|
-
gem 'mocha', require: false
|
8
|
+
gem 'mocha', require: false
|
9
|
+
|
10
|
+
platforms :rbx do
|
11
|
+
gem 'rubysl', '~> 2.0'
|
12
|
+
gem 'json', '~> 1.8'
|
13
|
+
gem 'rubysl-test-unit'
|
14
|
+
gem 'rubinius-developer_tools'
|
15
|
+
end
|
data/Gemfile.old
CHANGED
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2011-
|
1
|
+
Copyright (c) 2011-2014 David Heinemeier Hansson, 37signals
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/jbuilder.gemspec
CHANGED
@@ -15,45 +15,47 @@ rescue LoadError
|
|
15
15
|
end
|
16
16
|
|
17
17
|
if dependency_tracker
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
18
|
+
class Jbuilder
|
19
|
+
module DependencyTrackerMethods
|
20
|
+
# Matches:
|
21
|
+
# json.partial! "messages/message"
|
22
|
+
# json.partial!('messages/message')
|
23
|
+
#
|
24
|
+
DIRECT_RENDERS = /
|
25
|
+
\w+\.partial! # json.partial!
|
26
|
+
\(?\s* # optional parenthesis
|
27
|
+
(['"])([^'"]+)\1 # quoted value
|
28
|
+
/x
|
29
|
+
|
30
|
+
# Matches:
|
31
|
+
# json.partial! partial: "comments/comment"
|
32
|
+
# json.comments @post.comments, partial: "comments/comment", as: :comment
|
33
|
+
# json.array! @posts, partial: "posts/post", as: :post
|
34
|
+
# = render partial: "account"
|
35
|
+
#
|
36
|
+
INDIRECT_RENDERS = /
|
37
|
+
(?::partial\s*=>|partial:) # partial: or :partial =>
|
38
|
+
\s* # optional whitespace
|
39
|
+
(['"])([^'"]+)\1 # quoted value
|
40
|
+
/x
|
41
|
+
|
42
|
+
def dependencies
|
43
|
+
direct_dependencies + indirect_dependencies + explicit_dependencies
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def direct_dependencies
|
49
|
+
source.scan(DIRECT_RENDERS).map(&:second)
|
50
|
+
end
|
51
|
+
|
52
|
+
def indirect_dependencies
|
53
|
+
source.scan(INDIRECT_RENDERS).map(&:second)
|
54
|
+
end
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
56
58
|
::Jbuilder::DependencyTracker = Class.new(dependency_tracker::ERBTracker)
|
57
|
-
::Jbuilder::DependencyTracker.send :include,
|
59
|
+
::Jbuilder::DependencyTracker.send :include, ::Jbuilder::DependencyTrackerMethods
|
58
60
|
dependency_tracker.register_tracker :jbuilder, ::Jbuilder::DependencyTracker
|
59
61
|
end
|
@@ -23,10 +23,11 @@ class JbuilderDependencyTrackerTest < ActiveSupport::TestCase
|
|
23
23
|
|
24
24
|
test 'detects dependency via direct partial! call' do
|
25
25
|
dependencies = track_dependencies <<-RUBY
|
26
|
-
json.partial! 'path/to/partial'
|
26
|
+
json.partial! 'path/to/partial', foo: bar
|
27
|
+
json.partial! 'path/to/another/partial', :fizz => buzz
|
27
28
|
RUBY
|
28
29
|
|
29
|
-
assert_equal %w[path/to/partial], dependencies
|
30
|
+
assert_equal %w[path/to/partial path/to/another/partial], dependencies
|
30
31
|
end
|
31
32
|
|
32
33
|
test 'detects dependency via direct partial! call with parens' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|