volt 0.8.7 → 0.8.8

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: 0a2b7ff74b47831d3c51141f0160710989032615
4
- data.tar.gz: ab454d282bf8201f88ea15c47201adbe3b57a2d3
3
+ metadata.gz: 725663d259d0cbdeb328cb92cb6185af9df2b191
4
+ data.tar.gz: 10b2471d0b582b232e176cba6a57d9b944b2571f
5
5
  SHA512:
6
- metadata.gz: e9b1a50ea969c9c2b4bdc7f6c72c41a45585455bd92a1cb33b2b84e631756fb6f215d6a57b96e84ddb391c5b2e8d8d1f4b271d87c29fe0f91f737aca30d28d01
7
- data.tar.gz: d6e3dfb009545c36d6a12e74551ef15b6ed95e839e0caf6b4eb1e5c459d3e2916b52b0a0bee31219b8fbd49f135bf73c8743c4cc24b47ca2adf0b7c7692fbe33
6
+ metadata.gz: d8892f547d0ad523e00ef77e48129675e5027ee1235f52bef93375b4aa2f90b4c77499344e7fa120163144bb05c2aa91e1c9e6a69cd85878174e6250ffc17973
7
+ data.tar.gz: 3f3893a24fd20f25923a6cca7b4f3d087690b52b80bc8bf00f1db4c7ec8de4d2a1835dd584e9364ebc6b5c0b283f0429ec21c70a7202df2dd30416a964b0d7a4
@@ -1,15 +1,14 @@
1
1
  # 0.8.6 - Oct 5, 2014
2
2
 
3
3
  - Major changes to the templating system (to address common concerns and make things simpler).
4
- 1. All binding now takes place between {{ and }} instead of { and } (double stash instead of single stash) Escaping is still with a tripple stash {{{ escap{{ed}} }}} => escap{{ed}}
4
+ 1. All binding now takes place between ```{{ and }}``` instead of ```{ and }``` (double stash instead of single stash) Escaping is still with a tripple stash ```{{{ escap{{ed}} }}}``` => escap{{ed}}
5
5
  2. Bindings can now be (almost) any ruby code. No more #'s at the beginning. Blocks are now closed with {{ end }}
6
- If's are now: {{ if _something }} ... {{ elsif _other }} .. {{ else }} .. {{ end }}
7
- Each's are now: {{ _items.each do |item| }} ... {{ end }}
8
- Template bindings are now: {{ template "path" }} (along with other options)
9
-
6
+ If's are now: ```{{ if _something }}``` ... ```{{ elsif _other }}``` .. ```{{ else }}``` .. ```{{ end }}```
7
+ Each's are now: ```{{ _items.each do |item| }}``` ... ```{{ end }}```
8
+ Template bindings are now: ```{{ template "path" }}``` (along with other options)
10
9
  Each should use do notation not brackets. Also, .each is not actually called, the binding is parsed and converted into a EachBinding. Other Eneumerable methods do not work at this time, only each. (more coming soon)
11
10
  3. Bindings in routes now use double stashes as well get '/products/{{ _name }}/info'
12
- 4. To help clean things up, we reccomend spaces between {{ and }}
11
+ 4. To help clean things up, we reccomend spaces between ```{{``` and ```}}```
13
12
 
14
13
 
15
14
  # 0.8.4 - Oct 4, 2014
data/Readme.md CHANGED
@@ -447,7 +447,7 @@ Above, I mentioned that Volt comes with many default collection models accessibl
447
447
 
448
448
  The store collection backs data in the data store. Currently the only supported data store is Mongo. (More coming soon, RethinkDb will probably be next) You can use store very similar to the other collections.
449
449
 
450
- In Volt you can access ```store``` on the front-end and the back-end. Data will automatically be synced between the front-end and the backend. Any changes to the data in store will be reflected on any clients using the data (unless a [buffer](#buffer) is in use - see below).
450
+ In Volt you can access ```store``` on the front-end and the back-end. Data will automatically be synced between the front-end and the backend. Any changes to the data in store will be reflected on any clients using the data (unless a [buffer](#buffers) is in use - see below).
451
451
 
452
452
  ```ruby
453
453
  store._items << {_name: 'Item 1'}
@@ -727,15 +727,15 @@ Here "auth" would be the component name.
727
727
 
728
728
  ## Reactive Accessors
729
729
 
730
- The default ModelController proxies any missing methods to its model. Since models are wrapped in ReactiveValues, they return ReactiveValues by default. Sometimes you need to store additional data reactively in the controller outside of the model. (Though often you may want to condier doing another control/controller). In this case, you can add a ```reactive_accessor```. These behave just like ```attr_accessor``` except the values assigned and returned are wrapped in a ReactiveValue. Updates update the existing ReactiveValue.
730
+ The default ModelController proxies any missing methods to its model. Sometimes you need to store additional data reactively in the controller outside of the model. (Though often you may want to condier doing another control/controller). In this case, you can add a ```reactive_accessor```. These behave just like ```attr_accessor``` except the values assigned and returned are tracked for any Computations.
731
731
 
732
732
  ```ruby
733
733
  class Contacts < ModelController
734
- reactive_accessor :_query
734
+ reactive_accessor :query
735
735
  end
736
736
  ```
737
737
 
738
- Now from the view we can bind to _query while also changing in and out the model. You can also use ```reactive_reader``` and ```reactive_writer```
738
+ Now from the view we can bind to query while also changing in and out the model. You can also use ```reactive_reader``` and ```reactive_writer``` When query is accessed it tracks that it was accessed and will any Computations when it changes.
739
739
 
740
740
  # Tasks
741
741
 
@@ -982,7 +982,7 @@ Routes are matched top to bottom in a routes file.
982
982
 
983
983
  # Channel
984
984
 
985
- Controllers provide a `#channel` method, that you can use to get the status of the connection to the backend. Channel is provided in a ReactiveValue, and when the status changes, the changed events are triggered. It provides the following:
985
+ Controllers provide a `#channel` method, that you can use to get the status of the connection to the backend. Channel's access methods are reactive and when the status changes, the watching computations will be re-triggered. It provides the following:
986
986
 
987
987
  | method | description |
988
988
  |-------------|-----------------------------------------------------------|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.7
1
+ 0.8.8
@@ -11,6 +11,10 @@ class Volt
11
11
  # Run the app config to load all users config files
12
12
  Volt.run_files_in_config_folder
13
13
 
14
+ if Volt.server?
15
+ $page = Page.new
16
+ end
17
+
14
18
  component_paths = ComponentPaths.new(app_path)
15
19
  component_paths.require_in_components
16
20
 
@@ -38,6 +38,6 @@ class Console
38
38
  # start a REPL session
39
39
  # Pry.start
40
40
 
41
- Page.new.pry
41
+ $page.pry
42
42
  end
43
43
  end
@@ -6,8 +6,7 @@ class Object
6
6
  Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }]
7
7
  end
8
8
 
9
- # Provides the same functionality as ||, but since ReactiveValue's only
10
- # work with method calls, we provide .or as a convience.
9
+ # Provides the same functionality as ||, but treats a nil model as falsy
11
10
  def or(other)
12
11
  if self && !self.nil?
13
12
  return self
@@ -16,8 +15,7 @@ class Object
16
15
  end
17
16
  end
18
17
 
19
- # Provides the same functionality as &&, but since ReactiveValue's only
20
- # work with method calls, we provide .and as a convience
18
+ # Provides the same functionality as &&, treats a nil model as falsy
21
19
  def and(other)
22
20
  if self && !self.nil?
23
21
  return other
@@ -59,7 +59,6 @@ class ArrayModel < ReactiveArray
59
59
 
60
60
  # Make sure it gets wrapped
61
61
  def <<(model)
62
- # TODORW: handle changes
63
62
  if model.is_a?(Model)
64
63
  # Set the new path
65
64
  model.options = @options.merge(path: @options[:path] + [:[]])
@@ -173,7 +173,7 @@ class Model
173
173
  rescue => e
174
174
  result = e
175
175
 
176
- # Cleanup backtrace around ReactiveValue's
176
+ # Cleanup backtrace
177
177
  # TODO: this could be better
178
178
  result.backtrace.reject! {|line| line['lib/models/model.rb'] || line['lib/models/live_value.rb'] }
179
179
  end
@@ -243,10 +243,6 @@ class Model
243
243
  # Add the new item
244
244
  result << value
245
245
 
246
- # TODORW:
247
- # trigger!('added', nil, 0)
248
- # trigger!('changed')
249
-
250
246
  return nil
251
247
  end
252
248
 
@@ -177,7 +177,6 @@ module Persistors
177
177
 
178
178
  # When a model is added to this collection, we call its "changed"
179
179
  # method. This should trigger a save.
180
- # TODORW:
181
180
  def added(model, index)
182
181
  if model.persistor
183
182
  # Tell the persistor it was added
@@ -20,8 +20,6 @@ module Persistors
20
20
  end
21
21
 
22
22
  def run_update
23
- # TODORW:
24
- # $page.params.trigger!('child_changed') if Volt.client?
25
23
  if Volt.client?
26
24
  $page.url.update!
27
25
  end
@@ -18,7 +18,7 @@ class QueryListener
18
18
  @tasks.call('QueryTasks', 'add_listener', @collection, @query) do |results, errors|
19
19
  # puts "Query Tasks: #{results.inspect} - #{@stores.inspect} - #{self.inspect}"
20
20
  # When the initial data comes back, add it into the stores.
21
- @stores.each do |store|
21
+ @stores.dup.each do |store|
22
22
  # Clear if there are existing items
23
23
  store.model.clear if store.model.size > 0
24
24
 
@@ -17,8 +17,7 @@ class ContentBinding < BaseBinding
17
17
  end
18
18
 
19
19
  def update(value)
20
- # TODORW:
21
- value = value.nil? ? '' : value
20
+ value = value.or('')
22
21
 
23
22
  # Exception values display the exception as a string
24
23
  value = value.to_s
@@ -6,7 +6,6 @@ class Tasks
6
6
  @callback_id = 0
7
7
  @callbacks = {}
8
8
 
9
- # TODORW: ...
10
9
  page.channel.on('message') do |*args|
11
10
  received_message(*args)
12
11
  end
@@ -6,11 +6,6 @@ class UrlTracker
6
6
  @page = page
7
7
 
8
8
  if Volt.client?
9
- # TODORW:
10
- # page.params.on('child_changed') do
11
- # @page.url.update!
12
- # end
13
-
14
9
  that = self
15
10
 
16
11
  # Setup popstate on the dom ready event. Prevents an extra
@@ -12,7 +12,6 @@ class HashDependency
12
12
  end
13
13
 
14
14
  def delete(key)
15
- # TODORW: should this .remove
16
15
  dep = @hash_depedencies[key]
17
16
 
18
17
  if dep
@@ -88,7 +88,7 @@ module AttributeScope
88
88
  if tag_name == 'textarea'
89
89
  raise "The content of text area's can not be bound to multiple bindings."
90
90
  else
91
- # Multiple ReactiveValue's can not be passed to value or checked attributes.
91
+ # Multiple values can not be passed to value or checked attributes.
92
92
  raise "Multiple bindings can not be passed to a #{attribute_name} binding."
93
93
  end
94
94
  end
@@ -60,6 +60,14 @@ class ComponentPaths
60
60
  path = ruby_file.gsub(/^#{app_folder}\//, '')[0..-4]
61
61
  require(path)
62
62
  end
63
+
64
+ if Volt.server?
65
+ # Add models to page
66
+ Dir["#{app_folder}/*/models/*.rb"].each do |ruby_file|
67
+ class_name = File.basename(ruby_file).gsub(/[.]rb$/, '')
68
+ $page.add_model(class_name)
69
+ end
70
+ end
63
71
  end
64
72
  end
65
73
 
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.8.7
4
+ version: 0.8.8
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-10-06 00:00:00.000000000 Z
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor