live_record 0.2.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +154 -59
- data/app/assets/javascripts/live_record/model/create.coffee +78 -0
- data/app/channels/live_record/autoloads_channel.rb +92 -0
- data/app/channels/live_record/base_channel.rb +0 -25
- data/app/channels/live_record/base_channel/helpers.rb +27 -0
- data/app/channels/live_record/{publications_channel → base_channel}/search_adapters.rb +1 -1
- data/app/channels/live_record/changes_channel.rb +3 -3
- data/app/channels/live_record/publications_channel.rb +5 -5
- data/config/puma.rb +2 -0
- data/lib/live_record/model/callbacks.rb +29 -2
- data/lib/live_record/version.rb +1 -1
- data/live_record.gemspec +10 -6
- data/spec/features/live_record_syncing_spec.rb +219 -35
- data/spec/internal/app/views/posts/index.html.erb +0 -5
- data/spec/internal/db/schema.rb +4 -0
- data/spec/rails_helper.rb +1 -1
- metadata +53 -36
@@ -1,8 +1,3 @@
|
|
1
|
-
<script>
|
2
|
-
LiveRecord.helpers.loadRecords({ modelName: 'Post' });
|
3
|
-
LiveRecord.helpers.loadRecords({ modelName: 'User', url: '<%= j users_path %>' });
|
4
|
-
LiveRecord.Model.all.Post.subscribe({ where: { is_enabled_eq: true, content_eq: 'somecontent' }});
|
5
|
-
</script>
|
6
1
|
<p id="notice"><%= notice %></p>
|
7
2
|
|
8
3
|
<h1>Posts</h1>
|
data/spec/internal/db/schema.rb
CHANGED
@@ -16,11 +16,15 @@ ActiveRecord::Schema.define do
|
|
16
16
|
t.datetime "updated_at", null: false
|
17
17
|
t.index ["is_enabled"], name: "index_posts_on_is_enabled"
|
18
18
|
t.index ["user_id"], name: "index_posts_on_user_id"
|
19
|
+
t.index ["created_at"], name: "index_posts_on_created_at"
|
20
|
+
t.index ["updated_at"], name: "index_posts_on_updated_at"
|
19
21
|
end
|
20
22
|
|
21
23
|
create_table "users", force: :cascade do |t|
|
22
24
|
t.string "email"
|
23
25
|
t.datetime "created_at", null: false
|
24
26
|
t.datetime "updated_at", null: false
|
27
|
+
t.index ["created_at"], name: "index_users_on_created_at"
|
28
|
+
t.index ["updated_at"], name: "index_users_on_updated_at"
|
25
29
|
end
|
26
30
|
end
|
data/spec/rails_helper.rb
CHANGED
@@ -4,7 +4,7 @@ Dir[__dir__ + '/helpers/*.rb'].each {|file| require file }
|
|
4
4
|
|
5
5
|
ActiveRecord::Migration.maintain_test_schema!
|
6
6
|
|
7
|
-
Capybara.javascript_driver = :selenium_chrome_headless # :selenium_chrome
|
7
|
+
Capybara.javascript_driver = :selenium_chrome_headless # :selenium_chrome
|
8
8
|
Capybara.server = :puma
|
9
9
|
|
10
10
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: live_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jules Roman B. Polidario
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -45,159 +45,159 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '5.1'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: puma
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '3.10'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '3.10'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: bundler
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '3
|
67
|
+
version: '1.3'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '3
|
74
|
+
version: '1.3'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: byebug
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0
|
81
|
+
version: '9.0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0
|
88
|
+
version: '9.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: sprockets-rails
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '3.2'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '3.2'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
104
|
+
name: coffee-rails
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '4.2'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '4.2'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: jquery-rails
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
123
|
+
version: '4.3'
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
130
|
+
version: '4.3'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
132
|
+
name: jbuilder
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
137
|
+
version: '2.7'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
144
|
+
version: '2.7'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
146
|
+
name: sqlite3
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
151
|
+
version: '1.3'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
158
|
+
version: '1.3'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
160
|
+
name: redis
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: '3.
|
165
|
+
version: '3.3'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '3.
|
172
|
+
version: '3.3'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
174
|
+
name: rspec-rails
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
179
|
+
version: '3.6'
|
180
180
|
type: :development
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: '
|
186
|
+
version: '3.6'
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
|
-
name:
|
188
|
+
name: combustion
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
191
|
- - "~>"
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: '
|
193
|
+
version: '0.7'
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - "~>"
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: '
|
200
|
+
version: '0.7'
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
202
|
name: chromedriver-helper
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -254,6 +254,20 @@ dependencies:
|
|
254
254
|
- - "~>"
|
255
255
|
- !ruby/object:Gem::Version
|
256
256
|
version: '1.6'
|
257
|
+
- !ruby/object:Gem::Dependency
|
258
|
+
name: timecop
|
259
|
+
requirement: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - '='
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: 0.9.1
|
264
|
+
type: :development
|
265
|
+
prerelease: false
|
266
|
+
version_requirements: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - '='
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: 0.9.1
|
257
271
|
description: |-
|
258
272
|
Auto-syncs records in client-side JS (through a Model DSL) from changes (updates/destroy) in the backend Rails server through ActionCable.
|
259
273
|
Also supports streaming newly created records to client-side JS.
|
@@ -281,11 +295,14 @@ files:
|
|
281
295
|
- app/assets/javascripts/live_record/plugins.coffee
|
282
296
|
- app/assets/javascripts/live_record/plugins/live_dom.coffee
|
283
297
|
- app/assets/javascripts/live_record/plugins/live_dom/apply_to_model.coffee
|
298
|
+
- app/channels/live_record/autoloads_channel.rb
|
284
299
|
- app/channels/live_record/base_channel.rb
|
300
|
+
- app/channels/live_record/base_channel/helpers.rb
|
301
|
+
- app/channels/live_record/base_channel/search_adapters.rb
|
285
302
|
- app/channels/live_record/changes_channel.rb
|
286
303
|
- app/channels/live_record/publications_channel.rb
|
287
|
-
- app/channels/live_record/publications_channel/search_adapters.rb
|
288
304
|
- config.ru
|
305
|
+
- config/puma.rb
|
289
306
|
- lib/live_record.rb
|
290
307
|
- lib/live_record/action_view_extensions/view_helper.rb
|
291
308
|
- lib/live_record/configure.rb
|