volt 0.6.5 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/Readme.md +47 -40
  3. data/VERSION +1 -1
  4. data/app/volt/controllers/notices_controller.rb +3 -3
  5. data/app/volt/tasks/live_query/data_store.rb +2 -2
  6. data/app/volt/tasks/live_query/live_query.rb +20 -20
  7. data/app/volt/tasks/live_query/live_query_pool.rb +6 -6
  8. data/app/volt/tasks/live_query/query_tracker.rb +15 -15
  9. data/app/volt/tasks/query_tasks.rb +13 -13
  10. data/app/volt/tasks/store_tasks.rb +7 -7
  11. data/app/volt/views/notices/index.html +17 -18
  12. data/lib/volt/assets/test.rb +2 -2
  13. data/lib/volt/benchmark/benchmark.rb +25 -23
  14. data/lib/volt/cli/asset_compile.rb +11 -0
  15. data/lib/volt/cli/new_gem.rb +16 -16
  16. data/lib/volt/cli.rb +14 -12
  17. data/lib/volt/console.rb +5 -6
  18. data/lib/volt/controllers/model_controller.rb +18 -18
  19. data/lib/volt/extra_core/array.rb +4 -4
  20. data/lib/volt/extra_core/hash.rb +3 -3
  21. data/lib/volt/extra_core/object.rb +6 -6
  22. data/lib/volt/extra_core/string.rb +6 -6
  23. data/lib/volt/extra_core/symbol.rb +5 -5
  24. data/lib/volt/extra_core/time.rb +4 -4
  25. data/lib/volt/extra_core/true_false.rb +6 -6
  26. data/lib/volt/extra_core/try.rb +9 -9
  27. data/lib/volt/models/array_model.rb +26 -26
  28. data/lib/volt/models/model.rb +35 -35
  29. data/lib/volt/models/model_hash_behaviour.rb +15 -15
  30. data/lib/volt/models/model_helpers.rb +8 -8
  31. data/lib/volt/models/model_wrapper.rb +6 -6
  32. data/lib/volt/models/persistors/array_store.rb +36 -36
  33. data/lib/volt/models/persistors/base.rb +6 -6
  34. data/lib/volt/models/persistors/flash.rb +5 -5
  35. data/lib/volt/models/persistors/model_identity_map.rb +2 -2
  36. data/lib/volt/models/persistors/model_store.rb +22 -22
  37. data/lib/volt/models/persistors/params.rb +3 -3
  38. data/lib/volt/models/persistors/query/query_listener.rb +14 -14
  39. data/lib/volt/models/persistors/query/query_listener_pool.rb +2 -2
  40. data/lib/volt/models/persistors/store.rb +8 -8
  41. data/lib/volt/models/persistors/store_factory.rb +2 -2
  42. data/lib/volt/models/url.rb +37 -37
  43. data/lib/volt/page/bindings/attribute_binding.rb +14 -14
  44. data/lib/volt/page/bindings/base_binding.rb +9 -9
  45. data/lib/volt/page/bindings/component_binding.rb +7 -7
  46. data/lib/volt/page/bindings/content_binding.rb +3 -3
  47. data/lib/volt/page/bindings/each_binding.rb +13 -13
  48. data/lib/volt/page/bindings/event_binding.rb +4 -4
  49. data/lib/volt/page/bindings/if_binding.rb +12 -12
  50. data/lib/volt/page/bindings/template_binding.rb +30 -30
  51. data/lib/volt/page/channel.rb +19 -19
  52. data/lib/volt/page/channel_stub.rb +6 -6
  53. data/lib/volt/page/document.rb +2 -2
  54. data/lib/volt/page/document_events.rb +4 -4
  55. data/lib/volt/page/draw_cycle.rb +3 -3
  56. data/lib/volt/page/memory_test.rb +6 -6
  57. data/lib/volt/page/page.rb +19 -19
  58. data/lib/volt/page/reactive_template.rb +9 -9
  59. data/lib/volt/page/sub_context.rb +5 -5
  60. data/lib/volt/page/targets/attribute_section.rb +9 -9
  61. data/lib/volt/page/targets/attribute_target.rb +3 -3
  62. data/lib/volt/page/targets/base_section.rb +2 -2
  63. data/lib/volt/page/targets/binding_document/component_node.rb +23 -23
  64. data/lib/volt/page/targets/binding_document/html_node.rb +2 -2
  65. data/lib/volt/page/targets/dom_section.rb +40 -38
  66. data/lib/volt/page/targets/dom_target.rb +2 -2
  67. data/lib/volt/page/tasks.rb +12 -12
  68. data/lib/volt/page/template_renderer.rb +4 -4
  69. data/lib/volt/page/url_tracker.rb +6 -6
  70. data/lib/volt/reactive/array_extensions.rb +2 -2
  71. data/lib/volt/reactive/destructive_methods.rb +5 -5
  72. data/lib/volt/reactive/event_chain.rb +25 -25
  73. data/lib/volt/reactive/events.rb +33 -33
  74. data/lib/volt/reactive/object_tracker.rb +21 -21
  75. data/lib/volt/reactive/object_tracking.rb +2 -2
  76. data/lib/volt/reactive/reactive_array.rb +57 -57
  77. data/lib/volt/reactive/reactive_tags.rb +16 -16
  78. data/lib/volt/reactive/reactive_value.rb +72 -72
  79. data/lib/volt/reactive/string_extensions.rb +3 -3
  80. data/lib/volt/router/routes.rb +22 -23
  81. data/lib/volt/server/component_handler.rb +5 -5
  82. data/lib/volt/server/component_templates.rb +14 -11
  83. data/lib/volt/server/html_parser/attribute_scope.rb +116 -0
  84. data/lib/volt/server/html_parser/each_scope.rb +18 -0
  85. data/lib/volt/server/html_parser/if_view_scope.rb +71 -0
  86. data/lib/volt/server/html_parser/sandlebars_parser.rb +219 -0
  87. data/lib/volt/server/html_parser/textarea_scope.rb +31 -0
  88. data/lib/volt/server/html_parser/view_handler.rb +82 -0
  89. data/lib/volt/server/html_parser/view_parser.rb +23 -0
  90. data/lib/volt/server/html_parser/view_scope.rb +145 -0
  91. data/lib/volt/server/rack/asset_files.rb +17 -17
  92. data/lib/volt/server/rack/component_paths.rb +18 -18
  93. data/lib/volt/server/rack/index_files.rb +8 -8
  94. data/lib/volt/server/rack/opal_files.rb +11 -11
  95. data/lib/volt/server/socket_connection_handler.rb +13 -13
  96. data/lib/volt/server/socket_connection_handler_stub.rb +2 -2
  97. data/lib/volt/server.rb +18 -18
  98. data/lib/volt/tasks/dispatcher.rb +5 -5
  99. data/lib/volt/utils/ejson.rb +2 -2
  100. data/lib/volt/utils/generic_counting_pool.rb +8 -8
  101. data/lib/volt/utils/generic_pool.rb +16 -16
  102. data/lib/volt/volt/environment.rb +4 -4
  103. data/lib/volt.rb +6 -6
  104. data/spec/integration/test_integration_spec.rb +2 -2
  105. data/spec/models/event_chain_spec.rb +38 -38
  106. data/spec/models/model_spec.rb +128 -128
  107. data/spec/models/old_model_spec.rb +17 -17
  108. data/spec/models/persistors/params_spec.rb +3 -3
  109. data/spec/models/persistors/store_spec.rb +7 -7
  110. data/spec/models/reactive_array_spec.rb +82 -82
  111. data/spec/models/reactive_generator_spec.rb +11 -11
  112. data/spec/models/reactive_tags_spec.rb +6 -6
  113. data/spec/models/reactive_value_spec.rb +70 -70
  114. data/spec/models/store_spec.rb +4 -4
  115. data/spec/models/string_extensions_spec.rb +13 -13
  116. data/spec/page/bindings/content_binding_spec.rb +6 -6
  117. data/spec/page/sub_context_spec.rb +1 -1
  118. data/spec/router/routes_spec.rb +3 -3
  119. data/spec/server/html_parser/sample_page.html +595 -0
  120. data/spec/server/html_parser/sandlebars_parser_spec.rb +192 -0
  121. data/spec/server/html_parser/view_parser_spec.rb +286 -0
  122. data/spec/server/rack/asset_files_spec.rb +6 -6
  123. data/spec/server/rack/component_paths_spec.rb +5 -5
  124. data/spec/spec_helper.rb +4 -5
  125. data/spec/store/mongo_spec.rb +3 -3
  126. data/spec/tasks/live_query_spec.rb +6 -6
  127. data/spec/tasks/query_tasks.rb +4 -4
  128. data/spec/tasks/query_tracker_spec.rb +20 -20
  129. data/spec/templates/targets/binding_document/component_node_spec.rb +4 -4
  130. data/spec/templates/template_binding_spec.rb +28 -28
  131. data/spec/utils/generic_counting_pool_spec.rb +5 -5
  132. data/spec/utils/generic_pool_spec.rb +14 -14
  133. data/templates/newgem/app/newgem/views/index/index.html +1 -2
  134. data/templates/project/app/home/config/dependencies.rb +1 -1
  135. data/templates/project/app/home/controllers/index_controller.rb +1 -1
  136. data/templates/project/app/home/views/index/about.html +4 -6
  137. data/templates/project/app/home/views/index/home.html +4 -5
  138. data/templates/project/app/home/views/index/index.html +8 -9
  139. data/templates/project/spec/spec_helper.rb +1 -1
  140. metadata +17 -8
  141. data/lib/volt/server/binding_setup.rb +0 -2
  142. data/lib/volt/server/if_binding_setup.rb +0 -31
  143. data/lib/volt/server/scope.rb +0 -43
  144. data/lib/volt/server/template_parser.rb +0 -453
  145. data/spec/server/template_parser_spec.rb +0 -50
@@ -3,7 +3,7 @@ if RUBY_PLATFORM != 'opal'
3
3
  before do
4
4
  load File.join(File.dirname(__FILE__), "../../app/volt/tasks/live_query/live_query.rb")
5
5
  end
6
-
6
+
7
7
  # LiveQueryStub behaves as the front-end would with the changes to a
8
8
  # live query. Instead of passing changes to the models to the front
9
9
  # end, the changes are applied locally, then can be checked to see if
@@ -15,50 +15,50 @@ if RUBY_PLATFORM != 'opal'
15
15
  @query = {}
16
16
  @items = []
17
17
  end
18
-
18
+
19
19
  def notify_removed(ids, skip_channel)
20
20
  # Remove the id's that need to be removed
21
21
  @items.reject! {|item| ids.include?(item['_id']) }
22
22
  end
23
-
23
+
24
24
  def notify_added(index, data, skip_channel)
25
25
  @items.insert(index, data)
26
26
  end
27
-
27
+
28
28
  def notify_moved(id, index, skip_channel)
29
29
  item = @items.find {|item| item['_id'] == id }
30
30
  @items.delete(item)
31
-
31
+
32
32
  @items.insert(index, item)
33
33
  end
34
34
  end
35
-
35
+
36
36
  before do
37
37
  # Setup a live query stub
38
38
  @live_query = LiveQueryStub.new
39
39
  data_store = double('data store')
40
-
40
+
41
41
  # return an empty collection
42
42
  @items = []
43
43
  expect(data_store).to receive(:query).at_least(:once) { @items.dup }
44
-
44
+
45
45
  @query_tracker = QueryTracker.new(@live_query, data_store)
46
46
  @query_tracker.run
47
-
47
+
48
48
  end
49
-
49
+
50
50
  it "should add items" do
51
51
  @items = [
52
52
  {'_id' => 1, '_name' => 'one'}
53
53
  ]
54
-
54
+
55
55
  expect(@live_query.items).to eq([])
56
56
 
57
57
  @query_tracker.run
58
58
 
59
59
  expect(@live_query.items).to eq(@items)
60
60
  end
61
-
61
+
62
62
  it "should remove items" do
63
63
  @items = [
64
64
  {'_id' => 1, '_name' => 'one'},
@@ -66,14 +66,14 @@ if RUBY_PLATFORM != 'opal'
66
66
  ]
67
67
  @query_tracker.run
68
68
  expect(@live_query.items).to eq(@items)
69
-
69
+
70
70
  @items = [
71
71
  {'_id' => 2, '_name' => 'two'}
72
72
  ]
73
73
  @query_tracker.run
74
74
  expect(@live_query.items).to eq(@items)
75
75
  end
76
-
76
+
77
77
  it "should move items" do
78
78
  @items = [
79
79
  {'_id' => 1, '_name' => 'one'},
@@ -82,7 +82,7 @@ if RUBY_PLATFORM != 'opal'
82
82
  ]
83
83
  @query_tracker.run
84
84
  expect(@live_query.items).to eq(@items)
85
-
85
+
86
86
  @items = [
87
87
  {'_id' => 2, '_name' => 'two'},
88
88
  {'_id' => 3, '_name' => 'three'},
@@ -91,7 +91,7 @@ if RUBY_PLATFORM != 'opal'
91
91
  @query_tracker.run
92
92
  expect(@live_query.items).to eq(@items)
93
93
  end
94
-
94
+
95
95
  it "should handle complex transforms" do
96
96
  @items = [
97
97
  {'_id' => 1, '_name' => 'one'},
@@ -102,7 +102,7 @@ if RUBY_PLATFORM != 'opal'
102
102
  ]
103
103
  @query_tracker.run
104
104
  expect(@live_query.items).to eq(@items)
105
-
105
+
106
106
  @items = [
107
107
  {'_id' => 7, '_name' => 'seven'},
108
108
  {'_id' => 4, '_name' => 'four'},
@@ -113,8 +113,8 @@ if RUBY_PLATFORM != 'opal'
113
113
  ]
114
114
  @query_tracker.run
115
115
  expect(@live_query.items).to eq(@items)
116
-
116
+
117
117
  end
118
-
118
+
119
119
  end
120
- end
120
+ end
@@ -5,14 +5,14 @@ describe ComponentNode do
5
5
  html = <<-END
6
6
  <!-- $0 -->Before <!-- $1 -->Inside<!-- $/1 --> After<!-- $/0 -->
7
7
  END
8
-
8
+
9
9
  @component = ComponentNode.new
10
10
  @component.html = html
11
11
  end
12
-
12
+
13
13
  it "should find a component from a binding id" do
14
14
  expect(@component.find_by_binding_id(1).to_html).to eq('Inside')
15
15
  expect(@component.find_by_binding_id(0).to_html).to eq('Before Inside After')
16
-
16
+
17
17
  end
18
- end
18
+ end
@@ -11,94 +11,94 @@ describe TemplateBinding do
11
11
  before do
12
12
  @page = double('page')
13
13
  expect(@page).to receive(:templates).at_least(1).times.and_return { @templates }
14
-
14
+
15
15
  # TODO: We should decouple things so we don't need to allocate
16
16
  @template_binding = TemplateBinding.allocate
17
17
  @template_binding.instance_variable_set('@page', @page)
18
18
  @template_binding.setup_path('home/index/index')
19
19
  end
20
-
20
+
21
21
  def set_template(templates)
22
22
  @page.instance_variable_set('@templates', templates)
23
23
  end
24
-
24
+
25
25
  after do
26
26
  $page = nil
27
27
  end
28
-
28
+
29
29
  it "should lookup sub-templates within its own file" do
30
30
  @templates = {
31
31
  'home/index/blog/nav' => '',
32
32
  'home/index/index/nav' => '',
33
33
  }
34
-
34
+
35
35
  expect(@template_binding.path_for_template('nav').first).to eq('home/index/index/nav')
36
36
  end
37
-
37
+
38
38
  it "should lookup sub-templates within another local view" do
39
39
  @templates = {
40
40
  'home/index/blog/nav' => '',
41
41
  'home/index/index/nav' => '',
42
42
  }
43
-
43
+
44
44
  expect(@template_binding.path_for_template('blog/nav').first).to eq('home/index/blog/nav')
45
45
  end
46
-
46
+
47
47
  it "should lookup in another view" do
48
48
  @templates = {
49
49
  'home/index/nav/body' => '',
50
50
  }
51
-
52
- expect(@template_binding.path_for_template('nav').first).to eq('home/index/nav/body')
51
+
52
+ expect(@template_binding.path_for_template('nav').first).to eq('home/index/nav/body')
53
53
  end
54
-
54
+
55
55
  it "should lookup in a controller" do
56
56
  @templates = {
57
57
  'home/nav/index/body' => ''
58
58
  }
59
-
60
- expect(@template_binding.path_for_template('nav').first).to eq('home/nav/index/body')
59
+
60
+ expect(@template_binding.path_for_template('nav').first).to eq('home/nav/index/body')
61
61
  end
62
-
62
+
63
63
  it "should lookup in a controller/view" do
64
64
  @templates = {
65
65
  'home/blog/nav/body' => ''
66
66
  }
67
-
68
- expect(@template_binding.path_for_template('blog/nav').first).to eq('home/blog/nav/body')
67
+
68
+ expect(@template_binding.path_for_template('blog/nav').first).to eq('home/blog/nav/body')
69
69
  end
70
-
70
+
71
71
  it "should lookup in a controller" do
72
72
  @templates = {
73
73
  'home/nav/index/body' => ''
74
74
  }
75
-
76
- expect(@template_binding.path_for_template('nav').first).to eq('home/nav/index/body')
75
+
76
+ expect(@template_binding.path_for_template('nav').first).to eq('home/nav/index/body')
77
77
  end
78
-
78
+
79
79
  it "should lookup in a component" do
80
80
  @templates = {
81
81
  'nav/index/index/body' => ''
82
82
  }
83
-
84
- expect(@template_binding.path_for_template('nav').first).to eq('nav/index/index/body')
83
+
84
+ expect(@template_binding.path_for_template('nav').first).to eq('nav/index/index/body')
85
85
  end
86
-
86
+
87
87
  it "should lookup in a component/controller/view" do
88
88
  @templates = {
89
89
  'nav/index/index/body' => '',
90
90
  'auth/login/new/body' => ''
91
91
  }
92
-
92
+
93
93
  expect(@template_binding.path_for_template('auth/login/new').first).to eq('auth/login/new/body')
94
94
  end
95
-
95
+
96
96
  it "should let you force a sub template" do
97
97
  @templates = {
98
98
  'nav/index/index/title' => '',
99
99
  'auth/login/new/title' => ''
100
100
  }
101
-
102
- expect(@template_binding.path_for_template('nav', 'title').first).to eq('nav/index/index/title')
101
+
102
+ expect(@template_binding.path_for_template('nav', 'title').first).to eq('nav/index/index/title')
103
103
  end
104
- end
104
+ end
@@ -10,17 +10,17 @@ describe GenericCountingPool do
10
10
  before do
11
11
  @count_pool = CountingPoolTest.new
12
12
  end
13
-
13
+
14
14
  it "should lookup and retrieve" do
15
15
  item1 = @count_pool.find('one')
16
-
16
+
17
17
  item2 = @count_pool.find('one')
18
18
  item3 = @count_pool.find('two')
19
-
19
+
20
20
  expect(item1).to eq(item2)
21
21
  expect(item2).to_not eq(item3)
22
22
  end
23
-
23
+
24
24
  it "should only remove items when the same number have been removed as have been added" do
25
25
  item1 = @count_pool.find('_items', 'one')
26
26
  item2 = @count_pool.find('_items', 'one')
@@ -31,6 +31,6 @@ describe GenericCountingPool do
31
31
 
32
32
  @count_pool.remove('_items', 'one')
33
33
  expect(@count_pool.instance_variable_get('@pool')).to eq({})
34
-
34
+
35
35
  end
36
36
  end
@@ -11,40 +11,40 @@ describe GenericPool do
11
11
  before do
12
12
  @pool_test = PoolTest.new
13
13
  end
14
-
14
+
15
15
  it "should insert nested for fast lookup at a path" do
16
16
  item1 = @pool_test.lookup('_items', 'one')
17
17
  expect(@pool_test.instance_variable_get('@pool')).to eq({'_items' => {'one' => item1}})
18
18
  end
19
-
19
+
20
20
  it "should retrieve the same item both times" do
21
- item1 = @pool_test.lookup('_items', {})
21
+ item1 = @pool_test.lookup('_items', {})
22
22
  item2 = @pool_test.lookup('_items', {})
23
- expect(item1.object_id).to eq(item2.object_id)
23
+ expect(item1.object_id).to eq(item2.object_id)
24
24
  end
25
-
25
+
26
26
  it "should recreate after being removed" do
27
- item1 = @pool_test.lookup('_items', {})
27
+ item1 = @pool_test.lookup('_items', {})
28
28
  item2 = @pool_test.lookup('_items', {})
29
29
  expect(item1.object_id).to eq(item2.object_id)
30
-
30
+
31
31
  @pool_test.remove('_items', {})
32
32
  item3 = @pool_test.lookup('_items', {})
33
33
  expect(item3.object_id).to_not eq(item2.object_id)
34
34
  end
35
-
35
+
36
36
  it "should remove all of the way down" do
37
37
  @pool_test.instance_variable_set('@pool', {:name => {:ok => true}, :yep => true})
38
-
38
+
39
39
  @pool_test.remove(:name, :ok)
40
-
40
+
41
41
  expect(@pool_test.instance_variable_get('@pool')).to eq({:yep => true})
42
42
  end
43
-
43
+
44
44
  it "should lookup all items at a path" do
45
- item1 = @pool_test.lookup('_items', '_some', {:name => 'bob'})
45
+ item1 = @pool_test.lookup('_items', '_some', {:name => 'bob'})
46
46
  item2 = @pool_test.lookup('_items', '_some', {:name => 'jim'})
47
-
47
+
48
48
  expect(@pool_test.lookup_all('_items', '_some')).to eq([item1, item2])
49
49
  end
50
- end
50
+ end
@@ -1,3 +1,2 @@
1
- <:body>
1
+ <:Body>
2
2
  -- component --
3
- </:body>
@@ -1,4 +1,4 @@
1
- # Specify which components you wish to include when
1
+ # Specify which components you wish to include when
2
2
  # the "home" component loads.
3
3
 
4
4
  # bootstrap css framework
@@ -3,7 +3,7 @@ class IndexController < ModelController
3
3
 
4
4
  def initialize
5
5
  super
6
-
6
+
7
7
  # Add controller setup code here
8
8
  end
9
9
  end
@@ -1,9 +1,7 @@
1
- <:title>
2
- About
3
- </:title>
1
+ <:Title>
2
+ About
4
3
 
5
- <:body>
4
+ <:Body>
6
5
  <h1>About</h1>
7
-
6
+
8
7
  <p>About page...</p>
9
- </:body>
@@ -1,7 +1,6 @@
1
- <:title>
2
- Home
3
- </:title>
1
+ <:Title>
2
+ Home
4
3
 
5
- <:body>
4
+ <:Body>
6
5
  <h1>Home</h1>
7
- </:body>
6
+
@@ -1,8 +1,7 @@
1
- <:title>
1
+ <:Title>
2
2
  {#template params._view.or('home'), "title"}
3
- </:title>
4
3
 
5
- <:body>
4
+ <:Body>
6
5
  <div class="container">
7
6
  <div class="header">
8
7
  <ul class="nav nav-pills pull-right">
@@ -11,20 +10,20 @@
11
10
  </ul>
12
11
  <h3 class="text-muted">Project name</h3>
13
12
  </div>
14
-
13
+
15
14
  <:volt:notices />
16
-
15
+
17
16
  {#template params._view.or('home')}
18
-
17
+
19
18
  <div class="footer">
20
19
  <p>&copy; Company 2014</p>
21
20
  </div>
22
21
 
23
22
  </div>
24
- </:body>
25
23
 
26
- <:nav>
24
+
25
+ <:Nav>
27
26
  <li class="{#if params._view.or('') == view}active{/}">
28
27
  <a href="/{view}">{text}</a>
29
28
  </li>
30
- </:nav>
29
+
@@ -15,6 +15,6 @@ RSpec.configure do |config|
15
15
  # the seed, which is printed after each run.
16
16
  # --seed 1234
17
17
  config.order = 'random'
18
-
18
+
19
19
  config.enable_any_instance_mocks = true
20
20
  end
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.6.5
4
+ version: 0.7.0
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-02-18 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -425,6 +425,7 @@ files:
425
425
  - lib/volt/assets/test.rb
426
426
  - lib/volt/benchmark/benchmark.rb
427
427
  - lib/volt/cli.rb
428
+ - lib/volt/cli/asset_compile.rb
428
429
  - lib/volt/cli/new_gem.rb
429
430
  - lib/volt/console.rb
430
431
  - lib/volt/controllers/model_controller.rb
@@ -498,19 +499,23 @@ files:
498
499
  - lib/volt/router/routes.rb
499
500
  - lib/volt/server.rb
500
501
  - lib/volt/server/banner.txt
501
- - lib/volt/server/binding_setup.rb
502
502
  - lib/volt/server/component_handler.rb
503
503
  - lib/volt/server/component_templates.rb
504
- - lib/volt/server/if_binding_setup.rb
504
+ - lib/volt/server/html_parser/attribute_scope.rb
505
+ - lib/volt/server/html_parser/each_scope.rb
506
+ - lib/volt/server/html_parser/if_view_scope.rb
507
+ - lib/volt/server/html_parser/sandlebars_parser.rb
508
+ - lib/volt/server/html_parser/textarea_scope.rb
509
+ - lib/volt/server/html_parser/view_handler.rb
510
+ - lib/volt/server/html_parser/view_parser.rb
511
+ - lib/volt/server/html_parser/view_scope.rb
505
512
  - lib/volt/server/rack/asset_files.rb
506
513
  - lib/volt/server/rack/component_paths.rb
507
514
  - lib/volt/server/rack/index_files.rb
508
515
  - lib/volt/server/rack/opal_files.rb
509
516
  - lib/volt/server/rack/source_map_server.rb
510
- - lib/volt/server/scope.rb
511
517
  - lib/volt/server/socket_connection_handler.rb
512
518
  - lib/volt/server/socket_connection_handler_stub.rb
513
- - lib/volt/server/template_parser.rb
514
519
  - lib/volt/store/mongo.rb
515
520
  - lib/volt/tasks/dispatcher.rb
516
521
  - lib/volt/utils/ejson.rb
@@ -542,9 +547,11 @@ files:
542
547
  - spec/page/bindings/content_binding_spec.rb
543
548
  - spec/page/sub_context_spec.rb
544
549
  - spec/router/routes_spec.rb
550
+ - spec/server/html_parser/sample_page.html
551
+ - spec/server/html_parser/sandlebars_parser_spec.rb
552
+ - spec/server/html_parser/view_parser_spec.rb
545
553
  - spec/server/rack/asset_files_spec.rb
546
554
  - spec/server/rack/component_paths_spec.rb
547
- - spec/server/template_parser_spec.rb
548
555
  - spec/spec_helper.rb
549
556
  - spec/store/mongo_spec.rb
550
557
  - spec/tasks/live_query_spec.rb
@@ -644,9 +651,11 @@ test_files:
644
651
  - spec/page/bindings/content_binding_spec.rb
645
652
  - spec/page/sub_context_spec.rb
646
653
  - spec/router/routes_spec.rb
654
+ - spec/server/html_parser/sample_page.html
655
+ - spec/server/html_parser/sandlebars_parser_spec.rb
656
+ - spec/server/html_parser/view_parser_spec.rb
647
657
  - spec/server/rack/asset_files_spec.rb
648
658
  - spec/server/rack/component_paths_spec.rb
649
- - spec/server/template_parser_spec.rb
650
659
  - spec/spec_helper.rb
651
660
  - spec/store/mongo_spec.rb
652
661
  - spec/tasks/live_query_spec.rb
@@ -1,2 +0,0 @@
1
- class BindingSetup
2
- end
@@ -1,31 +0,0 @@
1
- # With if bindings, we need to track each branch, which is on the
2
- # same scope level as the original if statement. We use this class
3
- # to track each branch.
4
-
5
- require 'volt/server/binding_setup'
6
- class IfBindingSetup < BindingSetup
7
- def initialize
8
- @branches = []
9
- end
10
-
11
- def add_branch(content, template_name)
12
- @branches << [content, template_name]
13
- end
14
-
15
- def to_setup_code
16
- branches = @branches.map do |branch|
17
- content = branch[0]
18
- if content == nil
19
- content = nil.inspect
20
- else
21
- content = "Proc.new { #{branch[0]} }"
22
- end
23
-
24
- "[#{content}, #{branch[1].inspect}]"
25
- end.join(', ')
26
-
27
- # variables are captured for branches, so we must prefix them so they don't conflict.
28
- # page, target, context, id
29
- "lambda { |__p, __t, __c, __id| IfBinding.new(__p, __t, __c, __id, [#{branches}]) }"
30
- end
31
- end
@@ -1,43 +0,0 @@
1
- # Template parsing is fairly simple at the moment. Basically we walk the dom and
2
- # do two types of replacements.
3
- # 1) replacement in text nodes
4
- # 2) attribute replacements
5
-
6
- class Scope
7
- attr_accessor :bindings, :outer_binding_number, :closed_block_scopes, :last_if_binding
8
-
9
- def initialize(outer_binding_number=nil)
10
- # For block bindings, the outer binding number lets us know what the name
11
- # of the comments are that go before/after this scope block.
12
- @outer_binding_number = outer_binding_number
13
- @bindings = {}
14
- end
15
-
16
- def add_closed_child_scope(scope)
17
- @closed_block_scopes ||= []
18
- @closed_block_scopes << scope
19
- end
20
-
21
- def add_binding(binding_name, setup_code)
22
- @bindings[binding_name] ||= []
23
- @bindings[binding_name] << setup_code
24
- end
25
-
26
- def start_if_binding(binding_name, if_binding_setup)
27
- @last_if_binding = [binding_name, if_binding_setup]
28
- end
29
-
30
- def current_if_binding
31
- @last_if_binding
32
- end
33
-
34
- def close_if_binding!
35
- if @last_if_binding
36
- binding_name, if_binding_setup = @last_if_binding
37
- @last_if_binding = nil
38
-
39
- add_binding(binding_name, if_binding_setup.to_setup_code)
40
- end
41
- end
42
-
43
- end