volt 0.8.27.beta3 → 0.8.27.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/CHANGELOG.md +11 -0
  4. data/CONTRIBUTING.md +3 -2
  5. data/{Readme.md → README.md} +9 -12
  6. data/Rakefile +2 -9
  7. data/VERSION +1 -1
  8. data/app/volt/models/user.rb +8 -0
  9. data/app/volt/tasks/live_query/data_store.rb +13 -5
  10. data/app/volt/tasks/live_query/live_query.rb +45 -3
  11. data/app/volt/tasks/live_query/live_query_pool.rb +9 -1
  12. data/app/volt/tasks/query_tasks.rb +20 -2
  13. data/app/volt/tasks/store_tasks.rb +37 -20
  14. data/app/volt/tasks/user_tasks.rb +15 -13
  15. data/lib/volt/boot.rb +5 -3
  16. data/lib/volt/cli/console.rb +1 -0
  17. data/lib/volt/cli/generate.rb +15 -0
  18. data/lib/volt/cli.rb +19 -12
  19. data/lib/volt/config.rb +1 -1
  20. data/lib/volt/controllers/model_controller.rb +13 -3
  21. data/lib/volt/extra_core/extra_core.rb +1 -0
  22. data/lib/volt/extra_core/hash.rb +26 -0
  23. data/lib/volt/extra_core/object.rb +5 -1
  24. data/lib/volt/models/array_model.rb +86 -35
  25. data/lib/volt/models/associations.rb +53 -0
  26. data/lib/volt/models/buffer.rb +22 -10
  27. data/lib/volt/models/dirty.rb +88 -0
  28. data/lib/volt/models/errors.rb +21 -0
  29. data/lib/volt/models/field_helpers.rb +2 -2
  30. data/lib/volt/models/listener_tracker.rb +17 -0
  31. data/lib/volt/models/model.rb +213 -69
  32. data/lib/volt/models/model_helpers.rb +27 -17
  33. data/lib/volt/models/permissions.rb +246 -0
  34. data/lib/volt/models/persistors/array_store.rb +149 -81
  35. data/lib/volt/models/persistors/base.rb +16 -0
  36. data/lib/volt/models/persistors/cookies.rb +14 -9
  37. data/lib/volt/models/persistors/flash.rb +3 -0
  38. data/lib/volt/models/persistors/local_store.rb +0 -16
  39. data/lib/volt/models/persistors/model_store.rb +1 -2
  40. data/lib/volt/models/persistors/query/normalizer.rb +51 -0
  41. data/lib/volt/models/persistors/query/query_listener.rb +21 -5
  42. data/lib/volt/models/persistors/query/query_listener_pool.rb +0 -9
  43. data/lib/volt/models/persistors/store.rb +8 -0
  44. data/lib/volt/models/persistors/store_state.rb +4 -27
  45. data/lib/volt/models/state_helpers.rb +11 -0
  46. data/lib/volt/models/state_manager.rb +43 -0
  47. data/lib/volt/models/url.rb +5 -5
  48. data/lib/volt/models/validations.rb +38 -41
  49. data/lib/volt/models/validators/email_validator.rb +4 -9
  50. data/lib/volt/models/validators/format_validator.rb +23 -8
  51. data/lib/volt/models/validators/length_validator.rb +2 -2
  52. data/lib/volt/models/validators/numericality_validator.rb +7 -3
  53. data/lib/volt/models/validators/phone_number_validator.rb +4 -9
  54. data/lib/volt/models/validators/presence_validator.rb +2 -2
  55. data/lib/volt/models/validators/unique_validator.rb +2 -2
  56. data/lib/volt/models/validators/user_validation.rb +6 -0
  57. data/lib/volt/models.rb +8 -3
  58. data/lib/volt/page/bindings/attribute_binding.rb +10 -4
  59. data/lib/volt/page/bindings/content_binding.rb +9 -5
  60. data/lib/volt/page/bindings/if_binding.rb +25 -2
  61. data/lib/volt/page/bindings/template_binding.rb +19 -1
  62. data/lib/volt/page/bindings/yield_binding.rb +31 -0
  63. data/lib/volt/page/page.rb +11 -16
  64. data/lib/volt/reactive/class_eventable.rb +71 -0
  65. data/lib/volt/reactive/computation.rb +79 -10
  66. data/lib/volt/reactive/dependency.rb +27 -8
  67. data/lib/volt/reactive/eventable.rb +36 -22
  68. data/lib/volt/reactive/reactive_array.rb +2 -3
  69. data/lib/volt/reactive/reactive_hash.rb +8 -3
  70. data/lib/volt/router/routes.rb +2 -1
  71. data/lib/volt/server/component_templates.rb +0 -2
  72. data/lib/volt/server/html_parser/component_view_scope.rb +59 -0
  73. data/lib/volt/server/html_parser/view_handler.rb +3 -0
  74. data/lib/volt/server/html_parser/view_parser.rb +1 -0
  75. data/lib/volt/server/html_parser/view_scope.rb +17 -41
  76. data/lib/volt/server/rack/component_paths.rb +1 -10
  77. data/lib/volt/server/rack/index_files.rb +9 -4
  78. data/lib/volt/server/rack/opal_files.rb +22 -14
  79. data/lib/volt/server/rack/quiet_common_logger.rb +1 -1
  80. data/lib/volt/server/socket_connection_handler.rb +4 -0
  81. data/lib/volt/spec/setup.rb +26 -0
  82. data/lib/volt/tasks/dispatcher.rb +11 -0
  83. data/lib/volt/utils/event_counter.rb +29 -0
  84. data/lib/volt/utils/generic_pool.rb +12 -0
  85. data/lib/volt/utils/modes.rb +40 -0
  86. data/lib/volt/utils/promise_patch.rb +66 -0
  87. data/lib/volt/utils/timers.rb +33 -0
  88. data/lib/volt/volt/users.rb +48 -5
  89. data/lib/volt.rb +4 -0
  90. data/spec/apps/kitchen_sink/Gemfile +3 -1
  91. data/spec/apps/kitchen_sink/app/main/config/routes.rb +9 -8
  92. data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +9 -0
  93. data/spec/apps/kitchen_sink/app/main/controllers/yield_component_controller.rb +5 -0
  94. data/spec/apps/kitchen_sink/app/main/views/main/cookie_test.html +1 -1
  95. data/spec/apps/kitchen_sink/app/main/views/main/index.html +1 -1
  96. data/spec/apps/kitchen_sink/app/main/views/main/main.html +2 -1
  97. data/spec/apps/kitchen_sink/app/main/views/main/yield.html +18 -0
  98. data/spec/apps/kitchen_sink/app/main/views/yield-component/index.html +4 -0
  99. data/spec/extra_core/logger_spec.rb +4 -2
  100. data/spec/integration/user_spec.rb +42 -42
  101. data/spec/integration/yield_spec.rb +18 -0
  102. data/spec/models/associations_spec.rb +37 -0
  103. data/spec/models/dirty_spec.rb +102 -0
  104. data/spec/models/model_spec.rb +64 -8
  105. data/spec/models/model_state_spec.rb +24 -0
  106. data/spec/models/permissions_spec.rb +96 -0
  107. data/spec/models/user_spec.rb +8 -5
  108. data/spec/models/user_validation_spec.rb +24 -0
  109. data/spec/models/validations_spec.rb +44 -5
  110. data/spec/models/validators/email_validator_spec.rb +109 -82
  111. data/spec/models/validators/format_validator_spec.rb +4 -107
  112. data/spec/models/validators/length_validator_spec.rb +9 -9
  113. data/spec/models/validators/phone_number_validator_spec.rb +60 -103
  114. data/spec/models/validators/shared_examples_for_validators.rb +123 -0
  115. data/spec/reactive/class_eventable_spec.rb +37 -0
  116. data/spec/reactive/computation_spec.rb +68 -3
  117. data/spec/reactive/dependency_spec.rb +71 -0
  118. data/spec/reactive/eventable_spec.rb +21 -0
  119. data/spec/reactive/reactive_hash_spec.rb +12 -0
  120. data/spec/router/routes_spec.rb +50 -50
  121. data/spec/server/html_parser/view_parser_spec.rb +0 -3
  122. data/spec/server/rack/component_paths_spec.rb +11 -0
  123. data/spec/server/rack/quite_common_logger_spec.rb +3 -4
  124. data/spec/spec_helper.rb +7 -3
  125. data/templates/component/config/dependencies.rb +1 -7
  126. data/templates/component/config/routes.rb +1 -1
  127. data/templates/component/controllers/main_controller.rb.tt +20 -0
  128. data/templates/component/views/{index → main}/index.html.tt +0 -0
  129. data/templates/newgem/lib/newgem.rb.tt +1 -3
  130. data/templates/project/app/main/config/routes.rb +3 -3
  131. data/templates/project/app/main/views/main/main.html.tt +4 -4
  132. data/templates/project/config/app.rb.tt +6 -0
  133. data/volt.gemspec +11 -7
  134. metadata +96 -42
  135. data/lib/volt/models/model_state.rb +0 -21
  136. data/templates/component/controllers/main_controller.rb +0 -18
@@ -9,18 +9,18 @@ end
9
9
  describe Volt::Routes do
10
10
  it 'should setup direct routes' do
11
11
  routes do
12
- get '/', _view: 'index'
13
- get '/page1', _view: 'first_page'
12
+ get '/', view: 'index'
13
+ get '/page1', view: 'first_page'
14
14
  end
15
15
 
16
16
  direct_routes = @routes.instance_variable_get(:@direct_routes)
17
- expect(direct_routes).to eq('/' => { _view: 'index' }, '/page1' => { _view: 'first_page' })
17
+ expect(direct_routes).to eq('/' => { view: 'index' }, '/page1' => { view: 'first_page' })
18
18
  end
19
19
 
20
20
  it 'should setup indirect routes' do
21
21
  routes do
22
- get '/blog/{{ _id }}/edit', _view: 'blog/edit'
23
- get '/blog/{{ _id }}', _view: 'blog/show'
22
+ get '/blog/{{ id }}/edit', view: 'blog/edit'
23
+ get '/blog/{{ id }}', view: 'blog/show'
24
24
  end
25
25
 
26
26
  indirect_routes = @routes.instance_variable_get(:@indirect_routes)
@@ -28,9 +28,9 @@ describe Volt::Routes do
28
28
  'blog' => {
29
29
  '*' => {
30
30
  'edit' => {
31
- nil => { _view: 'blog/edit', _id: 1 }
31
+ nil => { view: 'blog/edit', id: 1 }
32
32
  },
33
- nil => { _view: 'blog/show', _id: 1 }
33
+ nil => { view: 'blog/show', id: 1 }
34
34
  }
35
35
  }
36
36
  )
@@ -38,31 +38,31 @@ describe Volt::Routes do
38
38
 
39
39
  it 'should match routes' do
40
40
  routes do
41
- get '/blog', _view: 'blog'
42
- get '/blog/{{ _id }}', _view: 'blog/show'
43
- get '/blog/{{ _id }}/draft', _view: 'blog/draft', _action: 'draft'
44
- get '/blog/{{ _id }}/edit', _view: 'blog/edit'
45
- get '/blog/tags/{{ _tag }}', _view: 'blog/tag'
46
- get '/login/{{ _name }}/user/{{ _id }}', _view: 'login', _action: 'user'
41
+ get '/blog', view: 'blog'
42
+ get '/blog/{{ id }}', view: 'blog/show'
43
+ get '/blog/{{ id }}/draft', view: 'blog/draft', action: 'draft'
44
+ get '/blog/{{ id }}/edit', view: 'blog/edit'
45
+ get '/blog/tags/{{ _tag }}', view: 'blog/tag'
46
+ get '/login/{{ name }}/user/{{ id }}', view: 'login', action: 'user'
47
47
  end
48
48
 
49
49
  params = @routes.url_to_params('/blog')
50
- expect(params).to eq(_view: 'blog')
50
+ expect(params).to eq(view: 'blog')
51
51
 
52
52
  params = @routes.url_to_params('/blog/55/edit')
53
- expect(params).to eq(_view: 'blog/edit', _id: '55')
53
+ expect(params).to eq(view: 'blog/edit', id: '55')
54
54
 
55
55
  params = @routes.url_to_params('/blog/55')
56
- expect(params).to eq(_view: 'blog/show', _id: '55')
56
+ expect(params).to eq(view: 'blog/show', id: '55')
57
57
 
58
58
  params = @routes.url_to_params('/blog/tags/good')
59
- expect(params).to eq(_view: 'blog/tag', _tag: 'good')
59
+ expect(params).to eq(view: 'blog/tag', _tag: 'good')
60
60
 
61
61
  params = @routes.url_to_params('/blog/55/draft')
62
- expect(params).to eq(_view: 'blog/draft', _id: '55', _action: 'draft')
62
+ expect(params).to eq(view: 'blog/draft', id: '55', action: 'draft')
63
63
 
64
64
  params = @routes.url_to_params('/login/jim/user/10')
65
- expect(params).to eq(_view: 'login', _action: 'user', _name: 'jim', _id: '10')
65
+ expect(params).to eq(view: 'login', action: 'user', name: 'jim', id: '10')
66
66
 
67
67
  params = @routes.url_to_params('/login/cool')
68
68
  expect(params).to eq(false)
@@ -70,30 +70,30 @@ describe Volt::Routes do
70
70
 
71
71
  it 'should setup param matchers' do
72
72
  routes do
73
- get '/blog', _view: 'blog'
74
- get '/blog/{{ _id }}', _view: 'blog/show'
75
- get '/blog/{{ _id }}/edit', _view: 'blog/edit'
76
- get '/blog/tags/{{ _tag }}', _view: 'blog/tag'
77
- get '/login/{{ _name }}/user/{{ _id }}', _view: 'login', _action: 'user'
73
+ get '/blog', view: 'blog'
74
+ get '/blog/{{ id }}', view: 'blog/show'
75
+ get '/blog/{{ id }}/edit', view: 'blog/edit'
76
+ get '/blog/tags/{{ _tag }}', view: 'blog/tag'
77
+ get '/login/{{ name }}/user/{{ id }}', view: 'login', action: 'user'
78
78
  end
79
79
 
80
80
  param_matches = @routes.instance_variable_get(:@param_matches)
81
81
  expect(param_matches.map { |v| v[0] }).to eq([
82
- { _view: 'blog' },
83
- { _view: 'blog/show', _id: nil },
84
- { _view: 'blog/edit', _id: nil },
85
- { _view: 'blog/tag', _tag: nil },
86
- { _view: 'login', _action: 'user', _name: nil, _id: nil }
82
+ { view: 'blog' },
83
+ { view: 'blog/show', id: nil },
84
+ { view: 'blog/edit', id: nil },
85
+ { view: 'blog/tag', _tag: nil },
86
+ { view: 'login', action: 'user', name: nil, id: nil }
87
87
  ])
88
88
  end
89
89
 
90
90
  it 'should go from params to url' do
91
91
  routes do
92
- get '/blog', _view: 'blog'
93
- get '/blog/{{ _id }}', _view: 'blog/show'
94
- get '/blog/{{ _id }}/edit', _view: 'blog/edit'
95
- get '/blog/tags/{{ _tag }}', _view: 'blog/tag'
96
- get '/login/{{ _name }}/user/{{ _id }}', _view: 'login', _action: 'user'
92
+ get '/blog', view: 'blog'
93
+ get '/blog/{{ id }}', view: 'blog/show'
94
+ get '/blog/{{ id }}/edit', view: 'blog/edit'
95
+ get '/blog/tags/{{ _tag }}', view: 'blog/tag'
96
+ get '/login/{{ name }}/user/{{ id }}', view: 'login', action: 'user'
97
97
  end
98
98
 
99
99
  url, params = @routes.params_to_url(view: 'blog/show', id: '55')
@@ -106,32 +106,32 @@ describe Volt::Routes do
106
106
 
107
107
  url, params = @routes.params_to_url(view: 'blog/edit', id: '100', other: 'should_pass')
108
108
  expect(url).to eq('/blog/100/edit')
109
- expect(params).to eq(_other: 'should_pass')
109
+ expect(params).to eq(other: 'should_pass')
110
110
  end
111
111
 
112
112
  it 'should test that params match a param matcher' do
113
113
  routes = Volt::Routes.new
114
- match, params = routes.send(:check_params_match, { _view: 'blog', _id: '55' }, _view: 'blog', _id: nil)
114
+ match, params = routes.send(:check_params_match, { view: 'blog', id: '55' }, view: 'blog', id: nil)
115
115
  expect(match).to eq(true)
116
- expect(params).to eq(_id: '55')
116
+ expect(params).to eq(id: '55')
117
117
 
118
- match, params = routes.send(:check_params_match, { _view: 'blog', _id: '55' }, _view: 'blog', _id: '20')
118
+ match, params = routes.send(:check_params_match, { view: 'blog', id: '55' }, view: 'blog', id: '20')
119
119
  expect(match).to eq(false)
120
120
 
121
- match, params = routes.send(:check_params_match, { _view: 'blog', _name: { _title: 'Mr', _name: 'Bob' }, _id: '55' }, _view: 'blog', _id: nil, _name: { _title: 'Mr', _name: nil })
121
+ match, params = routes.send(:check_params_match, { view: 'blog', name: { _title: 'Mr', name: 'Bob' }, id: '55' }, view: 'blog', id: nil, name: { _title: 'Mr', name: nil })
122
122
  expect(match).to eq(true)
123
- expect(params).to eq(_id: '55')
123
+ expect(params).to eq(id: '55')
124
124
 
125
- # Check with an extra value _name._name
126
- match, params = routes.send(:check_params_match, { _view: 'blog', _name: { _title: 'Mr', _name: 'Bob' }, _id: '55' }, _view: 'blog', _id: nil, _name: { _title: 'Mr' })
125
+ # Check with an extra value name.name
126
+ match, params = routes.send(:check_params_match, { view: 'blog', name: { _title: 'Mr', name: 'Bob' }, id: '55' }, view: 'blog', id: nil, name: { _title: 'Mr' })
127
127
  expect(match).to eq(true)
128
- expect(params).to eq(_id: '55')
128
+ expect(params).to eq(id: '55')
129
129
 
130
- match, params = routes.send(:check_params_match, { _view: 'blog', _name: { _title: 'Mr', _name: 'Bob' }, _id: '55' }, _view: 'blog', _id: nil, _name: { _title: 'Phd' })
130
+ match, params = routes.send(:check_params_match, { view: 'blog', name: { _title: 'Mr', name: 'Bob' }, id: '55' }, view: 'blog', id: nil, name: { _title: 'Phd' })
131
131
  expect(match).to eq(false)
132
132
 
133
133
  # Check to make sure extra values in the params pass it.
134
- match, params = routes.send(:check_params_match, { _view: 'blog', _id: '55', _extra: 'some value' }, _view: 'blog', _id: '55')
134
+ match, params = routes.send(:check_params_match, { view: 'blog', id: '55', _extra: 'some value' }, view: 'blog', id: '55')
135
135
  expect(match).to eq(true)
136
136
  expect(params).to eq(_extra: 'some value')
137
137
  end
@@ -142,21 +142,21 @@ describe Volt::Routes do
142
142
  params._index = '5'
143
143
 
144
144
  routes do
145
- get '/', _controller: 'index'
146
- get '/blog', _controller: 'blog'
145
+ get '/', controller: 'index'
146
+ get '/blog', controller: 'blog'
147
147
  end
148
148
 
149
149
  path, cleaned_params = @routes.params_to_url(params.to_h)
150
150
  expect(path).to eq('/blog')
151
- expect(cleaned_params).to eq(_index: '5')
151
+ expect(cleaned_params).to eq(index: '5')
152
152
  end
153
153
 
154
154
  it 'should handle routes with bindings in them' do
155
155
  params = Volt::Model.new({}, persistor: Volt::Persistors::Params)
156
156
 
157
157
  routes do
158
- get '/', _controller: 'index'
159
- get '/blog/{{ _id }}', _controller: 'blog'
158
+ get '/', controller: 'index'
159
+ get '/blog/{{ id }}', controller: 'blog'
160
160
  end
161
161
 
162
162
  params = @routes.url_to_params('/blog/20')
@@ -186,7 +186,6 @@ describe Volt::ViewParser do
186
186
 
187
187
  view = Volt::ViewParser.new(html, 'main/main/main/body')
188
188
 
189
- # puts view.templates.inspect
190
189
  end
191
190
  it 'should setup a href single attribute binding correctly' do
192
191
  html = <<-END
@@ -194,8 +193,6 @@ describe Volt::ViewParser do
194
193
  END
195
194
 
196
195
  view = Volt::ViewParser.new(html, 'main/main/main/body')
197
-
198
- # puts view.templates.inspect
199
196
  end
200
197
 
201
198
  it 'should parse components' do
@@ -24,5 +24,16 @@ if RUBY_PLATFORM != 'opal'
24
24
  main_path = @component_paths.component_paths('main').first
25
25
  expect(main_path).to match(/spec\/apps\/file_loading\/app\/main$/)
26
26
  end
27
+
28
+ it 'should not return paths to non-volt gems' do
29
+ Gem.loaded_specs['fake-gem'] = Gem::Specification.new do |s|
30
+ s.name = 'fake-gem'
31
+ s.version = Gem::Version.new('1.0')
32
+ s.full_gem_path = '/home/volt/projects/volt-app'
33
+ end
34
+ app_folders = @component_paths.app_folders { |f| f }
35
+ expect(app_folders).to_not include('/home/volt/projects/volt-app/app')
36
+ Gem.loaded_specs.delete 'fake-gem'
37
+ end
27
38
  end
28
39
  end
@@ -9,7 +9,6 @@ unless RUBY_PLATFORM == 'opal'
9
9
 
10
10
  before(:each) do
11
11
  allow(app).to receive(:call)
12
- # puts "SUBJECT: #{subject.inspect}"
13
12
  subject.instance_variable_set :@app, app
14
13
  end
15
14
 
@@ -24,7 +23,7 @@ unless RUBY_PLATFORM == 'opal'
24
23
  allow(subject).to receive(:log)
25
24
  end
26
25
 
27
- context 'when request path has no file extension and request run over web socket' do
26
+ describe 'when request path has no file extension and request run over web socket' do
28
27
  let(:env) { {'REQUEST_PATH' => '/file'} }
29
28
 
30
29
  it "calls 'log' method" do
@@ -33,7 +32,7 @@ unless RUBY_PLATFORM == 'opal'
33
32
  end
34
33
  end
35
34
 
36
- context 'when request path has file extension' do
35
+ describe 'when request path has file extension' do
37
36
  let(:env) { {'REQUEST_PATH' => '/file.ext'} }
38
37
 
39
38
  it "doesn't call 'log' method" do
@@ -42,7 +41,7 @@ unless RUBY_PLATFORM == 'opal'
42
41
  end
43
42
  end
44
43
 
45
- context 'when request run over web socket' do
44
+ describe 'when request run over web socket' do
46
45
  let(:env) { {'REQUEST_PATH' => '/channel'} }
47
46
 
48
47
  it "doesn't call 'log' method" do
data/spec/spec_helper.rb CHANGED
@@ -2,10 +2,13 @@ require 'volt/spec/setup'
2
2
 
3
3
  unless RUBY_PLATFORM == 'opal'
4
4
  require 'pry-byebug'
5
- # Specs are run against the kitchen sink app
6
- kitchen_sink_path = File.expand_path(File.join(File.dirname(__FILE__), 'apps/kitchen_sink'))
7
- Volt.spec_setup(kitchen_sink_path)
5
+ end
6
+
7
+ # Specs are run against the kitchen sink app
8
+ kitchen_sink_path = File.expand_path(File.join(File.dirname(__FILE__), 'apps/kitchen_sink'))
9
+ Volt.spec_setup(kitchen_sink_path)
8
10
 
11
+ unless RUBY_PLATFORM == 'opal'
9
12
  RSpec.configure do |config|
10
13
  # config.before(:each) do
11
14
  # DataStore.new.drop_database
@@ -21,4 +24,5 @@ unless RUBY_PLATFORM == 'opal'
21
24
  config.order = 'random'
22
25
  # config.seed = '31241'
23
26
  end
27
+
24
28
  end
@@ -1,8 +1,2 @@
1
1
  # Specify which components you wish to include when
2
- # the "home" component loads.
3
-
4
- # bootstrap css framework
5
- component 'bootstrap'
6
-
7
- # a default theme for the bootstrap framework
8
- component 'bootstrap-jumbotron-theme'
2
+ # this component loads.
@@ -1,6 +1,6 @@
1
1
  # See https://github.com/voltrb/volt#routes for more info on routes
2
2
 
3
- get '/about', _action: 'about'
3
+ get '/about', action: 'about'
4
4
 
5
5
  # The main route, this should be last. It will match any params not previously matched.
6
6
  get '/', {}
@@ -0,0 +1,20 @@
1
+ module <%= config[:component_name].camelize %>
2
+ class MainController < Volt::ModelController
3
+ def index
4
+ # Add code for when the index view is loaded
5
+ end
6
+
7
+ def about
8
+ # Add code for when the about view is loaded
9
+ end
10
+
11
+ private
12
+
13
+ # the main template contains a #template binding that shows another
14
+ # template. This is the path to that template. It may change based
15
+ # on the params._controller and params._action values.
16
+ def main_path
17
+ params._controller.or('main') + '/' + params._action.or('index')
18
+ end
19
+ end
20
+ end
@@ -1,7 +1,5 @@
1
- require "<%=config[:namespaced_path]%>/version"
2
-
3
1
  <%- config[:constant_array].each_with_index do |c,i| -%>
4
- <%= ' '*i %>class <%= c %>
2
+ <%= ' '*i %><% if c == 'Volt' %>module<% else %>class<% end %> <%= c %>
5
3
  <%- end -%>
6
4
  <%= ' '*config[:constant_array].size %># Your code goes here...
7
5
  <%- (config[:constant_array].size-1).downto(0) do |i| -%>
@@ -1,10 +1,10 @@
1
1
  # See https://github.com/voltrb/volt#routes for more info on routes
2
2
 
3
- get '/about', _action: 'about'
3
+ get '/about', action: 'about'
4
4
 
5
5
  # Routes for login and signup, provided by user-templates component gem
6
- get '/signup', _controller: 'user-templates', _action: 'signup'
7
- get '/login', _controller: 'user-templates', _action: 'login'
6
+ get '/signup', controller: 'user-templates', action: 'signup'
7
+ get '/login', controller: 'user-templates', action: 'login'
8
8
 
9
9
  # The main route, this should be last. It will match any params not
10
10
  # previously matched.
@@ -5,8 +5,8 @@
5
5
  <div class="container">
6
6
  <div class="header">
7
7
  <ul class="nav nav-pills pull-right">
8
- <:nav href="/" text="Home" />
9
- <:nav href="/about" text="About" />
8
+ <:nav href="/">Home</:nav>
9
+ <:nav href="/about">About</:nav>
10
10
  <:user-templates:menu />
11
11
  </ul>
12
12
  <h3 class="text-muted"><%= config[:name] %></h3>
@@ -17,13 +17,13 @@
17
17
  {{ template main_path, 'body', {controller_group: 'main'} }}
18
18
 
19
19
  <div class="footer">
20
- <p>&copy; Company 2014</p>
20
+ <p>&copy; Company {{ Time.now.year }}</p>
21
21
  </div>
22
22
 
23
23
  </div>
24
24
 
25
25
  <:Nav>
26
26
  <li class="{{ if active_tab? }}active{{ end }}">
27
- <a href="{{ attrs.href }}">{{ attrs.text }}</a>
27
+ <a href="{{ attrs.href }}">{{ yield }}</a>
28
28
  </li>
29
29
 
@@ -4,6 +4,12 @@ Volt.configure do |config|
4
4
  # Your app secret is used for signing things like the user cookie so it can't
5
5
  # be tampered with. A random value is generated on new projects that will work
6
6
  # without the need to customize. Make sure this value doesn't leave your server.
7
+ #
8
+ # For added security we reccomend moving the app secret into an enviromnet. You can
9
+ # setup that like so:
10
+ #
11
+ # config.app_secret = ENV['APP_SECRET']
12
+ #
7
13
  config.app_secret = '<%= SecureRandom.urlsafe_base64(50) %>'
8
14
 
9
15
  # Database config all start with db_ and can be set either in the config
data/volt.gemspec CHANGED
@@ -25,20 +25,18 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency 'sprockets-sass', '~> 1.0.0'
26
26
  spec.add_dependency 'sass', '~> 3.2.5'
27
27
  spec.add_dependency 'mongo', '~> 1.9.0'
28
- spec.add_dependency 'rake', '~> 10.0.4'
29
28
  spec.add_dependency 'listen', '~> 2.8.0'
30
29
  spec.add_dependency 'uglifier', '>= 2.4.0'
31
- spec.add_dependency 'configurations', '~> 2.0.0.pre'
32
- spec.add_dependency 'yui-compressor', '>= 0.12.0'
33
- spec.add_dependency 'opal', '~> 0.6.0'
34
- spec.add_dependency 'opal-jquery', '~> 0.2.0'
30
+ spec.add_dependency "configurations", "~> 2.0.0.pre"
31
+ spec.add_dependency 'yui-compressor', '~> 0.12.0'
32
+ spec.add_dependency 'opal', '~> 0.7.0'
33
+ spec.add_dependency 'opal-jquery', '~> 0.3.0'
35
34
  spec.add_dependency 'rspec-core', '~> 3.1.0'
36
- spec.add_dependency 'rspec-expectations', '~> 3.1.0'
37
35
  spec.add_dependency 'capybara', '~> 2.4.2'
38
36
  spec.add_dependency 'selenium-webdriver', '~> 2.43.0'
39
37
  spec.add_dependency 'chromedriver2-helper', '~> 0.0.8'
40
38
  spec.add_dependency 'poltergeist', '~> 1.5.0'
41
- spec.add_dependency 'opal-rspec', '0.3.0.beta3'
39
+ spec.add_dependency 'opal-rspec', '0.4.0'
42
40
  spec.add_dependency 'bundler', '>= 1.5'
43
41
  spec.add_dependency 'volt-sockjs', '~> 0.3.4.4'
44
42
 
@@ -47,7 +45,13 @@ Gem::Specification.new do |spec|
47
45
 
48
46
  spec.add_development_dependency 'guard', '2.6.0' # bug in current guard
49
47
  spec.add_development_dependency 'guard-rspec', '~> 4.3.0'
48
+ spec.add_development_dependency 'rake', '~> 10.0.4'
49
+
50
+ # Yard and formatting
50
51
  spec.add_development_dependency 'yard', '~> 0.8.7.0'
52
+ spec.add_development_dependency 'redcarpet', '~> 3.2.2'
53
+ spec.add_development_dependency 'github-markup', '~> 1.3.1'
54
+
51
55
  spec.add_development_dependency 'sauce', '~> 3.5.3'
52
56
  spec.add_development_dependency 'sauce-connect', '~> 3.5.0'
53
57
  spec.add_development_dependency 'pry-byebug', '~> 2.0.0'