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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3141e1a87d6a858eed1e1744e0d3f77dfd1f2285
4
- data.tar.gz: 20846381277c1288b86db8fb0c7bfd53421ce484
3
+ metadata.gz: 1f70e328fa8dca8b3a98c6d5d87102512f624ce9
4
+ data.tar.gz: 1d99855c2c28b3752b696ae47298663dd8a5f311
5
5
  SHA512:
6
- metadata.gz: 90cef844168896f3deef2cd9b83dfea34b3080687e33b412acc884e76f66f1e4b5994f71302712097f47028eba0482c57ac43dcf07e16b18956ddaa93a777f1d
7
- data.tar.gz: d4c479bdf1b91218a821cf10ae3823c1f3bf8fafd7df54605d724510ea69a4da276112cbb71d54e0ee8b5dfab2538f64835189d0f023c359ed5e62f9c9465865
6
+ metadata.gz: 9e8b3f0e5f8111b07dbc24fb0fed99bd975358d89dcc1c9fec20fea572c8de756b69c00af85b2b118f85316bdcc78b0c8605c15394692e0829d6178c54fb4063
7
+ data.tar.gz: 5f599be397203a899995cbe9fcfc67f76b9aaed89a8f9dc50a695adbc805705cf81bae83b431bf83caa9968d96c9d1856946011115bd7a2b6b05e7f0c20956be
@@ -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-19mode
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-19mode
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
@@ -4,4 +4,11 @@ gemspec
4
4
 
5
5
  gem 'rake'
6
6
  gem 'mocha', :require => false
7
- gem 'actionpack', '~> 3.0'
7
+ gem 'actionpack', '~> 3.0'
8
+
9
+ platforms :rbx do
10
+ gem 'rubysl', '~> 2.0'
11
+ gem 'json', '~> 1.8'
12
+ gem 'rubysl-test-unit'
13
+ gem 'rubinius-developer_tools'
14
+ end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2013 David Heinemeier Hansson, 37signals
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.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jbuilder'
3
- s.version = '2.0.1'
3
+ s.version = '2.0.2'
4
4
  s.author = 'David Heinemeier Hansson'
5
5
  s.email = 'david@37signals.com'
6
6
  s.summary = 'Create JSON structures via a Builder-style DSL'
@@ -15,45 +15,47 @@ rescue LoadError
15
15
  end
16
16
 
17
17
  if dependency_tracker
18
- dependency_tracking_module = Module.new do
19
- # Matches:
20
- # json.partial! "messages/message"
21
- # json.partial!('messages/message')
22
- #
23
- DIRECT_RENDERS = /
24
- \w+\.partial! # json.partial!
25
- \(?\s* # optional parenthesis
26
- (['"])([^""]+)\1 # quoted value
27
- /x
28
-
29
- # Matches:
30
- # json.partial! partial: "comments/comment"
31
- # json.comments @post.comments, partial: "comments/comment", as: :comment
32
- # json.array! @posts, partial: "posts/post", as: :post
33
- # = render partial: "account"
34
- #
35
- INDIRECT_RENDERS = /
36
- (?::partial\s*=>|partial:) # partial: or :partial =>
37
- \s* # optional whitespace
38
- (['"])([^'"]+)\1 # quoted value
39
- /x
40
-
41
- def dependencies
42
- direct_dependencies + indirect_dependencies + explicit_dependencies
43
- end
44
-
45
- private
46
-
47
- def direct_dependencies
48
- source.scan(DIRECT_RENDERS).map(&:second)
49
- end
50
-
51
- def indirect_dependencies
52
- source.scan(INDIRECT_RENDERS).map(&:second)
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, dependency_tracking_module
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.1
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: 2013-12-22 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport