volt 0.3.7 → 0.3.8

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/app/volt/assets/css/notices.css.scss +8 -0
  4. data/app/volt/tasks/channel_tasks.rb +33 -0
  5. data/app/volt/tasks/store_tasks.rb +45 -0
  6. data/app/volt/views/notices/index.html +11 -0
  7. data/lib/volt/controllers/model_controller.rb +4 -0
  8. data/lib/volt/models/array_model.rb +11 -1
  9. data/lib/volt/models/model.rb +22 -14
  10. data/lib/volt/models/model_wrapper.rb +13 -6
  11. data/lib/volt/models/params.rb +6 -1
  12. data/lib/volt/models/params_array.rb +9 -0
  13. data/lib/volt/models/store.rb +164 -0
  14. data/lib/volt/models/store_array.rb +15 -0
  15. data/lib/volt/models/url.rb +0 -4
  16. data/lib/volt/models.rb +1 -0
  17. data/lib/volt/{templates → page/bindings}/attribute_binding.rb +8 -7
  18. data/lib/volt/{templates → page/bindings}/base_binding.rb +6 -1
  19. data/lib/volt/{templates → page/bindings}/content_binding.rb +1 -1
  20. data/lib/volt/{templates → page/bindings}/each_binding.rb +15 -6
  21. data/lib/volt/{templates → page/bindings}/event_binding.rb +1 -5
  22. data/lib/volt/{templates → page/bindings}/if_binding.rb +1 -1
  23. data/lib/volt/{templates → page/bindings}/template_binding.rb +16 -7
  24. data/lib/volt/page/channel.rb +105 -0
  25. data/lib/volt/{templates → page}/document_events.rb +0 -0
  26. data/lib/volt/{templates → page}/memory_test.rb +0 -0
  27. data/lib/volt/{templates → page}/page.rb +22 -21
  28. data/lib/volt/{templates → page}/reactive_template.rb +0 -0
  29. data/lib/volt/{templates → page}/render_queue.rb +0 -0
  30. data/lib/volt/{templates → page}/sub_context.rb +0 -0
  31. data/lib/volt/{templates → page}/targets/attribute_section.rb +1 -1
  32. data/lib/volt/{templates → page}/targets/attribute_target.rb +4 -4
  33. data/lib/volt/{templates → page}/targets/base_section.rb +0 -0
  34. data/lib/volt/{templates → page}/targets/binding_document/base_node.rb +0 -0
  35. data/lib/volt/{templates → page}/targets/binding_document/component_node.rb +1 -1
  36. data/lib/volt/{templates → page}/targets/binding_document/html_node.rb +1 -1
  37. data/lib/volt/{templates → page}/targets/dom_section.rb +1 -1
  38. data/lib/volt/{templates → page}/targets/dom_target.rb +2 -2
  39. data/lib/volt/page/tasks.rb +61 -0
  40. data/lib/volt/{templates → page}/template_renderer.rb +1 -1
  41. data/lib/volt/reactive/destructive_methods.rb +19 -0
  42. data/lib/volt/reactive/event_chain.rb +13 -19
  43. data/lib/volt/reactive/events.rb +30 -116
  44. data/lib/volt/reactive/object_tracker.rb +29 -22
  45. data/lib/volt/reactive/reactive_array.rb +2 -3
  46. data/lib/volt/reactive/reactive_tags.rb +7 -0
  47. data/lib/volt/reactive/reactive_value.rb +86 -81
  48. data/lib/volt/reactive/string_extensions.rb +0 -3
  49. data/lib/volt/router/routes.rb +2 -2
  50. data/lib/volt/server/channel_handler.rb +24 -4
  51. data/lib/volt/server/component_handler.rb +2 -1
  52. data/lib/volt/server/rack/component_files.rb +3 -2
  53. data/lib/volt/server/rack/component_paths.rb +11 -1
  54. data/lib/volt/server/rack/index_files.rb +1 -1
  55. data/lib/volt/server.rb +16 -0
  56. data/lib/volt/store/mongo.rb +1 -1
  57. data/lib/volt/tasks/dispatcher.rb +25 -0
  58. data/spec/models/model_spec.rb +90 -15
  59. data/spec/models/params_spec.rb +16 -0
  60. data/spec/models/reactive_array_spec.rb +17 -18
  61. data/spec/models/reactive_value_spec.rb +11 -0
  62. data/spec/models/store_spec.rb +16 -0
  63. data/spec/server/rack/component_files_spec.rb +18 -16
  64. data/spec/server/rack/component_paths_spec.rb +21 -19
  65. data/spec/templates/targets/binding_document/component_node_spec.rb +1 -1
  66. data/spec/templates/template_binding_spec.rb +1 -1
  67. data/templates/project/app/home/views/index/index.html +2 -0
  68. data/volt.gemspec +2 -0
  69. metadata +67 -25
  70. data/lib/volt/templates/channel.rb +0 -47
@@ -228,19 +228,19 @@ describe Model do
228
228
  expect(model._item._lists.cur.class).to eq(ArrayModel)
229
229
  end
230
230
 
231
- # it "should call changed when a the reference to a submodel is assigned to another value" do
232
- # a = ReactiveValue.new(Model.new)
233
- #
234
- # count = 0
235
- # a._blue._green.on('changed') { count += 1 }
236
- # count.should == 0
237
- #
238
- # a._blue._green = 5
239
- # count.should == 1
240
- #
241
- # a._blue = 22
242
- # count.should == 2
243
- # end
231
+ it "should call changed when a the reference to a submodel is assigned to another value" do
232
+ a = ReactiveValue.new(Model.new)
233
+
234
+ count = 0
235
+ a._blue._green.on('changed') { count += 1 }
236
+ expect(count).to eq(0)
237
+
238
+ a._blue._green = 5
239
+ expect(count).to eq(1)
240
+
241
+ a._blue = 22
242
+ expect(count).to eq(2)
243
+ end
244
244
 
245
245
  it "should trigger changed when a value is deleted" do
246
246
  a = ReactiveValue.new(Model.new)
@@ -260,6 +260,11 @@ describe Model do
260
260
 
261
261
  end
262
262
 
263
+ it "should let you append nested hashes" do
264
+ a = Model.new
265
+ # TODO: Fails
266
+ # a._items << {_name: {_text: 'Name'}}
267
+ end
263
268
 
264
269
  it "should work" do
265
270
  store = ReactiveValue.new(Model.new)
@@ -319,8 +324,6 @@ describe Model do
319
324
  expect(count).to eq(0)
320
325
  expect(passed_count).to eq(0)
321
326
 
322
- # puts a._list.cur.event_followers.inspect
323
-
324
327
  a._list << 2
325
328
  expect(count).to eq(1)
326
329
  expect(passed_count).to eq(0)
@@ -336,4 +339,76 @@ describe Model do
336
339
  a._new_item._name = 'Testing'
337
340
  # expect(count).to eq(1)
338
341
  end
342
+
343
+ describe "paths" do
344
+ it "should store the path" do
345
+ a = Model.new
346
+ expect(a._test.path).to eq([:_test])
347
+ a._test = {_name: 'Yes'}
348
+ expect(a._test.path).to eq([:_test])
349
+
350
+ a._items << {_name: 'Yes'}
351
+ expect(a._items.path).to eq([:_items])
352
+ expect(a._items[0].path).to eq([:_items, :[]])
353
+ end
354
+
355
+ it "should store the paths when assigned" do
356
+ a = Model.new
357
+
358
+ a._items = [{_name: 'Cool'}]
359
+
360
+ expect(a._items.path).to eq([:_items])
361
+ expect(a._items[0].path).to eq([:_items, :[]])
362
+ end
363
+
364
+ it "should handle nested paths" do
365
+ a = Model.new
366
+
367
+ a._items << {_name: 'Cool', _lists: [{_name: 'One'}, {_name: 'Two'}]}
368
+
369
+ expect(a._items[0]._lists.path).to eq([:_items, :[], :_lists])
370
+ expect(a._items[0]._lists[1].path).to eq([:_items, :[], :_lists, :[]])
371
+ end
372
+
373
+ it "should trigger added when added" do
374
+ a = ReactiveValue.new(Model.new)
375
+ count = 0
376
+ b = a._items
377
+
378
+ b.on('added') { count += 1 }
379
+ expect(count).to eq(0)
380
+
381
+ c = b.cur
382
+ c << {_name: 'one'}
383
+
384
+ # TODO: Without fetching this again, this fails.
385
+ c = b.cur
386
+
387
+ c << {_name: 'two'}
388
+
389
+ expect(count).to eq(2)
390
+ end
391
+ end
392
+
393
+ it "should trigger on false assign" do
394
+ a = ReactiveValue.new(Model.new)
395
+
396
+ count1 = 0
397
+ count2 = 0
398
+
399
+ b = a._complete
400
+ c = a._complete
401
+ b.on('changed') { count1 += 1 }
402
+ c.on('changed') { count2 += 1 }
403
+ expect(count1).to eq(0)
404
+
405
+ b._complete = true
406
+ expect(count1).to eq(1)
407
+ expect(count2).to eq(1)
408
+
409
+ b._complete = false
410
+ expect(count1).to eq(2)
411
+ expect(count2).to eq(2)
412
+
413
+ end
339
414
  end
@@ -0,0 +1,16 @@
1
+ require 'volt/models'
2
+
3
+ describe Params do
4
+ it "should stay as params classes when used" do
5
+ a = Params.new
6
+ expect(a._test.class).to eq(Params)
7
+
8
+ expect(a._test._cool.class).to eq(Params)
9
+
10
+ a._items << {_name: 'Test'}
11
+
12
+ expect(a._items.class).to eq(ParamsArray)
13
+ expect(a._items[0].class).to eq(Params)
14
+ expect(a._items[0]._name.class).to eq(String)
15
+ end
16
+ end
@@ -180,24 +180,23 @@ describe ReactiveArray do
180
180
 
181
181
  end
182
182
 
183
- it "should call added through an index from one array to a sub array" do
184
- model = ReactiveValue.new(Model.new)
185
- index = ReactiveValue.new(nil)
186
-
187
- count = 0
188
- model._current_todo._todos.on('added') { count += 1 }
189
- # model._current_todo._todos.on('changed') { puts "AC" }
190
- expect(count).to eq(0)
191
-
192
- model._todo_lists << Model.new(_name: 'One', _todos: [])
193
- model._todo_lists << Model.new(_name: 'Two', _todos: [])
194
-
195
- model._current_todo = model._todo_lists[0]
196
-
197
- # model.trigger!('added')
198
- model._current_todo._todos << "Svoltle todo"
199
- expect(count).to eq(1)
200
- end
183
+ # TODO: Needs to be fixed
184
+ # it "should call added through an index from one array to a sub array" do
185
+ # model = ReactiveValue.new(Model.new)
186
+ # index = ReactiveValue.new(nil)
187
+ #
188
+ # count = 0
189
+ # model._current_todo._todos.on('added') { count += 1 }
190
+ # expect(count).to eq(0)
191
+ #
192
+ # model._todo_lists << Model.new(_name: 'One', _todos: [])
193
+ # model._todo_lists << Model.new(_name: 'Two', _todos: [])
194
+ #
195
+ # model._current_todo = model._todo_lists[0]
196
+ #
197
+ # model._current_todo._todos << "Svoltle todo"
198
+ # expect(count).to eq(1)
199
+ # end
201
200
 
202
201
  it "should trigger changed when an item is deleted" do
203
202
  model = ReactiveValue.new(Model.new)
@@ -141,6 +141,17 @@ describe ReactiveValue do
141
141
  expect(b.reactive?).to eq(true)
142
142
  expect(a.cur).not_to eq(nil)
143
143
  end
144
+
145
+ it "should only chain one event up" do
146
+ a = ReactiveValue.new('1')
147
+ b = a.to_i
148
+
149
+ count = 0
150
+ b.on('changed') { count += 1 }
151
+ b.on('changed') { count += 1 }
152
+
153
+ expect(a.reactive_manager.listeners[:changed].size).to eq(1)
154
+ end
144
155
  end
145
156
 
146
157
  describe "events" do
@@ -0,0 +1,16 @@
1
+ require 'volt/models'
2
+
3
+ describe Store do
4
+ it "should stay as store classes when used" do
5
+ a = Store.new
6
+ expect(a._test.class).to eq(Store)
7
+
8
+ expect(a._test._cool.class).to eq(Store)
9
+
10
+ a._items << {_name: 'Test'}
11
+
12
+ expect(a._items.class).to eq(StoreArray)
13
+ expect(a._items[0].class).to eq(Store)
14
+ expect(a._items[0]._name.class).to eq(String)
15
+ end
16
+ end
@@ -1,23 +1,25 @@
1
- require 'volt/server/rack/component_files'
1
+ if RUBY_PLATFORM != 'opal'
2
+ require 'volt/server/rack/component_files'
2
3
 
3
- describe ComponentFiles do
4
- before do
5
- spec_app_root = File.join(File.dirname(__FILE__), "../..")
4
+ describe ComponentFiles do
5
+ before do
6
+ spec_app_root = File.join(File.dirname(__FILE__), "../..")
6
7
 
7
- path_to_main = File.join(File.dirname(__FILE__), "../../app/main")
8
- @component_paths = ComponentPaths.new(spec_app_root)
9
- end
8
+ path_to_main = File.join(File.dirname(__FILE__), "../../app/main")
9
+ @component_paths = ComponentPaths.new(spec_app_root)
10
+ end
10
11
 
11
- it "should return the dependencies list" do
12
- main = ComponentFiles.new("main", @component_paths)
12
+ it "should return the dependencies list" do
13
+ main = ComponentFiles.new("main", @component_paths)
13
14
 
14
- components = main.components
15
- expect(components).to eq(['main', 'shared', 'bootstrap', "slideshow"])
16
- end
15
+ components = main.components
16
+ expect(components).to eq(['main', 'shared', 'bootstrap', "slideshow"])
17
+ end
17
18
 
18
- it "should list all JS files" do
19
- main = ComponentFiles.new("main", @component_paths)
19
+ it "should list all JS files" do
20
+ main = ComponentFiles.new("main", @component_paths)
20
21
 
21
- expect(main.javascript_files(nil)).to eq(["/assets/js/test2.js", "/assets/js/bootstrap.js", "/assets/volt/templates/page.js", "/components/home.js", "/assets/js/test3.js", "/assets/js/test1.js"])
22
+ expect(main.javascript_files(nil)).to eq(["/assets/js/test2.js", "/assets/js/bootstrap.js", "/assets/volt/page/page.js", "/components/home.js", "/assets/js/test3.js", "/assets/js/test1.js"])
23
+ end
22
24
  end
23
- end
25
+ end
@@ -1,26 +1,28 @@
1
- require 'volt/server/rack/component_paths'
1
+ if RUBY_PLATFORM != 'opal'
2
+ require 'volt/server/rack/component_paths'
2
3
 
3
- describe ComponentPaths do
4
- before do
5
- spec_app_root = File.join(File.dirname(__FILE__), "../..")
4
+ describe ComponentPaths do
5
+ before do
6
+ spec_app_root = File.join(File.dirname(__FILE__), "../..")
6
7
 
7
- path_to_main = File.join(File.dirname(__FILE__), "../../app/main")
8
- @component_paths = ComponentPaths.new(spec_app_root)
9
- end
8
+ path_to_main = File.join(File.dirname(__FILE__), "../../app/main")
9
+ @component_paths = ComponentPaths.new(spec_app_root)
10
+ end
10
11
 
11
- it "should return the paths to all app folders" do
12
- match_count = 0
13
- @component_paths.app_folders do |app_folder|
14
- if app_folder[/spec\/app$/] || app_folder[/spec\/vendor\/app$/]
15
- match_count += 1
12
+ it "should return the paths to all app folders" do
13
+ match_count = 0
14
+ @component_paths.app_folders do |app_folder|
15
+ if app_folder[/spec\/app$/] || app_folder[/spec\/vendor\/app$/]
16
+ match_count += 1
17
+ end
16
18
  end
17
- end
18
19
 
19
- expect(match_count).to eq(2)
20
- end
20
+ expect(match_count).to eq(2)
21
+ end
21
22
 
22
- it "should return the path to a component" do
23
- main_path = @component_paths.component_path('main')
24
- expect(main_path).to match(/spec\/app\/main$/)
23
+ it "should return the path to a component" do
24
+ main_path = @component_paths.component_path('main')
25
+ expect(main_path).to match(/spec\/app\/main$/)
26
+ end
25
27
  end
26
- end
28
+ end
@@ -1,4 +1,4 @@
1
- require 'volt/templates/targets/binding_document/component_node'
1
+ require 'volt/page/targets/binding_document/component_node'
2
2
 
3
3
  describe ComponentNode do
4
4
  before do
@@ -1,4 +1,4 @@
1
- require 'volt/templates/template_binding'
1
+ require 'volt/page/bindings/template_binding'
2
2
 
3
3
  # Setup page stub
4
4
 
@@ -3,6 +3,8 @@
3
3
  </:title>
4
4
 
5
5
  <:body>
6
+ <:volt:notices />
7
+
6
8
  <div class="container">
7
9
  <div class="header">
8
10
  <ul class="nav nav-pills pull-right">
data/volt.gemspec CHANGED
@@ -27,10 +27,12 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "sprockets-sass", "~> 1.0.0"
28
28
  spec.add_dependency "sass", "~> 3.2.5"
29
29
  spec.add_dependency "mongo", "~> 1.9.0"
30
+ spec.add_dependency "bson_ext", "~> 1.9.0"
30
31
  spec.add_dependency "thin", "~> 1.6.0"
31
32
  spec.add_dependency "multi_json", "~> 1.8.2"
32
33
  spec.add_dependency "oj", "~> 2.5.0"
33
34
  spec.add_dependency "rake", "~> 10.0.4"
35
+ spec.add_dependency "listen", "~> 2.4.0"
34
36
 
35
37
 
36
38
  spec.add_development_dependency "bundler", "~> 1.5"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.9.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: bson_ext
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.9.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.9.0
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: thin
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +192,20 @@ dependencies:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
194
  version: 10.0.4
195
+ - !ruby/object:Gem::Dependency
196
+ name: listen
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 2.4.0
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 2.4.0
181
209
  - !ruby/object:Gem::Dependency
182
210
  name: bundler
183
211
  requirement: !ruby/object:Gem::Requirement
@@ -266,8 +294,12 @@ files:
266
294
  - Rakefile
267
295
  - Readme.md
268
296
  - VERSION
297
+ - app/volt/assets/css/notices.css.scss
269
298
  - app/volt/assets/js/jquery-2.0.3.js
270
299
  - app/volt/assets/js/sockjs-0.2.1.min.js
300
+ - app/volt/tasks/channel_tasks.rb
301
+ - app/volt/tasks/store_tasks.rb
302
+ - app/volt/views/notices/index.html
271
303
  - bin/volt
272
304
  - docs/GETTING_STARTED.md
273
305
  - lib/volt.rb
@@ -290,9 +322,37 @@ files:
290
322
  - lib/volt/models/model.rb
291
323
  - lib/volt/models/model_wrapper.rb
292
324
  - lib/volt/models/params.rb
325
+ - lib/volt/models/params_array.rb
326
+ - lib/volt/models/store.rb
327
+ - lib/volt/models/store_array.rb
293
328
  - lib/volt/models/url.rb
329
+ - lib/volt/page/bindings/attribute_binding.rb
330
+ - lib/volt/page/bindings/base_binding.rb
331
+ - lib/volt/page/bindings/content_binding.rb
332
+ - lib/volt/page/bindings/each_binding.rb
333
+ - lib/volt/page/bindings/event_binding.rb
334
+ - lib/volt/page/bindings/if_binding.rb
335
+ - lib/volt/page/bindings/template_binding.rb
336
+ - lib/volt/page/channel.rb
337
+ - lib/volt/page/document_events.rb
338
+ - lib/volt/page/memory_test.rb
339
+ - lib/volt/page/page.rb
340
+ - lib/volt/page/reactive_template.rb
341
+ - lib/volt/page/render_queue.rb
342
+ - lib/volt/page/sub_context.rb
343
+ - lib/volt/page/targets/attribute_section.rb
344
+ - lib/volt/page/targets/attribute_target.rb
345
+ - lib/volt/page/targets/base_section.rb
346
+ - lib/volt/page/targets/binding_document/base_node.rb
347
+ - lib/volt/page/targets/binding_document/component_node.rb
348
+ - lib/volt/page/targets/binding_document/html_node.rb
349
+ - lib/volt/page/targets/dom_section.rb
350
+ - lib/volt/page/targets/dom_target.rb
351
+ - lib/volt/page/tasks.rb
352
+ - lib/volt/page/template_renderer.rb
294
353
  - lib/volt/page/url_tracker.rb
295
354
  - lib/volt/reactive/array_extensions.rb
355
+ - lib/volt/reactive/destructive_methods.rb
296
356
  - lib/volt/reactive/event_chain.rb
297
357
  - lib/volt/reactive/events.rb
298
358
  - lib/volt/reactive/object_tracker.rb
@@ -316,29 +376,7 @@ files:
316
376
  - lib/volt/server/scope.rb
317
377
  - lib/volt/server/template_parser.rb
318
378
  - lib/volt/store/mongo.rb
319
- - lib/volt/templates/attribute_binding.rb
320
- - lib/volt/templates/base_binding.rb
321
- - lib/volt/templates/channel.rb
322
- - lib/volt/templates/content_binding.rb
323
- - lib/volt/templates/document_events.rb
324
- - lib/volt/templates/each_binding.rb
325
- - lib/volt/templates/event_binding.rb
326
- - lib/volt/templates/if_binding.rb
327
- - lib/volt/templates/memory_test.rb
328
- - lib/volt/templates/page.rb
329
- - lib/volt/templates/reactive_template.rb
330
- - lib/volt/templates/render_queue.rb
331
- - lib/volt/templates/sub_context.rb
332
- - lib/volt/templates/targets/attribute_section.rb
333
- - lib/volt/templates/targets/attribute_target.rb
334
- - lib/volt/templates/targets/base_section.rb
335
- - lib/volt/templates/targets/binding_document/base_node.rb
336
- - lib/volt/templates/targets/binding_document/component_node.rb
337
- - lib/volt/templates/targets/binding_document/html_node.rb
338
- - lib/volt/templates/targets/dom_section.rb
339
- - lib/volt/templates/targets/dom_target.rb
340
- - lib/volt/templates/template_binding.rb
341
- - lib/volt/templates/template_renderer.rb
379
+ - lib/volt/tasks/dispatcher.rb
342
380
  - lib/volt/volt/environment.rb
343
381
  - spec/app/bootstrap/assets/js/bootstrap.js
344
382
  - spec/app/main/assets/js/test1.js
@@ -349,9 +387,11 @@ files:
349
387
  - spec/models/event_chain_spec.rb
350
388
  - spec/models/model_spec.rb
351
389
  - spec/models/old_model_spec.rb
390
+ - spec/models/params_spec.rb
352
391
  - spec/models/reactive_array_spec.rb
353
392
  - spec/models/reactive_tags_spec.rb
354
393
  - spec/models/reactive_value_spec.rb
394
+ - spec/models/store_spec.rb
355
395
  - spec/models/string_extensions_spec.rb
356
396
  - spec/router/routes_spec.rb
357
397
  - spec/server/rack/component_files_spec.rb
@@ -429,9 +469,11 @@ test_files:
429
469
  - spec/models/event_chain_spec.rb
430
470
  - spec/models/model_spec.rb
431
471
  - spec/models/old_model_spec.rb
472
+ - spec/models/params_spec.rb
432
473
  - spec/models/reactive_array_spec.rb
433
474
  - spec/models/reactive_tags_spec.rb
434
475
  - spec/models/reactive_value_spec.rb
476
+ - spec/models/store_spec.rb
435
477
  - spec/models/string_extensions_spec.rb
436
478
  - spec/router/routes_spec.rb
437
479
  - spec/server/rack/component_files_spec.rb
@@ -1,47 +0,0 @@
1
- # The channel is the connection between the front end and the backend.
2
-
3
- require 'volt/reactive/events'
4
- require 'json'
5
-
6
- class Channel
7
- include Events
8
-
9
- def initialize
10
- @socket = nil
11
- %x{
12
- this.socket = new SockJS('http://localhost:3000/channel');//, {reconnect: true});
13
-
14
- this.socket.onopen = function() {
15
- self['$trigger!']("open");
16
- };
17
-
18
- this.socket.onmessage = function(message) {
19
- console.log('received: ', message);
20
- self['$message_received'](message.data);
21
- };
22
- }
23
- end
24
-
25
- def message_received(message)
26
- message = JSON.parse(message)
27
- puts "Got #{message.inspect}"
28
-
29
- trigger!('message', message)
30
- end
31
-
32
- def send(message)
33
- # TODO: Temp: wrap message in an array, so we're sure its valid JSON
34
- message = JSON.dump([message])
35
- %x{
36
- //message = window.JSON.parse(message);
37
- console.log('send: ', message);
38
- this.socket.send(message);
39
- }
40
- end
41
-
42
- def close
43
- %x{
44
- this.socket.close();
45
- }
46
- end
47
- end