gon 6.4.0 → 6.6.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -2
- data/README.md +1 -5
- data/lib/gon/base.rb +6 -3
- data/lib/gon/compatibility/old_rails.rb +2 -0
- data/lib/gon/env_finder.rb +2 -0
- data/lib/gon/escaper.rb +2 -0
- data/lib/gon/global.rb +2 -2
- data/lib/gon/helpers.rb +2 -0
- data/lib/gon/jbuilder/parser.rb +6 -4
- data/lib/gon/jbuilder.rb +3 -1
- data/lib/gon/json_dumper.rb +2 -0
- data/lib/gon/rabl.rb +3 -1
- data/lib/gon/request.rb +2 -1
- data/lib/gon/spec_helpers.rb +2 -0
- data/lib/gon/version.rb +3 -1
- data/lib/gon/watch.rb +2 -0
- data/lib/gon.rb +2 -0
- metadata +3 -62
- data/.github/FUNDING.yml +0 -1
- data/.gitignore +0 -7
- data/.travis.yml +0 -14
- data/Gemfile +0 -6
- data/Rakefile +0 -10
- data/doc/logo.png +0 -0
- data/doc/logo_small.png +0 -0
- data/doc/top_sample.png +0 -0
- data/gon.gemspec +0 -31
- data/spec/gon/basic_spec.rb +0 -304
- data/spec/gon/global_spec.rb +0 -146
- data/spec/gon/jbuilder_spec.rb +0 -75
- data/spec/gon/rabl_spec.rb +0 -90
- data/spec/gon/templates_spec.rb +0 -36
- data/spec/gon/thread_spec.rb +0 -39
- data/spec/gon/watch_spec.rb +0 -81
- data/spec/spec_helper.rb +0 -36
- data/spec/test_data/_sample_partial.json.jbuilder +0 -1
- data/spec/test_data/sample.json.jbuilder +0 -1
- data/spec/test_data/sample.rabl +0 -2
- data/spec/test_data/sample_rabl_rails.rabl +0 -2
- data/spec/test_data/sample_url_helpers.json.jbuilder +0 -1
- data/spec/test_data/sample_with_controller_method.json.jbuilder +0 -2
- data/spec/test_data/sample_with_helpers.json.jbuilder +0 -1
- data/spec/test_data/sample_with_helpers.rabl +0 -3
- data/spec/test_data/sample_with_helpers_rabl_rails.rabl +0 -3
- data/spec/test_data/sample_with_locals.json.jbuilder +0 -2
- data/spec/test_data/sample_with_partial.json.jbuilder +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb4ea344f74cb962215bfcc4c6607e75e7f5be64f5b75cb4e3ae5a5aa10d6b27
|
|
4
|
+
data.tar.gz: 48336de0a30b405faad2edb277766420f2d06c80b6804092dd4ae7764ec40363
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7ddd83671c6caf68e29c1b5cde9d179c8b5cf746af9458fde6f8b7cba64e760c728e93fde8fede4ab2242b2b026e83f134318b1c3659636a2e57f89a6ead9b1
|
|
7
|
+
data.tar.gz: ee87e834c70358fd8019f55564039581a4cc7636e62f655b7d123e7254ad0147fb6dfcf1f12de01a28e1c65a2d57c09d6e7cfc510933590386e1ae8152ede5e5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 6.5.0 and later
|
|
4
|
+
|
|
5
|
+
For changes from version 6.5.0 onwards, please check the [GitHub Releases page](https://github.com/gazay/gon/releases).
|
|
4
6
|
|
|
5
7
|
## [6.4.0] - 2020-09-18
|
|
6
8
|
### Security
|
|
@@ -230,7 +232,8 @@
|
|
|
230
232
|
### Changed
|
|
231
233
|
- Don't really remember what was before this version
|
|
232
234
|
|
|
233
|
-
[Unreleased]: https://github.com/gazay/gon/compare/v6.
|
|
235
|
+
[Unreleased]: https://github.com/gazay/gon/compare/v6.4.0...master
|
|
236
|
+
[6.4.0]: https://github.com/gazay/gon/compare/v6.3.2...v6.4.0
|
|
234
237
|
[6.3.2]: https://github.com/gazay/gon/compare/v6.3.1...v6.3.2
|
|
235
238
|
[6.3.1]: https://github.com/gazay/gon/compare/v6.2.1...v6.3.1
|
|
236
239
|
[6.2.1]: https://github.com/gazay/gon/compare/v6.2.0...v6.2.1
|
data/README.md
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
# Gon gem — get your Rails variables in your js
|
|
2
2
|
|
|
3
|
-
[](https://gitter.im/gazay/gon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
4
|
-
|
|
5
3
|

|
|
6
4
|
|
|
7
|
-
[](https://travis-ci.org/gazay/gon) [](https://codeclimate.com/github/gazay/gon)
|
|
8
|
-
|
|
9
5
|
If you need to send some data to your js files and you don't want to do this with long way through views and parsing - use this force!
|
|
10
6
|
|
|
11
7
|
Now you can easily renew data in your variables through ajax with [gon.watch](https://github.com/gazay/gon/wiki/Usage-gon-watch)!
|
|
@@ -224,7 +220,7 @@ usage gon.global.
|
|
|
224
220
|
|
|
225
221
|
## Speed up Gon
|
|
226
222
|
|
|
227
|
-
You can use any [JSON Engine](https://github.com/
|
|
223
|
+
You can use any [JSON Engine](https://github.com/sferik/multi_json#supported-json-engines) you want.
|
|
228
224
|
Gon uses `MultiJson` with autodetect mode, so all you need is just require your JSON library.
|
|
229
225
|
|
|
230
226
|
## Contributors
|
data/lib/gon/base.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class Gon
|
|
4
4
|
module Base
|
|
@@ -16,6 +16,9 @@ class Gon
|
|
|
16
16
|
nonce: nil
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
Option = Struct.new(:cameled, *VALID_OPTION_DEFAULTS.keys)
|
|
20
|
+
private_constant :Option
|
|
21
|
+
|
|
19
22
|
class << self
|
|
20
23
|
|
|
21
24
|
def render_data(options = {})
|
|
@@ -31,7 +34,7 @@ class Gon
|
|
|
31
34
|
private
|
|
32
35
|
|
|
33
36
|
def define_options(options)
|
|
34
|
-
_o =
|
|
37
|
+
_o = Option.new
|
|
35
38
|
|
|
36
39
|
VALID_OPTION_DEFAULTS.each do |opt_name, default|
|
|
37
40
|
_o.send("#{opt_name}=", options.fetch(opt_name, default))
|
|
@@ -43,7 +46,7 @@ class Gon
|
|
|
43
46
|
end
|
|
44
47
|
|
|
45
48
|
def formatted_data(_o)
|
|
46
|
-
script = ''
|
|
49
|
+
script = +''
|
|
47
50
|
before, after = render_wrap(_o)
|
|
48
51
|
script << before
|
|
49
52
|
|
data/lib/gon/env_finder.rb
CHANGED
data/lib/gon/escaper.rb
CHANGED
data/lib/gon/global.rb
CHANGED
data/lib/gon/helpers.rb
CHANGED
data/lib/gon/jbuilder/parser.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class Gon
|
|
2
4
|
module Jbuilder
|
|
3
5
|
class Parser
|
|
@@ -91,7 +93,7 @@ class Gon
|
|
|
91
93
|
end
|
|
92
94
|
|
|
93
95
|
def parse_path(path)
|
|
94
|
-
return path if File.
|
|
96
|
+
return path if File.exist?(path)
|
|
95
97
|
if (splitted = path.split('/')).blank?
|
|
96
98
|
raise 'Something wrong with partial path in your jbuilder templates'
|
|
97
99
|
elsif splitted.size == 1
|
|
@@ -108,9 +110,9 @@ class Gon
|
|
|
108
110
|
end
|
|
109
111
|
|
|
110
112
|
def path_with_ext(path)
|
|
111
|
-
return path if File.
|
|
112
|
-
return "#{path}.jbuilder" if File.
|
|
113
|
-
return "#{path}.json.jbuilder" if File.
|
|
113
|
+
return path if File.exist?(path)
|
|
114
|
+
return "#{path}.jbuilder" if File.exist?("#{path}.jbuilder")
|
|
115
|
+
return "#{path}.json.jbuilder" if File.exist?("#{path}.json.jbuilder")
|
|
114
116
|
end
|
|
115
117
|
|
|
116
118
|
def find_partials(lines = [])
|
data/lib/gon/jbuilder.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class Gon
|
|
2
4
|
module Jbuilder
|
|
3
5
|
class << self
|
|
@@ -30,7 +32,7 @@ class Gon
|
|
|
30
32
|
|
|
31
33
|
def parse_options_from(args)
|
|
32
34
|
if old_api? args
|
|
33
|
-
text = "[DEPRECATION] view_path argument is now optional. "
|
|
35
|
+
text = +"[DEPRECATION] view_path argument is now optional. "
|
|
34
36
|
text << "If you need to specify it, "
|
|
35
37
|
text << "please use gon.jbuilder(:template => 'path')"
|
|
36
38
|
warn text
|
data/lib/gon/json_dumper.rb
CHANGED
data/lib/gon/rabl.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'action_view'
|
|
2
4
|
|
|
3
5
|
begin
|
|
@@ -63,7 +65,7 @@ class Gon
|
|
|
63
65
|
def parse_options_from(args, global)
|
|
64
66
|
if old_api? args
|
|
65
67
|
unless global
|
|
66
|
-
text = "[DEPRECATION] view_path argument is now optional. "
|
|
68
|
+
text = +"[DEPRECATION] view_path argument is now optional. "
|
|
67
69
|
text << "If you need to specify it, "
|
|
68
70
|
text << "please use gon.rabl(:template => 'path')"
|
|
69
71
|
warn text
|
data/lib/gon/request.rb
CHANGED
data/lib/gon/spec_helpers.rb
CHANGED
data/lib/gon/version.rb
CHANGED
data/lib/gon/watch.rb
CHANGED
data/lib/gon.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- gazay
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: actionpack
|
|
@@ -66,34 +65,6 @@ dependencies:
|
|
|
66
65
|
- - ">="
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
67
|
version: '0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rabl
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - '='
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.11.3
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - '='
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.11.3
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rabl-rails
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
68
|
- !ruby/object:Gem::Dependency
|
|
98
69
|
name: rspec
|
|
99
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -186,19 +157,10 @@ executables: []
|
|
|
186
157
|
extensions: []
|
|
187
158
|
extra_rdoc_files: []
|
|
188
159
|
files:
|
|
189
|
-
- ".github/FUNDING.yml"
|
|
190
|
-
- ".gitignore"
|
|
191
|
-
- ".travis.yml"
|
|
192
160
|
- CHANGELOG.md
|
|
193
|
-
- Gemfile
|
|
194
161
|
- LICENSE
|
|
195
162
|
- README.md
|
|
196
|
-
- Rakefile
|
|
197
163
|
- coffee/watch.coffee
|
|
198
|
-
- doc/logo.png
|
|
199
|
-
- doc/logo_small.png
|
|
200
|
-
- doc/top_sample.png
|
|
201
|
-
- gon.gemspec
|
|
202
164
|
- js/watch.js
|
|
203
165
|
- lib/gon.rb
|
|
204
166
|
- lib/gon/base.rb
|
|
@@ -215,30 +177,10 @@ files:
|
|
|
215
177
|
- lib/gon/spec_helpers.rb
|
|
216
178
|
- lib/gon/version.rb
|
|
217
179
|
- lib/gon/watch.rb
|
|
218
|
-
- spec/gon/basic_spec.rb
|
|
219
|
-
- spec/gon/global_spec.rb
|
|
220
|
-
- spec/gon/jbuilder_spec.rb
|
|
221
|
-
- spec/gon/rabl_spec.rb
|
|
222
|
-
- spec/gon/templates_spec.rb
|
|
223
|
-
- spec/gon/thread_spec.rb
|
|
224
|
-
- spec/gon/watch_spec.rb
|
|
225
|
-
- spec/spec_helper.rb
|
|
226
|
-
- spec/test_data/_sample_partial.json.jbuilder
|
|
227
|
-
- spec/test_data/sample.json.jbuilder
|
|
228
|
-
- spec/test_data/sample.rabl
|
|
229
|
-
- spec/test_data/sample_rabl_rails.rabl
|
|
230
|
-
- spec/test_data/sample_url_helpers.json.jbuilder
|
|
231
|
-
- spec/test_data/sample_with_controller_method.json.jbuilder
|
|
232
|
-
- spec/test_data/sample_with_helpers.json.jbuilder
|
|
233
|
-
- spec/test_data/sample_with_helpers.rabl
|
|
234
|
-
- spec/test_data/sample_with_helpers_rabl_rails.rabl
|
|
235
|
-
- spec/test_data/sample_with_locals.json.jbuilder
|
|
236
|
-
- spec/test_data/sample_with_partial.json.jbuilder
|
|
237
180
|
homepage: https://github.com/gazay/gon
|
|
238
181
|
licenses:
|
|
239
182
|
- MIT
|
|
240
183
|
metadata: {}
|
|
241
|
-
post_install_message:
|
|
242
184
|
rdoc_options: []
|
|
243
185
|
require_paths:
|
|
244
186
|
- lib
|
|
@@ -253,8 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
253
195
|
- !ruby/object:Gem::Version
|
|
254
196
|
version: '0'
|
|
255
197
|
requirements: []
|
|
256
|
-
rubygems_version: 3.
|
|
257
|
-
signing_key:
|
|
198
|
+
rubygems_version: 3.6.9
|
|
258
199
|
specification_version: 4
|
|
259
200
|
summary: Get your Rails variables in your JS
|
|
260
201
|
test_files: []
|
data/.github/FUNDING.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
tidelift: "rubygems/gon"
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/doc/logo.png
DELETED
|
Binary file
|
data/doc/logo_small.png
DELETED
|
Binary file
|
data/doc/top_sample.png
DELETED
|
Binary file
|
data/gon.gemspec
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
-
require 'gon/version'
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |s|
|
|
6
|
-
s.name = 'gon'
|
|
7
|
-
s.version = Gon::VERSION
|
|
8
|
-
s.platform = Gem::Platform::RUBY
|
|
9
|
-
s.authors = ['gazay']
|
|
10
|
-
s.licenses = ['MIT']
|
|
11
|
-
s.email = ['alex.gaziev@gmail.com']
|
|
12
|
-
s.homepage = 'https://github.com/gazay/gon'
|
|
13
|
-
s.summary = %q{Get your Rails variables in your JS}
|
|
14
|
-
s.description = %q{If you need to send some data to your js files and you don't want to do this with long way trough views and parsing - use this force!}
|
|
15
|
-
|
|
16
|
-
s.files = `git ls-files`.split("\n")
|
|
17
|
-
s.require_paths = ['lib']
|
|
18
|
-
s.required_ruby_version = '>= 2.2.0'
|
|
19
|
-
s.add_dependency 'actionpack', '>= 3.0.20'
|
|
20
|
-
s.add_dependency 'i18n', '>= 0.7'
|
|
21
|
-
s.add_dependency 'request_store', '>= 1.0'
|
|
22
|
-
s.add_dependency 'multi_json'
|
|
23
|
-
s.add_development_dependency 'rabl', '0.11.3'
|
|
24
|
-
s.add_development_dependency 'rabl-rails'
|
|
25
|
-
s.add_development_dependency 'rspec', '>= 3.0'
|
|
26
|
-
s.add_development_dependency 'jbuilder'
|
|
27
|
-
s.add_development_dependency 'railties', '>= 3.0.20'
|
|
28
|
-
s.add_development_dependency 'rake'
|
|
29
|
-
s.add_development_dependency 'pry'
|
|
30
|
-
s.add_development_dependency 'pry-byebug'
|
|
31
|
-
end
|