volt 0.9.4.pre3 → 0.9.4.pre5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/CODE_OF_CONDUCT.md +15 -0
- data/README.md +2 -0
- data/app/volt/models/user.rb +6 -4
- data/lib/volt/boot.rb +0 -2
- data/lib/volt/cli/bundle.rb +29 -0
- data/lib/volt/cli/console.rb +2 -2
- data/lib/volt/cli/generate.rb +2 -0
- data/lib/volt/cli/new_gem.rb +23 -0
- data/lib/volt/cli.rb +15 -2
- data/lib/volt/controllers/collection_helpers.rb +34 -3
- data/lib/volt/controllers/http_controller.rb +1 -1
- data/lib/volt/controllers/model_controller.rb +9 -33
- data/lib/volt/helpers/time.rb +43 -0
- data/lib/volt/models/array_model.rb +96 -90
- data/lib/volt/models/buffer.rb +42 -7
- data/lib/volt/models/helpers/array_model.rb +15 -0
- data/lib/volt/models/helpers/base.rb +113 -0
- data/lib/volt/models/helpers/change_helpers.rb +91 -0
- data/lib/volt/models/helpers/dirty.rb +93 -0
- data/lib/volt/models/helpers/listener_tracker.rb +19 -0
- data/lib/volt/models/helpers/model.rb +15 -0
- data/lib/volt/models/model.rb +17 -12
- data/lib/volt/models/permissions.rb +1 -1
- data/lib/volt/models/persistors/array_store.rb +4 -0
- data/lib/volt/models/persistors/base.rb +10 -0
- data/lib/volt/models/persistors/cookies.rb +2 -0
- data/lib/volt/models/persistors/local_store.rb +3 -0
- data/lib/volt/models/persistors/model_store.rb +7 -0
- data/lib/volt/models/persistors/params.rb +4 -1
- data/lib/volt/models/persistors/query/query_listener.rb +1 -1
- data/lib/volt/models/url.rb +12 -7
- data/lib/volt/models/validators/unique_validator.rb +1 -1
- data/lib/volt/page/bindings/base_binding.rb +2 -2
- data/lib/volt/page/bindings/event_binding.rb +2 -2
- data/lib/volt/page/bindings/view_binding/controller_handler.rb +20 -0
- data/lib/volt/page/bindings/view_binding/view_lookup_for_path.rb +6 -4
- data/lib/volt/page/bindings/view_binding.rb +7 -7
- data/lib/volt/page/path_string_renderer.rb +2 -4
- data/lib/volt/page/targets/base_section.rb +3 -3
- data/lib/volt/page/targets/dom_template.rb +2 -2
- data/lib/volt/page/tasks.rb +6 -6
- data/lib/volt/page/template_renderer.rb +1 -1
- data/lib/volt/page/url_tracker.rb +4 -4
- data/lib/volt/reactive/reactive_array.rb +31 -20
- data/lib/volt/server/component_templates.rb +5 -5
- data/lib/volt/server/forking_server.rb +2 -2
- data/lib/volt/server/message_bus/peer_to_peer/server_tracker.rb +3 -3
- data/lib/volt/server/message_bus/peer_to_peer.rb +7 -7
- data/lib/volt/server/rack/asset_files.rb +28 -8
- data/lib/volt/server/rack/component_paths.rb +4 -4
- data/lib/volt/server/rack/opal_files.rb +0 -1
- data/lib/volt/server/socket_connection_handler.rb +5 -2
- data/lib/volt/server.rb +0 -1
- data/lib/volt/spec/setup.rb +4 -5
- data/lib/volt/tasks/task.rb +2 -3
- data/lib/volt/utils/promise_extensions.rb +22 -6
- data/lib/volt/utils/time_patch.rb +12 -0
- data/lib/volt/utils/timers.rb +14 -2
- data/lib/volt/version.rb +1 -1
- data/lib/volt/volt/app.rb +44 -12
- data/lib/volt/volt/client_setup/browser.rb +113 -0
- data/lib/volt/volt/repos.rb +48 -0
- data/lib/volt/volt/server_setup/app.rb +1 -2
- data/lib/volt/volt/templates.rb +39 -0
- data/lib/volt/volt/users.rb +4 -4
- data/lib/volt.rb +1 -0
- data/spec/apps/file_loading/app/disable_auto/assets/css/test1.css.scss +0 -0
- data/spec/apps/file_loading/app/disable_auto/assets/css/test2.css.scss +0 -0
- data/spec/apps/file_loading/app/disable_auto/assets/js/test1.js +0 -0
- data/spec/apps/file_loading/app/disable_auto/assets/js/test2.js +0 -0
- data/spec/apps/file_loading/app/disable_auto/config/dependencies.rb +3 -0
- data/spec/apps/file_loading/app/main/assets/css/test3.css +0 -0
- data/spec/apps/file_loading/app/shared/config/dependencies.rb +1 -1
- data/spec/controllers/model_controller_spec.rb +7 -0
- data/spec/models/{model_helpers/model_helpers_spec.rb → helpers/base_spec.rb} +1 -1
- data/spec/models/helpers/model_spec.rb +26 -0
- data/spec/models/model_spec.rb +9 -0
- data/spec/models/persistors/params_spec.rb +1 -1
- data/spec/models/persistors/store_spec.rb +1 -0
- data/spec/page/bindings/content_binding_spec.rb +2 -4
- data/spec/page/bindings/each_binding_spec.rb +1 -4
- data/spec/page/bindings/if_binding_spec.rb +1 -4
- data/spec/page/bindings/template_binding/view_lookup_for_path_spec.rb +17 -27
- data/spec/page/path_string_renderer_spec.rb +15 -4
- data/spec/server/rack/asset_files_spec.rb +88 -8
- data/spec/tasks/user_tasks_spec.rb +1 -1
- data/spec/utils/promise_extensions_spec.rb +22 -0
- data/spec/volt/repos_spec.rb +11 -0
- data/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
- data/templates/project/app/main/config/routes.rb +4 -1
- metadata +34 -10
- data/lib/volt/models/model_helpers/dirty.rb +0 -88
- data/lib/volt/models/model_helpers/listener_tracker.rb +0 -15
- data/lib/volt/models/model_helpers/model_change_helpers.rb +0 -87
- data/lib/volt/models/model_helpers/model_helpers.rb +0 -110
- data/lib/volt/models/state_helpers.rb +0 -11
- data/lib/volt/page/page.rb +0 -190
@@ -2,17 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'volt/page/bindings/view_binding'
|
3
3
|
|
4
4
|
describe Volt::ViewBinding do
|
5
|
-
|
6
|
-
@page = double('volt/page')
|
7
|
-
expect(@page).to receive(:templates).at_least(1).times { @templates }
|
8
|
-
|
9
|
-
# TODO: We should decouple things so we don't need to allocate
|
10
|
-
@view_lookup = Volt::ViewLookupForPath.new(@page, 'main/main/main')
|
11
|
-
end
|
12
|
-
|
13
|
-
def set_template(templates)
|
14
|
-
@page.instance_variable_set('@templates', templates)
|
15
|
-
end
|
5
|
+
let(:view_lookup) { Volt::ViewLookupForPath.new(@templates, 'main/main/main') }
|
16
6
|
|
17
7
|
it 'should lookup nested controller action' do
|
18
8
|
@templates = {
|
@@ -20,7 +10,7 @@ describe Volt::ViewBinding do
|
|
20
10
|
'main/comments/new/body' => ''
|
21
11
|
}
|
22
12
|
|
23
|
-
result =
|
13
|
+
result = view_lookup.path_for_template('comments/new').last
|
24
14
|
expect(result).to eq(%w(main comments_controller new))
|
25
15
|
end
|
26
16
|
|
@@ -29,7 +19,7 @@ describe Volt::ViewBinding do
|
|
29
19
|
'main/comments/new/body' => ''
|
30
20
|
}
|
31
21
|
|
32
|
-
path, result =
|
22
|
+
path, result = view_lookup.path_for_template('comments/new')
|
33
23
|
expect(path).to eq('main/comments/new/body')
|
34
24
|
expect(result).to eq(%w(main comments_controller new))
|
35
25
|
end
|
@@ -40,7 +30,7 @@ describe Volt::ViewBinding do
|
|
40
30
|
'comments/new/errors/body' => ''
|
41
31
|
}
|
42
32
|
|
43
|
-
path, result =
|
33
|
+
path, result = view_lookup.path_for_template('comments/new/errors')
|
44
34
|
expect(path).to eq('main/comments/new/errors')
|
45
35
|
expect(result).to eq(%w(main comments_controller errors))
|
46
36
|
end
|
@@ -50,7 +40,7 @@ describe Volt::ViewBinding do
|
|
50
40
|
'comments/new/errors/body' => ''
|
51
41
|
}
|
52
42
|
|
53
|
-
path, result =
|
43
|
+
path, result = view_lookup.path_for_template('comments/new/errors')
|
54
44
|
expect(path).to eq('comments/new/errors/body')
|
55
45
|
expect(result).to eq(%w(comments new_controller errors))
|
56
46
|
end
|
@@ -60,7 +50,7 @@ describe Volt::ViewBinding do
|
|
60
50
|
'comments/new/index/body' => ''
|
61
51
|
}
|
62
52
|
|
63
|
-
path, result =
|
53
|
+
path, result = view_lookup.path_for_template('comments/new')
|
64
54
|
expect(path).to eq('comments/new/index/body')
|
65
55
|
expect(result).to eq(%w(comments new_controller index))
|
66
56
|
end
|
@@ -71,7 +61,7 @@ describe Volt::ViewBinding do
|
|
71
61
|
'main/main/main/nav' => ''
|
72
62
|
}
|
73
63
|
|
74
|
-
expect(
|
64
|
+
expect(view_lookup.path_for_template('nav').first).to eq('main/main/main/nav')
|
75
65
|
end
|
76
66
|
|
77
67
|
it 'should lookup sub-templates within another local view' do
|
@@ -80,7 +70,7 @@ describe Volt::ViewBinding do
|
|
80
70
|
'main/main/main/nav' => ''
|
81
71
|
}
|
82
72
|
|
83
|
-
expect(
|
73
|
+
expect(view_lookup.path_for_template('blog/nav').first).to eq('main/main/blog/nav')
|
84
74
|
end
|
85
75
|
|
86
76
|
it 'should lookup in another view' do
|
@@ -88,7 +78,7 @@ describe Volt::ViewBinding do
|
|
88
78
|
'main/main/nav/body' => ''
|
89
79
|
}
|
90
80
|
|
91
|
-
expect(
|
81
|
+
expect(view_lookup.path_for_template('nav').first).to eq('main/main/nav/body')
|
92
82
|
end
|
93
83
|
|
94
84
|
it 'should lookup in a controller' do
|
@@ -96,7 +86,7 @@ describe Volt::ViewBinding do
|
|
96
86
|
'main/nav/index/body' => ''
|
97
87
|
}
|
98
88
|
|
99
|
-
expect(
|
89
|
+
expect(view_lookup.path_for_template('nav').first).to eq('main/nav/index/body')
|
100
90
|
end
|
101
91
|
|
102
92
|
it 'should lookup in a controller/view' do
|
@@ -104,7 +94,7 @@ describe Volt::ViewBinding do
|
|
104
94
|
'main/blog/nav/body' => ''
|
105
95
|
}
|
106
96
|
|
107
|
-
expect(
|
97
|
+
expect(view_lookup.path_for_template('blog/nav').first).to eq('main/blog/nav/body')
|
108
98
|
end
|
109
99
|
|
110
100
|
it 'should lookup in a controller' do
|
@@ -112,7 +102,7 @@ describe Volt::ViewBinding do
|
|
112
102
|
'main/nav/index/body' => ''
|
113
103
|
}
|
114
104
|
|
115
|
-
expect(
|
105
|
+
expect(view_lookup.path_for_template('nav').first).to eq('main/nav/index/body')
|
116
106
|
end
|
117
107
|
|
118
108
|
it 'should lookup in a component' do
|
@@ -120,7 +110,7 @@ describe Volt::ViewBinding do
|
|
120
110
|
'nav/main/index/body' => ''
|
121
111
|
}
|
122
112
|
|
123
|
-
expect(
|
113
|
+
expect(view_lookup.path_for_template('nav').first).to eq('nav/main/index/body')
|
124
114
|
end
|
125
115
|
|
126
116
|
it 'should lookup in a component/controller/view' do
|
@@ -129,7 +119,7 @@ describe Volt::ViewBinding do
|
|
129
119
|
'auth/login/new/body' => ''
|
130
120
|
}
|
131
121
|
|
132
|
-
expect(
|
122
|
+
expect(view_lookup.path_for_template('auth/login/new').first).to eq('auth/login/new/body')
|
133
123
|
end
|
134
124
|
|
135
125
|
it 'should let you force a sub template' do
|
@@ -138,7 +128,7 @@ describe Volt::ViewBinding do
|
|
138
128
|
'auth/login/new/title' => ''
|
139
129
|
}
|
140
130
|
|
141
|
-
expect(
|
131
|
+
expect(view_lookup.path_for_template('nav', 'title').first).to eq('nav/main/index/title')
|
142
132
|
end
|
143
133
|
|
144
134
|
it 'should return nils when given a non-existant path' do
|
@@ -147,7 +137,7 @@ describe Volt::ViewBinding do
|
|
147
137
|
'auth/login/new/title' => ''
|
148
138
|
}
|
149
139
|
|
150
|
-
expect(
|
140
|
+
expect(view_lookup.path_for_template('not/a/real/item/')).to eq([nil, nil])
|
151
141
|
end
|
152
|
-
|
142
|
+
|
153
143
|
end
|
@@ -6,22 +6,33 @@ unless RUBY_PLATFORM == 'opal'
|
|
6
6
|
before do
|
7
7
|
kitchen_sink_path = File.expand_path(File.join(File.dirname(__FILE__), '../apps/kitchen_sink'))
|
8
8
|
@volt_app = Volt::App.new(kitchen_sink_path)
|
9
|
-
@page = @volt_app.page
|
10
9
|
end
|
11
10
|
|
12
11
|
it 'should render a section' do
|
13
|
-
html = Volt::PathStringRenderer.new(@volt_app, 'main/mailers/welcome/subject', nil
|
12
|
+
html = Volt::PathStringRenderer.new(@volt_app, 'main/mailers/welcome/subject', nil).html
|
14
13
|
expect(html).to eq("\n Welcome to the site!\n\n")
|
15
14
|
end
|
16
15
|
|
17
16
|
it 'should render a section with a variable' do
|
18
|
-
html = Volt::PathStringRenderer.new(@volt_app, 'main/mailers/welcome/html', { name: 'Jimmy' }
|
17
|
+
html = Volt::PathStringRenderer.new(@volt_app, 'main/mailers/welcome/html', { name: 'Jimmy' }).html
|
19
18
|
expect(html).to eq("\n <h1>Welcome Jimmy</h1>\n\n <p>Glad you signed up!</p>\n\n")
|
20
19
|
end
|
21
20
|
|
22
21
|
it 'Raises raises ViewLookupException if full_path is nil' do
|
23
22
|
expect do
|
24
|
-
Volt::PathStringRenderer.new(@volt_app, '', { name: 'Jimmy' }
|
23
|
+
Volt::PathStringRenderer.new(@volt_app, '', { name: 'Jimmy' }).html
|
24
|
+
end.to raise_error(Volt::ViewLookupException)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'Raises raises ViewLookupException if full_path is wrong' do
|
28
|
+
expect do
|
29
|
+
Volt::PathStringRenderer.new(@volt_app, 'some/missing/path/thing', { name: 'Jimmy' }).html
|
30
|
+
end.to raise_error(Volt::ViewLookupException)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'Raises raises ViewLookupException if full_path is wrong' do
|
34
|
+
expect do
|
35
|
+
Volt::PathStringRenderer.new(@volt_app, 'wrong/main', { name: 'Jimmy' }).html
|
25
36
|
end.to raise_error(Volt::ViewLookupException)
|
26
37
|
end
|
27
38
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
if RUBY_PLATFORM != 'opal'
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'volt/server/rack/asset_files'
|
4
|
-
|
5
|
-
describe Volt::AssetFiles do
|
4
|
+
describe Volt::AssetFiles do
|
6
5
|
before do
|
7
6
|
spec_app_root = File.join(File.dirname(__FILE__), '../../apps/file_loading')
|
8
7
|
|
@@ -16,10 +15,90 @@ if RUBY_PLATFORM != 'opal'
|
|
16
15
|
expect(components).to eq(%w(volt mongo main shared bootstrap slideshow))
|
17
16
|
end
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
describe 'js files' do
|
19
|
+
context "when the component's dependencies.rb does not contain .disable_auto_import" do
|
20
|
+
it 'should list all JS files' do
|
21
|
+
main = Volt::AssetFiles.new('main', @component_paths)
|
22
|
+
expect(main.javascript_files(nil)).to eq([
|
23
|
+
'/assets/js/jquery-2.0.3.js',
|
24
|
+
'/assets/js/volt_js_polyfills.js',
|
25
|
+
'/assets/js/volt_watch.js',
|
26
|
+
'/assets/js/bootstrap.js',
|
27
|
+
'/assets/js/test2.js',
|
28
|
+
'/assets/js/test3.js',
|
29
|
+
'/assets/js/test1.js',
|
30
|
+
'/assets/volt/volt/app.js',
|
31
|
+
'/components/main.js'
|
32
|
+
])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when the component's dependencies.rb contains .disable_auto_import" do
|
37
|
+
it 'should list only the files included via the css_file helpers' do
|
38
|
+
disabled_auto = Volt::AssetFiles.new('disable_auto', @component_paths)
|
39
|
+
expect(disabled_auto.javascript_files(nil)).to eq([
|
40
|
+
'/assets/js/jquery-2.0.3.js',
|
41
|
+
'/assets/js/volt_js_polyfills.js',
|
42
|
+
'/assets/js/volt_watch.js',
|
43
|
+
'/assets/disable_auto/assets/js/test1.js',
|
44
|
+
'/assets/volt/volt/app.js',
|
45
|
+
'/components/main.js'
|
46
|
+
])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'css files' do
|
21
52
|
|
22
|
-
|
53
|
+
context "when the component's dependencies.rb does not contain .disable_auto_import" do
|
54
|
+
it 'should list all the asset files in that component' do
|
55
|
+
main = Volt::AssetFiles.new('main', @component_paths)
|
56
|
+
|
57
|
+
expect(main.css_files).to eq([
|
58
|
+
'/assets/css/notices.css',
|
59
|
+
'/assets/css/01-bootstrap.css',
|
60
|
+
'/assets/css/test3.css'
|
61
|
+
])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "when the component's dependencies.rb contains .disable_auto_import" do
|
66
|
+
it 'should list only the files included via the css_file helpers' do
|
67
|
+
disabled_auto = Volt::AssetFiles.new('disable_auto', @component_paths)
|
68
|
+
|
69
|
+
expect(disabled_auto.css_files).to eq([
|
70
|
+
'/assets/css/notices.css',
|
71
|
+
'/assets/disable_auto/assets/css/test1.css'
|
72
|
+
])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '.is_url?' do
|
78
|
+
it 'should return true for URIs like //something.com/something.js' do
|
79
|
+
main = Volt::AssetFiles.new('main', @component_paths)
|
80
|
+
expect(main.url_or_path? '//something.com/a-folder/something.js').to eq(true)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should return true for HTTP and HTTPS urls' do
|
84
|
+
main = Volt::AssetFiles.new('main', @component_paths)
|
85
|
+
expect(main.url_or_path? 'http://something.com/a-folder/something.js').to eq(true)
|
86
|
+
expect(main.url_or_path? 'https://something.com/a-folder/something.js').to eq(true)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should return true for paths' do
|
90
|
+
main = Volt::AssetFiles.new('main', @component_paths)
|
91
|
+
expect(main.url_or_path? 'something.js').to eq(false)
|
92
|
+
expect(main.url_or_path? '/assets/something.js').to eq(true)
|
93
|
+
expect(main.url_or_path? '/assets/something/something.js').to eq(true)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should return false for file names' do
|
97
|
+
main = Volt::AssetFiles.new('main', @component_paths)
|
98
|
+
expect(main.url_or_path? 'something.js').to eq(false)
|
99
|
+
expect(main.url_or_path? 'assets/something/something.js').to eq(false)
|
100
|
+
end
|
101
|
+
|
23
102
|
end
|
24
103
|
|
25
104
|
it 'should raise an exception for a missing component gem' do
|
@@ -27,9 +106,10 @@ if RUBY_PLATFORM != 'opal'
|
|
27
106
|
|
28
107
|
relative_dep_path = '../../apps/file_loading/app/missing_deps'
|
29
108
|
path_to_missing_deps = File.join(File.dirname(__FILE__), relative_dep_path)
|
109
|
+
component_name = 'a-gem-that-isnt-in-the-gemfile'
|
30
110
|
expect do
|
31
|
-
main.load_dependencies(path_to_missing_deps)
|
32
|
-
end.to raise_error("Unable to find component '
|
111
|
+
main.load_dependencies(path_to_missing_deps, component_name)
|
112
|
+
end.to raise_error("Unable to find component '#{component_name}', make sure the gem is included in your Gemfile")
|
33
113
|
end
|
34
114
|
|
35
115
|
it 'should not raise an exception for a dependency file with valid components' do
|
@@ -38,7 +118,7 @@ if RUBY_PLATFORM != 'opal'
|
|
38
118
|
path_to_main = File.join(File.dirname(__FILE__), '../../apps/file_loading/app/main')
|
39
119
|
path_to_missing_deps = File.join(File.dirname(__FILE__), path_to_main)
|
40
120
|
expect do
|
41
|
-
main.load_dependencies(path_to_missing_deps)
|
121
|
+
main.load_dependencies(path_to_missing_deps, 'component_name')
|
42
122
|
end.to_not raise_error
|
43
123
|
end
|
44
124
|
end
|
@@ -14,7 +14,7 @@ if RUBY_PLATFORM != 'opal'
|
|
14
14
|
let(:login_info) { { 'login' => 'Marty', 'password' => 'McFly' } }
|
15
15
|
|
16
16
|
before do
|
17
|
-
allow(
|
17
|
+
allow(volt_app).to receive(:store).and_return fake_store
|
18
18
|
allow(User).to receive(:login_field).and_return 'user'
|
19
19
|
allow(user_promise).to receive(:then).and_yield(user)
|
20
20
|
end
|
@@ -55,4 +55,26 @@ describe Promise do
|
|
55
55
|
a.something
|
56
56
|
end.not_to raise_error
|
57
57
|
end
|
58
|
+
|
59
|
+
describe "unwrap" do
|
60
|
+
it 'should raise an exception if calling unwrap on an unrealized promise' do
|
61
|
+
a = Promise.new
|
62
|
+
expect do
|
63
|
+
a.unwrap
|
64
|
+
end.to raise_error(Promise::UnrealizedPromiseException, '#unwrap called on a promise that has yet to be realized.')
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should return the value for a resolved promise' do
|
68
|
+
a = Promise.value(5)
|
69
|
+
|
70
|
+
expect(a.unwrap).to eq(5)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should raise an error from a rejected promise' do
|
74
|
+
a = Promise.error(Exception.new('broke it'))
|
75
|
+
expect do
|
76
|
+
a.unwrap
|
77
|
+
end.to raise_error(Exception, 'broke it')
|
78
|
+
end
|
79
|
+
end
|
58
80
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Volt::App do
|
4
|
+
[:cookies, :flash, :local_store].each do |repo|
|
5
|
+
it "should raise an error when accessing #{repo} from the server" do
|
6
|
+
expect do
|
7
|
+
volt_app.send(repo)
|
8
|
+
end.to raise_error("The #{repo} collection can only be accessed from the client side currently")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
@@ -4,7 +4,10 @@ client '/about', action: 'about'
|
|
4
4
|
|
5
5
|
# Routes for login and signup, provided by user_templates component gem
|
6
6
|
client '/signup', component: 'user_templates', controller: 'signup'
|
7
|
-
client '/login', component: 'user_templates', controller: 'login'
|
7
|
+
client '/login', component: 'user_templates', controller: 'login', action: 'index'
|
8
|
+
client '/password_reset', component: 'user_templates', controller: 'password_reset', action: 'index'
|
9
|
+
client '/forgot', component: 'user_templates', controller: 'login', action: 'forgot'
|
10
|
+
client '/account', component: 'user_templates', controller: 'account', action: 'index'
|
8
11
|
|
9
12
|
# The main route, this should be last. It will match any params not
|
10
13
|
# previously matched.
|
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.4.
|
4
|
+
version: 0.9.4.pre5
|
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-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -375,6 +375,7 @@ files:
|
|
375
375
|
- ".ruby-version"
|
376
376
|
- ".travis.yml"
|
377
377
|
- CHANGELOG.md
|
378
|
+
- CODE_OF_CONDUCT.md
|
378
379
|
- CONTRIBUTING.md
|
379
380
|
- Gemfile
|
380
381
|
- Guardfile
|
@@ -404,6 +405,7 @@ files:
|
|
404
405
|
- lib/volt/boot.rb
|
405
406
|
- lib/volt/cli.rb
|
406
407
|
- lib/volt/cli/asset_compile.rb
|
408
|
+
- lib/volt/cli/bundle.rb
|
407
409
|
- lib/volt/cli/console.rb
|
408
410
|
- lib/volt/cli/generate.rb
|
409
411
|
- lib/volt/cli/new_gem.rb
|
@@ -431,6 +433,7 @@ files:
|
|
431
433
|
- lib/volt/extra_core/string.rb
|
432
434
|
- lib/volt/extra_core/stringify_keys.rb
|
433
435
|
- lib/volt/extra_core/symbol.rb
|
436
|
+
- lib/volt/helpers/time.rb
|
434
437
|
- lib/volt/models.rb
|
435
438
|
- lib/volt/models/array_model.rb
|
436
439
|
- lib/volt/models/associations.rb
|
@@ -438,13 +441,15 @@ files:
|
|
438
441
|
- lib/volt/models/cursor.rb
|
439
442
|
- lib/volt/models/errors.rb
|
440
443
|
- lib/volt/models/field_helpers.rb
|
444
|
+
- lib/volt/models/helpers/array_model.rb
|
445
|
+
- lib/volt/models/helpers/base.rb
|
446
|
+
- lib/volt/models/helpers/change_helpers.rb
|
447
|
+
- lib/volt/models/helpers/dirty.rb
|
448
|
+
- lib/volt/models/helpers/listener_tracker.rb
|
449
|
+
- lib/volt/models/helpers/model.rb
|
441
450
|
- lib/volt/models/location.rb
|
442
451
|
- lib/volt/models/model.rb
|
443
452
|
- lib/volt/models/model_hash_behaviour.rb
|
444
|
-
- lib/volt/models/model_helpers/dirty.rb
|
445
|
-
- lib/volt/models/model_helpers/listener_tracker.rb
|
446
|
-
- lib/volt/models/model_helpers/model_change_helpers.rb
|
447
|
-
- lib/volt/models/model_helpers/model_helpers.rb
|
448
453
|
- lib/volt/models/model_wrapper.rb
|
449
454
|
- lib/volt/models/permissions.rb
|
450
455
|
- lib/volt/models/persistors/array_store.rb
|
@@ -464,7 +469,6 @@ files:
|
|
464
469
|
- lib/volt/models/persistors/store_state.rb
|
465
470
|
- lib/volt/models/root_models/root_models.rb
|
466
471
|
- lib/volt/models/root_models/store_root.rb
|
467
|
-
- lib/volt/models/state_helpers.rb
|
468
472
|
- lib/volt/models/state_manager.rb
|
469
473
|
- lib/volt/models/url.rb
|
470
474
|
- lib/volt/models/validations/errors.rb
|
@@ -496,7 +500,6 @@ files:
|
|
496
500
|
- lib/volt/page/channel_stub.rb
|
497
501
|
- lib/volt/page/document.rb
|
498
502
|
- lib/volt/page/document_events.rb
|
499
|
-
- lib/volt/page/page.rb
|
500
503
|
- lib/volt/page/path_string_renderer.rb
|
501
504
|
- lib/volt/page/string_template_renderer.rb
|
502
505
|
- lib/volt/page/sub_context.rb
|
@@ -587,15 +590,25 @@ files:
|
|
587
590
|
- lib/volt/utils/read_write_lock.rb
|
588
591
|
- lib/volt/utils/set_patch.rb
|
589
592
|
- lib/volt/utils/tilt_patch.rb
|
593
|
+
- lib/volt/utils/time_patch.rb
|
590
594
|
- lib/volt/utils/timers.rb
|
591
595
|
- lib/volt/utils/volt_user_error.rb
|
592
596
|
- lib/volt/version.rb
|
593
597
|
- lib/volt/volt/app.rb
|
598
|
+
- lib/volt/volt/client_setup/browser.rb
|
594
599
|
- lib/volt/volt/core.rb
|
595
600
|
- lib/volt/volt/environment.rb
|
601
|
+
- lib/volt/volt/repos.rb
|
596
602
|
- lib/volt/volt/server_setup/app.rb
|
603
|
+
- lib/volt/volt/templates.rb
|
597
604
|
- lib/volt/volt/users.rb
|
598
605
|
- spec/apps/file_loading/app/bootstrap/assets/js/bootstrap.js
|
606
|
+
- spec/apps/file_loading/app/disable_auto/assets/css/test1.css.scss
|
607
|
+
- spec/apps/file_loading/app/disable_auto/assets/css/test2.css.scss
|
608
|
+
- spec/apps/file_loading/app/disable_auto/assets/js/test1.js
|
609
|
+
- spec/apps/file_loading/app/disable_auto/assets/js/test2.js
|
610
|
+
- spec/apps/file_loading/app/disable_auto/config/dependencies.rb
|
611
|
+
- spec/apps/file_loading/app/main/assets/css/test3.css
|
599
612
|
- spec/apps/file_loading/app/main/assets/js/test1.js
|
600
613
|
- spec/apps/file_loading/app/main/config/dependencies.rb
|
601
614
|
- spec/apps/file_loading/app/missing_deps/config/dependencies.rb
|
@@ -664,7 +677,8 @@ files:
|
|
664
677
|
- spec/models/buffer_spec.rb
|
665
678
|
- spec/models/dirty_spec.rb
|
666
679
|
- spec/models/field_helpers_spec.rb
|
667
|
-
- spec/models/
|
680
|
+
- spec/models/helpers/base_spec.rb
|
681
|
+
- spec/models/helpers/model_spec.rb
|
668
682
|
- spec/models/model_spec.rb
|
669
683
|
- spec/models/model_state_spec.rb
|
670
684
|
- spec/models/permissions_spec.rb
|
@@ -731,6 +745,7 @@ files:
|
|
731
745
|
- spec/utils/parsing_spec.rb
|
732
746
|
- spec/utils/promise_extensions_spec.rb
|
733
747
|
- spec/utils/task_argument_filtererer_spec.rb
|
748
|
+
- spec/volt/repos_spec.rb
|
734
749
|
- templates/.gitignore
|
735
750
|
- templates/component/assets/css/.empty_directory
|
736
751
|
- templates/component/assets/images/.empty_directory
|
@@ -756,6 +771,7 @@ files:
|
|
756
771
|
- templates/controller/model_controller_spec.rb.tt
|
757
772
|
- templates/model/model.rb.tt
|
758
773
|
- templates/model/model_spec.rb.tt
|
774
|
+
- templates/newgem/CODE_OF_CONDUCT.md.tt
|
759
775
|
- templates/newgem/Gemfile.tt
|
760
776
|
- templates/newgem/LICENSE.txt.tt
|
761
777
|
- templates/newgem/README.md.tt
|
@@ -843,6 +859,12 @@ specification_version: 4
|
|
843
859
|
summary: A reactive Ruby web framework.
|
844
860
|
test_files:
|
845
861
|
- spec/apps/file_loading/app/bootstrap/assets/js/bootstrap.js
|
862
|
+
- spec/apps/file_loading/app/disable_auto/assets/css/test1.css.scss
|
863
|
+
- spec/apps/file_loading/app/disable_auto/assets/css/test2.css.scss
|
864
|
+
- spec/apps/file_loading/app/disable_auto/assets/js/test1.js
|
865
|
+
- spec/apps/file_loading/app/disable_auto/assets/js/test2.js
|
866
|
+
- spec/apps/file_loading/app/disable_auto/config/dependencies.rb
|
867
|
+
- spec/apps/file_loading/app/main/assets/css/test3.css
|
846
868
|
- spec/apps/file_loading/app/main/assets/js/test1.js
|
847
869
|
- spec/apps/file_loading/app/main/config/dependencies.rb
|
848
870
|
- spec/apps/file_loading/app/missing_deps/config/dependencies.rb
|
@@ -911,7 +933,8 @@ test_files:
|
|
911
933
|
- spec/models/buffer_spec.rb
|
912
934
|
- spec/models/dirty_spec.rb
|
913
935
|
- spec/models/field_helpers_spec.rb
|
914
|
-
- spec/models/
|
936
|
+
- spec/models/helpers/base_spec.rb
|
937
|
+
- spec/models/helpers/model_spec.rb
|
915
938
|
- spec/models/model_spec.rb
|
916
939
|
- spec/models/model_state_spec.rb
|
917
940
|
- spec/models/permissions_spec.rb
|
@@ -978,4 +1001,5 @@ test_files:
|
|
978
1001
|
- spec/utils/parsing_spec.rb
|
979
1002
|
- spec/utils/promise_extensions_spec.rb
|
980
1003
|
- spec/utils/task_argument_filtererer_spec.rb
|
1004
|
+
- spec/volt/repos_spec.rb
|
981
1005
|
has_rdoc:
|
@@ -1,88 +0,0 @@
|
|
1
|
-
module Volt
|
2
|
-
# The dirty module provides helper methods for working with and tracking
|
3
|
-
# previous values on model attributes.
|
4
|
-
module Dirty
|
5
|
-
# Return the list of attributes that have changed since the last 'save' event.
|
6
|
-
def changed_attributes
|
7
|
-
@changed_attributes ||= {}
|
8
|
-
end
|
9
|
-
|
10
|
-
# Return true if key has changed
|
11
|
-
def changed?(key = nil)
|
12
|
-
if key
|
13
|
-
# return the changed values for the keys
|
14
|
-
changed_attributes.key?(key)
|
15
|
-
else
|
16
|
-
changed_attributes.present?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# Grab all previous versions of for key
|
21
|
-
def changes(key)
|
22
|
-
changed_attributes[key]
|
23
|
-
end
|
24
|
-
|
25
|
-
# Grab the previous value for the key
|
26
|
-
def was(key)
|
27
|
-
val = changed_attributes[key]
|
28
|
-
|
29
|
-
# Doing val && val[0] doesn't work in opal
|
30
|
-
# https://github.com/opal/opal/issues/664
|
31
|
-
if val
|
32
|
-
val[0]
|
33
|
-
else
|
34
|
-
nil
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Clear changed attributes
|
39
|
-
def clear_tracked_changes!
|
40
|
-
@changed_attributes = {}
|
41
|
-
end
|
42
|
-
|
43
|
-
# Reverts the model attributes back to the pre-change values.
|
44
|
-
def revert_changes!
|
45
|
-
# Reassign the first value since we started tracking
|
46
|
-
if @changed_attributes
|
47
|
-
@changed_attributes.each_pair do |key, value|
|
48
|
-
@attributes[key] = value.first
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
clear_tracked_changes!
|
53
|
-
end
|
54
|
-
|
55
|
-
def attribute_will_change!(attribute_name, old_value)
|
56
|
-
# Don't track nil models
|
57
|
-
old_value = nil if old_value.nil?
|
58
|
-
|
59
|
-
(changed_attributes[attribute_name] ||= []) << old_value
|
60
|
-
end
|
61
|
-
|
62
|
-
# Handle change and was method calls
|
63
|
-
# Example: name_was or name_changes
|
64
|
-
def method_missing(method_name, *args, &block)
|
65
|
-
# Quick check to see if changes or was are being called, this check
|
66
|
-
# keeps us from needing to parse out the parts if we're not going
|
67
|
-
# to use them.
|
68
|
-
if method_name =~ /[_](changes|was)$/
|
69
|
-
# Break apart the method call
|
70
|
-
# TODO: no destructuring because of https://github.com/opal/opal/issues/663
|
71
|
-
*parts = method_name.to_s.split('_')
|
72
|
-
action = parts.pop
|
73
|
-
key = parts.join('_').to_sym
|
74
|
-
|
75
|
-
# Handle changes or was calls.
|
76
|
-
case action
|
77
|
-
when 'changes'
|
78
|
-
return changes(key)
|
79
|
-
when 'was'
|
80
|
-
return was(key)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Otherwise, run super
|
85
|
-
super
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Volt
|
2
|
-
# Included in model's so they can inform the ArrayModel when new listeners are added or removed.
|
3
|
-
module ListenerTracker
|
4
|
-
# Called when data from this model begins being watched
|
5
|
-
def listener_added
|
6
|
-
@listener_count ||= 0
|
7
|
-
@listener_count += 1
|
8
|
-
end
|
9
|
-
|
10
|
-
def listener_removed
|
11
|
-
@listener_count ||= 0
|
12
|
-
@listener_count -= 1
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|