extjsizable 1.0.3 → 2.0.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 +7 -0
- data/lib/extjsizable/active_record/extjs.rb +49 -55
- data/lib/extjsizable/core_ext/active_record_relation/extjs.rb +11 -0
- data/lib/extjsizable/core_ext/array/extjs.rb +23 -28
- data/lib/extjsizable.rb +2 -0
- data/spec/extjsizable_spec.rb +90 -89
- metadata +59 -64
- data/.document +0 -5
- data/Gemfile +0 -18
- data/Gemfile.lock +0 -46
- data/Rakefile +0 -49
- data/VERSION +0 -1
- data/extjsizable-1.0.2.gem +0 -0
- data/extjsizable.gemspec +0 -68
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cb2e80339d73a927753e3dc3691539f5f9ca1ff3dda6abdbe4d5bfa9a8f7a7c8
|
4
|
+
data.tar.gz: ca0d741559ce744977f20b62420de4cec5ab3fbba9b68a425c3a507d4a8eec94
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 72498413e2a372b916423228586a9ef8b483eae545f3eae1e102d105d134a171bc4430fa8bc0f5c445fa1976e39c1e3fb54df7242627725c1f19bdaef05069eb
|
7
|
+
data.tar.gz: 376316f0b369ef94e2b39691bd340c3b4b9ce56bccbfe430110d3e6f2b90d56230b156ad4b0ea1bec2122fa8ee0301e4ed654756ab3cae2f215b2a924e66ad13
|
@@ -9,67 +9,62 @@ module Extjsizable
|
|
9
9
|
self.wrap_with_brackets = false
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
def to_extjs(options = {})
|
13
|
+
success = options.delete(:success)
|
14
|
+
underscored_class_name = self.class.to_s.demodulize.underscore
|
13
15
|
|
14
|
-
|
15
|
-
success
|
16
|
-
|
16
|
+
if success || (success.nil? && errors.empty?)
|
17
|
+
# returns success/data to load a form:
|
18
|
+
# {
|
19
|
+
# "data": {
|
20
|
+
# "id": 1,
|
21
|
+
# "title": "First Post",
|
22
|
+
# "body": "This is my first post.",
|
23
|
+
# "published": true, ...
|
24
|
+
# },
|
25
|
+
# "success": true
|
26
|
+
# }
|
27
|
+
#
|
28
|
+
# If ActiveRecord::Base.include_root_in_json is true then, the model name is used instead of data key:
|
29
|
+
# {
|
30
|
+
# "post": {
|
31
|
+
# "id": 1,
|
32
|
+
# "title": "First Post",
|
33
|
+
# "body": "This is my first post.",
|
34
|
+
# "published": true, ...
|
35
|
+
# },
|
36
|
+
# "success": true
|
37
|
+
# }
|
38
|
+
# If ActiveRecord::Base.wrap_with_brackets is true then, the model name is prefixed into data key and all keys are surrounded with brackets:
|
39
|
+
# {
|
40
|
+
# "data": {
|
41
|
+
# "post[id]": 1,
|
42
|
+
# "post[title]": "First Post",
|
43
|
+
# "post[body]": "This is my first post.",
|
44
|
+
# "post[published]": true, ...
|
45
|
+
# },
|
46
|
+
# "success": true
|
47
|
+
# }
|
17
48
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# "data": {
|
22
|
-
# "id": 1,
|
23
|
-
# "title": "First Post",
|
24
|
-
# "body": "This is my first post.",
|
25
|
-
# "published": true, ...
|
26
|
-
# },
|
27
|
-
# "success": true
|
28
|
-
# }
|
29
|
-
#
|
30
|
-
# If ActiveRecord::Base.include_root_in_json is true then, the model name is used instead of data key:
|
31
|
-
# {
|
32
|
-
# "post": {
|
33
|
-
# "id": 1,
|
34
|
-
# "title": "First Post",
|
35
|
-
# "body": "This is my first post.",
|
36
|
-
# "published": true, ...
|
37
|
-
# },
|
38
|
-
# "success": true
|
39
|
-
# }
|
40
|
-
# If ActiveRecord::Base.wrap_with_brackets is true then, the model name is prefixed into data key and all keys are surrounded with brackets:
|
41
|
-
# {
|
42
|
-
# "data": {
|
43
|
-
# "post[id]": 1,
|
44
|
-
# "post[title]": "First Post",
|
45
|
-
# "post[body]": "This is my first post.",
|
46
|
-
# "post[published]": true, ...
|
47
|
-
# },
|
48
|
-
# "success": true
|
49
|
-
# }
|
50
|
-
|
51
|
-
h_json_data = as_json(options)
|
52
|
-
h_json_data = { :data => h_json_data } unless ::ActiveRecord::Base.include_root_in_json?
|
53
|
-
h_json_data[h_json_data.keys.first] = wrap_hash_with_brackets(h_json_data.values.first, underscored_class_name) if ::ActiveRecord::Base.wrap_with_brackets?
|
49
|
+
h_json_data = as_json(options)
|
50
|
+
h_json_data = { :data => h_json_data } unless ::ActiveRecord::Base.include_root_in_json?
|
51
|
+
h_json_data[h_json_data.keys.first] = wrap_hash_with_brackets(h_json_data.values.first, underscored_class_name) if ::ActiveRecord::Base.wrap_with_brackets?
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
53
|
+
{ :success => true }.merge(h_json_data)
|
54
|
+
else
|
55
|
+
# retrieves no-success/errors to the form:
|
56
|
+
# {
|
57
|
+
# "errors": { "title": "Title can't be blank", ... },
|
58
|
+
# "success": false
|
59
|
+
# }
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
61
|
+
h_json_data = errors.as_json(options)
|
62
|
+
h_json_data = wrap_hash_with_brackets(h_json_data, underscored_class_name) if ::ActiveRecord::Base.wrap_with_brackets?
|
63
|
+
{ :success => false, :errors => h_json_data.with_indifferent_access }
|
64
|
+
end.with_indifferent_access
|
67
65
|
|
68
|
-
end
|
69
66
|
end
|
70
67
|
|
71
|
-
private
|
72
|
-
|
73
68
|
# Wrap with brackets so that {:a => {:b => :c} } becomes to { 'model[a]' : {'b' : 'c'} }
|
74
69
|
def wrap_hash_with_brackets(h, model_name)
|
75
70
|
h.reduce({}) do |nh, (k, v)|
|
@@ -80,4 +75,3 @@ module Extjsizable
|
|
80
75
|
end
|
81
76
|
end
|
82
77
|
end
|
83
|
-
|
@@ -10,39 +10,34 @@ module Extjsizable
|
|
10
10
|
self.dasherize_keys = false
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
if ::Array.dasherize_keys?
|
28
|
-
array_json_data.map! { |h| dasherize_hash_keys(h) }
|
29
|
-
end
|
30
|
-
|
31
|
-
{ :total => (options.delete(:total) || self.length), :data => array_json_data }.with_indifferent_access
|
13
|
+
# Creates a JSON object by specifying which attributes we want to be shown.
|
14
|
+
# Ej:
|
15
|
+
# { 'total' : 2,
|
16
|
+
# 'data' : [
|
17
|
+
# { 'id' : 1, :nombre : 'Juan' },
|
18
|
+
# { 'id' : 2, :nombre : 'Pedro' }
|
19
|
+
# ]
|
20
|
+
# }
|
21
|
+
|
22
|
+
def to_extjs(options = {})
|
23
|
+
array_json_data = as_json(options)
|
24
|
+
|
25
|
+
if ::Array.dasherize_keys?
|
26
|
+
array_json_data.map! { |h| dasherize_hash_keys(h) }
|
32
27
|
end
|
33
28
|
|
34
|
-
|
35
|
-
|
36
|
-
# Dasherize keys that {:a => {:b => :c} } becomes to { 'a_b' => :c }
|
37
|
-
def dasherize_hash_keys(h, dash_key = '')
|
38
|
-
return { dash_key => h } unless h.is_a?(Hash)
|
29
|
+
{ :total => (options.delete(:total) || self.length), :data => array_json_data }.with_indifferent_access
|
30
|
+
end
|
39
31
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
32
|
+
# Dasherize keys that {:a => {:b => :c} } becomes to { 'a_b' => :c }
|
33
|
+
def dasherize_hash_keys(h, dash_key = '')
|
34
|
+
return { dash_key => h } unless h.is_a?(Hash)
|
44
35
|
|
36
|
+
h.reduce({}) do |nh, (k, v)|
|
37
|
+
nh.merge(dasherize_hash_keys(v, dash_key.blank? ? k.to_s : "#{dash_key}_#{k.to_s}"))
|
38
|
+
end
|
45
39
|
end
|
40
|
+
|
46
41
|
end
|
47
42
|
end
|
48
43
|
end
|
data/lib/extjsizable.rb
CHANGED
@@ -3,6 +3,8 @@ require 'active_support/core_ext'
|
|
3
3
|
require 'active_support/concern'
|
4
4
|
require 'extjsizable/active_record/extjs'
|
5
5
|
require 'extjsizable/core_ext/array/extjs'
|
6
|
+
require 'extjsizable/core_ext/active_record_relation/extjs'
|
6
7
|
|
7
8
|
ActiveRecord::Base.send :include, Extjsizable::ActiveRecord::ExtJs
|
8
9
|
Array.send :include, Extjsizable::CoreExt::Array::ExtJs
|
10
|
+
ActiveRecord::Relation.send :include, Extjsizable::CoreExt::ActiveRecordRelation::ExtJs
|
data/spec/extjsizable_spec.rb
CHANGED
@@ -9,62 +9,63 @@ describe "Extjsizable" do
|
|
9
9
|
@category = Category.new :name => 'The category'
|
10
10
|
end
|
11
11
|
|
12
|
-
it "should return success : true and a data section when not ActiveRecord::Base.include_root_in_json" do
|
12
|
+
it "should return success : true and a data section when not ActiveRecord::Base.include_root_in_json" do
|
13
13
|
ActiveRecord::Base.include_root_in_json = false
|
14
|
-
@category.should be_valid
|
15
14
|
|
16
|
-
|
15
|
+
expect(@category).to be_valid
|
17
16
|
|
18
|
-
json_hash.
|
19
|
-
json_hash.should have_key(:success)
|
20
|
-
json_hash[:success].should be_true
|
17
|
+
json_hash = @category.to_extjs
|
21
18
|
|
22
|
-
json_hash.
|
19
|
+
expect(json_hash).not_to be_empty
|
20
|
+
expect(json_hash).to have_key(:success)
|
21
|
+
expect(json_hash[:success]).to be true
|
22
|
+
expect(json_hash).to have_key(:data)
|
23
23
|
end
|
24
|
-
|
25
|
-
it "should return success : true and a category section when ActiveRecord::Base.include_root_in_json" do
|
24
|
+
|
25
|
+
it "should return success : true and a category section when ActiveRecord::Base.include_root_in_json" do
|
26
26
|
ActiveRecord::Base.include_root_in_json = true
|
27
|
-
@category.
|
27
|
+
expect(@category).to be_valid
|
28
28
|
|
29
29
|
json_hash = @category.to_extjs
|
30
30
|
|
31
|
-
json_hash.
|
32
|
-
json_hash.
|
33
|
-
json_hash[:success].
|
34
|
-
json_hash.
|
31
|
+
expect(json_hash).not_to be_empty
|
32
|
+
expect(json_hash).to have_key(:success)
|
33
|
+
expect(json_hash[:success]).to be true
|
34
|
+
expect(json_hash).to have_key(:category)
|
35
35
|
end
|
36
|
-
|
37
|
-
it "should return a category section with category[name] key when ActiveRecord::Base.wrap_with_brackets?" do
|
36
|
+
|
37
|
+
it "should return a category section with category[name] key when ActiveRecord::Base.wrap_with_brackets?" do
|
38
38
|
ActiveRecord::Base.wrap_with_brackets = true
|
39
39
|
|
40
40
|
json_hash = @category.to_extjs
|
41
|
-
json_hash[:category].
|
41
|
+
expect(json_hash[:category]).to have_key('category[name]')
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should return the attribute name of category when not ActiveRecord::Base.wrap_with_brackets?" do
|
45
45
|
ActiveRecord::Base.wrap_with_brackets = false
|
46
46
|
|
47
47
|
json_hash = @category.to_extjs
|
48
|
-
json_hash[:category].
|
49
|
-
end
|
50
|
-
|
48
|
+
expect(json_hash[:category]).to have_key(:name)
|
49
|
+
end
|
50
|
+
|
51
51
|
it "should return all atributes and the result of the methods specified when called with :methods => [...]" do
|
52
52
|
json_hash = @category.to_extjs(:methods => :my_method)
|
53
|
-
|
54
|
-
json_hash[:category].
|
53
|
+
|
54
|
+
expect(json_hash[:category]).to have_key(:name)
|
55
|
+
expect(json_hash[:category]).to have_key(:my_method)
|
55
56
|
end
|
56
57
|
|
57
58
|
it "should return success : false and an empty errors section when called with :success => false" do
|
58
59
|
json_hash = @category.to_extjs(:success => false)
|
59
|
-
|
60
|
-
json_hash.should have_key(:success)
|
61
|
-
json_hash[:success].should be_false
|
62
60
|
|
63
|
-
json_hash.
|
64
|
-
json_hash.
|
61
|
+
expect(json_hash).to have_key(:success)
|
62
|
+
expect(json_hash[:success]).to be false
|
65
63
|
|
66
|
-
json_hash.
|
67
|
-
json_hash
|
64
|
+
expect(json_hash).to_not have_key(:data)
|
65
|
+
expect(json_hash).to_not have_key(:category)
|
66
|
+
|
67
|
+
expect(json_hash).to have_key(:errors)
|
68
|
+
expect(json_hash[:errors]).to be_empty
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
@@ -75,22 +76,22 @@ describe "Extjsizable" do
|
|
75
76
|
@category.save
|
76
77
|
end
|
77
78
|
|
78
|
-
it "should return success : false and an errors section" do
|
79
|
-
@category.
|
79
|
+
it "should return success : false and an errors section" do
|
80
|
+
expect(@category).to_not be_valid
|
80
81
|
|
81
82
|
json_hash = @category.to_extjs
|
82
83
|
|
83
|
-
json_hash.
|
84
|
-
json_hash.
|
85
|
-
json_hash[:success].
|
84
|
+
expect(json_hash).to_not be_empty
|
85
|
+
expect(json_hash).to have_key(:success)
|
86
|
+
expect(json_hash[:success]).to be false
|
86
87
|
|
87
|
-
json_hash.
|
88
|
+
expect(json_hash).to have_key(:errors)
|
88
89
|
end
|
89
|
-
|
90
|
+
|
90
91
|
it "should return the failed attribute name" do
|
91
92
|
json_hash = @category.to_extjs
|
92
|
-
json_hash[:errors].
|
93
|
-
end
|
93
|
+
expect(json_hash[:errors]).to have_key(:name)
|
94
|
+
end
|
94
95
|
end
|
95
96
|
end
|
96
97
|
|
@@ -104,13 +105,13 @@ describe "Extjsizable" do
|
|
104
105
|
|
105
106
|
it 'should return { total => 0, data => [] }' do
|
106
107
|
json_hash = @array.to_extjs
|
107
|
-
json_hash.
|
108
|
-
json_hash[:total].
|
109
|
-
json_hash.
|
110
|
-
json_hash[:data].
|
108
|
+
expect(json_hash).to have_key(:total)
|
109
|
+
expect(json_hash[:total]).to eq(0)
|
110
|
+
expect(json_hash).to have_key(:data)
|
111
|
+
expect(json_hash[:data]).to be_empty
|
111
112
|
end
|
112
113
|
end
|
113
|
-
|
114
|
+
|
114
115
|
describe 'with 4 categories with some products each' do
|
115
116
|
before do
|
116
117
|
Product.delete_all
|
@@ -127,70 +128,70 @@ describe "Extjsizable" do
|
|
127
128
|
|
128
129
|
it 'should return { :total => 4, :data => [{ "id" => ..., "name" => "Category ..."}, ...] }' do
|
129
130
|
json_hash = @array.to_extjs
|
130
|
-
json_hash.
|
131
|
-
json_hash[:total].
|
132
|
-
|
133
|
-
json_hash.
|
134
|
-
json_hash[:data].
|
135
|
-
json_hash[:data].each do |h|
|
136
|
-
h.
|
137
|
-
h.
|
131
|
+
expect(json_hash).to have_key(:total)
|
132
|
+
expect(json_hash[:total]).to eq(4)
|
133
|
+
|
134
|
+
expect(json_hash).to have_key(:data)
|
135
|
+
expect(json_hash[:data].size).to eq(4)
|
136
|
+
json_hash[:data].each do |h|
|
137
|
+
expect(h).to have_key('id')
|
138
|
+
expect(h).to have_key('name')
|
138
139
|
end
|
139
140
|
end
|
140
141
|
|
141
142
|
it 'should return only id attributes when called with :only => :id ' do
|
142
143
|
json_hash = @array.to_extjs :only => :id
|
143
|
-
json_hash.
|
144
|
-
json_hash[:total].
|
145
|
-
|
146
|
-
json_hash.
|
147
|
-
json_hash[:data].
|
148
|
-
json_hash[:data].each do |h|
|
149
|
-
h.
|
150
|
-
h.
|
144
|
+
expect(json_hash).to have_key(:total)
|
145
|
+
expect(json_hash[:total]).to eq(4)
|
146
|
+
|
147
|
+
expect(json_hash).to have_key(:data)
|
148
|
+
expect(json_hash[:data].size).to eq(4)
|
149
|
+
json_hash[:data].each do |h|
|
150
|
+
expect(h).to have_key('id')
|
151
|
+
expect(h).to_not have_key('name')
|
151
152
|
end
|
152
153
|
end
|
153
|
-
|
154
|
+
|
154
155
|
it 'should return only name attributes when called with :except => :id ' do
|
155
156
|
json_hash = @array.to_extjs :except => :id
|
156
|
-
json_hash.
|
157
|
-
json_hash[:total].
|
158
|
-
|
159
|
-
json_hash.
|
160
|
-
json_hash[:data].
|
161
|
-
json_hash[:data].each do |h|
|
162
|
-
h.
|
163
|
-
h.
|
157
|
+
expect(json_hash).to have_key(:total)
|
158
|
+
expect(json_hash[:total]).to eq(4)
|
159
|
+
|
160
|
+
expect(json_hash).to have_key(:data)
|
161
|
+
expect(json_hash[:data].size).to eq(4)
|
162
|
+
json_hash[:data].each do |h|
|
163
|
+
expect(h).to have_key('name')
|
164
|
+
expect(h).to_not have_key('id')
|
164
165
|
end
|
165
166
|
end
|
166
|
-
|
167
|
+
|
167
168
|
it 'should return only related data attributes with :include => :products ' do
|
168
169
|
json_hash = @array.to_extjs :include => :products
|
169
|
-
json_hash.
|
170
|
-
json_hash[:total].
|
171
|
-
|
172
|
-
json_hash.
|
173
|
-
json_hash[:data].
|
174
|
-
json_hash[:data].each do |h|
|
175
|
-
h.
|
176
|
-
h.
|
177
|
-
h.
|
178
|
-
h[
|
170
|
+
expect(json_hash).to have_key(:total)
|
171
|
+
expect(json_hash[:total]).to eq(4)
|
172
|
+
|
173
|
+
expect(json_hash).to have_key(:data)
|
174
|
+
expect(json_hash[:data].size).to eq(4)
|
175
|
+
json_hash[:data].each do |h|
|
176
|
+
expect(h).to have_key('name')
|
177
|
+
expect(h).to have_key('id')
|
178
|
+
expect(h).to have_key('products')
|
179
|
+
expect(h['products'].size).to eq(2)
|
179
180
|
end
|
180
181
|
end
|
181
|
-
|
182
|
+
|
182
183
|
it 'should return only related data attributes with :include => :category and dasherize all keys' do
|
183
184
|
Array.dasherize_keys = true
|
184
185
|
json_hash = Product.all.to_extjs :include => :category
|
185
|
-
json_hash.
|
186
|
-
json_hash[:total].
|
187
|
-
|
188
|
-
json_hash.
|
189
|
-
json_hash[:data].
|
190
|
-
json_hash[:data].each do |h|
|
191
|
-
h.
|
192
|
-
h.
|
193
|
-
h.
|
186
|
+
expect(json_hash).to have_key(:total)
|
187
|
+
expect(json_hash[:total]).to eq(8)
|
188
|
+
|
189
|
+
expect(json_hash).to have_key(:data)
|
190
|
+
expect(json_hash[:data].size).to eq(8)
|
191
|
+
json_hash[:data].each do |h|
|
192
|
+
expect(h).to have_key('name')
|
193
|
+
expect(h).to have_key('id')
|
194
|
+
expect(h).to have_key('category_name')
|
194
195
|
end
|
195
196
|
end
|
196
197
|
|
metadata
CHANGED
@@ -1,129 +1,124 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extjsizable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ungue
|
8
|
+
- dotpao
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
name: activerecord
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
|
-
- -
|
18
|
+
- - ">="
|
20
19
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
20
|
+
version: '5.2'
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
version_requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '5.2'
|
25
28
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
name: activesupport
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
29
31
|
requirements:
|
30
|
-
- -
|
32
|
+
- - ">="
|
31
33
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
34
|
+
version: '5.2'
|
33
35
|
type: :runtime
|
34
36
|
prerelease: false
|
35
|
-
version_requirements:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '5.2'
|
36
42
|
- !ruby/object:Gem::Dependency
|
37
43
|
name: rspec
|
38
|
-
requirement:
|
39
|
-
none: false
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
40
45
|
requirements:
|
41
|
-
- - ~>
|
46
|
+
- - "~>"
|
42
47
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
48
|
+
version: '3.12'
|
44
49
|
type: :development
|
45
50
|
prerelease: false
|
46
|
-
version_requirements:
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.12'
|
47
56
|
- !ruby/object:Gem::Dependency
|
48
57
|
name: bundler
|
49
|
-
requirement:
|
50
|
-
none: false
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
51
59
|
requirements:
|
52
|
-
- - ~>
|
60
|
+
- - "~>"
|
53
61
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
62
|
+
version: '2.0'
|
55
63
|
type: :development
|
56
64
|
prerelease: false
|
57
|
-
version_requirements:
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: jeweler
|
60
|
-
requirement: &21344380 !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
62
66
|
requirements:
|
63
|
-
- - ~>
|
67
|
+
- - "~>"
|
64
68
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
66
|
-
type: :development
|
67
|
-
prerelease: false
|
68
|
-
version_requirements: *21344380
|
69
|
+
version: '2.0'
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement:
|
72
|
-
none: false
|
71
|
+
name: rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
76
|
+
version: '13.0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements:
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '13.0'
|
84
|
+
description: Allows your models and collections to generate the JSON structure expected
|
85
|
+
by Ext JS 4-compatible frontends.
|
86
|
+
email:
|
87
|
+
- carlos@rodriguez-ruiz.com
|
83
88
|
executables: []
|
84
89
|
extensions: []
|
85
|
-
extra_rdoc_files:
|
86
|
-
- LICENSE.txt
|
87
|
-
- README.rdoc
|
90
|
+
extra_rdoc_files: []
|
88
91
|
files:
|
89
|
-
- .document
|
90
|
-
- Gemfile
|
91
|
-
- Gemfile.lock
|
92
92
|
- LICENSE.txt
|
93
93
|
- README.rdoc
|
94
|
-
- Rakefile
|
95
|
-
- VERSION
|
96
|
-
- extjsizable-1.0.2.gem
|
97
|
-
- extjsizable.gemspec
|
98
94
|
- lib/extjsizable.rb
|
99
95
|
- lib/extjsizable/active_record/extjs.rb
|
96
|
+
- lib/extjsizable/core_ext/active_record_relation/extjs.rb
|
100
97
|
- lib/extjsizable/core_ext/array/extjs.rb
|
101
98
|
- spec/extjsizable_spec.rb
|
102
99
|
- spec/spec_helper.rb
|
103
|
-
homepage:
|
100
|
+
homepage: https://github.com/dotpao/extjsizable
|
104
101
|
licenses:
|
105
102
|
- MIT
|
103
|
+
metadata: {}
|
106
104
|
post_install_message:
|
107
105
|
rdoc_options: []
|
108
106
|
require_paths:
|
109
107
|
- lib
|
110
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
109
|
requirements:
|
113
|
-
- -
|
110
|
+
- - ">="
|
114
111
|
- !ruby/object:Gem::Version
|
115
|
-
version: '
|
112
|
+
version: '2.6'
|
116
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
114
|
requirements:
|
119
|
-
- -
|
115
|
+
- - ">="
|
120
116
|
- !ruby/object:Gem::Version
|
121
117
|
version: '0'
|
122
118
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 1.8.10
|
119
|
+
rubygems_version: 3.5.22
|
125
120
|
signing_key:
|
126
|
-
specification_version:
|
127
|
-
summary:
|
128
|
-
|
121
|
+
specification_version: 4
|
122
|
+
summary: Adds `to_extjs` to ActiveRecord models and arrays to serialize JSON for Ext
|
123
|
+
JS.
|
129
124
|
test_files: []
|
data/.document
DELETED
data/Gemfile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
gem "activesupport", ">= 3.0"
|
5
|
-
gem "activerecord", ">= 3.0"
|
6
|
-
|
7
|
-
# Add dependencies to develop your gem here.
|
8
|
-
# Include everything needed to run rake, tests, features, etc.
|
9
|
-
group :development do
|
10
|
-
gem "rspec", "~> 2.3.0"
|
11
|
-
gem "bundler", "~> 1.0.0"
|
12
|
-
gem "jeweler", "~> 1.6.3"
|
13
|
-
gem "rcov", ">= 0"
|
14
|
-
end
|
15
|
-
|
16
|
-
group :test do
|
17
|
-
gem "sqlite3"
|
18
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activemodel (3.0.5)
|
5
|
-
activesupport (= 3.0.5)
|
6
|
-
builder (~> 2.1.2)
|
7
|
-
i18n (~> 0.4)
|
8
|
-
activerecord (3.0.5)
|
9
|
-
activemodel (= 3.0.5)
|
10
|
-
activesupport (= 3.0.5)
|
11
|
-
arel (~> 2.0.2)
|
12
|
-
tzinfo (~> 0.3.23)
|
13
|
-
activesupport (3.0.5)
|
14
|
-
arel (2.0.9)
|
15
|
-
builder (2.1.2)
|
16
|
-
diff-lcs (1.1.2)
|
17
|
-
git (1.2.5)
|
18
|
-
i18n (0.5.0)
|
19
|
-
jeweler (1.6.3)
|
20
|
-
bundler (~> 1.0)
|
21
|
-
git (>= 1.2.5)
|
22
|
-
rake
|
23
|
-
rake (0.9.2)
|
24
|
-
rcov (0.9.9)
|
25
|
-
rspec (2.3.0)
|
26
|
-
rspec-core (~> 2.3.0)
|
27
|
-
rspec-expectations (~> 2.3.0)
|
28
|
-
rspec-mocks (~> 2.3.0)
|
29
|
-
rspec-core (2.3.1)
|
30
|
-
rspec-expectations (2.3.0)
|
31
|
-
diff-lcs (~> 1.1.2)
|
32
|
-
rspec-mocks (2.3.0)
|
33
|
-
sqlite3 (1.3.3)
|
34
|
-
tzinfo (0.3.25)
|
35
|
-
|
36
|
-
PLATFORMS
|
37
|
-
ruby
|
38
|
-
|
39
|
-
DEPENDENCIES
|
40
|
-
activerecord (>= 3.0)
|
41
|
-
activesupport (>= 3.0)
|
42
|
-
bundler (~> 1.0.0)
|
43
|
-
jeweler (~> 1.6.3)
|
44
|
-
rcov
|
45
|
-
rspec (~> 2.3.0)
|
46
|
-
sqlite3
|
data/Rakefile
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "extjsizable"
|
18
|
-
gem.homepage = "http://github.com/ungue/extjsizable"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{Allow your models and collections to generate the JSON structure accepted by Ext JS 4}
|
21
|
-
gem.description = %Q{You can create REST services to be used for Ext JS 4 in an easy manner by calling to_extjs in your models or arrays.}
|
22
|
-
gem.email = "ungue79@yahoo.es"
|
23
|
-
gem.authors = ["Ungue"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
|
-
require 'rspec/core'
|
29
|
-
require 'rspec/core/rake_task'
|
30
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
-
end
|
33
|
-
|
34
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
-
spec.rcov = true
|
37
|
-
end
|
38
|
-
|
39
|
-
task :default => :spec
|
40
|
-
|
41
|
-
require 'rake/rdoctask'
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "extjsizable #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.3
|
data/extjsizable-1.0.2.gem
DELETED
Binary file
|
data/extjsizable.gemspec
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "extjsizable"
|
8
|
-
s.version = "1.0.3"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Ungue"]
|
12
|
-
s.date = "2011-11-08"
|
13
|
-
s.description = "You can create REST services to be used for Ext JS 4 in an easy manner by calling to_extjs in your models or arrays."
|
14
|
-
s.email = "ungue79@yahoo.es"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
|
-
"LICENSE.txt",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"extjsizable-1.0.2.gem",
|
28
|
-
"extjsizable.gemspec",
|
29
|
-
"lib/extjsizable.rb",
|
30
|
-
"lib/extjsizable/active_record/extjs.rb",
|
31
|
-
"lib/extjsizable/core_ext/array/extjs.rb",
|
32
|
-
"spec/extjsizable_spec.rb",
|
33
|
-
"spec/spec_helper.rb"
|
34
|
-
]
|
35
|
-
s.homepage = "http://github.com/ungue/extjsizable"
|
36
|
-
s.licenses = ["MIT"]
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = "1.8.10"
|
39
|
-
s.summary = "Allow your models and collections to generate the JSON structure accepted by Ext JS 4"
|
40
|
-
|
41
|
-
if s.respond_to? :specification_version then
|
42
|
-
s.specification_version = 3
|
43
|
-
|
44
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
|
46
|
-
s.add_runtime_dependency(%q<activerecord>, [">= 3.0"])
|
47
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
48
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.6.3"])
|
50
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<activesupport>, [">= 3.0"])
|
53
|
-
s.add_dependency(%q<activerecord>, [">= 3.0"])
|
54
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
55
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
56
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
|
57
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
58
|
-
end
|
59
|
-
else
|
60
|
-
s.add_dependency(%q<activesupport>, [">= 3.0"])
|
61
|
-
s.add_dependency(%q<activerecord>, [">= 3.0"])
|
62
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
63
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
64
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
|
65
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|