volt 0.9.1.pre2 → 0.9.1.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/VERSION +1 -1
- data/lib/volt/cli/asset_compile.rb +1 -1
- data/lib/volt/page/channel.rb +7 -1
- data/lib/volt/server/forking_server.rb +18 -6
- data/lib/volt/server.rb +8 -1
- data/lib/volt/volt/app.rb +1 -1
- data/spec/apps/kitchen_sink/app/main/config/routes.rb +1 -0
- data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +3 -0
- data/spec/apps/kitchen_sink/app/main/views/main/require_test.html +7 -0
- data/spec/integration/client_require_spec.rb +9 -0
- data/spec/models/validators/unique_validator_spec.rb +26 -0
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7e6af465488d4433ccb709514b3f805ad16cc7
|
4
|
+
data.tar.gz: 25cbe6bf32e904f35db51bd8d2b5b4822a1d81cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f21a61b49bf832d0f234271dcaa247401c80e43d4754fed3fcc49b17cfb61bb68f5aa1283379256449a0f1c881b1f80a59f1709387acecb172443f45b16c9220
|
7
|
+
data.tar.gz: c51891e601da7711ebc8324fcfa5d89f2d5b5524017b09ceeab9fa20a44a7cec36a9b98af3e9d4bad380e6140c8e1b6cbd0bd7588ea91fbc002d84d86bfdab6d
|
data/CHANGELOG.md
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
|
3
3
|
## 0.9.1
|
4
4
|
### Changed
|
5
|
+
- All code in ```app``` is now automatically reloaded when any files change. This is done through a "preforking" server. Before your apps code is loaded (and after Volt's is), the server forks a child process to handle the request (in dev and test mode).
|
5
6
|
- Corrected the name of StringTemplateRender to StringTemplateRenderer
|
6
7
|
- Volt now uses faye-websocket for socket connections. This means we can run on any rack-hijack server supported by faye-websocket. Currently Volt is tested with thin and puma. (Note: Thin will probably have better performance since it is evented, which means it doesn't need a thread per connection) More servers coming soon.
|
7
8
|
- fixed issue with the unique validation.
|
8
9
|
- made it so <:SectionName> can be accessed by <:section_name /> tag
|
9
10
|
- fixed issue with if bindings not resolving some promises.
|
11
|
+
- fixed issue with require's in controllers.
|
10
12
|
|
11
13
|
## 0.9.0
|
12
14
|
### Added
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.1.
|
1
|
+
0.9.1.pre3
|
@@ -16,6 +16,7 @@ module Volt
|
|
16
16
|
require 'opal'
|
17
17
|
require 'rack'
|
18
18
|
require 'volt'
|
19
|
+
require 'volt/volt/core'
|
19
20
|
require 'volt/boot'
|
20
21
|
|
21
22
|
|
@@ -71,7 +72,6 @@ module Volt
|
|
71
72
|
path = "#{@root_path}/public/assets/#{logical_path}"
|
72
73
|
|
73
74
|
begin
|
74
|
-
puts "LP: #{logical_path.inspect}"
|
75
75
|
content = @opal_files.environment[logical_path].to_s
|
76
76
|
write_file(path, content)
|
77
77
|
rescue Sprockets::FileNotFound, SyntaxError => e
|
data/lib/volt/page/channel.rb
CHANGED
@@ -28,7 +28,13 @@ module Volt
|
|
28
28
|
|
29
29
|
def connect!
|
30
30
|
%x{
|
31
|
-
|
31
|
+
if (document.location.protocol == 'https:') {
|
32
|
+
var wsProto = 'wss';
|
33
|
+
} else {
|
34
|
+
var wsProto = 'ws';
|
35
|
+
}
|
36
|
+
|
37
|
+
this.socket = new WebSocket(wsProto + '://' + document.location.host + '/socket');
|
32
38
|
|
33
39
|
this.socket.onopen = function () {
|
34
40
|
self.$opened();
|
@@ -142,8 +142,18 @@ module Volt
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
def reload
|
146
|
-
|
145
|
+
def reload(changed_files)
|
146
|
+
# only reload the server code if a non-view file was changed
|
147
|
+
server_code_changed = changed_files.any? {|path| File.extname(path) == '.rb' }
|
148
|
+
|
149
|
+
msg = 'file changed, reloading'
|
150
|
+
if server_code_changed
|
151
|
+
msg << ' server and'
|
152
|
+
end
|
153
|
+
msg << ' client...'
|
154
|
+
|
155
|
+
Volt.logger.log_with_color(msg, :light_blue)
|
156
|
+
|
147
157
|
begin
|
148
158
|
SocketConnectionHandler.send_message_all(nil, 'reload')
|
149
159
|
rescue => e
|
@@ -151,9 +161,11 @@ module Volt
|
|
151
161
|
Volt.logger.error(e)
|
152
162
|
end
|
153
163
|
|
154
|
-
|
155
|
-
|
156
|
-
|
164
|
+
if server_code_changed
|
165
|
+
@child_lock.with_write_lock do
|
166
|
+
stop_child
|
167
|
+
start_child
|
168
|
+
end
|
157
169
|
end
|
158
170
|
end
|
159
171
|
|
@@ -162,7 +174,7 @@ module Volt
|
|
162
174
|
@listener = Listen.to("#{@server.app_path}/") do |modified, added, removed|
|
163
175
|
Thread.new do
|
164
176
|
# Run the reload in a new thread
|
165
|
-
reload
|
177
|
+
reload(modified + added + removed)
|
166
178
|
end
|
167
179
|
end
|
168
180
|
@listener.start
|
data/lib/volt/server.rb
CHANGED
@@ -76,7 +76,14 @@ module Volt
|
|
76
76
|
# Handle websocket connections
|
77
77
|
app.use WebsocketHandler
|
78
78
|
|
79
|
-
|
79
|
+
can_fork = Process.respond_to?(:fork)
|
80
|
+
|
81
|
+
unless can_fork
|
82
|
+
Volt.logger.warn('Code reloading in Volt currently depends on `fork`. Your environment does not support `fork`. We\'re working on adding more reloading strategies. For now though you\'ll need to restart the server manually on changes, which sucks. Feel free to complain to the devs, we really let you down here. :-)')
|
83
|
+
end
|
84
|
+
|
85
|
+
# Only run ForkingServer if fork is supported in this env.
|
86
|
+
if !can_fork || Volt.env.production? || Volt.env.test?
|
80
87
|
# In production/test, we boot the app and run the server
|
81
88
|
#
|
82
89
|
# Sometimes the app is already booted, so we can skip if it is
|
data/lib/volt/volt/app.rb
CHANGED
@@ -10,6 +10,7 @@ client '/first_last', action: 'first_last'
|
|
10
10
|
client '/todos', controller: 'todos'
|
11
11
|
client '/html_safe', action: 'html_safe'
|
12
12
|
client '/missing', action: 'missing'
|
13
|
+
client '/require_test', action: 'require_test'
|
13
14
|
|
14
15
|
# Signup/login routes
|
15
16
|
client '/signup', component: 'user_templates', controller: 'signup'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
unless RUBY_PLATFORM == 'opal'
|
4
|
+
class Fridge < Volt::Model
|
5
|
+
validate :name, unique: true
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
describe 'unique spec' do
|
10
|
+
it 'should reject save if there are records with existing attributes already' do
|
11
|
+
store._fridges << { name: 'swift' }
|
12
|
+
fridge = store._fridges.buffer name: 'swift'
|
13
|
+
fridge.save!.then do
|
14
|
+
expect(false).to be_true
|
15
|
+
end.fail do
|
16
|
+
expect(true).to be_true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should not increase count of the total records in the store' do
|
21
|
+
store._fridges << { name: 'swift' }
|
22
|
+
store._fridges << { name: 'swift' }
|
23
|
+
expect(store._fridges.count).to eq(1)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.1.
|
4
|
+
version: 0.9.1.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Stout
|
@@ -701,6 +701,7 @@ files:
|
|
701
701
|
- spec/apps/kitchen_sink/app/main/views/main/index.html
|
702
702
|
- spec/apps/kitchen_sink/app/main/views/main/main.html
|
703
703
|
- spec/apps/kitchen_sink/app/main/views/main/missing.html
|
704
|
+
- spec/apps/kitchen_sink/app/main/views/main/require_test.html
|
704
705
|
- spec/apps/kitchen_sink/app/main/views/main/store.html
|
705
706
|
- spec/apps/kitchen_sink/app/main/views/main/yield.html
|
706
707
|
- spec/apps/kitchen_sink/app/main/views/todos/index.html
|
@@ -723,6 +724,7 @@ files:
|
|
723
724
|
- spec/extra_core/string_transformations_spec.rb
|
724
725
|
- spec/extra_core/symbol_spec.rb
|
725
726
|
- spec/integration/bindings_spec.rb
|
727
|
+
- spec/integration/client_require_spec.rb
|
726
728
|
- spec/integration/cookies_spec.rb
|
727
729
|
- spec/integration/first_last_spec.rb
|
728
730
|
- spec/integration/flash_spec.rb
|
@@ -751,6 +753,7 @@ files:
|
|
751
753
|
- spec/models/validators/length_validator_spec.rb
|
752
754
|
- spec/models/validators/phone_number_validator_spec.rb
|
753
755
|
- spec/models/validators/shared_examples_for_validators.rb
|
756
|
+
- spec/models/validators/unique_validator_spec.rb
|
754
757
|
- spec/page/bindings/content_binding_spec.rb
|
755
758
|
- spec/page/bindings/template_binding/view_lookup_for_path_spec.rb
|
756
759
|
- spec/page/bindings/template_binding_spec.rb
|
@@ -910,6 +913,7 @@ test_files:
|
|
910
913
|
- spec/apps/kitchen_sink/app/main/views/main/index.html
|
911
914
|
- spec/apps/kitchen_sink/app/main/views/main/main.html
|
912
915
|
- spec/apps/kitchen_sink/app/main/views/main/missing.html
|
916
|
+
- spec/apps/kitchen_sink/app/main/views/main/require_test.html
|
913
917
|
- spec/apps/kitchen_sink/app/main/views/main/store.html
|
914
918
|
- spec/apps/kitchen_sink/app/main/views/main/yield.html
|
915
919
|
- spec/apps/kitchen_sink/app/main/views/todos/index.html
|
@@ -932,6 +936,7 @@ test_files:
|
|
932
936
|
- spec/extra_core/string_transformations_spec.rb
|
933
937
|
- spec/extra_core/symbol_spec.rb
|
934
938
|
- spec/integration/bindings_spec.rb
|
939
|
+
- spec/integration/client_require_spec.rb
|
935
940
|
- spec/integration/cookies_spec.rb
|
936
941
|
- spec/integration/first_last_spec.rb
|
937
942
|
- spec/integration/flash_spec.rb
|
@@ -960,6 +965,7 @@ test_files:
|
|
960
965
|
- spec/models/validators/length_validator_spec.rb
|
961
966
|
- spec/models/validators/phone_number_validator_spec.rb
|
962
967
|
- spec/models/validators/shared_examples_for_validators.rb
|
968
|
+
- spec/models/validators/unique_validator_spec.rb
|
963
969
|
- spec/page/bindings/content_binding_spec.rb
|
964
970
|
- spec/page/bindings/template_binding/view_lookup_for_path_spec.rb
|
965
971
|
- spec/page/bindings/template_binding_spec.rb
|