live_record 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +3 -0
- data/Gemfile +2 -2
- data/README.md +17 -7
- data/config.ru +3 -1
- data/lib/live_record/version.rb +1 -1
- data/live_record.gemspec +6 -6
- data/spec/rails_helper.rb +1 -0
- data/spec/spec_helper.rb +3 -1
- metadata +17 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7c5e459f1fd9627b4731cd59fcc25622317d2ecbeb1afe32b4d55328880ba7cf
|
4
|
+
data.tar.gz: a2018fdbcfcdeef038c8a389bf3c5240a4ffa9b05884b6c8d9efb59a23d6c62c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba9f87dc58ad53ee987264795de0ba551c78888fc17725ed5176e036ae5294e50a5c50c84dc082425842eef3132fd48e49063930b6b65ded469e2376cc764cf
|
7
|
+
data.tar.gz: 7a08ddb71528e48371c5406a7616dfcf19d9268adad369cbce537c21426020101d819421f6d1f2adc0418271b292e0140649113541ac1a2593ddec2dcbbe682a
|
data/.travis.yml
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
+
sudo: required
|
1
2
|
dist: trusty
|
2
3
|
addons:
|
3
4
|
chrome: stable
|
4
5
|
language: ruby
|
6
|
+
cache: bundler
|
5
7
|
rvm:
|
6
8
|
- 2.2.2
|
7
9
|
- 2.2.7
|
8
10
|
- 2.3.4
|
9
11
|
- 2.4.1
|
12
|
+
- 2.5.1
|
10
13
|
before_install:
|
11
14
|
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
|
data/Gemfile
CHANGED
@@ -7,5 +7,5 @@ group :development, :test do
|
|
7
7
|
# therefore, this gem should not be part of .gemspec but instead is specified here in the Gemfile
|
8
8
|
gem 'factory_girl_rails', '~> 4.8', require: false
|
9
9
|
# do not require to prevent Capybara deprecation warning on rspec run
|
10
|
-
gem 'capybara', '~>
|
11
|
-
end
|
10
|
+
gem 'capybara', '~> 3.1', require: false
|
11
|
+
end
|
data/README.md
CHANGED
@@ -16,11 +16,12 @@
|
|
16
16
|
## Requirements
|
17
17
|
|
18
18
|
* **Ruby >= 2.2.2**
|
19
|
-
* **Rails
|
19
|
+
* **Rails ~> 5.0**
|
20
20
|
|
21
21
|
## Demo
|
22
22
|
|
23
|
-
* https://live-record-example.herokuapp.com/
|
23
|
+
* https://live-record-example.herokuapp.com/ (Basic Demo)
|
24
|
+
* http://playadj.io/ (Full Demo: An Online Card Game)
|
24
25
|
|
25
26
|
## Usage Example
|
26
27
|
|
@@ -61,10 +62,16 @@
|
|
61
62
|
// ...or only those which are enabled (you can also combine this with `reload: true`)
|
62
63
|
// LiveRecord.Model.all.Book.autoload({where: {is_enabled_eq: true}})
|
63
64
|
|
64
|
-
// now, we can just simply add a "
|
65
|
-
LiveRecord.Model.all.Book.addCallback('after:
|
65
|
+
// now, we can just simply add a "create" callback or also an "update" callback, to apply our own logic whenever a new Book record is streamed from the backend
|
66
|
+
LiveRecord.Model.all.Book.addCallback('after:create', function() {
|
66
67
|
// let's say you have a code here that adds this new Book on the page
|
67
|
-
// `this` refers to the Book record that has been created
|
68
|
+
// `this` refers to the Book record that has been created
|
69
|
+
console.log(this);
|
70
|
+
})
|
71
|
+
|
72
|
+
LiveRecord.Model.all.Book.addCallback('after:update', function() {
|
73
|
+
// let's say you have a code here that updates this Book on the page
|
74
|
+
// `this` refers to the Book record that has been updated
|
68
75
|
console.log(this);
|
69
76
|
})
|
70
77
|
```
|
@@ -135,7 +142,7 @@
|
|
135
142
|
# Add attributes to this array that you would like `current_user` to be able to query upon
|
136
143
|
# on the `subscribe({where: {...}})` and `autoload({where: {...}})` functions
|
137
144
|
# empty array means not-authorised
|
138
|
-
if current_user.
|
145
|
+
if current_user.is_admin?
|
139
146
|
[:id, :title, :author, :created_at, :updated_at, :reference_id, :origin_address]
|
140
147
|
else
|
141
148
|
[]
|
@@ -150,7 +157,7 @@
|
|
150
157
|
1. Add the following to your `Gemfile`:
|
151
158
|
|
152
159
|
```ruby
|
153
|
-
gem 'live_record', '~> 0.3.
|
160
|
+
gem 'live_record', '~> 0.3.4'
|
154
161
|
```
|
155
162
|
|
156
163
|
2. Run:
|
@@ -773,6 +780,9 @@ end
|
|
773
780
|
* MIT
|
774
781
|
|
775
782
|
## Changelog
|
783
|
+
* 0.3.4
|
784
|
+
* now supports Rails `~> 5.2` after being tested to work
|
785
|
+
* update dependency to Rails (and other dev gems) to use semantic versioning: `~> 5.0`, instead of `>= 5.0, < 5.3`
|
776
786
|
* 0.3.3
|
777
787
|
* now allows creating [`class` and `instance` methods](#example-2---model--associations--callbacks--methods) when creating a LiveRecord Model
|
778
788
|
* added `after:reload` callback to `autoload()` and `subscribe()` when `reload: true` is passed, which triggers once after reloading has finished transmitting all records
|
data/config.ru
CHANGED
@@ -5,6 +5,8 @@ Bundler.require :default, :development
|
|
5
5
|
require 'live_record'
|
6
6
|
require 'action_cable/engine'
|
7
7
|
|
8
|
-
Combustion.initialize! :all
|
8
|
+
Combustion.initialize! :all do
|
9
|
+
config.active_record.sqlite3.represent_boolean_as_integer = true
|
10
|
+
end
|
9
11
|
|
10
12
|
run Combustion::Application
|
data/lib/live_record/version.rb
CHANGED
data/live_record.gemspec
CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.license = 'MIT'
|
15
15
|
s.required_ruby_version = '>= 2.2.2'
|
16
16
|
|
17
|
-
s.add_dependency 'rails', '
|
17
|
+
s.add_dependency 'rails', '~> 5.0'
|
18
18
|
|
19
|
-
s.add_development_dependency 'rails', '~> 5.
|
19
|
+
s.add_development_dependency 'rails', '~> 5.2'
|
20
20
|
s.add_development_dependency 'puma', '~> 3.10'
|
21
21
|
s.add_development_dependency 'bundler', '~> 1.3'
|
22
22
|
s.add_development_dependency 'byebug', '~> 9.0'
|
@@ -30,10 +30,10 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_development_dependency 'redis', '~> 3.3'
|
31
31
|
|
32
32
|
s.add_development_dependency 'rspec-rails', '~> 3.6'
|
33
|
-
s.add_development_dependency 'combustion', '~> 0.
|
34
|
-
s.add_development_dependency 'chromedriver-helper', '~> 1.
|
35
|
-
s.add_development_dependency 'selenium-webdriver', '~> 3.
|
33
|
+
s.add_development_dependency 'combustion', '~> 0.9'
|
34
|
+
s.add_development_dependency 'chromedriver-helper', '~> 1.2'
|
35
|
+
s.add_development_dependency 'selenium-webdriver', '~> 3.12'
|
36
36
|
s.add_development_dependency 'faker', '~> 1.8'
|
37
37
|
s.add_development_dependency 'database_cleaner', '~> 1.6'
|
38
|
-
s.add_development_dependency 'timecop', '0.9
|
38
|
+
s.add_development_dependency 'timecop', '0.9'
|
39
39
|
end
|
data/spec/rails_helper.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,9 @@ Bundler.require :default, :development
|
|
5
5
|
require 'live_record'
|
6
6
|
require 'action_cable/engine'
|
7
7
|
|
8
|
-
Combustion.initialize! :all
|
8
|
+
Combustion.initialize! :all do
|
9
|
+
config.active_record.sqlite3.represent_boolean_as_integer = true
|
10
|
+
end
|
9
11
|
|
10
12
|
require 'rspec/rails'
|
11
13
|
require 'capybara/rails'
|
metadata
CHANGED
@@ -1,49 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: live_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
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:
|
11
|
+
date: 2018-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 5.0.0
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
19
|
+
version: '5.0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 5.0.0
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
26
|
+
version: '5.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rails
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: '5.
|
33
|
+
version: '5.2'
|
40
34
|
type: :development
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
38
|
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '5.
|
40
|
+
version: '5.2'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: puma
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,42 +184,42 @@ dependencies:
|
|
190
184
|
requirements:
|
191
185
|
- - "~>"
|
192
186
|
- !ruby/object:Gem::Version
|
193
|
-
version: '0.
|
187
|
+
version: '0.9'
|
194
188
|
type: :development
|
195
189
|
prerelease: false
|
196
190
|
version_requirements: !ruby/object:Gem::Requirement
|
197
191
|
requirements:
|
198
192
|
- - "~>"
|
199
193
|
- !ruby/object:Gem::Version
|
200
|
-
version: '0.
|
194
|
+
version: '0.9'
|
201
195
|
- !ruby/object:Gem::Dependency
|
202
196
|
name: chromedriver-helper
|
203
197
|
requirement: !ruby/object:Gem::Requirement
|
204
198
|
requirements:
|
205
199
|
- - "~>"
|
206
200
|
- !ruby/object:Gem::Version
|
207
|
-
version: '1.
|
201
|
+
version: '1.2'
|
208
202
|
type: :development
|
209
203
|
prerelease: false
|
210
204
|
version_requirements: !ruby/object:Gem::Requirement
|
211
205
|
requirements:
|
212
206
|
- - "~>"
|
213
207
|
- !ruby/object:Gem::Version
|
214
|
-
version: '1.
|
208
|
+
version: '1.2'
|
215
209
|
- !ruby/object:Gem::Dependency
|
216
210
|
name: selenium-webdriver
|
217
211
|
requirement: !ruby/object:Gem::Requirement
|
218
212
|
requirements:
|
219
213
|
- - "~>"
|
220
214
|
- !ruby/object:Gem::Version
|
221
|
-
version: '3.
|
215
|
+
version: '3.12'
|
222
216
|
type: :development
|
223
217
|
prerelease: false
|
224
218
|
version_requirements: !ruby/object:Gem::Requirement
|
225
219
|
requirements:
|
226
220
|
- - "~>"
|
227
221
|
- !ruby/object:Gem::Version
|
228
|
-
version: '3.
|
222
|
+
version: '3.12'
|
229
223
|
- !ruby/object:Gem::Dependency
|
230
224
|
name: faker
|
231
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -260,14 +254,14 @@ dependencies:
|
|
260
254
|
requirements:
|
261
255
|
- - '='
|
262
256
|
- !ruby/object:Gem::Version
|
263
|
-
version: 0.9
|
257
|
+
version: '0.9'
|
264
258
|
type: :development
|
265
259
|
prerelease: false
|
266
260
|
version_requirements: !ruby/object:Gem::Requirement
|
267
261
|
requirements:
|
268
262
|
- - '='
|
269
263
|
- !ruby/object:Gem::Version
|
270
|
-
version: 0.9
|
264
|
+
version: '0.9'
|
271
265
|
description: |-
|
272
266
|
Auto-syncs records in client-side JS (through a Model DSL) from changes (updates/destroy) in the backend Rails server through ActionCable.
|
273
267
|
Also supports streaming newly created records to client-side JS.
|
@@ -378,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
378
372
|
version: '0'
|
379
373
|
requirements: []
|
380
374
|
rubyforge_project:
|
381
|
-
rubygems_version: 2.6
|
375
|
+
rubygems_version: 2.7.6
|
382
376
|
signing_key:
|
383
377
|
specification_version: 4
|
384
378
|
summary: Rails 5 ActionCable Live JS Objects and DOM Elements
|