volt 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b53ad931d8386ec350af55adf688c865a96021aa
4
- data.tar.gz: db65b8addb0e41e518cc1494a0a75fdee4afc84a
3
+ metadata.gz: da0ec8ba7a9dd12d296bbcc1aa8d61f1ead80e7b
4
+ data.tar.gz: 2c2cfe82c79dffd7595ca067c684733e4c5808fb
5
5
  SHA512:
6
- metadata.gz: 6b32dffb18e5e0e0052c71c15f7d3540fd1d7bcabb0d3c04d6b8187d4ec40044b4746fdb87a53a271c91bffad9a25cf49fc8bd1e3928bf4916ce839823b34594
7
- data.tar.gz: 97d1d0c43d453482904cff905109192dccdfb18a388fddc5fa285e1958241802da9b64aeb6ed652d801d1d5aac6c4f1ad2d1c2ec6e932eb7dfd0de7117d61373
6
+ metadata.gz: 00936670499b943bd1cd52a2db013c9991429b85b1739cccb237975832524aaff9ad195856d09f2e3c9f2527004990a3287c1c1a676cd47ca5955b5011c0e983
7
+ data.tar.gz: 171b29c7808b72547de2e088981f69cacf515426f89a0a5c2eaac286d358f0dfb2ef58695c4ff4893860ea8f59d3de748c9a4863af7256ae4a8710652e99c47b
data/Readme.md CHANGED
@@ -695,6 +695,13 @@ TODO
695
695
 
696
696
  # Data Store
697
697
 
698
+ Volt provides a data store collection on the front-end and the back-end. Unlike the other [collections](#provided-collections), all plural names are assumed to be collections (like an array), and all singluar are assumed to be a model (like a hash).
699
+
700
+ ```ruby
701
+
702
+ store._things
703
+ ```
704
+
698
705
  **Work in process**
699
706
 
700
707
  | state | events bound | description |
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
@@ -30,7 +30,7 @@ class LiveQuery
30
30
  end
31
31
 
32
32
  def notify_added(index, data, skip_channel)
33
- notify! do |channel|
33
+ notify!(skip_channel) do |channel|
34
34
  # puts "Added: #{index} - #{data.inspect} to #{channel.inspect}"
35
35
  channel.send_message("added", nil, @collection, @query, index, data)
36
36
  end
data/lib/volt/console.rb CHANGED
@@ -18,7 +18,7 @@ class Console
18
18
 
19
19
  app_path = File.expand_path(File.join(Dir.pwd, "app"))
20
20
  component_paths = ComponentPaths.new
21
- component_paths.setup_components_load_path
21
+ component_paths.require_in_components
22
22
 
23
23
  Pry.config.prompt_name = 'volt'
24
24
 
@@ -81,8 +81,8 @@ class ArrayModel < ReactiveArray
81
81
  super(*args)
82
82
  end
83
83
 
84
- def new_model(*args)
85
- Model.new(*args)
84
+ def new_model(attributes, options)
85
+ class_at_path(options[:path]).new(attributes, options)
86
86
  end
87
87
 
88
88
  def new_array_model(*args)
@@ -132,8 +132,8 @@ class Model
132
132
  end
133
133
  end
134
134
 
135
- def new_model(*args)
136
- Model.new(*args)
135
+ def new_model(attributes, options)
136
+ class_at_path(options[:path]).new(attributes, options)
137
137
  end
138
138
 
139
139
  def new_array_model(*args)
@@ -20,4 +20,27 @@ module ModelHelpers
20
20
  def event_removed(event, no_more_events)
21
21
  @persistor.event_removed(event, no_more_events) if @persistor
22
22
  end
23
+
24
+ # Gets the class for a model at the specified path.
25
+ def class_at_path(path)
26
+ if path && path.last == :[]
27
+ begin
28
+ # TODO: SECURITY on the back-end we need to check that the model class we're loading
29
+ # is coming from the models folder.
30
+
31
+ # remove the _ and then singularize
32
+ klass_name = path[-2][1..-1].singularize.camelize
33
+
34
+ klass_name = klass_name.camelize
35
+ klass = Object.send(:const_get, klass_name.to_sym)
36
+ rescue NameError => e
37
+ # Ignore exception, just means the model isn't defined
38
+ klass = Model
39
+ end
40
+ else
41
+ klass = Model
42
+ end
43
+
44
+ return klass
45
+ end
23
46
  end
@@ -35,7 +35,6 @@ class Page
35
35
  attr_reader :url, :params, :page, :store, :flash, :templates, :routes, :draw_cycle, :events
36
36
 
37
37
  def initialize
38
-
39
38
  # debugger
40
39
  puts "------ Page Loaded -------"
41
40
  @model_classes = {}
data/lib/volt/server.rb CHANGED
@@ -93,7 +93,7 @@ class Server
93
93
 
94
94
  # Handle socks js connection
95
95
  if RUBY_PLATFORM != 'java'
96
- component_paths.setup_components_load_path
96
+ component_paths.require_in_components
97
97
  SocketConnectionHandler.dispatcher = Dispatcher.new
98
98
 
99
99
  @app.map "/channel" do
@@ -47,8 +47,19 @@ class ComponentPaths
47
47
  return @components
48
48
  end
49
49
 
50
- # Makes each components classes available on the load path
51
- def setup_components_load_path
50
+ # Makes each components classes available on the load path, require classes.
51
+ def require_in_components
52
+ # app_folders do |app_folder|
53
+ # $LOAD_PATH.unshift(app_folder)
54
+ #
55
+ # Dir["#{app_folder}/*/{controllers,model}/*.rb"].each do |ruby_file|
56
+ # path = ruby_file.gsub(/^#{app_folder}\//, '')[0..-4]
57
+ # puts "Path: #{path}"
58
+ # # require(path)
59
+ # end
60
+ # end
61
+
62
+ # add each tasks folder directly
52
63
  components.each do |name,component_folders|
53
64
  component_folders.each do |component_folder|
54
65
  Dir["#{component_folder}/tasks"].sort.each do |tasks_folder|
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.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-12 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor