volt 0.8.15 → 0.8.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -1
- data/Guardfile +2 -3
- data/Rakefile +1 -4
- data/VERSION +1 -1
- data/app/volt/controllers/notices_controller.rb +1 -1
- data/app/volt/tasks/live_query/data_store.rb +7 -7
- data/app/volt/tasks/live_query/live_query.rb +7 -9
- data/app/volt/tasks/live_query/live_query_pool.rb +13 -12
- data/app/volt/tasks/live_query/query_tracker.rb +4 -5
- data/app/volt/tasks/query_tasks.rb +9 -11
- data/app/volt/tasks/store_tasks.rb +4 -4
- data/app/volt/tasks/user_tasks.rb +1 -1
- data/bin/volt +2 -2
- data/lib/volt.rb +3 -7
- data/lib/volt/assets/test.rb +1 -2
- data/lib/volt/benchmark/benchmark.rb +3 -3
- data/lib/volt/boot.rb +1 -1
- data/lib/volt/cli.rb +18 -18
- data/lib/volt/cli/asset_compile.rb +8 -10
- data/lib/volt/cli/generate.rb +9 -11
- data/lib/volt/cli/new_gem.rb +51 -51
- data/lib/volt/config.rb +2 -3
- data/lib/volt/console.rb +1 -1
- data/lib/volt/controllers/model_controller.rb +6 -6
- data/lib/volt/data_stores/data_store.rb +1 -1
- data/lib/volt/data_stores/mongo_driver.rb +1 -1
- data/lib/volt/extra_core/array.rb +2 -2
- data/lib/volt/extra_core/blank.rb +1 -2
- data/lib/volt/extra_core/extra_core.rb +1 -1
- data/lib/volt/extra_core/inflector/methods.rb +0 -1
- data/lib/volt/extra_core/logger.rb +13 -7
- data/lib/volt/extra_core/numeric.rb +1 -1
- data/lib/volt/extra_core/string.rb +7 -7
- data/lib/volt/extra_core/stringify_keys.rb +5 -5
- data/lib/volt/models.rb +2 -2
- data/lib/volt/models/array_model.rb +18 -19
- data/lib/volt/models/cursor.rb +0 -1
- data/lib/volt/models/model.rb +17 -35
- data/lib/volt/models/model_hash_behaviour.rb +0 -2
- data/lib/volt/models/model_state.rb +1 -1
- data/lib/volt/models/model_wrapper.rb +1 -1
- data/lib/volt/models/persistors/array_store.rb +26 -13
- data/lib/volt/models/persistors/base.rb +1 -1
- data/lib/volt/models/persistors/flash.rb +2 -2
- data/lib/volt/models/persistors/local_store.rb +2 -3
- data/lib/volt/models/persistors/model_store.rb +7 -6
- data/lib/volt/models/persistors/params.rb +2 -2
- data/lib/volt/models/persistors/query/query_listener.rb +2 -0
- data/lib/volt/models/persistors/query/query_listener_pool.rb +1 -1
- data/lib/volt/models/persistors/store.rb +1 -2
- data/lib/volt/models/persistors/store_state.rb +2 -3
- data/lib/volt/models/url.rb +17 -16
- data/lib/volt/models/validations.rb +11 -14
- data/lib/volt/models/validators/length_validator.rb +3 -3
- data/lib/volt/models/validators/presence_validator.rb +2 -2
- data/lib/volt/page/bindings/attribute_binding.rb +2 -3
- data/lib/volt/page/bindings/base_binding.rb +1 -1
- data/lib/volt/page/bindings/each_binding.rb +8 -9
- data/lib/volt/page/bindings/event_binding.rb +2 -3
- data/lib/volt/page/bindings/template_binding.rb +8 -7
- data/lib/volt/page/bindings/template_binding/grouped_controllers.rb +2 -1
- data/lib/volt/page/channel.rb +10 -10
- data/lib/volt/page/channel_stub.rb +1 -1
- data/lib/volt/page/document.rb +0 -1
- data/lib/volt/page/document_events.rb +4 -4
- data/lib/volt/page/page.rb +26 -19
- data/lib/volt/page/string_template_renderer.rb +2 -2
- data/lib/volt/page/sub_context.rb +10 -4
- data/lib/volt/page/targets/attribute_section.rb +1 -1
- data/lib/volt/page/targets/attribute_target.rb +1 -2
- data/lib/volt/page/targets/base_section.rb +4 -4
- data/lib/volt/page/targets/binding_document/base_node.rb +0 -1
- data/lib/volt/page/targets/binding_document/component_node.rb +4 -5
- data/lib/volt/page/targets/dom_section.rb +21 -22
- data/lib/volt/page/targets/dom_target.rb +1 -1
- data/lib/volt/page/targets/dom_template.rb +11 -12
- data/lib/volt/page/targets/helpers/comment_searchers.rb +7 -8
- data/lib/volt/page/tasks.rb +0 -1
- data/lib/volt/page/template_renderer.rb +1 -1
- data/lib/volt/page/url_tracker.rb +3 -3
- data/lib/volt/reactive/computation.rb +5 -11
- data/lib/volt/reactive/dependency.rb +1 -3
- data/lib/volt/reactive/eventable.rb +17 -4
- data/lib/volt/reactive/hash_dependency.rb +1 -0
- data/lib/volt/reactive/reactive_accessors.rb +0 -1
- data/lib/volt/reactive/reactive_array.rb +20 -25
- data/lib/volt/reactive/reactive_hash.rb +3 -3
- data/lib/volt/router/routes.rb +11 -13
- data/lib/volt/server.rb +17 -17
- data/lib/volt/server/component_handler.rb +2 -2
- data/lib/volt/server/component_templates.rb +8 -8
- data/lib/volt/server/html_parser/attribute_scope.rb +9 -10
- data/lib/volt/server/html_parser/if_view_scope.rb +2 -2
- data/lib/volt/server/html_parser/sandlebars_parser.rb +14 -14
- data/lib/volt/server/html_parser/textarea_scope.rb +1 -2
- data/lib/volt/server/html_parser/view_handler.rb +1 -1
- data/lib/volt/server/html_parser/view_parser.rb +1 -1
- data/lib/volt/server/html_parser/view_scope.rb +10 -10
- data/lib/volt/server/rack/asset_files.rb +15 -16
- data/lib/volt/server/rack/component_code.rb +2 -2
- data/lib/volt/server/rack/component_html_renderer.rb +0 -1
- data/lib/volt/server/rack/component_paths.rb +13 -10
- data/lib/volt/server/rack/index_files.rb +4 -4
- data/lib/volt/server/rack/opal_files.rb +4 -5
- data/lib/volt/server/rack/source_map_server.rb +3 -3
- data/lib/volt/server/socket_connection_handler.rb +3 -4
- data/lib/volt/server/socket_connection_handler_stub.rb +1 -1
- data/lib/volt/spec/setup.rb +3 -3
- data/lib/volt/store/mongo.rb +2 -2
- data/lib/volt/tasks/task_handler.rb +3 -3
- data/lib/volt/utils/generic_counting_pool.rb +2 -2
- data/lib/volt/utils/generic_pool.rb +7 -8
- data/lib/volt/utils/local_storage.rb +4 -4
- data/lib/volt/volt/environment.rb +1 -1
- data/spec/apps/file_loading/app/shared/config/dependencies.rb +1 -1
- data/spec/apps/kitchen_sink/Gemfile +0 -2
- data/spec/apps/kitchen_sink/app/main/config/routes.rb +5 -5
- data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +7 -6
- data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +3 -4
- data/spec/controllers/reactive_accessors_spec.rb +4 -4
- data/spec/extra_core/inflector_spec.rb +1 -1
- data/spec/extra_core/string_transformation_test_cases.rb +23 -24
- data/spec/extra_core/string_transformations_spec.rb +11 -12
- data/spec/integration/bindings_spec.rb +15 -15
- data/spec/integration/list_spec.rb +12 -13
- data/spec/integration/templates_spec.rb +3 -3
- data/spec/models/model_spec.rb +74 -80
- data/spec/models/persistors/params_spec.rb +2 -2
- data/spec/models/persistors/store_spec.rb +4 -4
- data/spec/models/validations_spec.rb +14 -23
- data/spec/page/bindings/content_binding_spec.rb +7 -8
- data/spec/page/bindings/template_binding_spec.rb +22 -24
- data/spec/page/sub_context_spec.rb +2 -2
- data/spec/reactive/computation_spec.rb +3 -3
- data/spec/reactive/reactive_array_spec.rb +12 -12
- data/spec/router/routes_spec.rb +45 -48
- data/spec/server/html_parser/sandlebars_parser_spec.rb +42 -42
- data/spec/server/html_parser/view_parser_spec.rb +132 -153
- data/spec/server/rack/asset_files_spec.rb +9 -8
- data/spec/server/rack/component_paths_spec.rb +5 -5
- data/spec/server/rack/rack_requests_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- data/spec/tasks/live_query_spec.rb +4 -5
- data/spec/tasks/query_tasks.rb +2 -4
- data/spec/tasks/query_tracker_spec.rb +29 -29
- data/spec/templates/targets/binding_document/component_node_spec.rb +1 -1
- data/spec/utils/generic_counting_pool_spec.rb +4 -4
- data/spec/utils/generic_pool_spec.rb +12 -12
- data/templates/component/config/routes.rb +2 -2
- data/templates/component/controllers/main_controller.rb +7 -6
- data/templates/newgem/app/newgem/config/dependencies.rb +1 -1
- data/templates/newgem/app/newgem/config/routes.rb +1 -1
- data/templates/project/app/main/config/routes.rb +2 -2
- data/templates/project/app/main/controllers/main_controller.rb +7 -6
- data/templates/project/spec/sample_spec.rb +2 -2
- data/volt.gemspec +32 -33
- metadata +3 -4
- data/lib/volt/extra_core/log.rb +0 -56
- data/lib/volt/extra_core/try.rb +0 -31
@@ -36,7 +36,7 @@ module Volt
|
|
36
36
|
if args.blank?
|
37
37
|
add_else(nil)
|
38
38
|
else
|
39
|
-
|
39
|
+
fail "else does not take a conditional, #{content} was provided."
|
40
40
|
end
|
41
41
|
when 'template'
|
42
42
|
add_template(args)
|
@@ -73,7 +73,7 @@ module Volt
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def add_else(content)
|
76
|
-
|
76
|
+
fail '#else can only be added inside of an if block'
|
77
77
|
end
|
78
78
|
|
79
79
|
def add_each(content)
|
@@ -99,11 +99,11 @@ module Volt
|
|
99
99
|
parent = 'self'
|
100
100
|
end
|
101
101
|
|
102
|
-
|
102
|
+
parent
|
103
103
|
end
|
104
104
|
|
105
105
|
def last_method_name(getter)
|
106
|
-
|
106
|
+
getter.strip[/[^.]+$/]
|
107
107
|
end
|
108
108
|
|
109
109
|
def add_component(tag_name, attributes, unary)
|
@@ -125,17 +125,17 @@ module Volt
|
|
125
125
|
data_hash << "#{name.inspect} => Proc.new { #{getter} }"
|
126
126
|
|
127
127
|
setter = getter_to_setter(getter)
|
128
|
-
data_hash << "#{(name +
|
128
|
+
data_hash << "#{(name + '=').inspect} => Proc.new { |val| #{setter} }"
|
129
129
|
|
130
130
|
# Add an _parent fetcher. Useful for things like volt-fields to get the parent model.
|
131
131
|
parent = parent_fetcher(getter)
|
132
132
|
|
133
133
|
# TODO: This adds some overhead, perhaps there is a way to compute this dynamically on the
|
134
134
|
# front-end.
|
135
|
-
data_hash << "#{(name +
|
135
|
+
data_hash << "#{(name + '_parent').inspect} => Proc.new { #{parent} }"
|
136
136
|
|
137
137
|
# Add a _last_method property. This is useful
|
138
|
-
data_hash << "#{(name +
|
138
|
+
data_hash << "#{(name + '_last_method').inspect} => #{last_method_name(getter).inspect}"
|
139
139
|
end
|
140
140
|
else
|
141
141
|
# String
|
@@ -159,17 +159,17 @@ module Volt
|
|
159
159
|
end
|
160
160
|
|
161
161
|
# Called when this scope should be closed out
|
162
|
-
def close_scope(pop=true)
|
162
|
+
def close_scope(pop = true)
|
163
163
|
if pop
|
164
164
|
scope = @handler.scope.pop
|
165
165
|
else
|
166
166
|
scope = @handler.last
|
167
167
|
end
|
168
168
|
|
169
|
-
|
169
|
+
fail "template path already exists: #{scope.path}" if @handler.templates[scope.path]
|
170
170
|
|
171
171
|
template = {
|
172
|
-
|
172
|
+
'html' => scope.html
|
173
173
|
}
|
174
174
|
|
175
175
|
if scope.bindings.size > 0
|
@@ -14,12 +14,12 @@ module Volt
|
|
14
14
|
|
15
15
|
def load_dependencies(path)
|
16
16
|
if path
|
17
|
-
dependencies_file = File.join(path,
|
17
|
+
dependencies_file = File.join(path, 'config/dependencies.rb')
|
18
18
|
else
|
19
|
-
|
19
|
+
fail "Unable to find component #{component_name.inspect}"
|
20
20
|
end
|
21
21
|
|
22
|
-
if File.
|
22
|
+
if File.exist?(dependencies_file)
|
23
23
|
# Run the dependencies file in this asset files context
|
24
24
|
code = File.read(dependencies_file)
|
25
25
|
instance_eval(code)
|
@@ -28,18 +28,19 @@ module Volt
|
|
28
28
|
|
29
29
|
def component(name)
|
30
30
|
unless @included_components[name]
|
31
|
-
# Get the path to the component
|
32
|
-
path = @component_paths.component_path(name)
|
33
|
-
|
34
31
|
# Track that we added
|
35
32
|
@included_components[name] = true
|
36
33
|
|
37
|
-
#
|
38
|
-
|
34
|
+
# Get the path to the component
|
35
|
+
@component_paths.component_paths(name).each do |path|
|
36
|
+
|
37
|
+
# Load the dependencies
|
38
|
+
load_dependencies(path)
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
# Add any assets
|
41
|
+
add_assets(path)
|
42
|
+
@components << [path, name]
|
43
|
+
end
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -56,7 +57,7 @@ module Volt
|
|
56
57
|
end
|
57
58
|
|
58
59
|
def component_paths
|
59
|
-
|
60
|
+
@components
|
60
61
|
end
|
61
62
|
|
62
63
|
def add_assets(path)
|
@@ -66,7 +67,6 @@ module Volt
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
|
70
70
|
def javascript_files(opal_files)
|
71
71
|
javascript_files = []
|
72
72
|
@assets.each do |type, path|
|
@@ -88,7 +88,7 @@ module Volt
|
|
88
88
|
|
89
89
|
javascript_files += opal_js_files
|
90
90
|
|
91
|
-
|
91
|
+
javascript_files.uniq
|
92
92
|
end
|
93
93
|
|
94
94
|
def css_files
|
@@ -102,8 +102,7 @@ module Volt
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
-
|
105
|
+
css_files.uniq
|
106
106
|
end
|
107
|
-
|
108
107
|
end
|
109
108
|
end
|
@@ -6,7 +6,7 @@ require 'volt/server/rack/asset_files'
|
|
6
6
|
# method that returns all of the ruby setup code for the component.
|
7
7
|
module Volt
|
8
8
|
class ComponentCode
|
9
|
-
def initialize(component_name, component_paths, client=true)
|
9
|
+
def initialize(component_name, component_paths, client = true)
|
10
10
|
@component_name = component_name
|
11
11
|
@component_paths = component_paths
|
12
12
|
@client = client
|
@@ -21,7 +21,7 @@ module Volt
|
|
21
21
|
code << "\n\n"
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
code
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# ComponentPaths gives an array of every folder where you find a component.
|
2
2
|
module Volt
|
3
3
|
class ComponentPaths
|
4
|
-
def initialize(root=nil)
|
4
|
+
def initialize(root = nil)
|
5
5
|
@root = root || Dir.pwd
|
6
6
|
end
|
7
7
|
|
@@ -9,12 +9,12 @@ module Volt
|
|
9
9
|
def app_folders
|
10
10
|
# Find all app folders
|
11
11
|
@app_folders ||= begin
|
12
|
-
volt_app = File.expand_path(File.join(File.dirname(__FILE__),
|
12
|
+
volt_app = File.expand_path(File.join(File.dirname(__FILE__), '../../../../app'))
|
13
13
|
app_folders = [volt_app, "#{@root}/app", "#{@root}/vendor/app"].map { |f| File.expand_path(f) }
|
14
14
|
|
15
15
|
# Gem folders with volt in them
|
16
16
|
# TODO: we should probably qualify this a bit more
|
17
|
-
app_folders += Gem.loaded_specs.values.map
|
17
|
+
app_folders += Gem.loaded_specs.values.map(&:full_gem_path).reject { |g| g !~ /volt/ }.map { |f| f + '/app' }
|
18
18
|
|
19
19
|
app_folders
|
20
20
|
end
|
@@ -27,7 +27,7 @@ module Volt
|
|
27
27
|
files << yield(app_folder)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
files.flatten
|
31
31
|
end
|
32
32
|
|
33
33
|
# returns an array of every folder that is a component
|
@@ -40,13 +40,16 @@ module Volt
|
|
40
40
|
if File.directory?(folder)
|
41
41
|
folder_name = folder[/[^\/]+$/]
|
42
42
|
|
43
|
-
|
44
|
-
@components[folder_name]
|
43
|
+
# Add in the folder if it's not alreay in there
|
44
|
+
folders = (@components[folder_name] ||= [])
|
45
|
+
unless folders.include?(folder)
|
46
|
+
folders << folder
|
47
|
+
end
|
45
48
|
end
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
49
|
-
|
52
|
+
@components
|
50
53
|
end
|
51
54
|
|
52
55
|
# Makes each components classes available on the load path, require classes.
|
@@ -73,12 +76,12 @@ module Volt
|
|
73
76
|
end
|
74
77
|
end
|
75
78
|
|
76
|
-
# Returns
|
77
|
-
def
|
79
|
+
# Returns all paths for a specific component
|
80
|
+
def component_paths(name)
|
78
81
|
folders = components[name]
|
79
82
|
|
80
83
|
if folders
|
81
|
-
return folders
|
84
|
+
return folders
|
82
85
|
else
|
83
86
|
return nil
|
84
87
|
end
|
@@ -11,7 +11,7 @@ module Volt
|
|
11
11
|
|
12
12
|
@@router ||= Routes.new.define do
|
13
13
|
# Find the route file
|
14
|
-
home_path = component_paths.
|
14
|
+
home_path = component_paths.component_paths('main').first
|
15
15
|
route_file = File.read("#{home_path}/config/routes.rb")
|
16
16
|
eval(route_file)
|
17
17
|
end
|
@@ -22,19 +22,19 @@ module Volt
|
|
22
22
|
|
23
23
|
return params if params
|
24
24
|
|
25
|
-
|
25
|
+
false
|
26
26
|
end
|
27
27
|
|
28
28
|
def call(env)
|
29
29
|
if route_match?(env['PATH_INFO'])
|
30
|
-
[200, {'Content-Type' => 'text/html; charset=utf-8'}, [html]]
|
30
|
+
[200, { 'Content-Type' => 'text/html; charset=utf-8' }, [html]]
|
31
31
|
else
|
32
32
|
@app.call env
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
def html
|
37
|
-
index_path = File.expand_path(File.join(Volt.root,
|
37
|
+
index_path = File.expand_path(File.join(Volt.root, 'public/index.html'))
|
38
38
|
html = File.read(index_path)
|
39
39
|
|
40
40
|
ERB.new(html).result(binding)
|
@@ -23,7 +23,7 @@ module Volt
|
|
23
23
|
# environment in closure
|
24
24
|
environment = @environment
|
25
25
|
|
26
|
-
environment.cache = Sprockets::Cache::FileStore.new(
|
26
|
+
environment.cache = Sprockets::Cache::FileStore.new('./tmp')
|
27
27
|
|
28
28
|
if Volt.env.production?
|
29
29
|
# Compress in production
|
@@ -33,7 +33,7 @@ module Volt
|
|
33
33
|
|
34
34
|
environment.append_path(app_path)
|
35
35
|
|
36
|
-
volt_gem_lib_path = File.expand_path(File.join(File.dirname(__FILE__),
|
36
|
+
volt_gem_lib_path = File.expand_path(File.join(File.dirname(__FILE__), '../../..'))
|
37
37
|
environment.append_path(volt_gem_lib_path)
|
38
38
|
|
39
39
|
add_asset_folders(environment)
|
@@ -44,8 +44,8 @@ module Volt
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# opal-jquery gem
|
47
|
-
spec = Gem::Specification.find_by_name(
|
48
|
-
environment.append_path(spec.gem_dir +
|
47
|
+
spec = Gem::Specification.find_by_name('opal-jquery')
|
48
|
+
environment.append_path(spec.gem_dir + '/opal')
|
49
49
|
|
50
50
|
builder.map '/assets' do
|
51
51
|
run environment
|
@@ -65,6 +65,5 @@ module Volt
|
|
65
65
|
environment.append_path(asset_folder)
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
69
68
|
end
|
70
69
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Volt
|
2
2
|
class SourceMapServer
|
3
|
-
def initialize
|
3
|
+
def initialize(sprockets)
|
4
4
|
@sprockets = sprockets
|
5
5
|
end
|
6
6
|
|
@@ -24,9 +24,9 @@ module Volt
|
|
24
24
|
asset = sprockets[path]
|
25
25
|
return [404, {}, []] if asset.nil?
|
26
26
|
|
27
|
-
return [200, {
|
27
|
+
return [200, { 'Content-Type' => 'text/json' }, [$OPAL_SOURCE_MAPS[asset.pathname].to_s]]
|
28
28
|
else
|
29
|
-
return [200, {
|
29
|
+
return [200, { 'Content-Type' => 'text/text' }, [File.read(sprockets.resolve(path_info))]]
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'sockjs/session'
|
3
|
-
require File.join(File.dirname(__FILE__),
|
3
|
+
require File.join(File.dirname(__FILE__), '../../../app/volt/tasks/query_tasks')
|
4
4
|
|
5
5
|
module Volt
|
6
6
|
class SocketConnectionHandler < SockJS::Session
|
@@ -15,14 +15,13 @@ module Volt
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Sends a message to all, optionally skipping a users channel
|
18
|
-
def self.send_message_all(skip_channel=nil, *args)
|
18
|
+
def self.send_message_all(skip_channel = nil, *args)
|
19
19
|
@@channels.each do |channel|
|
20
20
|
if skip_channel && channel == skip_channel
|
21
21
|
next
|
22
22
|
end
|
23
23
|
channel.send_message(*args)
|
24
24
|
end
|
25
|
-
|
26
25
|
end
|
27
26
|
|
28
27
|
def initialize(session, *args)
|
@@ -63,7 +62,7 @@ module Volt
|
|
63
62
|
end
|
64
63
|
|
65
64
|
def inspect
|
66
|
-
"<#{self.class
|
65
|
+
"<#{self.class}:#{object_id}>"
|
67
66
|
end
|
68
67
|
end
|
69
68
|
end
|
data/lib/volt/spec/setup.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Volt
|
2
|
-
def self.spec_setup(app_path='.')
|
2
|
+
def self.spec_setup(app_path = '.')
|
3
3
|
if RUBY_PLATFORM == 'opal'
|
4
4
|
require 'volt'
|
5
5
|
else
|
@@ -23,7 +23,7 @@ module Volt
|
|
23
23
|
|
24
24
|
Capybara.server do |app, port|
|
25
25
|
require 'rack/handler/thin'
|
26
|
-
Rack::Handler::Thin.run(app, :
|
26
|
+
Rack::Handler::Thin.run(app, Port: port)
|
27
27
|
end
|
28
28
|
|
29
29
|
Capybara.app = Server.new(app_path).app
|
@@ -50,7 +50,7 @@ module Volt
|
|
50
50
|
elsif ENV['BROWSER'] == 'safari'
|
51
51
|
# Needs extension
|
52
52
|
Capybara.register_driver :safari do |app|
|
53
|
-
Capybara::Selenium::Driver.new(app, :
|
53
|
+
Capybara::Selenium::Driver.new(app, browser: :safari)
|
54
54
|
end
|
55
55
|
Capybara.default_driver = :safari
|
56
56
|
end
|
data/lib/volt/store/mongo.rb
CHANGED
@@ -7,7 +7,7 @@ module Volt
|
|
7
7
|
$page.tasks.call(self.name, name, *args, &block)
|
8
8
|
end
|
9
9
|
else
|
10
|
-
def initialize(channel=nil, dispatcher=nil)
|
10
|
+
def initialize(channel = nil, dispatcher = nil)
|
11
11
|
@channel = channel
|
12
12
|
@dispatcher = dispatcher
|
13
13
|
end
|
@@ -27,7 +27,7 @@ module Volt
|
|
27
27
|
promise = Promise.new
|
28
28
|
|
29
29
|
begin
|
30
|
-
result =
|
30
|
+
result = new(nil, nil).send(name, *args, &block)
|
31
31
|
|
32
32
|
promise.resolve(result)
|
33
33
|
rescue => e
|
@@ -36,7 +36,7 @@ module Volt
|
|
36
36
|
promise.reject(e)
|
37
37
|
end
|
38
38
|
|
39
|
-
|
39
|
+
promise
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|