volt 0.9.3.pre2 → 0.9.3.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/app/volt/tasks/query_tasks.rb +0 -7
  4. data/app/volt/tasks/store_tasks.rb +0 -6
  5. data/docs/UPGRADE_GUIDE.md +2 -0
  6. data/lib/volt/cli/asset_compile.rb +2 -2
  7. data/lib/volt/cli/console.rb +21 -0
  8. data/lib/volt/config.rb +0 -10
  9. data/lib/volt/controllers/collection_helpers.rb +18 -0
  10. data/lib/volt/controllers/model_controller.rb +2 -12
  11. data/lib/volt/extra_core/object.rb +19 -0
  12. data/lib/volt/models.rb +14 -9
  13. data/lib/volt/models/array_model.rb +62 -22
  14. data/lib/volt/models/associations.rb +16 -1
  15. data/lib/volt/models/model.rb +27 -15
  16. data/lib/volt/models/model_helpers/model_helpers.rb +29 -0
  17. data/lib/volt/models/permissions.rb +15 -4
  18. data/lib/volt/models/persistors/array_store.rb +40 -0
  19. data/lib/volt/models/persistors/model_store.rb +2 -2
  20. data/lib/volt/models/persistors/query/query_listener.rb +3 -1
  21. data/lib/volt/models/persistors/store.rb +2 -1
  22. data/lib/volt/models/root_models/root_models.rb +31 -0
  23. data/lib/volt/models/root_models/store_root.rb +36 -0
  24. data/lib/volt/models/validators/unique_validator.rb +1 -1
  25. data/lib/volt/page/bindings/each_binding.rb +56 -47
  26. data/lib/volt/page/page.rb +5 -5
  27. data/lib/volt/reactive/reactive_array.rb +9 -6
  28. data/lib/volt/server.rb +2 -2
  29. data/lib/volt/server/component_templates.rb +7 -4
  30. data/lib/volt/server/message_bus/message_encoder.rb +9 -1
  31. data/lib/volt/server/rack/component_code.rb +8 -1
  32. data/lib/volt/server/rack/index_files.rb +5 -2
  33. data/lib/volt/tasks/{task_handler.rb → task.rb} +6 -6
  34. data/lib/volt/utils/promise.rb +429 -0
  35. data/lib/volt/utils/promise_extensions.rb +79 -0
  36. data/lib/volt/version.rb +1 -1
  37. data/lib/volt/volt/app.rb +5 -2
  38. data/lib/volt/volt/server_setup/app.rb +28 -7
  39. data/spec/apps/kitchen_sink/app/main/controllers/server/simple_http_controller.rb +1 -1
  40. data/spec/apps/kitchen_sink/app/main/views/main/store.html +3 -0
  41. data/spec/extra_core/object_spec.rb +13 -0
  42. data/spec/integration/store_spec.rb +10 -0
  43. data/spec/models/associations_spec.rb +48 -26
  44. data/spec/models/model_spec.rb +23 -7
  45. data/spec/models/persistors/store_spec.rb +28 -0
  46. data/spec/models/validators/unique_validator_spec.rb +1 -1
  47. data/spec/spec_helper.rb +4 -1
  48. data/spec/utils/promise_extensions_spec.rb +42 -0
  49. data/templates/component/config/initializers/boot.rb +10 -0
  50. data/templates/{project/app → component/config/initializers/client}/.empty_directory +0 -0
  51. data/templates/component/config/initializers/server/.empty_directory +0 -0
  52. data/templates/newgem/app/newgem/config/initializers/client/.empty_directory +0 -0
  53. data/templates/newgem/app/newgem/config/initializers/server/.empty_directory +0 -0
  54. data/templates/project/Gemfile.tt +6 -2
  55. data/templates/project/app/main/config/initializers/boot.rb +10 -0
  56. data/templates/project/app/main/config/initializers/client/.empty_directory +0 -0
  57. data/templates/project/app/main/config/initializers/server/.empty_directory +0 -0
  58. data/templates/project/config/app.rb.tt +3 -0
  59. data/templates/project/config/initializers/client/.empty_directory +0 -0
  60. data/templates/project/config/initializers/server/.empty_directory +0 -0
  61. metadata +22 -5
  62. data/lib/volt/utils/promise_patch.rb +0 -70
@@ -0,0 +1,10 @@
1
+ # Place any code you want to run when the component is included on the client
2
+ # or server.
3
+
4
+ # To include code only on the client use:
5
+ # if RUBY_PLATFORM == 'opal'
6
+ #
7
+ # To include code only on the server, use:
8
+ # unless RUBY_PLATFORM == 'opal'
9
+ # ^^ this will not send compile in code in the conditional to the client.
10
+ # ^^ this include code required in the conditional.
@@ -20,8 +20,12 @@ gem 'volt-mailer', '~> 0.1.0'
20
20
 
21
21
  # Use rbnacl for message bus encrpytion
22
22
  # (optional, if you don't need encryption, disable in app.rb and remove)
23
- gem 'rbnacl', require: false
24
- gem 'rbnacl-libsodium', require: false
23
+ #
24
+ # Message Bus encryption is not supported on Windows at the moment.
25
+ platform :ruby, :jruby do
26
+ gem 'rbnacl', require: false
27
+ gem 'rbnacl-libsodium', require: false
28
+ end
25
29
 
26
30
  # Asset compilation gems, they will be required when needed.
27
31
  gem 'csso-rails', '~> 0.3.4', require: false
@@ -0,0 +1,10 @@
1
+ # Place any code you want to run when the component is included on the client
2
+ # or server.
3
+
4
+ # To include code only on the client use:
5
+ # if RUBY_PLATFORM == 'opal'
6
+ #
7
+ # To include code only on the server, use:
8
+ # unless RUBY_PLATFORM == 'opal'
9
+ # ^^ this will not send compile in code in the conditional to the client.
10
+ # ^^ this include code required in the conditional.
@@ -1,3 +1,6 @@
1
+ # app.rb is used to configure your app. This code is only run on the server,
2
+ # then any config options in config.public are passed to the client as well.
3
+
1
4
  Volt.configure do |config|
2
5
  # Setup your global app config here.
3
6
 
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.3.pre2
4
+ version: 0.9.3.pre3
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-05-26 00:00:00.000000000 Z
11
+ date: 2015-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -410,6 +410,7 @@ files:
410
410
  - lib/volt/cli/runner.rb
411
411
  - lib/volt/config.rb
412
412
  - lib/volt/controllers/actions.rb
413
+ - lib/volt/controllers/collection_helpers.rb
413
414
  - lib/volt/controllers/http_controller.rb
414
415
  - lib/volt/controllers/model_controller.rb
415
416
  - lib/volt/controllers/template_helpers.rb
@@ -461,6 +462,8 @@ files:
461
462
  - lib/volt/models/persistors/store.rb
462
463
  - lib/volt/models/persistors/store_factory.rb
463
464
  - lib/volt/models/persistors/store_state.rb
465
+ - lib/volt/models/root_models/root_models.rb
466
+ - lib/volt/models/root_models/store_root.rb
464
467
  - lib/volt/models/state_helpers.rb
465
468
  - lib/volt/models/state_manager.rb
466
469
  - lib/volt/models/url.rb
@@ -561,7 +564,7 @@ files:
561
564
  - lib/volt/spec/setup.rb
562
565
  - lib/volt/store/mongo.rb
563
566
  - lib/volt/tasks/dispatcher.rb
564
- - lib/volt/tasks/task_handler.rb
567
+ - lib/volt/tasks/task.rb
565
568
  - lib/volt/utils/boolean_patch.rb
566
569
  - lib/volt/utils/csso_patch.rb
567
570
  - lib/volt/utils/ejson.rb
@@ -573,7 +576,8 @@ files:
573
576
  - lib/volt/utils/logging/task_logger.rb
574
577
  - lib/volt/utils/modes.rb
575
578
  - lib/volt/utils/parsing.rb
576
- - lib/volt/utils/promise_patch.rb
579
+ - lib/volt/utils/promise.rb
580
+ - lib/volt/utils/promise_extensions.rb
577
581
  - lib/volt/utils/read_write_lock.rb
578
582
  - lib/volt/utils/tilt_patch.rb
579
583
  - lib/volt/utils/timers.rb
@@ -644,6 +648,7 @@ files:
644
648
  - spec/integration/list_spec.rb
645
649
  - spec/integration/missing_spec.rb
646
650
  - spec/integration/raw_html_binding.rb
651
+ - spec/integration/store_spec.rb
647
652
  - spec/integration/templates_spec.rb
648
653
  - spec/integration/todos_spec.rb
649
654
  - spec/integration/url_spec.rb
@@ -713,12 +718,16 @@ files:
713
718
  - spec/utils/generic_counting_pool_spec.rb
714
719
  - spec/utils/generic_pool_spec.rb
715
720
  - spec/utils/parsing_spec.rb
721
+ - spec/utils/promise_extensions_spec.rb
716
722
  - spec/utils/task_argument_filtererer_spec.rb
717
723
  - templates/.gitignore
718
724
  - templates/component/assets/css/.empty_directory
719
725
  - templates/component/assets/images/.empty_directory
720
726
  - templates/component/assets/js/.empty_directory
721
727
  - templates/component/config/dependencies.rb
728
+ - templates/component/config/initializers/boot.rb
729
+ - templates/component/config/initializers/client/.empty_directory
730
+ - templates/component/config/initializers/server/.empty_directory
722
731
  - templates/component/config/routes.rb
723
732
  - templates/component/controllers/main_controller.rb.tt
724
733
  - templates/component/controllers/server/.empty_directory
@@ -744,6 +753,8 @@ files:
744
753
  - templates/newgem/app/newgem/assets/js/.empty_directory
745
754
  - templates/newgem/app/newgem/config/dependencies.rb
746
755
  - templates/newgem/app/newgem/config/initializers/boot.rb
756
+ - templates/newgem/app/newgem/config/initializers/client/.empty_directory
757
+ - templates/newgem/app/newgem/config/initializers/server/.empty_directory
747
758
  - templates/newgem/app/newgem/config/routes.rb
748
759
  - templates/newgem/app/newgem/controllers/main_controller.rb.tt
749
760
  - templates/newgem/app/newgem/controllers/server/.empty_directory
@@ -763,12 +774,14 @@ files:
763
774
  - templates/project/.gitignore
764
775
  - templates/project/Gemfile.tt
765
776
  - templates/project/README.md.tt
766
- - templates/project/app/.empty_directory
767
777
  - templates/project/app/main/assets/css/.empty_directory
768
778
  - templates/project/app/main/assets/css/app.css.scss
769
779
  - templates/project/app/main/assets/images/.empty_directory
770
780
  - templates/project/app/main/assets/js/.empty_directory
771
781
  - templates/project/app/main/config/dependencies.rb
782
+ - templates/project/app/main/config/initializers/boot.rb
783
+ - templates/project/app/main/config/initializers/client/.empty_directory
784
+ - templates/project/app/main/config/initializers/server/.empty_directory
772
785
  - templates/project/app/main/config/routes.rb
773
786
  - templates/project/app/main/controllers/main_controller.rb
774
787
  - templates/project/app/main/lib/.empty_directory
@@ -782,6 +795,8 @@ files:
782
795
  - templates/project/config/app.rb.tt
783
796
  - templates/project/config/base/index.html
784
797
  - templates/project/config/initializers/.empty_directory
798
+ - templates/project/config/initializers/client/.empty_directory
799
+ - templates/project/config/initializers/server/.empty_directory
785
800
  - templates/project/spec/app/main/controllers/server/sample_http_controller_spec.rb
786
801
  - templates/project/spec/app/main/integration/sample_integration_spec.rb
787
802
  - templates/project/spec/app/main/models/sample_model_spec.rb
@@ -876,6 +891,7 @@ test_files:
876
891
  - spec/integration/list_spec.rb
877
892
  - spec/integration/missing_spec.rb
878
893
  - spec/integration/raw_html_binding.rb
894
+ - spec/integration/store_spec.rb
879
895
  - spec/integration/templates_spec.rb
880
896
  - spec/integration/todos_spec.rb
881
897
  - spec/integration/url_spec.rb
@@ -945,5 +961,6 @@ test_files:
945
961
  - spec/utils/generic_counting_pool_spec.rb
946
962
  - spec/utils/generic_pool_spec.rb
947
963
  - spec/utils/parsing_spec.rb
964
+ - spec/utils/promise_extensions_spec.rb
948
965
  - spec/utils/task_argument_filtererer_spec.rb
949
966
  has_rdoc:
@@ -1,70 +0,0 @@
1
- # A temp patch for promises until https://github.com/opal/opal/pull/725 is released.
2
- class Promise
3
- def initialize(success = nil, failure = nil)
4
- @success = success
5
- @failure = failure
6
-
7
- @realized = nil
8
- @exception = false
9
- @value = nil
10
- @error = nil
11
- @delayed = false
12
-
13
- @prev = nil
14
- @next = nil
15
- end
16
-
17
- def >>(promise)
18
- @next = promise
19
-
20
- if exception?
21
- promise.reject(@delayed[0])
22
- elsif resolved?
23
- promise.resolve(@delayed ? @delayed[0] : value)
24
- elsif rejected? && (!@failure || Promise === (@delayed ? @delayed[0] : @error))
25
- promise.reject(@delayed ? @delayed[0] : error)
26
- end
27
-
28
- self
29
- end
30
-
31
- def resolve!(value)
32
- if @next
33
- @next.resolve(value)
34
- else
35
- @delayed = [value]
36
- end
37
- end
38
-
39
- def reject!(value)
40
- if @next
41
- @next.reject(value)
42
- else
43
- @delayed = [value]
44
- end
45
- end
46
-
47
- # Waits for the promise to resolve (assuming it is blocking on
48
- # the server) and returns the result.
49
- def sync
50
- raise ".sync can only be used on the client" if Volt.client?
51
-
52
- result = nil
53
- error = nil
54
-
55
- self.then do |val|
56
- result = val
57
- end.fail do |err|
58
- error = err
59
- end
60
-
61
- if error
62
- err_str = "Exception in Promise at .sync: #{error.inspect}"
63
- err_str += error.backtrace.join("\n")
64
- Volt.logger.error(err_str)
65
- fail error
66
- else
67
- return result
68
- end
69
- end
70
- end