volt 0.8.14 → 0.8.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Readme.md +8 -2
  4. data/VERSION +1 -1
  5. data/app/volt/controllers/notices_controller.rb +1 -1
  6. data/app/volt/models/user.rb +2 -2
  7. data/app/volt/tasks/live_query/live_query_pool.rb +1 -1
  8. data/app/volt/tasks/query_tasks.rb +1 -1
  9. data/app/volt/tasks/store_tasks.rb +1 -1
  10. data/app/volt/tasks/user_tasks.rb +2 -2
  11. data/lib/volt/boot.rb +2 -2
  12. data/lib/volt/cli/asset_compile.rb +31 -27
  13. data/lib/volt/cli.rb +64 -65
  14. data/lib/volt/config.rb +25 -23
  15. data/lib/volt/console.rb +17 -16
  16. data/lib/volt/controllers/model_controller.rb +82 -80
  17. data/lib/volt/data_stores/data_store.rb +2 -2
  18. data/lib/volt/data_stores/mongo_driver.rb +2 -2
  19. data/lib/volt/extra_core/inflections.rb +2 -2
  20. data/lib/volt/extra_core/inflector/inflections.rb +185 -183
  21. data/lib/volt/extra_core/inflector/methods.rb +50 -48
  22. data/lib/volt/extra_core/string.rb +2 -2
  23. data/lib/volt/models/array_model.rb +93 -92
  24. data/lib/volt/models/cursor.rb +3 -2
  25. data/lib/volt/models/model.rb +248 -251
  26. data/lib/volt/models/model_hash_behaviour.rb +44 -44
  27. data/lib/volt/models/model_helpers.rb +38 -36
  28. data/lib/volt/models/model_state.rb +16 -17
  29. data/lib/volt/models/model_wrapper.rb +25 -24
  30. data/lib/volt/models/persistors/array_store.rb +145 -143
  31. data/lib/volt/models/persistors/base.rb +18 -16
  32. data/lib/volt/models/persistors/flash.rb +24 -22
  33. data/lib/volt/models/persistors/local_store.rb +46 -44
  34. data/lib/volt/models/persistors/model_identity_map.rb +10 -8
  35. data/lib/volt/models/persistors/model_store.rb +76 -76
  36. data/lib/volt/models/persistors/params.rb +19 -17
  37. data/lib/volt/models/persistors/query/query_listener.rb +65 -63
  38. data/lib/volt/models/persistors/query/query_listener_pool.rb +12 -10
  39. data/lib/volt/models/persistors/store.rb +28 -28
  40. data/lib/volt/models/persistors/store_factory.rb +12 -10
  41. data/lib/volt/models/persistors/store_state.rb +33 -31
  42. data/lib/volt/models/url.rb +96 -104
  43. data/lib/volt/models/validations.rb +56 -54
  44. data/lib/volt/models/validators/length_validator.rb +24 -22
  45. data/lib/volt/models/validators/presence_validator.rb +14 -12
  46. data/lib/volt/page/bindings/attribute_binding.rb +106 -106
  47. data/lib/volt/page/bindings/base_binding.rb +23 -21
  48. data/lib/volt/page/bindings/component_binding.rb +3 -1
  49. data/lib/volt/page/bindings/content_binding.rb +34 -34
  50. data/lib/volt/page/bindings/each_binding.rb +113 -113
  51. data/lib/volt/page/bindings/event_binding.rb +38 -34
  52. data/lib/volt/page/bindings/if_binding.rb +56 -54
  53. data/lib/volt/page/bindings/template_binding/grouped_controllers.rb +24 -22
  54. data/lib/volt/page/bindings/template_binding.rb +182 -185
  55. data/lib/volt/page/channel.rb +79 -77
  56. data/lib/volt/page/channel_stub.rb +29 -27
  57. data/lib/volt/page/document.rb +6 -5
  58. data/lib/volt/page/document_events.rb +54 -52
  59. data/lib/volt/page/page.rb +139 -138
  60. data/lib/volt/page/string_template_renderer.rb +36 -36
  61. data/lib/volt/page/sub_context.rb +26 -25
  62. data/lib/volt/page/targets/attribute_section.rb +27 -25
  63. data/lib/volt/page/targets/attribute_target.rb +7 -6
  64. data/lib/volt/page/targets/base_section.rb +27 -26
  65. data/lib/volt/page/targets/binding_document/base_node.rb +3 -1
  66. data/lib/volt/page/targets/binding_document/component_node.rb +85 -82
  67. data/lib/volt/page/targets/binding_document/html_node.rb +11 -9
  68. data/lib/volt/page/targets/dom_section.rb +78 -77
  69. data/lib/volt/page/targets/dom_target.rb +8 -6
  70. data/lib/volt/page/targets/dom_template.rb +90 -88
  71. data/lib/volt/page/targets/helpers/comment_searchers.rb +51 -49
  72. data/lib/volt/page/tasks.rb +59 -57
  73. data/lib/volt/page/template_renderer.rb +17 -14
  74. data/lib/volt/page/url_tracker.rb +26 -24
  75. data/lib/volt/reactive/computation.rb +87 -88
  76. data/lib/volt/reactive/dependency.rb +30 -28
  77. data/lib/volt/reactive/eventable.rb +64 -62
  78. data/lib/volt/reactive/hash_dependency.rb +25 -23
  79. data/lib/volt/reactive/reactive_accessors.rb +34 -32
  80. data/lib/volt/reactive/reactive_array.rb +162 -162
  81. data/lib/volt/reactive/reactive_hash.rb +37 -35
  82. data/lib/volt/router/routes.rb +99 -101
  83. data/lib/volt/server/component_handler.rb +20 -21
  84. data/lib/volt/server/component_templates.rb +72 -70
  85. data/lib/volt/server/html_parser/attribute_scope.rb +109 -99
  86. data/lib/volt/server/html_parser/each_scope.rb +17 -16
  87. data/lib/volt/server/html_parser/if_view_scope.rb +51 -49
  88. data/lib/volt/server/html_parser/sandlebars_parser.rb +184 -177
  89. data/lib/volt/server/html_parser/textarea_scope.rb +24 -22
  90. data/lib/volt/server/html_parser/view_handler.rb +66 -65
  91. data/lib/volt/server/html_parser/view_parser.rb +23 -21
  92. data/lib/volt/server/html_parser/view_scope.rb +142 -141
  93. data/lib/volt/server/rack/asset_files.rb +81 -79
  94. data/lib/volt/server/rack/component_code.rb +17 -15
  95. data/lib/volt/server/rack/component_html_renderer.rb +14 -12
  96. data/lib/volt/server/rack/component_paths.rb +72 -71
  97. data/lib/volt/server/rack/index_files.rb +36 -39
  98. data/lib/volt/server/rack/opal_files.rb +43 -41
  99. data/lib/volt/server/rack/source_map_server.rb +23 -21
  100. data/lib/volt/server/socket_connection_handler.rb +46 -45
  101. data/lib/volt/server/socket_connection_handler_stub.rb +21 -19
  102. data/lib/volt/server.rb +60 -58
  103. data/lib/volt/spec/setup.rb +3 -3
  104. data/lib/volt/tasks/dispatcher.rb +24 -23
  105. data/lib/volt/tasks/task_handler.rb +35 -33
  106. data/lib/volt/utils/ejson.rb +8 -6
  107. data/lib/volt/utils/generic_counting_pool.rb +33 -31
  108. data/lib/volt/utils/generic_pool.rb +73 -70
  109. data/lib/volt/utils/local_storage.rb +42 -38
  110. data/lib/volt/volt/environment.rb +1 -1
  111. data/lib/volt.rb +44 -42
  112. data/spec/apps/kitchen_sink/app/main/assets/css/todos.css +28 -0
  113. data/spec/apps/kitchen_sink/app/main/config/routes.rb +1 -0
  114. data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +2 -2
  115. data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +17 -0
  116. data/spec/apps/kitchen_sink/app/main/views/main/main.html +1 -0
  117. data/spec/apps/kitchen_sink/app/main/views/todos/index.html +24 -0
  118. data/spec/apps/kitchen_sink/config.ru +1 -1
  119. data/spec/controllers/reactive_accessors_spec.rb +5 -5
  120. data/spec/extra_core/inflector_spec.rb +2 -2
  121. data/spec/integration/list_spec.rb +68 -0
  122. data/spec/models/model_spec.rb +57 -57
  123. data/spec/models/persistors/params_spec.rb +6 -6
  124. data/spec/models/persistors/store_spec.rb +7 -7
  125. data/spec/models/validations_spec.rb +3 -3
  126. data/spec/page/bindings/content_binding_spec.rb +7 -7
  127. data/spec/page/bindings/template_binding_spec.rb +4 -5
  128. data/spec/page/sub_context_spec.rb +2 -2
  129. data/spec/reactive/computation_spec.rb +10 -10
  130. data/spec/reactive/dependency_spec.rb +2 -2
  131. data/spec/reactive/eventable_spec.rb +4 -4
  132. data/spec/reactive/reactive_array_spec.rb +13 -13
  133. data/spec/router/routes_spec.rb +5 -5
  134. data/spec/server/html_parser/sandlebars_parser_spec.rb +9 -9
  135. data/spec/server/html_parser/view_parser_spec.rb +27 -27
  136. data/spec/server/rack/asset_files_spec.rb +5 -5
  137. data/spec/server/rack/component_paths_spec.rb +2 -2
  138. data/spec/tasks/live_query_spec.rb +2 -2
  139. data/spec/tasks/query_tasks.rb +1 -1
  140. data/spec/tasks/query_tracker_spec.rb +1 -1
  141. data/spec/templates/targets/binding_document/component_node_spec.rb +2 -2
  142. data/spec/utils/generic_counting_pool_spec.rb +2 -2
  143. data/spec/utils/generic_pool_spec.rb +2 -2
  144. data/templates/component/controllers/main_controller.rb +1 -1
  145. data/templates/model/model.rb.tt +2 -2
  146. data/templates/newgem/app/newgem/controllers/main_controller.rb.tt +2 -2
  147. data/templates/project/app/main/controllers/main_controller.rb +1 -1
  148. data/templates/project/config.ru +1 -1
  149. metadata +10 -3
  150. data/app/volt/assets/js/vertxbus.js +0 -216
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
  require 'volt/reactive/reactive_array'
3
3
 
4
- describe ReactiveArray do
4
+ describe Volt::ReactiveArray do
5
5
  describe "cells" do
6
6
  it 'should track dependencies for cells' do
7
- a = ReactiveArray.new
7
+ a = Volt::ReactiveArray.new
8
8
 
9
9
  count = 0
10
10
  values = []
@@ -12,19 +12,19 @@ describe ReactiveArray do
12
12
 
13
13
  a[0] = 5
14
14
 
15
- Computation.flush!
15
+ Volt::Computation.flush!
16
16
 
17
17
  a[0] = 10
18
18
  expect(count).to eq(2)
19
19
  expect(values).to eq([nil, 5])
20
20
 
21
- Computation.flush!
21
+ Volt::Computation.flush!
22
22
  expect(count).to eq(3)
23
23
  expect(values).to eq([nil, 5, 10])
24
24
  end
25
25
 
26
26
  it 'should trigger changed on the last cell when appending' do
27
- a = ReactiveArray.new([1,2,3])
27
+ a = Volt::ReactiveArray.new([1,2,3])
28
28
 
29
29
  values = []
30
30
  -> { values << a[3] }.watch!
@@ -34,12 +34,12 @@ describe ReactiveArray do
34
34
  a << 4
35
35
  expect(values).to eq([nil])
36
36
 
37
- Computation.flush!
37
+ Volt::Computation.flush!
38
38
  expect(values).to eq([nil, 4])
39
39
  end
40
40
 
41
41
  it 'should trigger changes for each cell after index after insert' do
42
- a = ReactiveArray.new([1,2,3])
42
+ a = Volt::ReactiveArray.new([1,2,3])
43
43
 
44
44
  values_at_2 = []
45
45
  values_at_3 = []
@@ -54,7 +54,7 @@ describe ReactiveArray do
54
54
 
55
55
  a.insert(2,1.3,1.7)
56
56
 
57
- Computation.flush!
57
+ Volt::Computation.flush!
58
58
 
59
59
  expect(values_at_2).to eq([3,1.3])
60
60
  expect(values_at_3).to eq([nil,1.7])
@@ -65,7 +65,7 @@ describe ReactiveArray do
65
65
 
66
66
  describe "size dependencies" do
67
67
  it 'pushing should trigger changed for size' do
68
- array = ReactiveArray.new
68
+ array = Volt::ReactiveArray.new
69
69
  count = 0
70
70
 
71
71
  size_values = []
@@ -75,12 +75,12 @@ describe ReactiveArray do
75
75
 
76
76
  array << 5
77
77
 
78
- Computation.flush!
78
+ Volt::Computation.flush!
79
79
  expect(size_values).to eq([0,1])
80
80
  end
81
81
 
82
82
  it 'should trigger a size change when deleting' do
83
- array = ReactiveArray.new([1,2,3])
83
+ array = Volt::ReactiveArray.new([1,2,3])
84
84
 
85
85
  size_values = []
86
86
  -> { size_values << array.size }.watch!
@@ -90,8 +90,8 @@ describe ReactiveArray do
90
90
  array.delete_at(2)
91
91
 
92
92
  expect(size_values).to eq([3])
93
- Computation.flush!
93
+ Volt::Computation.flush!
94
94
  expect(size_values).to eq([3,2])
95
95
  end
96
96
  end
97
- end
97
+ end
@@ -2,11 +2,11 @@ require 'volt/router/routes'
2
2
  require 'volt/models'
3
3
 
4
4
  def routes(&block)
5
- @routes = Routes.new
5
+ @routes = Volt::Routes.new
6
6
  @routes.define(&block)
7
7
  end
8
8
 
9
- describe Routes do
9
+ describe Volt::Routes do
10
10
  it "should setup direct routes" do
11
11
  routes do
12
12
  get '/', _view: 'index'
@@ -115,7 +115,7 @@ describe Routes do
115
115
  end
116
116
 
117
117
  it "should test that params match a param matcher" do
118
- routes = Routes.new
118
+ routes = Volt::Routes.new
119
119
  match, params = routes.send(:check_params_match, {_view: 'blog', _id: '55'}, {_view: 'blog', _id: nil})
120
120
  expect(match).to eq(true)
121
121
  expect(params).to eq({_id: '55'})
@@ -143,7 +143,7 @@ describe Routes do
143
143
  end
144
144
 
145
145
  it "should match routes" do
146
- params = Model.new({}, persistor: Persistors::Params)
146
+ params = Volt::Model.new({}, persistor: Volt::Persistors::Params)
147
147
  params._controller = 'blog'
148
148
  params._index = '5'
149
149
 
@@ -158,7 +158,7 @@ describe Routes do
158
158
  end
159
159
 
160
160
  it "should handle routes with bindings in them" do
161
- params = Model.new({}, persistor: Persistors::Params)
161
+ params = Volt::Model.new({}, persistor: Volt::Persistors::Params)
162
162
 
163
163
  routes do
164
164
  get '/', _controller: 'index'
@@ -46,15 +46,15 @@ def parse_url(url)
46
46
  File.open("/Users/ryanstout/Desktop/tests/#{url}1.html", 'w') {|f| f.write(html) }
47
47
 
48
48
  handler = HTMLHandler.new
49
- SandlebarsParser.new(html, handler)
49
+ Volt::SandlebarsParser.new(html, handler)
50
50
 
51
51
  File.open("/Users/ryanstout/Desktop/tests/#{url}2.html", 'w') {|f| f.write(handler.html) }
52
52
  end
53
53
 
54
- describe SandlebarsParser do
54
+ describe Volt::SandlebarsParser do
55
55
  def test_html(html, match=nil)
56
56
  handler = HTMLHandler.new
57
- parser = SandlebarsParser.new(html, handler)
57
+ parser = Volt::SandlebarsParser.new(html, handler)
58
58
 
59
59
  expect(handler.html).to eq(match || html)
60
60
  end
@@ -107,21 +107,21 @@ describe SandlebarsParser do
107
107
  html = "<p>testing with {{nested"
108
108
 
109
109
  handler = HTMLHandler.new
110
- expect { SandlebarsParser.new(html, handler) }.to raise_error(HTMLParseError)
110
+ expect { Volt::SandlebarsParser.new(html, handler) }.to raise_error(Volt::HTMLParseError)
111
111
  end
112
112
 
113
113
  it "should raise an exception on an unclosed binding" do
114
114
  html = "<p>testing with {{nested </p>\n<p>ok</p>"
115
115
 
116
116
  handler = HTMLHandler.new
117
- expect { SandlebarsParser.new(html, handler) }.to raise_error(HTMLParseError)
117
+ expect { Volt::SandlebarsParser.new(html, handler) }.to raise_error(Volt::HTMLParseError)
118
118
  end
119
119
 
120
120
  it "should report the line number" do
121
121
  html = "\n\n<p>some paragraph</p>\n\n<p>testing with {{nested </p>\n<p>ok</p>"
122
122
 
123
123
  handler = HTMLHandler.new
124
- expect { SandlebarsParser.new(html, handler) }.to raise_error(HTMLParseError, "unclosed binding: {nested </p> on line: 5")
124
+ expect { Volt::SandlebarsParser.new(html, handler) }.to raise_error(Volt::HTMLParseError, "unclosed binding: {nested </p> on line: 5")
125
125
  end
126
126
 
127
127
  it "should handle a bunch of things" do
@@ -179,7 +179,7 @@ describe SandlebarsParser do
179
179
  html = File.read(File.join(File.dirname(__FILE__), 'sample_page.html'))
180
180
  handler = HTMLHandler.new
181
181
  time = Benchmark.measure do
182
- SandlebarsParser.new(html, handler)
182
+ Volt::SandlebarsParser.new(html, handler)
183
183
  end
184
184
 
185
185
  # Less than 100ms
@@ -195,7 +195,7 @@ describe SandlebarsParser do
195
195
  # html = "<div><p>test</p></div></div>"
196
196
  #
197
197
  # handler = HTMLHandler.new
198
- # expect { SandlebarsParser.new(html, handler) }.to raise_error(HTMLParseError)
198
+ # expect { Volt::SandlebarsParser.new(html, handler) }.to raise_error(Volt::HTMLParseError)
199
199
  # end
200
200
  end
201
- end
201
+ end
@@ -3,18 +3,18 @@ else
3
3
  require 'benchmark'
4
4
  require 'volt/server/html_parser/view_parser'
5
5
 
6
- describe ViewParser do
6
+ describe Volt::ViewParser do
7
7
  it "should parse content bindings" do
8
8
  html = "<p>Some {{ content }} binding, {{ name }}</p>"
9
9
 
10
- view = ViewParser.new(html, "main/main/main")
10
+ view = Volt::ViewParser.new(html, "main/main/main")
11
11
 
12
12
  expect(view.templates).to eq({
13
13
  'main/main/main/body' => {
14
14
  'html' => '<p>Some <!-- $0 --><!-- $/0 --> binding, <!-- $1 --><!-- $/1 --></p>',
15
15
  'bindings' => {
16
- 0 => ["lambda { |__p, __t, __c, __id| ContentBinding.new(__p, __t, __c, __id, Proc.new { content }) }"],
17
- 1 => ["lambda { |__p, __t, __c, __id| ContentBinding.new(__p, __t, __c, __id, Proc.new { name }) }"]
16
+ 0 => ["lambda { |__p, __t, __c, __id| Volt::ContentBinding.new(__p, __t, __c, __id, Proc.new { content }) }"],
17
+ 1 => ["lambda { |__p, __t, __c, __id| Volt::ContentBinding.new(__p, __t, __c, __id, Proc.new { name }) }"]
18
18
  }
19
19
  }
20
20
  })
@@ -34,7 +34,7 @@ describe ViewParser do
34
34
  </p>
35
35
  END
36
36
 
37
- view = ViewParser.new(html, "main/main/main")
37
+ view = Volt::ViewParser.new(html, "main/main/main")
38
38
 
39
39
  expect(view.templates).to eq( {
40
40
  "main/main/main/body/__ifg0/__if0" => {
@@ -50,7 +50,7 @@ describe ViewParser do
50
50
  "html" => " <p>\n Some\n <!-- $0 --><!-- $/0 -->\n </p>\n",
51
51
  "bindings" => {
52
52
  0 => [
53
- "lambda { |__p, __t, __c, __id| IfBinding.new(__p, __t, __c, __id, [[Proc.new { showing == :text }, \"main/main/main/body/__ifg0/__if0\"], [Proc.new { showing == :button }, \"main/main/main/body/__ifg0/__if1\"], [nil, \"main/main/main/body/__ifg0/__if2\"]]) }"
53
+ "lambda { |__p, __t, __c, __id| Volt::IfBinding.new(__p, __t, __c, __id, [[Proc.new { showing == :text }, \"main/main/main/body/__ifg0/__if0\"], [Proc.new { showing == :button }, \"main/main/main/body/__ifg0/__if1\"], [nil, \"main/main/main/body/__ifg0/__if2\"]]) }"
54
54
  ]
55
55
  }
56
56
  }
@@ -73,7 +73,7 @@ describe ViewParser do
73
73
  </p>
74
74
  END
75
75
 
76
- view = ViewParser.new(html, "main/main/main")
76
+ view = Volt::ViewParser.new(html, "main/main/main")
77
77
 
78
78
  expect(view.templates).to eq( {
79
79
  "main/main/main/body/__ifg0/__if0/__ifg0/__if0" => {
@@ -83,7 +83,7 @@ describe ViewParser do
83
83
  "html" => "\n <!-- $0 --><!-- $/0 -->\n ",
84
84
  "bindings" => {
85
85
  0 => [
86
- "lambda { |__p, __t, __c, __id| IfBinding.new(__p, __t, __c, __id, [[Proc.new { sub_item }, \"main/main/main/body/__ifg0/__if0/__ifg0/__if0\"]]) }"
86
+ "lambda { |__p, __t, __c, __id| Volt::IfBinding.new(__p, __t, __c, __id, [[Proc.new { sub_item }, \"main/main/main/body/__ifg0/__if0/__ifg0/__if0\"]]) }"
87
87
  ]
88
88
  }
89
89
  },
@@ -94,7 +94,7 @@ describe ViewParser do
94
94
  "html" => " <p>\n Some\n <!-- $0 --><!-- $/0 -->\n </p>\n",
95
95
  "bindings" => {
96
96
  0 => [
97
- "lambda { |__p, __t, __c, __id| IfBinding.new(__p, __t, __c, __id, [[Proc.new { showing == :text }, \"main/main/main/body/__ifg0/__if0\"], [nil, \"main/main/main/body/__ifg0/__if1\"]]) }"
97
+ "lambda { |__p, __t, __c, __id| Volt::IfBinding.new(__p, __t, __c, __id, [[Proc.new { showing == :text }, \"main/main/main/body/__ifg0/__if0\"], [nil, \"main/main/main/body/__ifg0/__if1\"]]) }"
98
98
  ]
99
99
  }
100
100
  }
@@ -111,14 +111,14 @@ describe ViewParser do
111
111
  </div>
112
112
  END
113
113
 
114
- view = ViewParser.new(html, "main/main/main")
114
+ view = Volt::ViewParser.new(html, "main/main/main")
115
115
 
116
116
  expect(view.templates).to eq({
117
117
  "main/main/main/body/__each0/__template/0" => {
118
118
  "html" => "\n <p><!-- $0 --><!-- $/0 --></p>\n ",
119
119
  "bindings" => {
120
120
  0 => [
121
- "lambda { |__p, __t, __c, __id| ContentBinding.new(__p, __t, __c, __id, Proc.new { item }) }"
121
+ "lambda { |__p, __t, __c, __id| Volt::ContentBinding.new(__p, __t, __c, __id, Proc.new { item }) }"
122
122
  ]
123
123
  }
124
124
  },
@@ -126,7 +126,7 @@ describe ViewParser do
126
126
  "html" => " <div class=\"main\">\n <!-- $0 --><!-- $/0 -->\n </div>\n",
127
127
  "bindings" => {
128
128
  0 => [
129
- "lambda { |__p, __t, __c, __id| EachBinding.new(__p, __t, __c, __id, Proc.new { _items }, \"item\", \"main/main/main/body/__each0/__template/0\") }"
129
+ "lambda { |__p, __t, __c, __id| Volt::EachBinding.new(__p, __t, __c, __id, Proc.new { _items }, \"item\", \"main/main/main/body/__each0/__template/0\") }"
130
130
  ]
131
131
  }
132
132
  }
@@ -141,9 +141,9 @@ describe ViewParser do
141
141
  </div>
142
142
  END
143
143
 
144
- view = ViewParser.new(html, "main/main/main")
144
+ view = Volt::ViewParser.new(html, "main/main/main")
145
145
 
146
- expect(view.templates).to eq({"main/main/main/body"=>{"html"=>" <div id=\"id0\">\n </div>\n", "bindings"=>{"id0"=>["lambda { |__p, __t, __c, __id| AttributeBinding.new(__p, __t, __c, __id, \"class\", Proc.new { main_class }, Proc.new { |val| self.main_class=(val) }) }"]}}})
146
+ expect(view.templates).to eq({"main/main/main/body"=>{"html"=>" <div id=\"id0\">\n </div>\n", "bindings"=>{"id0"=>["lambda { |__p, __t, __c, __id| Volt::AttributeBinding.new(__p, __t, __c, __id, \"class\", Proc.new { main_class }, Proc.new { |val| self.main_class=(val) }) }"]}}})
147
147
  end
148
148
 
149
149
  it "should parse multiple attribute bindings in a single attribute" do
@@ -152,17 +152,17 @@ describe ViewParser do
152
152
  </div>
153
153
  END
154
154
 
155
- view = ViewParser.new(html, "main/main/main")
155
+ view = Volt::ViewParser.new(html, "main/main/main")
156
156
 
157
157
  expect(view.templates).to eq({
158
158
  "main/main/main/body/_rv1" => {
159
159
  "html" => "start <!-- $0 --><!-- $/0 --> <!-- $1 --><!-- $/1 --> string",
160
160
  "bindings" => {
161
161
  0 => [
162
- "lambda { |__p, __t, __c, __id| ContentBinding.new(__p, __t, __c, __id, Proc.new { main_class }) }"
162
+ "lambda { |__p, __t, __c, __id| Volt::ContentBinding.new(__p, __t, __c, __id, Proc.new { main_class }) }"
163
163
  ],
164
164
  1 => [
165
- "lambda { |__p, __t, __c, __id| ContentBinding.new(__p, __t, __c, __id, Proc.new { awesome_class }) }"
165
+ "lambda { |__p, __t, __c, __id| Volt::ContentBinding.new(__p, __t, __c, __id, Proc.new { awesome_class }) }"
166
166
  ]
167
167
  }
168
168
  },
@@ -170,7 +170,7 @@ describe ViewParser do
170
170
  "html" => " <div id=\"id0\">\n </div>\n",
171
171
  "bindings" => {
172
172
  "id0" => [
173
- "lambda { |__p, __t, __c, __id| AttributeBinding.new(__p, __t, __c, __id, \"class\", Proc.new { StringTemplateRender.new(__p, __c, \"main/main/main/body/_rv1\") }) }"
173
+ "lambda { |__p, __t, __c, __id| Volt::AttributeBinding.new(__p, __t, __c, __id, \"class\", Proc.new { Volt::StringTemplateRender.new(__p, __c, \"main/main/main/body/_rv1\") }) }"
174
174
  ]
175
175
  }
176
176
  }
@@ -182,14 +182,14 @@ describe ViewParser do
182
182
  {{ template "/home/temp/path" }}
183
183
  END
184
184
 
185
- view = ViewParser.new(html, "main/main/main")
185
+ view = Volt::ViewParser.new(html, "main/main/main")
186
186
 
187
187
  expect(view.templates).to eq({
188
188
  "main/main/main/body" => {
189
189
  "html" => " <!-- $0 --><!-- $/0 -->\n",
190
190
  "bindings" => {
191
191
  0 => [
192
- "lambda { |__p, __t, __c, __id| TemplateBinding.new(__p, __t, __c, __id, \"main/main/main/body\", Proc.new { [\"/home/temp/path\"] }) }"
192
+ "lambda { |__p, __t, __c, __id| Volt::TemplateBinding.new(__p, __t, __c, __id, \"main/main/main/body\", Proc.new { [\"/home/temp/path\"] }) }"
193
193
  ]
194
194
  }
195
195
  }
@@ -202,7 +202,7 @@ describe ViewParser do
202
202
  <a href="/{link_name}">Link</a>
203
203
  END
204
204
 
205
- view = ViewParser.new(html, "main/main/main/body")
205
+ view = Volt::ViewParser.new(html, "main/main/main/body")
206
206
 
207
207
  # puts view.templates.inspect
208
208
  end
@@ -211,7 +211,7 @@ describe ViewParser do
211
211
  <a href="{link_name}">Link</a>
212
212
  END
213
213
 
214
- view = ViewParser.new(html, "main/main/main/body")
214
+ view = Volt::ViewParser.new(html, "main/main/main/body")
215
215
 
216
216
  # puts view.templates.inspect
217
217
  end
@@ -229,7 +229,7 @@ describe ViewParser do
229
229
  <p>This text goes in the body</p>
230
230
  END
231
231
 
232
- view = ViewParser.new(html, "main/main/main")
232
+ view = Volt::ViewParser.new(html, "main/main/main")
233
233
 
234
234
  expect(view.templates).to eq( {
235
235
  "main/main/main/title" => {
@@ -248,7 +248,7 @@ describe ViewParser do
248
248
  <textarea name="cool">some text in a textarea</textarea>
249
249
  END
250
250
 
251
- view = ViewParser.new(html, "main/main/main")
251
+ view = Volt::ViewParser.new(html, "main/main/main")
252
252
 
253
253
  expect(view.templates).to eq({
254
254
  "main/main/main/body" => {
@@ -262,10 +262,10 @@ describe ViewParser do
262
262
  <textarea name="cool">{{ awesome }}</textarea>
263
263
  END
264
264
 
265
- view = ViewParser.new(html, "main/main/main")
265
+ view = Volt::ViewParser.new(html, "main/main/main")
266
266
 
267
- expect(view.templates).to eq({"main/main/main/body"=>{"html"=>" <textarea name=\"cool\" id=\"id1\"></textarea>\n", "bindings"=>{"id1"=>["lambda { |__p, __t, __c, __id| AttributeBinding.new(__p, __t, __c, __id, \"value\", Proc.new { awesome }, Proc.new { |val| self.awesome=(val) }) }"]}}})
267
+ expect(view.templates).to eq({"main/main/main/body"=>{"html"=>" <textarea name=\"cool\" id=\"id1\"></textarea>\n", "bindings"=>{"id1"=>["lambda { |__p, __t, __c, __id| Volt::AttributeBinding.new(__p, __t, __c, __id, \"value\", Proc.new { awesome }, Proc.new { |val| self.awesome=(val) }) }"]}}})
268
268
  end
269
+ end
269
270
 
270
271
  end
271
- end
@@ -1,25 +1,25 @@
1
1
  if RUBY_PLATFORM != 'opal'
2
2
  require 'volt/server/rack/asset_files'
3
3
 
4
- describe AssetFiles do
4
+ describe Volt::AssetFiles do
5
5
  before do
6
6
  spec_app_root = File.join(File.dirname(__FILE__), "../../apps/file_loading")
7
7
 
8
8
  path_to_main = File.join(File.dirname(__FILE__), "../../apps/file_loading/app/main")
9
- @component_paths = ComponentPaths.new(spec_app_root)
9
+ @component_paths = Volt::ComponentPaths.new(spec_app_root)
10
10
  end
11
11
 
12
12
  it "should return the dependencies list" do
13
- main = AssetFiles.new("main", @component_paths)
13
+ main = Volt::AssetFiles.new("main", @component_paths)
14
14
 
15
15
  components = main.components
16
16
  expect(components).to eq(['volt', 'main', 'shared', 'bootstrap', "slideshow"])
17
17
  end
18
18
 
19
19
  it "should list all JS files" do
20
- main = AssetFiles.new("main", @component_paths)
20
+ main = Volt::AssetFiles.new("main", @component_paths)
21
21
 
22
- expect(main.javascript_files(nil)).to eq(["/assets/js/jquery-2.0.3.js", "/assets/js/setImmediate.js", "/assets/js/sockjs-0.3.4.min.js", "/assets/js/vertxbus.js", "/assets/js/bootstrap.js", "/assets/js/test2.js", "/assets/js/test3.js", "/assets/js/test1.js", "/assets/volt/page/page.js", "/components/main.js"])
22
+ expect(main.javascript_files(nil)).to eq(["/assets/js/jquery-2.0.3.js", "/assets/js/setImmediate.js", "/assets/js/sockjs-0.3.4.min.js", "/assets/js/bootstrap.js", "/assets/js/test2.js", "/assets/js/test3.js", "/assets/js/test1.js", "/assets/volt/page/page.js", "/components/main.js"])
23
23
  end
24
24
  end
25
25
  end
@@ -1,12 +1,12 @@
1
1
  if RUBY_PLATFORM != 'opal'
2
2
  require 'volt/server/rack/component_paths'
3
3
 
4
- describe ComponentPaths do
4
+ describe Volt::ComponentPaths do
5
5
  before do
6
6
  spec_app_root = File.join(File.dirname(__FILE__), "../../apps/file_loading")
7
7
 
8
8
  path_to_main = File.join(File.dirname(__FILE__), "../../apps/file_loading/app/main")
9
- @component_paths = ComponentPaths.new(spec_app_root)
9
+ @component_paths = Volt::ComponentPaths.new(spec_app_root)
10
10
  end
11
11
 
12
12
  it "should return the paths to all app folders" do
@@ -5,8 +5,8 @@ if RUBY_PLATFORM != 'opal'
5
5
  end
6
6
 
7
7
  it "should run a query" do
8
- pool = double('pool')
9
- data_store = double('data store')
8
+ pool = double('volt/pool')
9
+ data_store = double('volt/data store')
10
10
 
11
11
  expect(data_store).to receive(:query).with('_items', {}).and_return([
12
12
  {'_id' => 0, '_name' => 'one'}
@@ -1,5 +1,5 @@
1
1
  if RUBY_PLATFORM != 'opal'
2
- describe "QueryTasks" do
2
+ describe "Volt::QueryTasks" do
3
3
  before do
4
4
  load File.join(File.dirname(__FILE__), "../../app/volt/tasks/query_tasks.rb")
5
5
  end
@@ -36,7 +36,7 @@ if RUBY_PLATFORM != 'opal'
36
36
  before do
37
37
  # Setup a live query stub
38
38
  @live_query = LiveQueryStub.new
39
- data_store = double('data store')
39
+ data_store = double('volt/data store')
40
40
 
41
41
  # return an empty collection
42
42
  @items = []
@@ -1,12 +1,12 @@
1
1
  require 'volt/page/targets/binding_document/component_node'
2
2
 
3
- describe ComponentNode do
3
+ describe Volt::ComponentNode do
4
4
  before do
5
5
  html = <<-END
6
6
  <!-- $0 -->Before <!-- $1 -->Inside<!-- $/1 --> After<!-- $/0 -->
7
7
  END
8
8
 
9
- @component = ComponentNode.new
9
+ @component = Volt::ComponentNode.new
10
10
  @component.html = html
11
11
  end
12
12
 
@@ -1,12 +1,12 @@
1
1
  require 'volt/utils/generic_counting_pool'
2
2
 
3
- class CountingPoolTest < GenericCountingPool
3
+ class CountingPoolTest < Volt::GenericCountingPool
4
4
  def create(id, name=nil)
5
5
  return Object.new
6
6
  end
7
7
  end
8
8
 
9
- describe GenericCountingPool do
9
+ describe Volt::GenericCountingPool do
10
10
  before do
11
11
  @count_pool = CountingPoolTest.new
12
12
  end
@@ -1,12 +1,12 @@
1
1
  require 'volt/utils/generic_pool'
2
2
 
3
- class PoolTest < GenericPool
3
+ class PoolTest < Volt::GenericPool
4
4
  def create(collection, query, other=nil)
5
5
  return Object.new
6
6
  end
7
7
  end
8
8
 
9
- describe GenericPool do
9
+ describe Volt::GenericPool do
10
10
 
11
11
  before do
12
12
  @pool_test = PoolTest.new
@@ -1,4 +1,4 @@
1
- class MainController < ModelController
1
+ class MainController < Volt::ModelController
2
2
  def index
3
3
  # Add code for when the index view is loaded
4
4
  end
@@ -1,3 +1,3 @@
1
- class <%= config[:model_name] %> < Model
1
+ class <%= config[:model_name] %> < Volt::Model
2
2
 
3
- end
3
+ end
@@ -1,4 +1,4 @@
1
1
  module <%=config[:name].gsub(/^volt[-]/, '').gsub('-', '_').split("_").map {|s| s.capitalize }.join("") %>
2
- class MainController < ModelController
2
+ class MainController < Volt::ModelController
3
3
  end
4
- end
4
+ end
@@ -1,4 +1,4 @@
1
- class MainController < ModelController
1
+ class MainController < Volt::ModelController
2
2
  def index
3
3
  # Add code for when the index view is loaded
4
4
  end
@@ -1,4 +1,4 @@
1
1
  # Run via rack server
2
2
  require 'bundler/setup'
3
3
  require 'volt/server'
4
- run Server.new.app
4
+ run Volt::Server.new.app
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.8.14
4
+ version: 0.8.15
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-10-17 00:00:00.000000000 Z
11
+ date: 2014-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -355,7 +355,6 @@ files:
355
355
  - app/volt/assets/js/jquery-2.0.3.js
356
356
  - app/volt/assets/js/setImmediate.js
357
357
  - app/volt/assets/js/sockjs-0.3.4.min.js
358
- - app/volt/assets/js/vertxbus.js
359
358
  - app/volt/config/dependencies.rb
360
359
  - app/volt/controllers/notices_controller.rb
361
360
  - app/volt/models/user.rb
@@ -501,13 +500,16 @@ files:
501
500
  - spec/apps/file_loading/app/slideshow/assets/js/test3.js
502
501
  - spec/apps/kitchen_sink/.gitignore
503
502
  - spec/apps/kitchen_sink/Gemfile
503
+ - spec/apps/kitchen_sink/app/main/assets/css/todos.css
504
504
  - spec/apps/kitchen_sink/app/main/config/dependencies.rb
505
505
  - spec/apps/kitchen_sink/app/main/config/routes.rb
506
506
  - spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
507
+ - spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb
507
508
  - spec/apps/kitchen_sink/app/main/views/main/bindings.html
508
509
  - spec/apps/kitchen_sink/app/main/views/main/index.html
509
510
  - spec/apps/kitchen_sink/app/main/views/main/main.html
510
511
  - spec/apps/kitchen_sink/app/main/views/main/store.html
512
+ - spec/apps/kitchen_sink/app/main/views/todos/index.html
511
513
  - spec/apps/kitchen_sink/config.ru
512
514
  - spec/apps/kitchen_sink/public/index.html
513
515
  - spec/controllers/reactive_accessors_spec.rb
@@ -515,6 +517,7 @@ files:
515
517
  - spec/extra_core/string_transformation_test_cases.rb
516
518
  - spec/extra_core/string_transformations_spec.rb
517
519
  - spec/integration/bindings_spec.rb
520
+ - spec/integration/list_spec.rb
518
521
  - spec/integration/templates_spec.rb
519
522
  - spec/models/model_spec.rb
520
523
  - spec/models/persistors/params_spec.rb
@@ -626,13 +629,16 @@ test_files:
626
629
  - spec/apps/file_loading/app/slideshow/assets/js/test3.js
627
630
  - spec/apps/kitchen_sink/.gitignore
628
631
  - spec/apps/kitchen_sink/Gemfile
632
+ - spec/apps/kitchen_sink/app/main/assets/css/todos.css
629
633
  - spec/apps/kitchen_sink/app/main/config/dependencies.rb
630
634
  - spec/apps/kitchen_sink/app/main/config/routes.rb
631
635
  - spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
636
+ - spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb
632
637
  - spec/apps/kitchen_sink/app/main/views/main/bindings.html
633
638
  - spec/apps/kitchen_sink/app/main/views/main/index.html
634
639
  - spec/apps/kitchen_sink/app/main/views/main/main.html
635
640
  - spec/apps/kitchen_sink/app/main/views/main/store.html
641
+ - spec/apps/kitchen_sink/app/main/views/todos/index.html
636
642
  - spec/apps/kitchen_sink/config.ru
637
643
  - spec/apps/kitchen_sink/public/index.html
638
644
  - spec/controllers/reactive_accessors_spec.rb
@@ -640,6 +646,7 @@ test_files:
640
646
  - spec/extra_core/string_transformation_test_cases.rb
641
647
  - spec/extra_core/string_transformations_spec.rb
642
648
  - spec/integration/bindings_spec.rb
649
+ - spec/integration/list_spec.rb
643
650
  - spec/integration/templates_spec.rb
644
651
  - spec/models/model_spec.rb
645
652
  - spec/models/persistors/params_spec.rb