cubism 0.1.0.pre10 → 0.1.0.pre13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +16 -0
- data/Appraisals~ +16 -0
- data/CHANGELOG.md +87 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +220 -0
- data/Gemfile~ +9 -0
- data/README.md +35 -14
- data/README.md~ +191 -0
- data/app/assets/javascripts/cubism.js +141 -0
- data/app/assets/javascripts/cubism.min.js +2 -0
- data/app/assets/javascripts/cubism.min.js.map +1 -0
- data/app/assets/javascripts/cubism.umd.js +149 -0
- data/app/assets/javascripts/cubism.umd.min.js +2 -0
- data/app/assets/javascripts/cubism.umd.min.js.map +1 -0
- data/app/channels/cubism/presence_channel.rb +14 -5
- data/app/helpers/cubism_helper.rb +15 -17
- data/app/models/concerns/cubism/presence.rb +11 -3
- data/bin/rails +14 -0
- data/bin/standardize +4 -0
- data/bin/test +5 -0
- data/cubism.gemspec +36 -0
- data/cubism.gemspec~ +28 -0
- data/lib/cubism/broadcaster.rb +13 -6
- data/lib/cubism/cubicle_store.rb +141 -0
- data/lib/cubism/engine.rb +23 -2
- data/lib/cubism/importmap.rb +2 -0
- data/lib/cubism/preprocessor.rb +4 -1
- data/lib/cubism/version.rb +1 -1
- data/lib/cubism.rb +3 -2
- data/package.json +43 -0
- data/package.json~ +33 -0
- data/rollup.config.js +77 -0
- data/{lib/cubism/parser.rb~ → rollup.config.js~} +0 -0
- data/test/block_container_test.rb +105 -0
- data/test/block_source_test.rb +102 -0
- data/test/broadcaster_test.rb +66 -0
- data/test/channels/cubism/presence_channel_test.rb +72 -0
- data/test/cubicle_store_test.rb +34 -0
- data/test/cubism_test.rb +7 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +7 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/post.rb +3 -0
- data/test/dummy/app/models/user.rb +3 -0
- data/test/dummy/config/application.rb +22 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +76 -0
- data/test/dummy/config/environments/production.rb +120 -0
- data/test/dummy/config/environments/test.rb +59 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +12 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +8 -0
- data/test/dummy/config/initializers/content_security_policy.rb +28 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/permissions_policy.rb +11 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/puma.rb +43 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/db/migrate/20220102072929_create_posts.rb +10 -0
- data/test/dummy/db/migrate/20220102073003_create_users.rb +9 -0
- data/test/dummy/db/schema.rb +26 -0
- data/test/dummy/test/models/post_test.rb +7 -0
- data/test/dummy/test/models/user_test.rb +7 -0
- data/test/helpers/cubism_helper_test.rb +39 -0
- data/test/integration/navigation_test.rb +7 -0
- data/test/models/concerns/presence_test.rb +25 -0
- data/test/models/concerns/user_test.rb +9 -0
- data/test/rendering/preprocessor_test.rb +61 -0
- data/test/test_helper.rb +16 -0
- data/yarn.lock +2814 -0
- metadata +118 -18
- data/app/channels/cubism/presence_channel.rb~ +0 -52
- data/app/helpers/cubism_helper.rb~ +0 -34
- data/app/models/concerns/cubism/presence.rb~ +0 -13
- data/config/routes.rb +0 -2
- data/lib/cubism/broadcaster.rb~ +0 -50
- data/lib/cubism/cubicle_block_store.rb +0 -56
- data/lib/cubism/cubicle_block_store.rb~ +0 -43
- data/lib/cubism/engine.rb~ +0 -4
- data/lib/cubism/preprocessor.rb~ +0 -26
- data/lib/cubism/version.rb~ +0 -3
- data/lib/cubism.rb~ +0 -18
- data/lib/tasks/cubism_tasks.rake +0 -4
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cubism
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Rubisch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 5.0.0.
|
47
|
+
version: 5.0.0.pre9
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 5.0.0.
|
54
|
+
version: 5.0.0.pre9
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: standard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,32 +129,88 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- Appraisals
|
133
|
+
- Appraisals~
|
134
|
+
- CHANGELOG.md
|
135
|
+
- Gemfile
|
136
|
+
- Gemfile.lock
|
137
|
+
- Gemfile~
|
132
138
|
- MIT-LICENSE
|
133
139
|
- README.md
|
140
|
+
- README.md~
|
134
141
|
- Rakefile
|
142
|
+
- app/assets/javascripts/cubism.js
|
143
|
+
- app/assets/javascripts/cubism.min.js
|
144
|
+
- app/assets/javascripts/cubism.min.js.map
|
145
|
+
- app/assets/javascripts/cubism.umd.js
|
146
|
+
- app/assets/javascripts/cubism.umd.min.js
|
147
|
+
- app/assets/javascripts/cubism.umd.min.js.map
|
135
148
|
- app/channels/cubism/presence_channel.rb
|
136
|
-
- app/channels/cubism/presence_channel.rb~
|
137
149
|
- app/helpers/cubism_helper.rb
|
138
|
-
- app/helpers/cubism_helper.rb~
|
139
150
|
- app/models/concerns/cubism/presence.rb
|
140
|
-
- app/models/concerns/cubism/presence.rb~
|
141
151
|
- app/models/concerns/cubism/user.rb
|
142
152
|
- app/models/cubism/current.rb
|
143
|
-
-
|
153
|
+
- bin/rails
|
154
|
+
- bin/standardize
|
155
|
+
- bin/test
|
156
|
+
- cubism.gemspec
|
157
|
+
- cubism.gemspec~
|
144
158
|
- lib/cubism.rb
|
145
|
-
- lib/cubism.rb~
|
146
159
|
- lib/cubism/broadcaster.rb
|
147
|
-
- lib/cubism/
|
148
|
-
- lib/cubism/cubicle_block_store.rb
|
149
|
-
- lib/cubism/cubicle_block_store.rb~
|
160
|
+
- lib/cubism/cubicle_store.rb
|
150
161
|
- lib/cubism/engine.rb
|
151
|
-
- lib/cubism/
|
152
|
-
- lib/cubism/parser.rb~
|
162
|
+
- lib/cubism/importmap.rb
|
153
163
|
- lib/cubism/preprocessor.rb
|
154
|
-
- lib/cubism/preprocessor.rb~
|
155
164
|
- lib/cubism/version.rb
|
156
|
-
-
|
157
|
-
-
|
165
|
+
- package.json
|
166
|
+
- package.json~
|
167
|
+
- rollup.config.js
|
168
|
+
- rollup.config.js~
|
169
|
+
- test/block_container_test.rb
|
170
|
+
- test/block_source_test.rb
|
171
|
+
- test/broadcaster_test.rb
|
172
|
+
- test/channels/cubism/presence_channel_test.rb
|
173
|
+
- test/cubicle_store_test.rb
|
174
|
+
- test/cubism_test.rb
|
175
|
+
- test/dummy/app/channels/application_cable/channel.rb
|
176
|
+
- test/dummy/app/channels/application_cable/connection.rb
|
177
|
+
- test/dummy/app/controllers/application_controller.rb
|
178
|
+
- test/dummy/app/helpers/application_helper.rb
|
179
|
+
- test/dummy/app/jobs/application_job.rb
|
180
|
+
- test/dummy/app/mailers/application_mailer.rb
|
181
|
+
- test/dummy/app/models/application_record.rb
|
182
|
+
- test/dummy/app/models/post.rb
|
183
|
+
- test/dummy/app/models/user.rb
|
184
|
+
- test/dummy/config/application.rb
|
185
|
+
- test/dummy/config/boot.rb
|
186
|
+
- test/dummy/config/environment.rb
|
187
|
+
- test/dummy/config/environments/development.rb
|
188
|
+
- test/dummy/config/environments/production.rb
|
189
|
+
- test/dummy/config/environments/test.rb
|
190
|
+
- test/dummy/config/initializers/application_controller_renderer.rb
|
191
|
+
- test/dummy/config/initializers/assets.rb
|
192
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
193
|
+
- test/dummy/config/initializers/content_security_policy.rb
|
194
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
195
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
196
|
+
- test/dummy/config/initializers/inflections.rb
|
197
|
+
- test/dummy/config/initializers/mime_types.rb
|
198
|
+
- test/dummy/config/initializers/permissions_policy.rb
|
199
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
200
|
+
- test/dummy/config/puma.rb
|
201
|
+
- test/dummy/config/routes.rb
|
202
|
+
- test/dummy/db/migrate/20220102072929_create_posts.rb
|
203
|
+
- test/dummy/db/migrate/20220102073003_create_users.rb
|
204
|
+
- test/dummy/db/schema.rb
|
205
|
+
- test/dummy/test/models/post_test.rb
|
206
|
+
- test/dummy/test/models/user_test.rb
|
207
|
+
- test/helpers/cubism_helper_test.rb
|
208
|
+
- test/integration/navigation_test.rb
|
209
|
+
- test/models/concerns/presence_test.rb
|
210
|
+
- test/models/concerns/user_test.rb
|
211
|
+
- test/rendering/preprocessor_test.rb
|
212
|
+
- test/test_helper.rb
|
213
|
+
- yarn.lock
|
158
214
|
homepage: https://github.com/julianrubisch/cubism
|
159
215
|
licenses:
|
160
216
|
- MIT
|
@@ -180,4 +236,48 @@ rubygems_version: 3.1.4
|
|
180
236
|
signing_key:
|
181
237
|
specification_version: 4
|
182
238
|
summary: Lightweight Resource-Based Presence Solution with CableReady
|
183
|
-
test_files:
|
239
|
+
test_files:
|
240
|
+
- test/dummy/app/mailers/application_mailer.rb
|
241
|
+
- test/dummy/app/models/application_record.rb
|
242
|
+
- test/dummy/app/models/post.rb
|
243
|
+
- test/dummy/app/models/user.rb
|
244
|
+
- test/dummy/app/jobs/application_job.rb
|
245
|
+
- test/dummy/app/controllers/application_controller.rb
|
246
|
+
- test/dummy/app/helpers/application_helper.rb
|
247
|
+
- test/dummy/app/channels/application_cable/connection.rb
|
248
|
+
- test/dummy/app/channels/application_cable/channel.rb
|
249
|
+
- test/dummy/test/models/post_test.rb
|
250
|
+
- test/dummy/test/models/user_test.rb
|
251
|
+
- test/dummy/config/routes.rb
|
252
|
+
- test/dummy/config/environments/production.rb
|
253
|
+
- test/dummy/config/environments/development.rb
|
254
|
+
- test/dummy/config/environments/test.rb
|
255
|
+
- test/dummy/config/environment.rb
|
256
|
+
- test/dummy/config/application.rb
|
257
|
+
- test/dummy/config/puma.rb
|
258
|
+
- test/dummy/config/boot.rb
|
259
|
+
- test/dummy/config/initializers/application_controller_renderer.rb
|
260
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
261
|
+
- test/dummy/config/initializers/mime_types.rb
|
262
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
263
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
264
|
+
- test/dummy/config/initializers/assets.rb
|
265
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
266
|
+
- test/dummy/config/initializers/permissions_policy.rb
|
267
|
+
- test/dummy/config/initializers/content_security_policy.rb
|
268
|
+
- test/dummy/config/initializers/inflections.rb
|
269
|
+
- test/dummy/db/schema.rb
|
270
|
+
- test/dummy/db/migrate/20220102072929_create_posts.rb
|
271
|
+
- test/dummy/db/migrate/20220102073003_create_users.rb
|
272
|
+
- test/integration/navigation_test.rb
|
273
|
+
- test/broadcaster_test.rb
|
274
|
+
- test/cubicle_store_test.rb
|
275
|
+
- test/models/concerns/presence_test.rb
|
276
|
+
- test/models/concerns/user_test.rb
|
277
|
+
- test/block_container_test.rb
|
278
|
+
- test/cubism_test.rb
|
279
|
+
- test/rendering/preprocessor_test.rb
|
280
|
+
- test/test_helper.rb
|
281
|
+
- test/helpers/cubism_helper_test.rb
|
282
|
+
- test/block_source_test.rb
|
283
|
+
- test/channels/cubism/presence_channel_test.rb
|
@@ -1,52 +0,0 @@
|
|
1
|
-
class Cubism::PresenceChannel < ActionCable::Channel::Base
|
2
|
-
include CableReady::StreamIdentifier
|
3
|
-
|
4
|
-
def subscribed
|
5
|
-
if resource.present?
|
6
|
-
stream_from params[:element_id]
|
7
|
-
resource.cubicle_element_ids << element_id
|
8
|
-
resource.excluded_user_id_for_element_id[element_id] = user.id if exclude_current_user?
|
9
|
-
else
|
10
|
-
reject
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def unsubscribed
|
15
|
-
return unless resource.present?
|
16
|
-
|
17
|
-
resource.cubicle_element_ids.remove(element_id)
|
18
|
-
resource.excluded_user_id_for_element_id.delete(element_id)
|
19
|
-
disappear
|
20
|
-
end
|
21
|
-
|
22
|
-
def appear
|
23
|
-
resource.present_users.add(user.id)
|
24
|
-
end
|
25
|
-
|
26
|
-
def disappear
|
27
|
-
resource.present_users.remove(user.id)
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def resource
|
33
|
-
locator = verified_stream_identifier(params[:identifier])
|
34
|
-
GlobalID::Locator.locate(locator)
|
35
|
-
end
|
36
|
-
|
37
|
-
def user
|
38
|
-
GlobalID::Locator.locate_signed(params[:user])
|
39
|
-
end
|
40
|
-
|
41
|
-
def exclude_current_user?
|
42
|
-
params[:exclude_current_user]
|
43
|
-
end
|
44
|
-
|
45
|
-
def element_id
|
46
|
-
params[:element_id]
|
47
|
-
end
|
48
|
-
|
49
|
-
def url
|
50
|
-
params[:url]
|
51
|
-
end
|
52
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module CubismHelper
|
2
|
-
include CableReady::StreamIdentifier
|
3
|
-
|
4
|
-
def cubicle_for(resource, user, html_options: {}, appear_trigger: :connect, disappear_trigger: nil, trigger_root: nil, exclude_current_user: true, &block)
|
5
|
-
filename, lineno = block.source_location
|
6
|
-
block_location = block.source_location.join(":")
|
7
|
-
resource_user_key = "#{resource.to_gid}:#{user.to_gid}"
|
8
|
-
digested_block_key = ActiveSupport::Digest.hexdigest("#{block_location}:#{resource_user_key}")
|
9
|
-
|
10
|
-
Cubism.store[digested_block_key] = Cubism::BlockStoreItem.new(
|
11
|
-
block_location: block_location,
|
12
|
-
resource_gid: resource.to_gid.to_s,
|
13
|
-
user_gid: user.to_gid.to_s
|
14
|
-
)
|
15
|
-
|
16
|
-
if Cubism.store[block_location].blank? && !block_location.start_with?("inline template")
|
17
|
-
lines = File.readlines(filename)[lineno - 1..]
|
18
|
-
|
19
|
-
preprocessor = Cubism::Preprocessor.new(source: lines.join.squish, view_context: self)
|
20
|
-
Cubism.store[block_location] = preprocessor.process
|
21
|
-
end
|
22
|
-
|
23
|
-
tag.cubicle_element(
|
24
|
-
identifier: signed_stream_identifier(resource.to_gid.to_s),
|
25
|
-
user: user.to_sgid.to_s,
|
26
|
-
"appear-trigger": Array(appear_trigger).join(","),
|
27
|
-
"disappear-trigger": disappear_trigger,
|
28
|
-
"trigger-root": trigger_root,
|
29
|
-
id: "cubicle-#{digested_block_key}",
|
30
|
-
"exclude-current-user": exclude_current_user,
|
31
|
-
**html_options
|
32
|
-
)
|
33
|
-
end
|
34
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Cubism::Presence
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
included do
|
5
|
-
kredis_set :present_users, after_change: :stream_presence
|
6
|
-
kredis_set :cubicle_element_ids
|
7
|
-
kredis_hash :excluded_user_id_for_element_id
|
8
|
-
end
|
9
|
-
|
10
|
-
def stream_presence
|
11
|
-
Cubism::Broadcaster.new(resource: self).broadcast
|
12
|
-
end
|
13
|
-
end
|
data/config/routes.rb
DELETED
data/lib/cubism/broadcaster.rb~
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require "cable_ready"
|
2
|
-
require "parser/current"
|
3
|
-
|
4
|
-
module Cubism
|
5
|
-
class Broadcaster
|
6
|
-
include CableReady::Broadcaster
|
7
|
-
include CableReady::StreamIdentifier
|
8
|
-
include ActionView::Helpers
|
9
|
-
|
10
|
-
attr_reader :resource
|
11
|
-
|
12
|
-
def initialize(resource:)
|
13
|
-
@resource = resource
|
14
|
-
end
|
15
|
-
|
16
|
-
def broadcast
|
17
|
-
resource.cubicle_element_ids.to_a.each do |element_id|
|
18
|
-
/cubicle-(?<block_key>.+)/ =~ element_id
|
19
|
-
block_store_item = Cubism.store[block_key]
|
20
|
-
|
21
|
-
next if block_store_item.blank?
|
22
|
-
|
23
|
-
block_source = Cubism.store[block_store_item.block_location]
|
24
|
-
erubi = ActionView::Template::Handlers::ERB::Erubi.new(block_source)
|
25
|
-
ast = Parser::CurrentRuby.parse erubi.src
|
26
|
-
|
27
|
-
# html = ApplicationController.render(inline: block_source, locals: {current_user: block_store_item.user, "@project": block_store_item.resource, users: resource.present_users_for_element_id(element_id)})
|
28
|
-
|
29
|
-
# binding.pry
|
30
|
-
|
31
|
-
# context = ActionView::Base.with_view_paths(ActionController::Base.view_paths)
|
32
|
-
# erubi = ActionView::Template::Handlers::ERB::Erubi.new(File.read(filename), filename: filename)
|
33
|
-
# context = ApplicationController.new.view_context
|
34
|
-
|
35
|
-
# filename, lineno = block_store_item.block_location.split
|
36
|
-
|
37
|
-
# binding.pry
|
38
|
-
|
39
|
-
# block = Cubism.store[block_key].block
|
40
|
-
# view_context = Cubism.store[block_key].context
|
41
|
-
# html = view_context.capture(resource.present_users_for_element_id(element_id), &block)
|
42
|
-
|
43
|
-
cable_ready[element_id].inner_html(
|
44
|
-
selector: "cubicle-element##{element_id}[identifier='#{signed_stream_identifier(resource.to_global_id.to_s)}']",
|
45
|
-
html: "#{resource.present_users_for_element_id(element_id).map(&:id)}"
|
46
|
-
).broadcast
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module Cubism
|
2
|
-
class CubicleBlockStore
|
3
|
-
delegate_missing_to :@blocks
|
4
|
-
|
5
|
-
def initialize
|
6
|
-
@blocks = Kredis.hash "cubism-blocks"
|
7
|
-
end
|
8
|
-
|
9
|
-
def [](key)
|
10
|
-
Marshal.load(@blocks[key]) if @blocks[key]
|
11
|
-
end
|
12
|
-
|
13
|
-
def []=(key, value)
|
14
|
-
mutex.synchronize do
|
15
|
-
@blocks[key] = Marshal.dump value
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def clear
|
20
|
-
mutex.synchronize do
|
21
|
-
# kredis #remove
|
22
|
-
@blocks.remove
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def size
|
27
|
-
@blocks.to_h.size
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def mutex
|
33
|
-
@mutex ||= Mutex.new
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
BlockStoreItem = Struct.new(:block_location, :block_source, :user_gid, :resource_gid, keyword_init: true) do
|
38
|
-
def user
|
39
|
-
GlobalID::Locator.locate self[:user_gid]
|
40
|
-
end
|
41
|
-
|
42
|
-
def resource
|
43
|
-
GlobalID::Locator.locate self[:resource_gid]
|
44
|
-
end
|
45
|
-
|
46
|
-
def marshal_dump
|
47
|
-
to_h
|
48
|
-
end
|
49
|
-
|
50
|
-
def marshal_load(serialized_item)
|
51
|
-
%i[block_location block_source user_gid resource_gid].each do |arg|
|
52
|
-
send("#{arg}=", serialized_item[arg])
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Cubism
|
2
|
-
class CubicleBlockStore
|
3
|
-
include Singleton
|
4
|
-
|
5
|
-
delegate_missing_to :@blocks
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@blocks = {}
|
9
|
-
end
|
10
|
-
|
11
|
-
def [](key)
|
12
|
-
@blocks[key]
|
13
|
-
end
|
14
|
-
|
15
|
-
def []=(key, value)
|
16
|
-
mutex.synchronize do
|
17
|
-
@blocks[key] = value
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def clear
|
22
|
-
mutex.synchronize do
|
23
|
-
@blocks.clear
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def mutex
|
30
|
-
@mutex ||= Mutex.new
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
BlockStoreItem = Struct.new(:block_location, :user_gid, :resource_gid, keyword_init: true) do
|
35
|
-
def user
|
36
|
-
GlobalID::Locator.locate self[:user_gid]
|
37
|
-
end
|
38
|
-
|
39
|
-
def resource
|
40
|
-
GlobalID::Locator.locate self[:resource_gid]
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/cubism/engine.rb~
DELETED
data/lib/cubism/preprocessor.rb~
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module Cubism
|
2
|
-
class Preprocessor
|
3
|
-
def initialize(source:, view_context:)
|
4
|
-
start_pos = /<%= cubicle_for/ =~ source
|
5
|
-
@source = source[start_pos..]
|
6
|
-
@view_context = view_context
|
7
|
-
end
|
8
|
-
|
9
|
-
def process
|
10
|
-
begin
|
11
|
-
do_parse
|
12
|
-
rescue NameError
|
13
|
-
# we ignore any name errors from unset instance variables or local assigns here
|
14
|
-
end
|
15
|
-
|
16
|
-
@source
|
17
|
-
end
|
18
|
-
|
19
|
-
def do_parse
|
20
|
-
ActionView::Template::Handlers::ERB::Erubi.new(@source).evaluate(@view_context)
|
21
|
-
rescue SyntaxError
|
22
|
-
@source = @source[..-2]
|
23
|
-
do_parse
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/lib/cubism/version.rb~
DELETED
data/lib/cubism.rb~
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require "kredis"
|
2
|
-
|
3
|
-
require "cubism/version"
|
4
|
-
require "cubism/engine"
|
5
|
-
require "cubism/broadcaster"
|
6
|
-
require "cubism/cubicle_block_store"
|
7
|
-
require "cubism/preprocessor"
|
8
|
-
|
9
|
-
module Cubism
|
10
|
-
extend ActiveSupport::Autoload
|
11
|
-
|
12
|
-
autoload :Broadcaster, "cubism/broadcaster"
|
13
|
-
autoload :Preprocessor, "cubism/preprocessor"
|
14
|
-
|
15
|
-
mattr_accessor :user_class, instance_writer: false, instance_reader: false
|
16
|
-
|
17
|
-
mattr_reader :store, instance_reader: false, default: Cubism::CubicleBlockStore.instance
|
18
|
-
end
|
data/lib/tasks/cubism_tasks.rake
DELETED