volt 0.9.6.pre1 → 0.9.6.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/lib/volt/models/helpers/change_helpers.rb +4 -1
- data/lib/volt/models/persistors/model_store.rb +4 -1
- data/lib/volt/reactive/computation.rb +11 -3
- data/lib/volt/server/template_handlers/view_processor.rb +6 -3
- data/lib/volt/tasks/dispatcher.rb +21 -4
- data/lib/volt/version.rb +1 -1
- data/lib/volt/volt/templates.rb +1 -1
- data/spec/apps/kitchen_sink/Gemfile +1 -1
- data/spec/apps/kitchen_sink/app/main/config/routes.rb +2 -0
- data/spec/apps/kitchen_sink/app/main/controllers/save_controller.rb +9 -0
- data/spec/apps/kitchen_sink/app/main/models/post.rb +5 -0
- data/spec/apps/kitchen_sink/app/main/views/save/index.html +10 -0
- data/spec/integration/save_spec.rb +13 -0
- data/spec/tasks/dispatcher_spec.rb +7 -2
- data/templates/project/Gemfile.tt +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16b909f645dc9943c62dcd512df36371ac4c1dfc
|
4
|
+
data.tar.gz: 3b1bc0f0bdeef3eef63f9f7fbcbf47042a9f3fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af36ac78914b63e4c3a1c9161a64ec36e85f317320540461bb5008852261a9c0f66a2016f9130d4578122fd4eab8f1bba62eff2e8c48746d9451d87bab66c09e
|
7
|
+
data.tar.gz: 909e57f674271f32315f0f987cb28035703ed949bd704fe601c7ad547a287b9262a10f45525964796f8c92d557102cb3e232f44a82761f7a6da43acf854b12f6
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
### Changed
|
8
8
|
- Finally tracked down an illusive memory leak.
|
9
9
|
- Computations now raise an error on their inital run, then log errors (via Volt.logger.error(..)) when running again (since they update on next tick)
|
10
|
+
- fixed template caching issue
|
10
11
|
|
11
12
|
## 0.9.5
|
12
13
|
### Breaking Changes
|
@@ -24,7 +24,10 @@ module Volt
|
|
24
24
|
return validate!.then do
|
25
25
|
# Buffers are allowed to be in an invalid state
|
26
26
|
unless buffer?
|
27
|
-
# First check that all local validations pass
|
27
|
+
# First check that all local validations pass. Any time any
|
28
|
+
# validations fail, the model is in an invalid state and won't
|
29
|
+
# persist. However, we want to be able to move the model
|
30
|
+
# towards a valid state one change at a time.
|
28
31
|
if error_in_changed_attributes?
|
29
32
|
# Some errors are present, revert changes
|
30
33
|
revert_changes!
|
@@ -114,7 +114,10 @@ module Volt
|
|
114
114
|
end.fail do |errors|
|
115
115
|
save_promises = @save_promises
|
116
116
|
@save_promises = nil
|
117
|
-
|
117
|
+
|
118
|
+
# Rewrap in Volt::Errors
|
119
|
+
errors = Volt::Errors.new(errors)
|
120
|
+
save_promises.each { |promise| promise.reject(errors) }
|
118
121
|
|
119
122
|
# Mark that we failed to save
|
120
123
|
@model.change_state_to(:saved_state, :save_failed)
|
@@ -41,9 +41,17 @@ module Volt
|
|
41
41
|
# Re-raise if we are in the initial run
|
42
42
|
raise
|
43
43
|
else
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
# Sometimes we get nil as the exception, not sure if thats an opal
|
45
|
+
# issue or what.
|
46
|
+
if e
|
47
|
+
msg = "Exception During Compute: " + e.inspect
|
48
|
+
msg += "\n" + e.backtrace.join("\n") if e.respond_to?(:backtrace)
|
49
|
+
Volt.logger.error(msg)
|
50
|
+
|
51
|
+
if RUBY_PLATFORM == 'opal'
|
52
|
+
`console.log(e);`
|
53
|
+
end
|
54
|
+
end
|
47
55
|
end
|
48
56
|
ensure
|
49
57
|
@computing = false
|
@@ -3,13 +3,13 @@ require 'opal/sprockets/processor'
|
|
3
3
|
require 'sprockets'
|
4
4
|
require 'tilt'
|
5
5
|
require 'opal/sprockets/processor'
|
6
|
+
require 'sprockets/uri_utils'
|
6
7
|
|
7
8
|
module Volt
|
8
9
|
|
9
10
|
|
10
11
|
|
11
12
|
class ViewProcessor < ::Opal::TiltTemplate
|
12
|
-
|
13
13
|
def initialize(client)
|
14
14
|
@client = client
|
15
15
|
end
|
@@ -49,6 +49,10 @@ module Volt
|
|
49
49
|
# puts input[:data].inspect
|
50
50
|
# Remove all semicolons from source
|
51
51
|
# input[:content_type] = 'application/javascript'
|
52
|
+
|
53
|
+
# Track the dependency
|
54
|
+
context.metadata[:dependencies] << Sprockets::URIUtils.build_file_digest_uri(input[:filename])
|
55
|
+
|
52
56
|
compile(filename, input[:data], context)
|
53
57
|
end
|
54
58
|
|
@@ -81,10 +85,9 @@ module Volt
|
|
81
85
|
|
82
86
|
def self.setup(sprockets=$volt_app.sprockets)
|
83
87
|
exts = ComponentTemplates::Preprocessors.extensions.map{ |ext| ".#{ext}" }
|
84
|
-
|
88
|
+
|
85
89
|
sprockets.register_mime_type 'application/vtemplate', extensions: exts
|
86
90
|
sprockets.register_transformer 'application/vtemplate', 'application/javascript', Volt::ViewProcessor.new(true)
|
87
91
|
end
|
88
92
|
end
|
89
93
|
end
|
90
|
-
|
@@ -151,11 +151,28 @@ module Volt
|
|
151
151
|
|
152
152
|
finish.call
|
153
153
|
end.fail do |error|
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
begin
|
155
|
+
finish.call(error)
|
156
|
+
|
157
|
+
begin
|
158
|
+
# Try to send, handle error if we can't convert the result to EJSON
|
159
|
+
reply = EJSON.stringify(['response', callback_id, nil, error, cookies])
|
160
|
+
|
161
|
+
# use send_string_message, since we stringify here, not on the other
|
162
|
+
# side of Drb.
|
163
|
+
channel.send_string_message(reply)
|
164
|
+
rescue EJSON::NonEjsonType => e
|
165
|
+
# Convert the error into a string so it can be serialized to
|
166
|
+
# something.
|
167
|
+
error = "#{error.class.to_s}: #{error.to_s}"
|
168
|
+
channel.send_message('response', callback_id, nil, error, cookies)
|
169
|
+
end
|
157
170
|
|
158
|
-
|
171
|
+
rescue => e
|
172
|
+
Volt.logger.error "Error in fail dispatch: #{e.inspect}"
|
173
|
+
Volt.logger.error(e.backtrace.join("\n")) if e.respond_to?(:backtrace)
|
174
|
+
raise
|
175
|
+
end
|
159
176
|
end
|
160
177
|
|
161
178
|
end
|
data/lib/volt/version.rb
CHANGED
data/lib/volt/volt/templates.rb
CHANGED
@@ -19,6 +19,8 @@ client '/callbacks', action: 'callbacks'
|
|
19
19
|
# Events
|
20
20
|
client '/events', component: 'main', controller: 'events', action: 'index'
|
21
21
|
|
22
|
+
client '/save', component: 'main', controller: 'save', action: 'index'
|
23
|
+
|
22
24
|
# Signup/login routes
|
23
25
|
client '/signup', component: 'user_templates', controller: 'signup'
|
24
26
|
client '/login', component: 'user_templates', controller: 'login'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'saving', type: :feature, sauce: true do
|
4
|
+
it 'should return an error as an instance of Volt::Error' do
|
5
|
+
visit '/save'
|
6
|
+
|
7
|
+
fill_in 'post_title', with: 'ok'
|
8
|
+
|
9
|
+
click_button 'Save'
|
10
|
+
|
11
|
+
expect(page).to have_content('#<Volt::Errors {"title"=>["must be at least 5 characters"]}>')
|
12
|
+
end
|
13
|
+
end
|
@@ -43,7 +43,7 @@ if RUBY_PLATFORM != 'opal'
|
|
43
43
|
it 'should not allow eval' do
|
44
44
|
channel = double('channel')
|
45
45
|
|
46
|
-
expect(channel).to receive(:send_message).with('response', 0, nil,
|
46
|
+
expect(channel).to receive(:send_message).with('response', 0, nil, 'RuntimeError: unsafe method: eval', nil)
|
47
47
|
|
48
48
|
dispatcher.dispatch(channel, [0, 'TestTask', :eval, '5 + 10'])
|
49
49
|
end
|
@@ -51,7 +51,12 @@ if RUBY_PLATFORM != 'opal'
|
|
51
51
|
it 'should not allow instance_eval' do
|
52
52
|
channel = double('channel')
|
53
53
|
|
54
|
-
|
54
|
+
|
55
|
+
first = true
|
56
|
+
expect(channel).to receive(:send_message).with("response", 0, nil, 'RuntimeError: unsafe method: instance_eval', nil)
|
57
|
+
|
58
|
+
|
59
|
+
# .with('response', 0, nil, /RuntimeError: unsafe method: instance_eval/, nil)
|
55
60
|
|
56
61
|
dispatcher.dispatch(channel, [0, 'TestTask', :instance_eval, '5 + 10'])
|
57
62
|
end
|
@@ -16,7 +16,7 @@ gem 'volt-bootstrap_jumbotron_theme', '~> 0.1.0'
|
|
16
16
|
gem 'volt-user_templates', '~> 0.4.0'
|
17
17
|
|
18
18
|
# Add ability to send e-mail from apps.
|
19
|
-
gem 'volt-mailer', '~> 0.1.
|
19
|
+
gem 'volt-mailer', '~> 0.1.1'
|
20
20
|
|
21
21
|
# Use rbnacl for message bus encrpytion
|
22
22
|
# (optional, if you don't need encryption, disable in app.rb and remove)
|
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.9.6.
|
4
|
+
version: 0.9.6.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Stout
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -638,10 +638,12 @@ files:
|
|
638
638
|
- spec/apps/kitchen_sink/app/main/config/routes.rb
|
639
639
|
- spec/apps/kitchen_sink/app/main/controllers/events_controller.rb
|
640
640
|
- spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
|
641
|
+
- spec/apps/kitchen_sink/app/main/controllers/save_controller.rb
|
641
642
|
- spec/apps/kitchen_sink/app/main/controllers/server/simple_http_controller.rb
|
642
643
|
- spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb
|
643
644
|
- spec/apps/kitchen_sink/app/main/controllers/upload_controller.rb
|
644
645
|
- spec/apps/kitchen_sink/app/main/controllers/yield_component_controller.rb
|
646
|
+
- spec/apps/kitchen_sink/app/main/models/post.rb
|
645
647
|
- spec/apps/kitchen_sink/app/main/models/user.rb
|
646
648
|
- spec/apps/kitchen_sink/app/main/tasks/login_tasks.rb
|
647
649
|
- spec/apps/kitchen_sink/app/main/views/events/index.html
|
@@ -661,6 +663,7 @@ files:
|
|
661
663
|
- spec/apps/kitchen_sink/app/main/views/main/require_test.html
|
662
664
|
- spec/apps/kitchen_sink/app/main/views/main/store_demo.html
|
663
665
|
- spec/apps/kitchen_sink/app/main/views/main/yield.html
|
666
|
+
- spec/apps/kitchen_sink/app/main/views/save/index.html
|
664
667
|
- spec/apps/kitchen_sink/app/main/views/todos/index.html
|
665
668
|
- spec/apps/kitchen_sink/app/main/views/upload/index.html
|
666
669
|
- spec/apps/kitchen_sink/app/main/views/yield_component/index.html
|
@@ -692,6 +695,7 @@ files:
|
|
692
695
|
- spec/integration/list_spec.rb
|
693
696
|
- spec/integration/missing_spec.rb
|
694
697
|
- spec/integration/raw_html_binding.rb
|
698
|
+
- spec/integration/save_spec.rb
|
695
699
|
- spec/integration/store_spec.rb
|
696
700
|
- spec/integration/templates_spec.rb
|
697
701
|
- spec/integration/todos_spec.rb
|
@@ -913,10 +917,12 @@ test_files:
|
|
913
917
|
- spec/apps/kitchen_sink/app/main/config/routes.rb
|
914
918
|
- spec/apps/kitchen_sink/app/main/controllers/events_controller.rb
|
915
919
|
- spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
|
920
|
+
- spec/apps/kitchen_sink/app/main/controllers/save_controller.rb
|
916
921
|
- spec/apps/kitchen_sink/app/main/controllers/server/simple_http_controller.rb
|
917
922
|
- spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb
|
918
923
|
- spec/apps/kitchen_sink/app/main/controllers/upload_controller.rb
|
919
924
|
- spec/apps/kitchen_sink/app/main/controllers/yield_component_controller.rb
|
925
|
+
- spec/apps/kitchen_sink/app/main/models/post.rb
|
920
926
|
- spec/apps/kitchen_sink/app/main/models/user.rb
|
921
927
|
- spec/apps/kitchen_sink/app/main/tasks/login_tasks.rb
|
922
928
|
- spec/apps/kitchen_sink/app/main/views/events/index.html
|
@@ -936,6 +942,7 @@ test_files:
|
|
936
942
|
- spec/apps/kitchen_sink/app/main/views/main/require_test.html
|
937
943
|
- spec/apps/kitchen_sink/app/main/views/main/store_demo.html
|
938
944
|
- spec/apps/kitchen_sink/app/main/views/main/yield.html
|
945
|
+
- spec/apps/kitchen_sink/app/main/views/save/index.html
|
939
946
|
- spec/apps/kitchen_sink/app/main/views/todos/index.html
|
940
947
|
- spec/apps/kitchen_sink/app/main/views/upload/index.html
|
941
948
|
- spec/apps/kitchen_sink/app/main/views/yield_component/index.html
|
@@ -967,6 +974,7 @@ test_files:
|
|
967
974
|
- spec/integration/list_spec.rb
|
968
975
|
- spec/integration/missing_spec.rb
|
969
976
|
- spec/integration/raw_html_binding.rb
|
977
|
+
- spec/integration/save_spec.rb
|
970
978
|
- spec/integration/store_spec.rb
|
971
979
|
- spec/integration/templates_spec.rb
|
972
980
|
- spec/integration/todos_spec.rb
|