cubism 0.1.0.pre12 → 0.1.0.pre13

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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +16 -0
  3. data/Appraisals~ +16 -0
  4. data/CHANGELOG.md +87 -0
  5. data/Gemfile +7 -0
  6. data/Gemfile.lock +220 -0
  7. data/Gemfile~ +9 -0
  8. data/README.md +32 -12
  9. data/README.md~ +191 -0
  10. data/app/assets/javascripts/cubism.js +141 -0
  11. data/app/assets/javascripts/cubism.min.js +2 -0
  12. data/app/assets/javascripts/cubism.min.js.map +1 -0
  13. data/app/assets/javascripts/cubism.umd.js +149 -0
  14. data/app/assets/javascripts/cubism.umd.min.js +2 -0
  15. data/app/assets/javascripts/cubism.umd.min.js.map +1 -0
  16. data/bin/rails +14 -0
  17. data/bin/standardize +4 -0
  18. data/bin/test +5 -0
  19. data/cubism.gemspec +36 -0
  20. data/cubism.gemspec~ +28 -0
  21. data/lib/cubism/engine.rb +20 -0
  22. data/lib/cubism/importmap.rb +2 -0
  23. data/lib/cubism/version.rb +1 -1
  24. data/package.json +43 -0
  25. data/package.json~ +33 -0
  26. data/rollup.config.js +77 -0
  27. data/{lib/cubism/cubicle_source_store.rb~ → rollup.config.js~} +0 -0
  28. data/test/block_container_test.rb +105 -0
  29. data/test/block_source_test.rb +102 -0
  30. data/test/broadcaster_test.rb +66 -0
  31. data/test/channels/cubism/presence_channel_test.rb +72 -0
  32. data/test/cubicle_store_test.rb +34 -0
  33. data/test/cubism_test.rb +7 -0
  34. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  35. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  36. data/test/dummy/app/controllers/application_controller.rb +2 -0
  37. data/test/dummy/app/helpers/application_helper.rb +2 -0
  38. data/test/dummy/app/jobs/application_job.rb +7 -0
  39. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  40. data/test/dummy/app/models/application_record.rb +3 -0
  41. data/test/dummy/app/models/post.rb +3 -0
  42. data/test/dummy/app/models/user.rb +3 -0
  43. data/test/dummy/config/application.rb +22 -0
  44. data/test/dummy/config/boot.rb +5 -0
  45. data/test/dummy/config/environment.rb +5 -0
  46. data/test/dummy/config/environments/development.rb +76 -0
  47. data/test/dummy/config/environments/production.rb +120 -0
  48. data/test/dummy/config/environments/test.rb +59 -0
  49. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  50. data/test/dummy/config/initializers/assets.rb +12 -0
  51. data/test/dummy/config/initializers/backtrace_silencers.rb +8 -0
  52. data/test/dummy/config/initializers/content_security_policy.rb +28 -0
  53. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  54. data/test/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  55. data/test/dummy/config/initializers/inflections.rb +16 -0
  56. data/test/dummy/config/initializers/mime_types.rb +4 -0
  57. data/test/dummy/config/initializers/permissions_policy.rb +11 -0
  58. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  59. data/test/dummy/config/puma.rb +43 -0
  60. data/test/dummy/config/routes.rb +3 -0
  61. data/test/dummy/db/migrate/20220102072929_create_posts.rb +10 -0
  62. data/test/dummy/db/migrate/20220102073003_create_users.rb +9 -0
  63. data/test/dummy/db/schema.rb +26 -0
  64. data/test/dummy/test/models/post_test.rb +7 -0
  65. data/test/dummy/test/models/user_test.rb +7 -0
  66. data/test/helpers/cubism_helper_test.rb +39 -0
  67. data/test/integration/navigation_test.rb +7 -0
  68. data/test/models/concerns/presence_test.rb +25 -0
  69. data/test/models/concerns/user_test.rb +9 -0
  70. data/test/rendering/preprocessor_test.rb +61 -0
  71. data/test/test_helper.rb +16 -0
  72. data/yarn.lock +2814 -0
  73. metadata +117 -19
  74. data/app/channels/cubism/presence_channel.rb~ +0 -61
  75. data/app/helpers/cubism_helper.rb~ +0 -36
  76. data/app/models/concerns/cubism/presence.rb~ +0 -20
  77. data/config/routes.rb +0 -2
  78. data/lib/cubism/broadcaster.rb~ +0 -37
  79. data/lib/cubism/cubicle_block_store.rb~ +0 -56
  80. data/lib/cubism/cubicle_store.rb~ +0 -141
  81. data/lib/cubism/engine.rb~ +0 -7
  82. data/lib/cubism/parser.rb~ +0 -0
  83. data/lib/cubism/preprocessor.rb~ +0 -30
  84. data/lib/cubism/version.rb~ +0 -3
  85. data/lib/cubism.rb~ +0 -18
  86. 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.pre12
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-03-01 00:00:00.000000000 Z
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.pre8
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.pre8
54
+ version: 5.0.0.pre9
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: standard
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -129,34 +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
- - config/routes.rb
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/broadcaster.rb~
148
- - lib/cubism/cubicle_block_store.rb~
149
- - lib/cubism/cubicle_source_store.rb~
150
160
  - lib/cubism/cubicle_store.rb
151
- - lib/cubism/cubicle_store.rb~
152
161
  - lib/cubism/engine.rb
153
- - lib/cubism/engine.rb~
154
- - lib/cubism/parser.rb~
162
+ - lib/cubism/importmap.rb
155
163
  - lib/cubism/preprocessor.rb
156
- - lib/cubism/preprocessor.rb~
157
164
  - lib/cubism/version.rb
158
- - lib/cubism/version.rb~
159
- - lib/tasks/cubism_tasks.rake
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
160
214
  homepage: https://github.com/julianrubisch/cubism
161
215
  licenses:
162
216
  - MIT
@@ -182,4 +236,48 @@ rubygems_version: 3.1.4
182
236
  signing_key:
183
237
  specification_version: 4
184
238
  summary: Lightweight Resource-Based Presence Solution with CableReady
185
- 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,61 +0,0 @@
1
- class Cubism::PresenceChannel < ActionCable::Channel::Base
2
- include CableReady::StreamIdentifier
3
-
4
- def subscribed
5
- if resource.present?
6
- stream_from 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.set_present_users_for_scope(resource.present_users_for_scope(scope).add(user.id), scope)
24
- end
25
-
26
- def disappear
27
- resource.set_present_users_for_scope(resource.present_users_for_scope(scope).delete(user.id), scope)
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
- block_container.user
39
- end
40
-
41
- def scope
42
- block_container.scope
43
- end
44
-
45
- def block_container
46
- Cubism.block_store[element_id]
47
- end
48
-
49
- def exclude_current_user?
50
- params[:exclude_current_user]
51
- end
52
-
53
- def element_id
54
- /cubicle-(?<element_id>.+)/ =~ params[:element_id]
55
- element_id
56
- end
57
-
58
- def url
59
- params[:url]
60
- end
61
- end
@@ -1,36 +0,0 @@
1
- module CubismHelper
2
- include CableReady::StreamIdentifier
3
-
4
- def cubicle_for(resource, user, scope: "", html_options: {}, appear_trigger: :connect, disappear_trigger: nil, trigger_root: nil, exclude_current_user: true, &block)
5
- block_location = block.source_location.join(":")
6
- block_source = Cubism::BlockSource.find_or_create(
7
- location: block_location,
8
- view_context: self
9
- )
10
-
11
- resource_gid = resource.to_gid.to_s
12
-
13
- block_container = Cubism::BlockContainer.new(
14
- block_location: block_location,
15
- block_source: block_source,
16
- resource_gid: resource_gid,
17
- user_gid: user.to_gid.to_s,
18
- scope: scope
19
- )
20
-
21
- digested_block_key = block_container.digest
22
-
23
- Cubism.block_store.fetch(digested_block_key, block_container)
24
-
25
- tag.cubicle_element(
26
- identifier: signed_stream_identifier(resource_gid),
27
- "appear-trigger": Array(appear_trigger).join(","),
28
- "disappear-trigger": disappear_trigger,
29
- "trigger-root": trigger_root,
30
- scope: scope,
31
- id: "cubicle-#{digested_block_key}",
32
- "exclude-current-user": exclude_current_user,
33
- **html_options
34
- )
35
- end
36
- end
@@ -1,20 +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
-
14
- def present_users_for_element_id(element_id)
15
- users = Cubism.user_class.find(present_users.members)
16
- users.reject! { |user| user.id == excluded_user_id_for_element_id[element_id].to_i }
17
-
18
- users
19
- end
20
- end
data/config/routes.rb DELETED
@@ -1,2 +0,0 @@
1
- Rails.application.routes.draw do
2
- end
@@ -1,37 +0,0 @@
1
- require "cable_ready"
2
-
3
- module Cubism
4
- class Broadcaster
5
- include CableReady::Broadcaster
6
- include CableReady::StreamIdentifier
7
-
8
- attr_reader :resource
9
-
10
- def initialize(resource:)
11
- @resource = resource
12
- end
13
-
14
- def broadcast
15
- resource.cubicle_element_ids.to_a.each do |element_id|
16
- block_container = Cubism.block_store[element_id]
17
-
18
- next if block_container.blank?
19
-
20
- present_users = resource.present_users_for_element_id_and_scope(element_id, block_container.scope)
21
-
22
- block_source = block_container.block_source
23
-
24
- html = ApplicationController.render(inline: block_source.source, locals: {"#{block_source.variable_name}": present_users})
25
-
26
- selector = "cubicle-element#cubicle-#{element_id}[identifier='#{signed_stream_identifier(resource.to_global_id.to_s)}'][scope='#{block_container.scope}']"
27
-
28
- cable_ready[element_id].inner_html(
29
- selector: selector,
30
- html: html
31
- )
32
- end
33
-
34
- cable_ready.broadcast
35
- end
36
- end
37
- 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,141 +0,0 @@
1
- module Cubism
2
- class CubicleStore
3
- delegate_missing_to :@blocks
4
-
5
- def initialize(key)
6
- @blocks = Kredis.hash key
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 fetch(key, value = nil, &block)
20
- if self[key].nil?
21
- yield value if block
22
- self[key] = value
23
- end
24
-
25
- self[key]
26
- end
27
-
28
- def clear
29
- mutex.synchronize do
30
- # kredis #remove
31
- @blocks.remove
32
- end
33
- end
34
-
35
- def size
36
- @blocks.to_h.size
37
- end
38
-
39
- private
40
-
41
- def mutex
42
- @mutex ||= Mutex.new
43
- end
44
- end
45
-
46
- # Container for cubicle blocks
47
- BlockContainer = Struct.new(
48
- :block_location,
49
- :block_source,
50
- :user_gid,
51
- :resource_gid,
52
- :scope,
53
- keyword_init: true
54
- ) do
55
- def initialize(*args)
56
- super
57
-
58
- @filename, _lineno = block_location.split(":")
59
- end
60
-
61
- def user
62
- GlobalID::Locator.locate self[:user_gid]
63
- end
64
-
65
- def resource
66
- GlobalID::Locator.locate self[:resource_gid]
67
- end
68
-
69
- def scope
70
- self[:scope] || ""
71
- end
72
-
73
- def digest
74
- resource_user_key = [resource_gid, user_gid].join(":")
75
-
76
- ActiveSupport::Digest.hexdigest("#{block_location}:#{File.read(@filename)}:#{resource_user_key}")
77
- end
78
-
79
- def marshal_dump
80
- to_h.merge(block_source: block_source.digest)
81
- end
82
-
83
- def marshal_load(serialized_item)
84
- members.excluding(:block_source).each do |arg|
85
- send("#{arg}=", serialized_item[arg])
86
- end
87
-
88
- self.block_source = Cubism.source_store[serialized_item[:block_source]]
89
- end
90
- end
91
-
92
- # Container for cubicle block sources
93
- BlockSource = Struct.new(
94
- :location,
95
- :source,
96
- :variable_name,
97
- :view_context,
98
- keyword_init: true
99
- ) do
100
- def self.find_or_create(location:, view_context:)
101
- instance = new(location: location, view_context: view_context)
102
-
103
- Cubism.source_store.fetch(instance.digest, instance) do |instance|
104
- instance.parse!
105
- end
106
-
107
- instance
108
- end
109
-
110
- def initialize(*args)
111
- super
112
-
113
- @filename, @lineno = location.split(":")
114
- @lineno = @lineno.to_i
115
- end
116
-
117
- def parse!
118
- return if location.start_with?("inline template")
119
-
120
- lines = File.readlines(@filename)[@lineno - 1..]
121
-
122
- preprocessor = Cubism::Preprocessor.new(source: lines.join.squish, view_context: view_context)
123
- self.variable_name = preprocessor.block_variable_name
124
- self.source = preprocessor.process
125
- end
126
-
127
- def digest
128
- ActiveSupport::Digest.hexdigest("#{location}:#{File.read(@filename)}")
129
- end
130
-
131
- def marshal_dump
132
- to_h.except(:view_context)
133
- end
134
-
135
- def marshal_load(serialized_item)
136
- members.excluding(:view_context).each do |arg|
137
- send("#{arg}=", serialized_item[arg])
138
- end
139
- end
140
- end
141
- end
@@ -1,7 +0,0 @@
1
- module Cubism
2
- class Engine < ::Rails::Engine
3
- initializer "cubism.block_store" do
4
- Cubism.block_store = Cubism::CubicleBlockStore.new
5
- end
6
- end
7
- end
File without changes
@@ -1,30 +0,0 @@
1
- module Cubism
2
- class Preprocessor
3
- def initialize(source:, view_context:)
4
- match_data = /<%=\s+cubicle_for.+\|.+\|\s+%>/.match(source)
5
- start_pos = match_data&.end(0) || 0
6
- @source = source[start_pos..]
7
- @view_context = view_context
8
- end
9
-
10
- def process
11
- begin
12
- do_parse
13
- rescue NameError
14
- # we ignore any name errors from unset instance variables or local assigns here
15
- end
16
-
17
- @source
18
- end
19
-
20
- private
21
-
22
- def do_parse
23
- ActionView::Template::Handlers::ERB::Erubi.new(@source).evaluate(@view_context)
24
- rescue SyntaxError
25
- end_at_end = /(<%\s+end\s+%>)\z/.match(@source)
26
- @source = end_at_end ? @source[..-(end_at_end[0].length + 1)] : @source[..-2]
27
- do_parse
28
- end
29
- end
30
- end
@@ -1,3 +0,0 @@
1
- module Cubism
2
- VERSION = "0.1.0.pre11"
3
- end
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_accessor :block_store, instance_reader: false
18
- end
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :cubism do
3
- # # Task goes here
4
- # end