volt 0.9.6 → 0.9.7.pre2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/CHANGELOG.md +26 -0
  4. data/Gemfile +6 -1
  5. data/README.md +2 -0
  6. data/Rakefile +1 -0
  7. data/app/volt/models/active_volt_instance.rb +8 -6
  8. data/app/volt/models/user.rb +11 -2
  9. data/app/volt/models/volt_app_property.rb +8 -0
  10. data/app/volt/tasks/query_tasks.rb +23 -31
  11. data/app/volt/tasks/store_tasks.rb +2 -2
  12. data/app/volt/tasks/volt_admin_tasks.rb +24 -0
  13. data/docs/UPGRADE_GUIDE.md +6 -0
  14. data/lib/volt.rb +19 -12
  15. data/lib/volt/boot.rb +1 -0
  16. data/lib/volt/cli.rb +19 -8
  17. data/lib/volt/cli/console.rb +0 -1
  18. data/lib/volt/cli/generators.rb +14 -3
  19. data/lib/volt/cli/migrate.rb +26 -0
  20. data/lib/volt/config.rb +17 -4
  21. data/lib/volt/controllers/http_controller.rb +12 -0
  22. data/lib/volt/data_stores/base_adaptor_client.rb +2 -2
  23. data/lib/volt/data_stores/base_adaptor_server.rb +2 -0
  24. data/lib/volt/data_stores/data_store.rb +20 -14
  25. data/lib/volt/extra_core/class.rb +28 -14
  26. data/lib/volt/extra_core/hash.rb +5 -0
  27. data/lib/volt/extra_core/string.rb +3 -1
  28. data/lib/volt/helpers/time.rb +9 -43
  29. data/lib/volt/helpers/time/calculations.rb +204 -0
  30. data/lib/volt/helpers/time/distance.rb +63 -0
  31. data/lib/volt/helpers/time/duration.rb +71 -0
  32. data/lib/volt/helpers/time/local_calculations.rb +49 -0
  33. data/lib/volt/helpers/time/local_volt_time.rb +23 -0
  34. data/lib/volt/helpers/time/numeric.rb +59 -0
  35. data/lib/volt/helpers/time/volt_time.rb +170 -0
  36. data/lib/volt/models.rb +5 -0
  37. data/lib/volt/models/array_model.rb +33 -6
  38. data/lib/volt/models/associations.rb +146 -23
  39. data/lib/volt/models/buffer.rb +38 -41
  40. data/lib/volt/models/cursor.rb +15 -0
  41. data/lib/volt/models/errors.rb +11 -0
  42. data/lib/volt/models/field_helpers.rb +108 -68
  43. data/lib/volt/models/helpers/array_model.rb +4 -0
  44. data/lib/volt/models/helpers/base.rb +8 -1
  45. data/lib/volt/models/helpers/change_helpers.rb +31 -12
  46. data/lib/volt/models/helpers/defaults.rb +15 -0
  47. data/lib/volt/models/location.rb +20 -6
  48. data/lib/volt/models/migrations/migration.rb +23 -0
  49. data/lib/volt/models/migrations/migration_runner.rb +146 -0
  50. data/lib/volt/models/model.rb +38 -1
  51. data/lib/volt/models/permissions.rb +8 -1
  52. data/lib/volt/models/persistors/array_store.rb +87 -8
  53. data/lib/volt/models/persistors/base.rb +19 -0
  54. data/lib/volt/models/persistors/model_store.rb +1 -1
  55. data/lib/volt/models/persistors/page.rb +4 -1
  56. data/lib/volt/models/persistors/query/query_identifier.rb +102 -0
  57. data/lib/volt/models/persistors/query/query_listener.rb +57 -12
  58. data/lib/volt/models/root_models/root_models.rb +19 -0
  59. data/lib/volt/models/url.rb +11 -2
  60. data/lib/volt/models/validations/validations.rb +5 -2
  61. data/lib/volt/models/validators/type_validator.rb +11 -0
  62. data/lib/volt/models/validators/unique_validator.rb +2 -2
  63. data/lib/volt/page/bindings/attribute_binding.rb +23 -1
  64. data/lib/volt/page/targets/attribute_section.rb +7 -0
  65. data/lib/volt/page/targets/binding_document/component_node.rb +44 -18
  66. data/lib/volt/page/targets/binding_document/tag_node.rb +41 -0
  67. data/lib/volt/page/tasks.rb +16 -8
  68. data/lib/volt/queries/live_query.rb +109 -0
  69. data/lib/volt/queries/live_query_pool.rb +58 -0
  70. data/lib/volt/queries/live_subquery.rb +0 -0
  71. data/lib/volt/queries/query_association_splitter.rb +31 -0
  72. data/lib/volt/queries/query_diff.rb +100 -0
  73. data/lib/volt/queries/query_runner.rb +110 -0
  74. data/lib/volt/queries/query_subscription.rb +80 -0
  75. data/lib/volt/queries/query_subscription_pool.rb +37 -0
  76. data/lib/volt/reactive/eventable.rb +8 -0
  77. data/lib/volt/reactive/reactive_array.rb +0 -4
  78. data/lib/volt/router/routes.rb +81 -31
  79. data/lib/volt/server/message_bus/base_message_bus.rb +9 -3
  80. data/lib/volt/server/message_bus/peer_to_peer.rb +6 -6
  81. data/lib/volt/server/message_bus/peer_to_peer/server_tracker.rb +1 -1
  82. data/lib/volt/server/middleware/default_middleware_stack.rb +12 -8
  83. data/lib/volt/server/rack/component_paths.rb +31 -4
  84. data/lib/volt/server/rack/http_content_types.rb +62 -0
  85. data/lib/volt/server/rack/http_resource.rb +1 -1
  86. data/lib/volt/server/rack/index_files.rb +8 -1
  87. data/lib/volt/server/rack/opal_files.rb +16 -1
  88. data/lib/volt/server/rack/sprockets_helpers_setup.rb +32 -1
  89. data/lib/volt/server/socket_connection_handler.rb +16 -7
  90. data/lib/volt/server/template_handlers/sprockets_component_handler.rb +5 -3
  91. data/lib/volt/spec/capybara.rb +4 -3
  92. data/lib/volt/spec/setup.rb +5 -0
  93. data/lib/volt/tasks/dispatcher.rb +3 -1
  94. data/lib/volt/utils/data_transformer.rb +4 -4
  95. data/lib/volt/utils/ejson.rb +19 -6
  96. data/lib/volt/utils/promise_extensions.rb +1 -1
  97. data/lib/volt/utils/time_opal_patch.rb +749 -0
  98. data/lib/volt/utils/time_patch.rb +11 -4
  99. data/lib/volt/version.rb +1 -1
  100. data/lib/volt/volt/app.rb +19 -11
  101. data/lib/volt/volt/properties.rb +24 -0
  102. data/lib/volt/volt/server_setup/app.rb +30 -7
  103. data/lib/volt/volt/users.rb +15 -3
  104. data/spec/apps/kitchen_sink/Gemfile +5 -1
  105. data/spec/apps/kitchen_sink/app/main/config/routes.rb +1 -0
  106. data/spec/apps/kitchen_sink/app/main/controllers/save_controller.rb +1 -1
  107. data/spec/apps/kitchen_sink/app/main/controllers/server/simple_http_controller.rb +4 -0
  108. data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +4 -2
  109. data/spec/apps/kitchen_sink/app/main/models/post.rb +0 -1
  110. data/spec/apps/kitchen_sink/app/main/models/todo.rb +4 -0
  111. data/spec/apps/kitchen_sink/app/main/views/mailers/reset_password.html +10 -0
  112. data/spec/apps/kitchen_sink/app/main/views/todos/index.html +2 -0
  113. data/spec/apps/kitchen_sink/config/app.rb +2 -0
  114. data/spec/apps/migrations/config/db/migrations/1445111704_migration1.rb +7 -0
  115. data/spec/apps/migrations/config/db/migrations/1445113517_migration2.rb +7 -0
  116. data/spec/apps/migrations/config/db/migrations/1445115200_migration3.rb +7 -0
  117. data/spec/extra_core/class_spec.rb +10 -0
  118. data/spec/helpers/distance_spec.rb +35 -0
  119. data/spec/helpers/duration_spec.rb +160 -0
  120. data/spec/helpers/volt_time_spec.rb +275 -0
  121. data/spec/integration/callbacks_spec.rb +2 -1
  122. data/spec/integration/http_endpoints_spec.rb +4 -0
  123. data/spec/integration/save_spec.rb +1 -1
  124. data/spec/integration/todos_spec.rb +7 -5
  125. data/spec/models/array_model_spec.rb +17 -3
  126. data/spec/models/associations_spec.rb +48 -1
  127. data/spec/models/field_helpers_spec.rb +7 -3
  128. data/spec/models/migrations/migration_runner_spec.rb +69 -0
  129. data/spec/models/model_spec.rb +42 -8
  130. data/spec/models/permissions_spec.rb +20 -8
  131. data/spec/models/persistors/array_store_spec.rb +18 -0
  132. data/spec/models/persistors/page_spec.rb +15 -10
  133. data/spec/models/persistors/store_spec.rb +13 -3
  134. data/spec/models/url_spec.rb +4 -3
  135. data/spec/models/user_spec.rb +6 -3
  136. data/spec/models/user_validation_spec.rb +3 -3
  137. data/spec/models/validations_spec.rb +4 -0
  138. data/spec/models/validators/block_validations_spec.rb +9 -5
  139. data/spec/models/validators/email_validator_spec.rb +2 -0
  140. data/spec/models/validators/lifecycle_callbacks_spec.rb +86 -0
  141. data/spec/models/validators/unique_validator_spec.rb +1 -0
  142. data/spec/page/path_string_renderer_spec.rb +5 -0
  143. data/spec/queries/live_query_spec.rb +16 -0
  144. data/spec/queries/query_association_splitter_spec.rb +14 -0
  145. data/spec/queries/query_diff_spec.rb +132 -0
  146. data/spec/queries/query_identifier_spec.rb +98 -0
  147. data/spec/queries/query_runner_spec.rb +63 -0
  148. data/spec/queries/query_tracker_spec.rb +141 -0
  149. data/spec/router/routes_spec.rb +52 -21
  150. data/spec/server/middleware/rack_content_types_spec.rb +78 -0
  151. data/spec/server/rack/asset_files_spec.rb +38 -30
  152. data/spec/spec_helper.rb +8 -0
  153. data/spec/utils/ejson_spec.rb +9 -8
  154. data/spec/utils/ejson_volt_time_spec.rb +65 -0
  155. data/templates/migration/migration.rb.tt +9 -0
  156. data/templates/newgem/gitignore.tt +1 -0
  157. data/templates/project/Gemfile.tt +19 -2
  158. data/templates/project/README.md.tt +6 -1
  159. data/templates/project/app/main/config/dependencies.rb +6 -0
  160. data/templates/project/config/app.rb.tt +18 -4
  161. data/volt.gemspec +2 -2
  162. metadata +73 -16
  163. data/app/volt/tasks/live_query/live_query_pool.rb +0 -48
  164. data/app/volt/tasks/live_query/query_tracker.rb +0 -92
  165. data/spec/tasks/live_query_spec.rb +0 -18
  166. data/spec/tasks/query_tasks.rb +0 -7
  167. data/spec/tasks/query_tracker_spec.rb +0 -145
@@ -3,7 +3,7 @@ if RUBY_PLATFORM != 'opal'
3
3
  require 'volt/server/rack/asset_files'
4
4
  require 'volt/server/template_handlers/sprockets_component_handler'
5
5
 
6
- describe Volt::AssetFiles do
6
+ describe Volt::AssetFiles do
7
7
  before do
8
8
  spec_app_root = File.join(File.dirname(__FILE__), '../../apps/file_loading')
9
9
 
@@ -14,38 +14,42 @@ if RUBY_PLATFORM != 'opal'
14
14
  main = Volt::AssetFiles.new('/app', 'main', @component_paths)
15
15
 
16
16
  components = main.components
17
- expect(components).to eq(%w(volt mongo main shared bootstrap slideshow))
17
+ expect(components).to eq(%w(volt sql main shared bootstrap slideshow))
18
18
  end
19
19
 
20
20
  describe 'js files' do
21
21
  context "when the component's dependencies.rb does not contain .disable_auto_import" do
22
22
  it 'should list all JS files' do
23
23
  main = Volt::AssetFiles.new('/app', 'main', @component_paths)
24
- expect(main.javascript(volt_app).reject{|v| v[0] != :src }).to eq([
25
- [:src, "/app/volt/assets/js/jquery-2.0.3.js"],
26
- [:src, "/app/volt/assets/js/volt_js_polyfills.js"],
27
- [:src, "/app/volt/assets/js/volt_watch.js"],
28
- [:src, "/app/bootstrap/assets/js/bootstrap.js"],
29
- [:src, "/app/shared/assets/js/test2.js"],
30
- [:src, "/app/slideshow/assets/js/test3.js"],
31
- [:src, "/app/main/assets/js/test1.js"],
32
- [:src, "/app/volt/volt/app.js"],
33
- [:src, "/app/components/main.js"]
34
- ])
24
+ expect(main.javascript(volt_app).reject{|v| v[0] != :src }).to eq(
25
+ [
26
+ [:src, "/app/volt/assets/js/jquery-2.0.3.js"],
27
+ [:src, "/app/volt/assets/js/volt_js_polyfills.js"],
28
+ [:src, "/app/volt/assets/js/volt_watch.js"],
29
+ [:src, "/app/bootstrap/assets/js/bootstrap.js"],
30
+ [:src, "/app/shared/assets/js/test2.js"],
31
+ [:src, "/app/slideshow/assets/js/test3.js"],
32
+ [:src, "/app/main/assets/js/test1.js"],
33
+ [:src, "/app/volt/volt/app.js"],
34
+ [:src, "/app/components/main.js"]
35
+ ]
36
+ )
35
37
  end
36
38
  end
37
39
 
38
40
  context "when the component's dependencies.rb contains .disable_auto_import" do
39
41
  it 'should list only the files included via the css_file helpers' do
40
42
  disabled_auto = Volt::AssetFiles.new('/app', 'disable_auto', @component_paths)
41
- expect(disabled_auto.javascript(volt_app).reject{|v| v[0] != :src }).to eq([
42
- [:src, "/app/volt/assets/js/jquery-2.0.3.js"],
43
- [:src, "/app/volt/assets/js/volt_js_polyfills.js"],
44
- [:src, "/app/volt/assets/js/volt_watch.js"],
45
- [:src, "/app/disable_auto/assets/js/test1.js"],
46
- [:src, "/app/volt/volt/app.js"],
47
- [:src, "/app/components/main.js"]
48
- ])
43
+ expect(disabled_auto.javascript(volt_app).reject{|v| v[0] != :src }).to eq(
44
+ [
45
+ [:src, "/app/volt/assets/js/jquery-2.0.3.js"],
46
+ [:src, "/app/volt/assets/js/volt_js_polyfills.js"],
47
+ [:src, "/app/volt/assets/js/volt_watch.js"],
48
+ [:src, "/app/disable_auto/assets/js/test1.js"],
49
+ [:src, "/app/volt/volt/app.js"],
50
+ [:src, "/app/components/main.js"]
51
+ ]
52
+ )
49
53
  end
50
54
  end
51
55
  end
@@ -56,11 +60,13 @@ if RUBY_PLATFORM != 'opal'
56
60
  it 'should list all the asset files in that component' do
57
61
  main = Volt::AssetFiles.new('/app', 'main', @component_paths)
58
62
 
59
- expect(main.css).to eq([
60
- "/app/volt/assets/css/notices.css",
61
- "/app/bootstrap/assets/css/01-bootstrap.css",
62
- "/app/main/assets/css/test3.css"
63
- ])
63
+ expect(main.css).to eq(
64
+ [
65
+ "/app/volt/assets/css/notices.css",
66
+ "/app/bootstrap/assets/css/01-bootstrap.css",
67
+ "/app/main/assets/css/test3.css"
68
+ ]
69
+ )
64
70
  end
65
71
  end
66
72
 
@@ -68,10 +74,12 @@ if RUBY_PLATFORM != 'opal'
68
74
  it 'should list only the files included via the css_file helpers' do
69
75
  disabled_auto = Volt::AssetFiles.new('/app', 'disable_auto', @component_paths)
70
76
 
71
- expect(disabled_auto.css).to eq([
72
- "/app/volt/assets/css/notices.css",
73
- "/app/disable_auto/assets/css/test1.css"
74
- ])
77
+ expect(disabled_auto.css).to eq(
78
+ [
79
+ "/app/volt/assets/css/notices.css",
80
+ "/app/disable_auto/assets/css/test1.css"
81
+ ]
82
+ )
75
83
  end
76
84
  end
77
85
  end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,16 @@
1
+ # require 'volt'
2
+ # if ENV['DB'] = 'pg'
3
+ # Volt.configure do |config|
4
+ # config.db.uri = 'postgres://ryanstout:@localhost:5432/volt_sql_test'
5
+ # end
6
+ # end
7
+
1
8
 
2
9
  require 'volt/spec/setup'
3
10
 
4
11
  unless RUBY_PLATFORM == 'opal'
5
12
  begin
13
+ require 'rack/test'
6
14
  require 'pry-byebug'
7
15
  rescue LoadError => e
8
16
  # Ignore if not installed
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'volt/helpers/time'
2
3
 
3
4
  describe Volt::EJSON, '.parse' do
4
5
  subject { Volt::EJSON }
@@ -15,7 +16,7 @@ describe Volt::EJSON, '.parse' do
15
16
  it 'only escapes one level down' do
16
17
  parsed = subject.parse %({"$escape": {"$date": {"$date": #{epoch}}}})
17
18
 
18
- expect(parsed).to eq('$date' => Time.at(ruby_epoch))
19
+ expect(parsed).to eq('$date' => VoltTime.at(ruby_epoch))
19
20
  end
20
21
  end
21
22
 
@@ -29,13 +30,13 @@ describe Volt::EJSON, '.parse' do
29
30
  it 'parses proper $date EJSON fields' do
30
31
  parsed = subject.parse '{"a" : {"$date": 135820576553}}'
31
32
 
32
- expect(parsed['a']).to eq Time.at(ruby_epoch)
33
+ expect(parsed['a']).to eq VoltTime.at(ruby_epoch)
33
34
  end
34
35
 
35
36
  it 'parses nested EJSON date fields' do
36
37
  parsed = subject.parse '{"a" : {"b" : {"$date": 135820576553}}}'
37
38
 
38
- expect(parsed['a']['b']).to eq Time.at(ruby_epoch)
39
+ expect(parsed['a']['b']).to eq VoltTime.at(ruby_epoch)
39
40
  end
40
41
 
41
42
  it 'parses nested $dates within $escapes' do
@@ -43,7 +44,7 @@ describe Volt::EJSON, '.parse' do
43
44
  '{"a" : {"$escape": {"$date" : {"date" : {"$date": 135820576553}}}}}'
44
45
  )
45
46
 
46
- expect(parsed['a']['$date']['date']).to eq Time.at(ruby_epoch)
47
+ expect(parsed['a']['$date']['date']).to eq VoltTime.at(ruby_epoch)
47
48
  end
48
49
 
49
50
  it 'parses multiple EJSON date fields' do
@@ -52,8 +53,8 @@ describe Volt::EJSON, '.parse' do
52
53
  end
53
54
 
54
55
  expect(subject.parse ejson).to eq(
55
- "when" => Time.at(ruby_epoch),
56
- "then" => Time.at(ruby_epoch)
56
+ "when" => VoltTime.at(ruby_epoch),
57
+ "then" => VoltTime.at(ruby_epoch)
57
58
  )
58
59
  end
59
60
  end
@@ -63,7 +64,7 @@ end
63
64
  describe Volt::EJSON, '.stringify' do
64
65
  subject { Volt::EJSON }
65
66
  context 'marshaling dates' do
66
- let(:now) { Time.now }
67
+ let(:now) { VoltTime.now }
67
68
  let(:now_js_epoch) { now.to_i * 1_000 }
68
69
 
69
70
  it 'does nothing with regular hashes' do
@@ -104,4 +105,4 @@ describe Volt::EJSON, '.stringify' do
104
105
  expect(stringified).to eq '{"$escape":{"$date":"something"}}'
105
106
  end
106
107
  end
107
- end
108
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+ require 'volt/helpers/time'
3
+
4
+ describe Volt::EJSON, '.parse' do
5
+ subject { Volt::EJSON }
6
+ let(:epoch) { 135820576553 }
7
+ let(:ruby_epoch) { epoch / 1000.0 }
8
+
9
+ context 'parsing EJSON fields' do
10
+ context 'VoltTime' do
11
+ it 'parses proper $date EJSON fields to VoltTime' do
12
+ parsed = subject.parse '{"a" : {"$date": 135820576553}}'
13
+
14
+ expect(parsed['a']).to eq VoltTime.at(ruby_epoch)
15
+ expect(parsed['a']).to be_a VoltTime
16
+
17
+ end
18
+
19
+ it 'parses nested EJSON date fields to VoltTime' do
20
+ parsed = subject.parse '{"a" : {"b" : {"$date": 135820576553}}}'
21
+
22
+ expect(parsed['a']['b']).to eq VoltTime.at(ruby_epoch)
23
+ expect(parsed['a']['b']).to be_a VoltTime
24
+ end
25
+
26
+ it 'parses nested $dates within $escapes' do
27
+ parsed = subject.parse(
28
+ '{"a" : {"$escape": {"$date" : {"date" : {"$date": 135820576553}}}}}'
29
+ )
30
+
31
+ expect(parsed['a']['$date']['date']).to eq VoltTime.at(ruby_epoch)
32
+ expect(parsed['a']['$date']['date']).to be_a VoltTime
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+
39
+ describe Volt::EJSON, '.stringify' do
40
+ subject { Volt::EJSON }
41
+ context 'marshaling dates' do
42
+ let(:now) { VoltTime.now }
43
+ let(:now_js_epoch) { now.to_i * 1_000 }
44
+
45
+ it 'marshals when given a VoltTime' do
46
+ stringified = subject.stringify when: now
47
+
48
+ expect(stringified).to eq %({"when":{"$date":#{now_js_epoch}}})
49
+ end
50
+
51
+ it 'marshals nested VoltTimes' do
52
+ stringified = subject.stringify how: { when: now }
53
+
54
+ expect(stringified).to eq %({"how":{"when":{"$date":#{now_js_epoch}}}})
55
+ end
56
+
57
+ it 'marshals multiple VoltTimes' do
58
+ stringified = subject.stringify when: now, then: now
59
+
60
+ expect(stringified.gsub(' ', '')).to eq(
61
+ %({"when":{"$date":#{now_js_epoch}},"then":{"$date":#{now_js_epoch}}})
62
+ )
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,9 @@
1
+ class <%= config[:class_name] %> < Volt::Migration
2
+ def up
3
+
4
+ end
5
+
6
+ def down
7
+
8
+ end
9
+ end
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ config/db/
@@ -3,7 +3,18 @@ source 'https://rubygems.org'
3
3
  gem 'volt', '<%= config[:version] %>'
4
4
 
5
5
  # volt uses mongo as the default data store.
6
- gem 'volt-mongo', '~> 0.1.0'
6
+ gem 'volt-sql', '~> 0.0.1'
7
+
8
+ # Choose the database drivers
9
+ # sqlite (default, mostly for dev)
10
+ gem 'sqlite3'
11
+
12
+ # Postgres
13
+ # gem 'pg', '~> 0.18.2'
14
+ # gem 'pg_json', '~> 0.1.29'
15
+
16
+ # Mysql
17
+ # gem 'mysql2'
7
18
 
8
19
  # The following gem's are optional for themeing
9
20
  # Twitter bootstrap
@@ -13,11 +24,17 @@ gem 'volt-bootstrap', '~> 0.1.0'
13
24
  gem 'volt-bootstrap_jumbotron_theme', '~> 0.1.0'
14
25
 
15
26
  # User templates for login, signup, and logout menu.
16
- gem 'volt-user_templates', '~> 0.4.0'
27
+ gem 'volt-user_templates', '~> 0.5.1'
17
28
 
18
29
  # Add ability to send e-mail from apps.
19
30
  gem 'volt-mailer', '~> 0.1.1'
20
31
 
32
+ group :development do
33
+ # browser_irb is optional, gives you an irb like terminal on the client
34
+ # (hit ESC) to activate.
35
+ gem 'volt-browser_irb'
36
+ end
37
+
21
38
  # Use rbnacl for message bus encrpytion
22
39
  # (optional, if you don't need encryption, disable in app.rb and remove)
23
40
  #
@@ -1,4 +1,9 @@
1
- # Place your app's docs here.
1
+ # Welcome to Volt
2
+
3
+ You can start your volt app by running:
4
+
5
+ ```bundle exec volt server```
2
6
 
3
7
  ## New to Volt?
8
+
4
9
  Be sure to read the volt docs at http://voltframework.com/docs
@@ -9,3 +9,9 @@ component 'bootstrap_jumbotron_theme'
9
9
 
10
10
  # provides templates for login, signup, and logout
11
11
  component 'user_templates'
12
+
13
+ # browser_irb is optional, gives you an irb like terminal on the client
14
+ # (hit ESC) to activate.
15
+ if Volt.env.development?
16
+ component 'browser_irb'
17
+ end
@@ -8,6 +8,7 @@ Volt.configure do |config|
8
8
  # Basic App Info (stuff you should set)
9
9
  #######################################
10
10
  config.domain = '<%= config[:domain] %>.com'
11
+ config.scheme = Volt.env.production? ? 'https' : 'http' # http or https
11
12
  config.app_name = '<%= config[:app_name] %>'
12
13
  config.mailer.from = '<%= config[:app_name] %> <no-reply@<%= config[:domain] %>.com>'
13
14
 
@@ -39,10 +40,23 @@ Volt.configure do |config|
39
40
  # Database config all start with db_ and can be set either in the config
40
41
  # file or with an environment variable (DB_NAME for example).
41
42
 
42
- # config.db_driver = 'mongo'
43
- # config.db_name = (config.app_name + '_' + Volt.env.to_s)
44
- # config.db_host = 'localhost'
45
- # config.db_port = 27017
43
+ # Default Sqlite Setup
44
+ config.db_driver = 'sqlite' # or 'postgres' or 'mysql'
45
+ config.db.database = "config/db/#{config.app_name}_#{Volt.env.to_s}.db"
46
+
47
+ # for postgres or mysql configuration, see the sequel options here:
48
+ # http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-General+connection+options
49
+ # Any options set on config.db will be passed to Sequel on connect.
50
+ # Example (with uri):
51
+ #
52
+ # config.db.uri = 'postgres://ryanstout:@localhost:5432/blog_demo10'
53
+ #
54
+ # Example (with options)
55
+ # config.db_driver = 'postgres'# or 'mysql'
56
+ # config.db.database = "#{config.app_name}_#{Volt.env.to_s}"
57
+ # config.db.host = 'mydatabase.com/'
58
+ # config.db.user = 'my user'
59
+ # config.db.password = 'some password'
46
60
 
47
61
  #####################
48
62
  # Compression options
data/volt.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency 'thor', '~> 0.19.0'
23
23
  spec.add_dependency 'pry', '~> 0.10.1'
24
- spec.add_dependency 'rack', '~> 1.5.0'
24
+ spec.add_dependency 'rack', '~> 1.6.4'
25
25
  # spec.add_dependency 'sprockets-sass', '~> 1.0.0'
26
26
  spec.add_dependency 'sass', '~> 3.4.15'
27
27
  spec.add_dependency 'listen', '~> 3.0.1'
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
41
41
  # For testing
42
42
  spec.add_development_dependency 'rspec', '~> 3.2.0'
43
43
  spec.add_development_dependency 'opal-rspec', '~> 0.4.3'
44
- spec.add_development_dependency 'capybara', '~> 2.4.4'
44
+ spec.add_development_dependency 'capybara', '~> 2.5.0'
45
45
 
46
46
  # There is a big performance issue with selenium-webdriver on v2.45.0
47
47
  spec.add_development_dependency 'selenium-webdriver', '~> 2.47.1'
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.7.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-10-17 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.5.0
47
+ version: 1.6.4
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.5.0
54
+ version: 1.6.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sass
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -218,14 +218,14 @@ dependencies:
218
218
  requirements:
219
219
  - - "~>"
220
220
  - !ruby/object:Gem::Version
221
- version: 2.4.4
221
+ version: 2.5.0
222
222
  type: :development
223
223
  prerelease: false
224
224
  version_requirements: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - - "~>"
227
227
  - !ruby/object:Gem::Version
228
- version: 2.4.4
228
+ version: 2.5.0
229
229
  - !ruby/object:Gem::Dependency
230
230
  name: selenium-webdriver
231
231
  requirement: !ruby/object:Gem::Requirement
@@ -396,12 +396,12 @@ files:
396
396
  - app/volt/controllers/notices_controller.rb
397
397
  - app/volt/models/active_volt_instance.rb
398
398
  - app/volt/models/user.rb
399
+ - app/volt/models/volt_app_property.rb
399
400
  - app/volt/tasks/live_query/live_query.rb
400
- - app/volt/tasks/live_query/live_query_pool.rb
401
- - app/volt/tasks/live_query/query_tracker.rb
402
401
  - app/volt/tasks/query_tasks.rb
403
402
  - app/volt/tasks/store_tasks.rb
404
403
  - app/volt/tasks/user_tasks.rb
404
+ - app/volt/tasks/volt_admin_tasks.rb
405
405
  - app/volt/views/notices/index.html
406
406
  - bin/volt
407
407
  - docs/UPGRADE_GUIDE.md
@@ -418,6 +418,7 @@ files:
418
418
  - lib/volt/cli/destroy.rb
419
419
  - lib/volt/cli/generate.rb
420
420
  - lib/volt/cli/generators.rb
421
+ - lib/volt/cli/migrate.rb
421
422
  - lib/volt/cli/new_gem.rb
422
423
  - lib/volt/cli/runner.rb
423
424
  - lib/volt/config.rb
@@ -445,6 +446,13 @@ files:
445
446
  - lib/volt/extra_core/stringify_keys.rb
446
447
  - lib/volt/extra_core/symbol.rb
447
448
  - lib/volt/helpers/time.rb
449
+ - lib/volt/helpers/time/calculations.rb
450
+ - lib/volt/helpers/time/distance.rb
451
+ - lib/volt/helpers/time/duration.rb
452
+ - lib/volt/helpers/time/local_calculations.rb
453
+ - lib/volt/helpers/time/local_volt_time.rb
454
+ - lib/volt/helpers/time/numeric.rb
455
+ - lib/volt/helpers/time/volt_time.rb
448
456
  - lib/volt/models.rb
449
457
  - lib/volt/models/array_model.rb
450
458
  - lib/volt/models/associations.rb
@@ -455,10 +463,13 @@ files:
455
463
  - lib/volt/models/helpers/array_model.rb
456
464
  - lib/volt/models/helpers/base.rb
457
465
  - lib/volt/models/helpers/change_helpers.rb
466
+ - lib/volt/models/helpers/defaults.rb
458
467
  - lib/volt/models/helpers/dirty.rb
459
468
  - lib/volt/models/helpers/listener_tracker.rb
460
469
  - lib/volt/models/helpers/model.rb
461
470
  - lib/volt/models/location.rb
471
+ - lib/volt/models/migrations/migration.rb
472
+ - lib/volt/models/migrations/migration_runner.rb
462
473
  - lib/volt/models/model.rb
463
474
  - lib/volt/models/model_hash_behaviour.rb
464
475
  - lib/volt/models/model_wrapper.rb
@@ -473,6 +484,7 @@ files:
473
484
  - lib/volt/models/persistors/page.rb
474
485
  - lib/volt/models/persistors/params.rb
475
486
  - lib/volt/models/persistors/query/normalizer.rb
487
+ - lib/volt/models/persistors/query/query_identifier.rb
476
488
  - lib/volt/models/persistors/query/query_listener.rb
477
489
  - lib/volt/models/persistors/query/query_listener_pool.rb
478
490
  - lib/volt/models/persistors/store.rb
@@ -521,6 +533,7 @@ files:
521
533
  - lib/volt/page/targets/binding_document/base_node.rb
522
534
  - lib/volt/page/targets/binding_document/component_node.rb
523
535
  - lib/volt/page/targets/binding_document/html_node.rb
536
+ - lib/volt/page/targets/binding_document/tag_node.rb
524
537
  - lib/volt/page/targets/dom_section.rb
525
538
  - lib/volt/page/targets/dom_target.rb
526
539
  - lib/volt/page/targets/dom_template.rb
@@ -528,6 +541,14 @@ files:
528
541
  - lib/volt/page/tasks.rb
529
542
  - lib/volt/page/template_renderer.rb
530
543
  - lib/volt/page/url_tracker.rb
544
+ - lib/volt/queries/live_query.rb
545
+ - lib/volt/queries/live_query_pool.rb
546
+ - lib/volt/queries/live_subquery.rb
547
+ - lib/volt/queries/query_association_splitter.rb
548
+ - lib/volt/queries/query_diff.rb
549
+ - lib/volt/queries/query_runner.rb
550
+ - lib/volt/queries/query_subscription.rb
551
+ - lib/volt/queries/query_subscription_pool.rb
531
552
  - lib/volt/reactive/class_eventable.rb
532
553
  - lib/volt/reactive/computation.rb
533
554
  - lib/volt/reactive/dependency.rb
@@ -564,6 +585,7 @@ files:
564
585
  - lib/volt/server/rack/asset_files.rb
565
586
  - lib/volt/server/rack/component_code.rb
566
587
  - lib/volt/server/rack/component_paths.rb
588
+ - lib/volt/server/rack/http_content_types.rb
567
589
  - lib/volt/server/rack/http_request.rb
568
590
  - lib/volt/server/rack/http_resource.rb
569
591
  - lib/volt/server/rack/http_response_header.rb
@@ -603,6 +625,7 @@ files:
603
625
  - lib/volt/utils/read_write_lock.rb
604
626
  - lib/volt/utils/recursive_exists.rb
605
627
  - lib/volt/utils/tilt_patch.rb
628
+ - lib/volt/utils/time_opal_patch.rb
606
629
  - lib/volt/utils/time_patch.rb
607
630
  - lib/volt/utils/timers.rb
608
631
  - lib/volt/utils/volt_user_error.rb
@@ -611,6 +634,7 @@ files:
611
634
  - lib/volt/volt/client_setup/browser.rb
612
635
  - lib/volt/volt/core.rb
613
636
  - lib/volt/volt/environment.rb
637
+ - lib/volt/volt/properties.rb
614
638
  - lib/volt/volt/repos.rb
615
639
  - lib/volt/volt/server_setup/app.rb
616
640
  - lib/volt/volt/templates.rb
@@ -644,9 +668,11 @@ files:
644
668
  - spec/apps/kitchen_sink/app/main/controllers/upload_controller.rb
645
669
  - spec/apps/kitchen_sink/app/main/controllers/yield_component_controller.rb
646
670
  - spec/apps/kitchen_sink/app/main/models/post.rb
671
+ - spec/apps/kitchen_sink/app/main/models/todo.rb
647
672
  - spec/apps/kitchen_sink/app/main/models/user.rb
648
673
  - spec/apps/kitchen_sink/app/main/tasks/login_tasks.rb
649
674
  - spec/apps/kitchen_sink/app/main/views/events/index.html
675
+ - spec/apps/kitchen_sink/app/main/views/mailers/reset_password.html
650
676
  - spec/apps/kitchen_sink/app/main/views/mailers/welcome.email
651
677
  - spec/apps/kitchen_sink/app/main/views/main/bindings.html
652
678
  - spec/apps/kitchen_sink/app/main/views/main/callbacks.html
@@ -670,6 +696,9 @@ files:
670
696
  - spec/apps/kitchen_sink/config.ru
671
697
  - spec/apps/kitchen_sink/config/app.rb
672
698
  - spec/apps/kitchen_sink/config/base/index.html
699
+ - spec/apps/migrations/config/db/migrations/1445111704_migration1.rb
700
+ - spec/apps/migrations/config/db/migrations/1445113517_migration2.rb
701
+ - spec/apps/migrations/config/db/migrations/1445115200_migration3.rb
673
702
  - spec/controllers/http_controller_spec.rb
674
703
  - spec/controllers/model_controller_spec.rb
675
704
  - spec/controllers/reactive_accessors_spec.rb
@@ -683,6 +712,9 @@ files:
683
712
  - spec/extra_core/string_transformation_test_cases.rb
684
713
  - spec/extra_core/string_transformations_spec.rb
685
714
  - spec/extra_core/symbol_spec.rb
715
+ - spec/helpers/distance_spec.rb
716
+ - spec/helpers/duration_spec.rb
717
+ - spec/helpers/volt_time_spec.rb
686
718
  - spec/integration/bindings_spec.rb
687
719
  - spec/integration/callbacks_spec.rb
688
720
  - spec/integration/client_require_spec.rb
@@ -709,9 +741,11 @@ files:
709
741
  - spec/models/field_helpers_spec.rb
710
742
  - spec/models/helpers/base_spec.rb
711
743
  - spec/models/helpers/model_spec.rb
744
+ - spec/models/migrations/migration_runner_spec.rb
712
745
  - spec/models/model_spec.rb
713
746
  - spec/models/model_state_spec.rb
714
747
  - spec/models/permissions_spec.rb
748
+ - spec/models/persistors/array_store_spec.rb
715
749
  - spec/models/persistors/flash_spec.rb
716
750
  - spec/models/persistors/page_spec.rb
717
751
  - spec/models/persistors/params_spec.rb
@@ -725,6 +759,7 @@ files:
725
759
  - spec/models/validators/format_validator_spec.rb
726
760
  - spec/models/validators/inclusion_validator_spec.rb
727
761
  - spec/models/validators/length_validator_spec.rb
762
+ - spec/models/validators/lifecycle_callbacks_spec.rb
728
763
  - spec/models/validators/phone_number_validator_spec.rb
729
764
  - spec/models/validators/shared_examples_for_validators.rb
730
765
  - spec/models/validators/type_validator_spec.rb
@@ -736,6 +771,12 @@ files:
736
771
  - spec/page/bindings/template_binding_spec.rb
737
772
  - spec/page/path_string_renderer_spec.rb
738
773
  - spec/page/sub_context_spec.rb
774
+ - spec/queries/live_query_spec.rb
775
+ - spec/queries/query_association_splitter_spec.rb
776
+ - spec/queries/query_diff_spec.rb
777
+ - spec/queries/query_identifier_spec.rb
778
+ - spec/queries/query_runner_spec.rb
779
+ - spec/queries/query_tracker_spec.rb
739
780
  - spec/reactive/class_eventable_spec.rb
740
781
  - spec/reactive/computation_spec.rb
741
782
  - spec/reactive/dependency_spec.rb
@@ -756,6 +797,7 @@ files:
756
797
  - spec/server/message_bus/peer_to_peer/socket_with_timeout_spec.rb
757
798
  - spec/server/message_bus/peer_to_peer_spec.rb
758
799
  - spec/server/middleware/middleware_stack_spec.rb
800
+ - spec/server/middleware/rack_content_types_spec.rb
759
801
  - spec/server/rack/asset_files_spec.rb
760
802
  - spec/server/rack/component_paths_spec.rb
761
803
  - spec/server/rack/http_request_spec.rb
@@ -768,13 +810,11 @@ files:
768
810
  - spec/server/socket_connection_handler_spec.rb
769
811
  - spec/spec_helper.rb
770
812
  - spec/tasks/dispatcher_spec.rb
771
- - spec/tasks/live_query_spec.rb
772
- - spec/tasks/query_tasks.rb
773
- - spec/tasks/query_tracker_spec.rb
774
813
  - spec/tasks/user_tasks_spec.rb
775
814
  - spec/templates/targets/binding_document/component_node_spec.rb
776
815
  - spec/utils/data_transformer_spec.rb
777
816
  - spec/utils/ejson_spec.rb
817
+ - spec/utils/ejson_volt_time_spec.rb
778
818
  - spec/utils/generic_counting_pool_spec.rb
779
819
  - spec/utils/generic_pool_spec.rb
780
820
  - spec/utils/lifecycle_callbacks_spec.rb
@@ -805,6 +845,7 @@ files:
805
845
  - templates/controller/http_controller_spec.rb.tt
806
846
  - templates/controller/model_controller.rb.tt
807
847
  - templates/controller/model_controller_spec.rb.tt
848
+ - templates/migration/migration.rb.tt
808
849
  - templates/model/model.rb.tt
809
850
  - templates/model/model_spec.rb.tt
810
851
  - templates/newgem/CODE_OF_CONDUCT.md.tt
@@ -884,9 +925,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
884
925
  version: '2.1'
885
926
  required_rubygems_version: !ruby/object:Gem::Requirement
886
927
  requirements:
887
- - - ">="
928
+ - - ">"
888
929
  - !ruby/object:Gem::Version
889
- version: '0'
930
+ version: 1.3.1
890
931
  requirements: []
891
932
  rubyforge_project:
892
933
  rubygems_version: 2.4.5
@@ -923,9 +964,11 @@ test_files:
923
964
  - spec/apps/kitchen_sink/app/main/controllers/upload_controller.rb
924
965
  - spec/apps/kitchen_sink/app/main/controllers/yield_component_controller.rb
925
966
  - spec/apps/kitchen_sink/app/main/models/post.rb
967
+ - spec/apps/kitchen_sink/app/main/models/todo.rb
926
968
  - spec/apps/kitchen_sink/app/main/models/user.rb
927
969
  - spec/apps/kitchen_sink/app/main/tasks/login_tasks.rb
928
970
  - spec/apps/kitchen_sink/app/main/views/events/index.html
971
+ - spec/apps/kitchen_sink/app/main/views/mailers/reset_password.html
929
972
  - spec/apps/kitchen_sink/app/main/views/mailers/welcome.email
930
973
  - spec/apps/kitchen_sink/app/main/views/main/bindings.html
931
974
  - spec/apps/kitchen_sink/app/main/views/main/callbacks.html
@@ -949,6 +992,9 @@ test_files:
949
992
  - spec/apps/kitchen_sink/config.ru
950
993
  - spec/apps/kitchen_sink/config/app.rb
951
994
  - spec/apps/kitchen_sink/config/base/index.html
995
+ - spec/apps/migrations/config/db/migrations/1445111704_migration1.rb
996
+ - spec/apps/migrations/config/db/migrations/1445113517_migration2.rb
997
+ - spec/apps/migrations/config/db/migrations/1445115200_migration3.rb
952
998
  - spec/controllers/http_controller_spec.rb
953
999
  - spec/controllers/model_controller_spec.rb
954
1000
  - spec/controllers/reactive_accessors_spec.rb
@@ -962,6 +1008,9 @@ test_files:
962
1008
  - spec/extra_core/string_transformation_test_cases.rb
963
1009
  - spec/extra_core/string_transformations_spec.rb
964
1010
  - spec/extra_core/symbol_spec.rb
1011
+ - spec/helpers/distance_spec.rb
1012
+ - spec/helpers/duration_spec.rb
1013
+ - spec/helpers/volt_time_spec.rb
965
1014
  - spec/integration/bindings_spec.rb
966
1015
  - spec/integration/callbacks_spec.rb
967
1016
  - spec/integration/client_require_spec.rb
@@ -988,9 +1037,11 @@ test_files:
988
1037
  - spec/models/field_helpers_spec.rb
989
1038
  - spec/models/helpers/base_spec.rb
990
1039
  - spec/models/helpers/model_spec.rb
1040
+ - spec/models/migrations/migration_runner_spec.rb
991
1041
  - spec/models/model_spec.rb
992
1042
  - spec/models/model_state_spec.rb
993
1043
  - spec/models/permissions_spec.rb
1044
+ - spec/models/persistors/array_store_spec.rb
994
1045
  - spec/models/persistors/flash_spec.rb
995
1046
  - spec/models/persistors/page_spec.rb
996
1047
  - spec/models/persistors/params_spec.rb
@@ -1004,6 +1055,7 @@ test_files:
1004
1055
  - spec/models/validators/format_validator_spec.rb
1005
1056
  - spec/models/validators/inclusion_validator_spec.rb
1006
1057
  - spec/models/validators/length_validator_spec.rb
1058
+ - spec/models/validators/lifecycle_callbacks_spec.rb
1007
1059
  - spec/models/validators/phone_number_validator_spec.rb
1008
1060
  - spec/models/validators/shared_examples_for_validators.rb
1009
1061
  - spec/models/validators/type_validator_spec.rb
@@ -1015,6 +1067,12 @@ test_files:
1015
1067
  - spec/page/bindings/template_binding_spec.rb
1016
1068
  - spec/page/path_string_renderer_spec.rb
1017
1069
  - spec/page/sub_context_spec.rb
1070
+ - spec/queries/live_query_spec.rb
1071
+ - spec/queries/query_association_splitter_spec.rb
1072
+ - spec/queries/query_diff_spec.rb
1073
+ - spec/queries/query_identifier_spec.rb
1074
+ - spec/queries/query_runner_spec.rb
1075
+ - spec/queries/query_tracker_spec.rb
1018
1076
  - spec/reactive/class_eventable_spec.rb
1019
1077
  - spec/reactive/computation_spec.rb
1020
1078
  - spec/reactive/dependency_spec.rb
@@ -1035,6 +1093,7 @@ test_files:
1035
1093
  - spec/server/message_bus/peer_to_peer/socket_with_timeout_spec.rb
1036
1094
  - spec/server/message_bus/peer_to_peer_spec.rb
1037
1095
  - spec/server/middleware/middleware_stack_spec.rb
1096
+ - spec/server/middleware/rack_content_types_spec.rb
1038
1097
  - spec/server/rack/asset_files_spec.rb
1039
1098
  - spec/server/rack/component_paths_spec.rb
1040
1099
  - spec/server/rack/http_request_spec.rb
@@ -1047,13 +1106,11 @@ test_files:
1047
1106
  - spec/server/socket_connection_handler_spec.rb
1048
1107
  - spec/spec_helper.rb
1049
1108
  - spec/tasks/dispatcher_spec.rb
1050
- - spec/tasks/live_query_spec.rb
1051
- - spec/tasks/query_tasks.rb
1052
- - spec/tasks/query_tracker_spec.rb
1053
1109
  - spec/tasks/user_tasks_spec.rb
1054
1110
  - spec/templates/targets/binding_document/component_node_spec.rb
1055
1111
  - spec/utils/data_transformer_spec.rb
1056
1112
  - spec/utils/ejson_spec.rb
1113
+ - spec/utils/ejson_volt_time_spec.rb
1057
1114
  - spec/utils/generic_counting_pool_spec.rb
1058
1115
  - spec/utils/generic_pool_spec.rb
1059
1116
  - spec/utils/lifecycle_callbacks_spec.rb