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.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +26 -0
- data/Gemfile +6 -1
- data/README.md +2 -0
- data/Rakefile +1 -0
- data/app/volt/models/active_volt_instance.rb +8 -6
- data/app/volt/models/user.rb +11 -2
- data/app/volt/models/volt_app_property.rb +8 -0
- data/app/volt/tasks/query_tasks.rb +23 -31
- data/app/volt/tasks/store_tasks.rb +2 -2
- data/app/volt/tasks/volt_admin_tasks.rb +24 -0
- data/docs/UPGRADE_GUIDE.md +6 -0
- data/lib/volt.rb +19 -12
- data/lib/volt/boot.rb +1 -0
- data/lib/volt/cli.rb +19 -8
- data/lib/volt/cli/console.rb +0 -1
- data/lib/volt/cli/generators.rb +14 -3
- data/lib/volt/cli/migrate.rb +26 -0
- data/lib/volt/config.rb +17 -4
- data/lib/volt/controllers/http_controller.rb +12 -0
- data/lib/volt/data_stores/base_adaptor_client.rb +2 -2
- data/lib/volt/data_stores/base_adaptor_server.rb +2 -0
- data/lib/volt/data_stores/data_store.rb +20 -14
- data/lib/volt/extra_core/class.rb +28 -14
- data/lib/volt/extra_core/hash.rb +5 -0
- data/lib/volt/extra_core/string.rb +3 -1
- data/lib/volt/helpers/time.rb +9 -43
- data/lib/volt/helpers/time/calculations.rb +204 -0
- data/lib/volt/helpers/time/distance.rb +63 -0
- data/lib/volt/helpers/time/duration.rb +71 -0
- data/lib/volt/helpers/time/local_calculations.rb +49 -0
- data/lib/volt/helpers/time/local_volt_time.rb +23 -0
- data/lib/volt/helpers/time/numeric.rb +59 -0
- data/lib/volt/helpers/time/volt_time.rb +170 -0
- data/lib/volt/models.rb +5 -0
- data/lib/volt/models/array_model.rb +33 -6
- data/lib/volt/models/associations.rb +146 -23
- data/lib/volt/models/buffer.rb +38 -41
- data/lib/volt/models/cursor.rb +15 -0
- data/lib/volt/models/errors.rb +11 -0
- data/lib/volt/models/field_helpers.rb +108 -68
- data/lib/volt/models/helpers/array_model.rb +4 -0
- data/lib/volt/models/helpers/base.rb +8 -1
- data/lib/volt/models/helpers/change_helpers.rb +31 -12
- data/lib/volt/models/helpers/defaults.rb +15 -0
- data/lib/volt/models/location.rb +20 -6
- data/lib/volt/models/migrations/migration.rb +23 -0
- data/lib/volt/models/migrations/migration_runner.rb +146 -0
- data/lib/volt/models/model.rb +38 -1
- data/lib/volt/models/permissions.rb +8 -1
- data/lib/volt/models/persistors/array_store.rb +87 -8
- data/lib/volt/models/persistors/base.rb +19 -0
- data/lib/volt/models/persistors/model_store.rb +1 -1
- data/lib/volt/models/persistors/page.rb +4 -1
- data/lib/volt/models/persistors/query/query_identifier.rb +102 -0
- data/lib/volt/models/persistors/query/query_listener.rb +57 -12
- data/lib/volt/models/root_models/root_models.rb +19 -0
- data/lib/volt/models/url.rb +11 -2
- data/lib/volt/models/validations/validations.rb +5 -2
- data/lib/volt/models/validators/type_validator.rb +11 -0
- data/lib/volt/models/validators/unique_validator.rb +2 -2
- data/lib/volt/page/bindings/attribute_binding.rb +23 -1
- data/lib/volt/page/targets/attribute_section.rb +7 -0
- data/lib/volt/page/targets/binding_document/component_node.rb +44 -18
- data/lib/volt/page/targets/binding_document/tag_node.rb +41 -0
- data/lib/volt/page/tasks.rb +16 -8
- data/lib/volt/queries/live_query.rb +109 -0
- data/lib/volt/queries/live_query_pool.rb +58 -0
- data/lib/volt/queries/live_subquery.rb +0 -0
- data/lib/volt/queries/query_association_splitter.rb +31 -0
- data/lib/volt/queries/query_diff.rb +100 -0
- data/lib/volt/queries/query_runner.rb +110 -0
- data/lib/volt/queries/query_subscription.rb +80 -0
- data/lib/volt/queries/query_subscription_pool.rb +37 -0
- data/lib/volt/reactive/eventable.rb +8 -0
- data/lib/volt/reactive/reactive_array.rb +0 -4
- data/lib/volt/router/routes.rb +81 -31
- data/lib/volt/server/message_bus/base_message_bus.rb +9 -3
- data/lib/volt/server/message_bus/peer_to_peer.rb +6 -6
- data/lib/volt/server/message_bus/peer_to_peer/server_tracker.rb +1 -1
- data/lib/volt/server/middleware/default_middleware_stack.rb +12 -8
- data/lib/volt/server/rack/component_paths.rb +31 -4
- data/lib/volt/server/rack/http_content_types.rb +62 -0
- data/lib/volt/server/rack/http_resource.rb +1 -1
- data/lib/volt/server/rack/index_files.rb +8 -1
- data/lib/volt/server/rack/opal_files.rb +16 -1
- data/lib/volt/server/rack/sprockets_helpers_setup.rb +32 -1
- data/lib/volt/server/socket_connection_handler.rb +16 -7
- data/lib/volt/server/template_handlers/sprockets_component_handler.rb +5 -3
- data/lib/volt/spec/capybara.rb +4 -3
- data/lib/volt/spec/setup.rb +5 -0
- data/lib/volt/tasks/dispatcher.rb +3 -1
- data/lib/volt/utils/data_transformer.rb +4 -4
- data/lib/volt/utils/ejson.rb +19 -6
- data/lib/volt/utils/promise_extensions.rb +1 -1
- data/lib/volt/utils/time_opal_patch.rb +749 -0
- data/lib/volt/utils/time_patch.rb +11 -4
- data/lib/volt/version.rb +1 -1
- data/lib/volt/volt/app.rb +19 -11
- data/lib/volt/volt/properties.rb +24 -0
- data/lib/volt/volt/server_setup/app.rb +30 -7
- data/lib/volt/volt/users.rb +15 -3
- data/spec/apps/kitchen_sink/Gemfile +5 -1
- data/spec/apps/kitchen_sink/app/main/config/routes.rb +1 -0
- data/spec/apps/kitchen_sink/app/main/controllers/save_controller.rb +1 -1
- data/spec/apps/kitchen_sink/app/main/controllers/server/simple_http_controller.rb +4 -0
- data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +4 -2
- data/spec/apps/kitchen_sink/app/main/models/post.rb +0 -1
- data/spec/apps/kitchen_sink/app/main/models/todo.rb +4 -0
- data/spec/apps/kitchen_sink/app/main/views/mailers/reset_password.html +10 -0
- data/spec/apps/kitchen_sink/app/main/views/todos/index.html +2 -0
- data/spec/apps/kitchen_sink/config/app.rb +2 -0
- data/spec/apps/migrations/config/db/migrations/1445111704_migration1.rb +7 -0
- data/spec/apps/migrations/config/db/migrations/1445113517_migration2.rb +7 -0
- data/spec/apps/migrations/config/db/migrations/1445115200_migration3.rb +7 -0
- data/spec/extra_core/class_spec.rb +10 -0
- data/spec/helpers/distance_spec.rb +35 -0
- data/spec/helpers/duration_spec.rb +160 -0
- data/spec/helpers/volt_time_spec.rb +275 -0
- data/spec/integration/callbacks_spec.rb +2 -1
- data/spec/integration/http_endpoints_spec.rb +4 -0
- data/spec/integration/save_spec.rb +1 -1
- data/spec/integration/todos_spec.rb +7 -5
- data/spec/models/array_model_spec.rb +17 -3
- data/spec/models/associations_spec.rb +48 -1
- data/spec/models/field_helpers_spec.rb +7 -3
- data/spec/models/migrations/migration_runner_spec.rb +69 -0
- data/spec/models/model_spec.rb +42 -8
- data/spec/models/permissions_spec.rb +20 -8
- data/spec/models/persistors/array_store_spec.rb +18 -0
- data/spec/models/persistors/page_spec.rb +15 -10
- data/spec/models/persistors/store_spec.rb +13 -3
- data/spec/models/url_spec.rb +4 -3
- data/spec/models/user_spec.rb +6 -3
- data/spec/models/user_validation_spec.rb +3 -3
- data/spec/models/validations_spec.rb +4 -0
- data/spec/models/validators/block_validations_spec.rb +9 -5
- data/spec/models/validators/email_validator_spec.rb +2 -0
- data/spec/models/validators/lifecycle_callbacks_spec.rb +86 -0
- data/spec/models/validators/unique_validator_spec.rb +1 -0
- data/spec/page/path_string_renderer_spec.rb +5 -0
- data/spec/queries/live_query_spec.rb +16 -0
- data/spec/queries/query_association_splitter_spec.rb +14 -0
- data/spec/queries/query_diff_spec.rb +132 -0
- data/spec/queries/query_identifier_spec.rb +98 -0
- data/spec/queries/query_runner_spec.rb +63 -0
- data/spec/queries/query_tracker_spec.rb +141 -0
- data/spec/router/routes_spec.rb +52 -21
- data/spec/server/middleware/rack_content_types_spec.rb +78 -0
- data/spec/server/rack/asset_files_spec.rb +38 -30
- data/spec/spec_helper.rb +8 -0
- data/spec/utils/ejson_spec.rb +9 -8
- data/spec/utils/ejson_volt_time_spec.rb +65 -0
- data/templates/migration/migration.rb.tt +9 -0
- data/templates/newgem/gitignore.tt +1 -0
- data/templates/project/Gemfile.tt +19 -2
- data/templates/project/README.md.tt +6 -1
- data/templates/project/app/main/config/dependencies.rb +6 -0
- data/templates/project/config/app.rb.tt +18 -4
- data/volt.gemspec +2 -2
- metadata +73 -16
- data/app/volt/tasks/live_query/live_query_pool.rb +0 -48
- data/app/volt/tasks/live_query/query_tracker.rb +0 -92
- data/spec/tasks/live_query_spec.rb +0 -18
- data/spec/tasks/query_tasks.rb +0 -7
- data/spec/tasks/query_tracker_spec.rb +0 -145
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25051871468c59824f6199f8656f30ebb31134a4
|
|
4
|
+
data.tar.gz: 0a9d1c61f06188fd8395abbe62a05aa7535d297c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca789facecc7f76aaa5b2f92e2c8b900113d2b390cfa2a5aca6e771ad4dc3ff32659e578a8fba23bb3243dbc6e4061aad7d842374401dd181c77c46e26465537
|
|
7
|
+
data.tar.gz: 40c1a6edf970b4eac77087023a4d2b94b420cd92b2d28b588e92b0ef70ab23c3080b59b9e6a785f74173924e09fb47dae0a16928e606a3f91390f5c76040a6ed
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.9.7
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
You can now do "splat" matches in routes. Splat matches let you match multiple sections at the end of a url.
|
|
7
|
+
```ruby
|
|
8
|
+
client '/info/{{ *rest_of_path }}', component: 'main', controller: 'main', action: 'info'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
By doing the above, anything after /info/ will be matched and placed into the rest_of_path param.
|
|
12
|
+
|
|
13
|
+
- Add send_file(path) to HttpController, send_file streams the file off of disk.
|
|
14
|
+
- ```field``` now accepts :default
|
|
15
|
+
- ```index``` has been added for sql databases:
|
|
16
|
+
```index :user_id``` (single)
|
|
17
|
+
```index [:user_id, :name]``` (compound)
|
|
18
|
+
```index [:user_id, :username], unique: true``` (unique)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- fixed the issue with serving precompiled assets in production. It also fixes the issue where sometimes non-root urls wouldn't load correctly.
|
|
23
|
+
- fixed issue with some routes not matching
|
|
24
|
+
- fixed issue with attribute bindings in mailer templates
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
3
28
|
## 0.9.6
|
|
4
29
|
0.9.6 is mostly a bug fix release with a few minor features.
|
|
5
30
|
|
|
@@ -17,6 +42,7 @@ Volt.boot(Dir.pwd)
|
|
|
17
42
|
- Finally tracked down an illusive memory leak.
|
|
18
43
|
- Computations now raise an error on their inital run, then log errors (via Volt.logger.error(..)) when running again (since they update on next tick)
|
|
19
44
|
- fixed template caching issue
|
|
45
|
+
- .validate! return a promise that now rejects when the model is invalid
|
|
20
46
|
- upgrade the volt-mongo gem to mongo gem 2.1
|
|
21
47
|
- fixed issue with https web socket connection
|
|
22
48
|
- improved errors when returning objects from Tasks that can't be serialized
|
data/Gemfile
CHANGED
|
@@ -3,7 +3,8 @@ source 'http://rubygems.org'
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
5
|
# volt-mongo gem for testing
|
|
6
|
-
gem 'volt-mongo'
|
|
6
|
+
# gem 'volt-mongo'
|
|
7
|
+
gem 'volt-sql'
|
|
7
8
|
|
|
8
9
|
# Use rbnacl for message bus encrpytion
|
|
9
10
|
# (optional, if you don't need encryption, disable in app.rb and remove)
|
|
@@ -12,6 +13,10 @@ gem 'rbnacl-libsodium', require: false
|
|
|
12
13
|
|
|
13
14
|
# temp until 0.8.0 of opal
|
|
14
15
|
# gem 'opal-rspec', github: 'opal/opal-rspec'
|
|
16
|
+
gem 'sqlite3'
|
|
17
|
+
gem 'pg', '~> 0.18.2'
|
|
18
|
+
gem 'pg_json', '~> 0.1.29'
|
|
19
|
+
|
|
15
20
|
|
|
16
21
|
group :development, :test do
|
|
17
22
|
# For testing the kitchen sink app
|
data/README.md
CHANGED
|
@@ -27,6 +27,8 @@ Check out demo apps:
|
|
|
27
27
|
- https://github.com/voltrb/todomvc
|
|
28
28
|
- https://github.com/voltrb/blog5
|
|
29
29
|
|
|
30
|
+
For a full list of all things volt, check out [awesome-volt](https://github.com/heri/awesome-volt)
|
|
31
|
+
|
|
30
32
|
# Docs
|
|
31
33
|
|
|
32
34
|
Read the [full docs on Volt here](http://voltframework.com/docs)
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
unless ENV['NO_MESSAGE_BUS']
|
|
2
|
+
class ActiveVoltInstance < Volt::Model
|
|
3
|
+
field :server_id, String
|
|
4
|
+
field :ips, String
|
|
5
|
+
field :port, Fixnum
|
|
6
|
+
field :time#, Time
|
|
7
|
+
end
|
|
8
|
+
end
|
data/app/volt/models/user.rb
CHANGED
|
@@ -2,7 +2,15 @@ require 'bcrypt' unless RUBY_PLATFORM == 'opal'
|
|
|
2
2
|
|
|
3
3
|
module Volt
|
|
4
4
|
class User < Model
|
|
5
|
-
field :
|
|
5
|
+
field :hashed_password
|
|
6
|
+
|
|
7
|
+
def password=(val)
|
|
8
|
+
set(:password, val)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def password
|
|
12
|
+
get(:password)
|
|
13
|
+
end
|
|
6
14
|
|
|
7
15
|
# returns login field name depending on config settings
|
|
8
16
|
def self.login_field
|
|
@@ -44,10 +52,11 @@ module Volt
|
|
|
44
52
|
|
|
45
53
|
if password.present?
|
|
46
54
|
# Clear the password
|
|
47
|
-
set('password', nil)
|
|
55
|
+
# set('password', nil)
|
|
48
56
|
|
|
49
57
|
# Set the hashed_password field instead
|
|
50
58
|
set('hashed_password', BCrypt::Password.create(password))
|
|
59
|
+
delete('password')
|
|
51
60
|
end
|
|
52
61
|
end
|
|
53
62
|
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# VoltAppProperty backs the volt_app.properties hash. properties is designed
|
|
2
|
+
# to allow things like gems that have external setup processes (creating an
|
|
3
|
+
# S3 bucket for example) to keep track of if that action has been completed on
|
|
4
|
+
# a global level.
|
|
5
|
+
class VoltAppProperty < Volt::Model
|
|
6
|
+
field :name, String
|
|
7
|
+
field :value, String
|
|
8
|
+
end
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# QueryTasks is responsible for passing back the data from a query. It will
|
|
2
|
+
# be run both from the client side and server side. From the client it passed
|
|
3
|
+
# data with websockets. From the server it uses the stub channel to pass data
|
|
4
|
+
# directly.
|
|
5
|
+
|
|
1
6
|
class QueryTasks < Volt::Task
|
|
2
7
|
def add_listener(collection, query)
|
|
3
|
-
live_query = @volt_app.live_query_pool.lookup(collection, query)
|
|
4
|
-
track_channel_in_live_query(live_query)
|
|
5
|
-
|
|
6
8
|
if @channel
|
|
7
9
|
# For requests from the client (with @channel), we track the channel
|
|
8
10
|
# so we can send the results back. Server side requests don't stay live,
|
|
@@ -11,61 +13,51 @@ class QueryTasks < Volt::Task
|
|
|
11
13
|
|
|
12
14
|
# live_query.add_channel(@channel)
|
|
13
15
|
end
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
query_subscription = subscription(collection, query)
|
|
15
18
|
|
|
16
19
|
errors = {}
|
|
17
20
|
|
|
18
21
|
begin
|
|
19
22
|
# Get the initial data
|
|
20
|
-
initial_data =
|
|
23
|
+
initial_data = query_subscription.initial_data
|
|
21
24
|
rescue => exception
|
|
22
25
|
# Capture and pass up any exceptions
|
|
23
26
|
error = { error: exception.message }
|
|
24
27
|
end
|
|
25
28
|
|
|
26
|
-
if initial_data
|
|
27
|
-
# Only send the filtered attributes for this user
|
|
28
|
-
initial_data.map! do |data|
|
|
29
|
-
[data[0], live_query.model_for_filter(data[1]).filtered_attributes.sync]
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
29
|
[initial_data, error]
|
|
34
30
|
end
|
|
35
31
|
|
|
36
32
|
def initial_data
|
|
37
|
-
|
|
38
|
-
data[:id] = data[:id].to_s
|
|
39
|
-
|
|
40
|
-
data
|
|
33
|
+
live_query.initial_data(@channel)
|
|
41
34
|
end
|
|
42
35
|
|
|
43
36
|
# Remove a listening channel, the LiveQuery will automatically remove
|
|
44
37
|
# itsself from the pool when there are no channels.
|
|
45
38
|
def remove_listener(collection, query)
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
# TODO: Need LiveQueryPool to be counting, and we need to remove it
|
|
40
|
+
query_sub = subscription(collection, query)
|
|
41
|
+
query_sub.remove
|
|
48
42
|
end
|
|
49
43
|
|
|
50
|
-
#
|
|
44
|
+
# Remove all QuerySubscriptions for a channel
|
|
51
45
|
def close!
|
|
52
|
-
|
|
46
|
+
query_subscriptions = @volt_app.channel_query_subscriptions[@channel]
|
|
53
47
|
|
|
54
|
-
if
|
|
55
|
-
|
|
56
|
-
live_query.remove_channel(@channel)
|
|
57
|
-
end
|
|
48
|
+
if query_subscriptions
|
|
49
|
+
query_subscriptions.keys.reverse.each(&:remove)
|
|
58
50
|
end
|
|
59
|
-
|
|
60
|
-
@volt_app.channel_live_queries.delete(@channel)
|
|
61
51
|
end
|
|
62
52
|
|
|
63
53
|
private
|
|
64
54
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
def subscription(collection, query)
|
|
56
|
+
# Lookup or create the live query
|
|
57
|
+
live_query = @volt_app.live_query_pool.lookup(collection, query)
|
|
58
|
+
|
|
59
|
+
# Find or create a QuerySubscription for this channel
|
|
60
|
+
live_query.query_subscription_for_channel(@channel)
|
|
70
61
|
end
|
|
62
|
+
|
|
71
63
|
end
|
|
@@ -2,7 +2,7 @@ require 'volt/models'
|
|
|
2
2
|
|
|
3
3
|
class StoreTasks < Volt::Task
|
|
4
4
|
def db
|
|
5
|
-
@@db ||= Volt::DataStore.fetch
|
|
5
|
+
@@db ||= Volt::DataStore.fetch(Volt.current_app)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def load_model(collection, path, data)
|
|
@@ -66,7 +66,7 @@ class StoreTasks < Volt::Task
|
|
|
66
66
|
|
|
67
67
|
query.first.then do |model|
|
|
68
68
|
if model
|
|
69
|
-
if model.can_delete
|
|
69
|
+
if model.can_delete?.sync
|
|
70
70
|
db.delete(collection, 'id' => id)
|
|
71
71
|
else
|
|
72
72
|
fail "Permissions did not allow #{collection} #{id} to be deleted."
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class VoltAdminTasks < Volt::Task
|
|
2
|
+
def live_queries
|
|
3
|
+
pool = @volt_app.live_query_pool.pool
|
|
4
|
+
|
|
5
|
+
live_queries = []
|
|
6
|
+
|
|
7
|
+
pool.each_pair do |collection, queries|
|
|
8
|
+
if queries
|
|
9
|
+
queries.each do |query, live_query|
|
|
10
|
+
live_queries << live_query
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
data = live_queries.map do |lq|
|
|
16
|
+
[lq.collection, lq.query]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
puts "--- current query pool ---"
|
|
20
|
+
puts data.map {|collection, query| "#{collection}:\t#{query.inspect}" }
|
|
21
|
+
|
|
22
|
+
data
|
|
23
|
+
end
|
|
24
|
+
end
|
data/docs/UPGRADE_GUIDE.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# 0.9.5 to 0.9.7
|
|
2
|
+
|
|
3
|
+
- 0.9.7 adds the awesome VoltTime class.
|
|
4
|
+
To make this work, some stuff had to change in volt-mongo, upgrade volt-mongo to at least 0.2.0. Also, switch any instances of Time to VoltTime.
|
|
5
|
+
-
|
|
6
|
+
|
|
1
7
|
# 0.9.4 to 0.9.5
|
|
2
8
|
|
|
3
9
|
CSS url's now should be referenced either 1) as relative paths from the css file, or 2) using the full path from inside of app (eg: main/assets/images/background.jpg)
|
data/lib/volt.rb
CHANGED
|
@@ -6,6 +6,7 @@ require 'volt/utils/modes'
|
|
|
6
6
|
require 'volt/utils/volt_user_error'
|
|
7
7
|
require 'volt/utils/boolean_patch'
|
|
8
8
|
require 'volt/utils/time_patch'
|
|
9
|
+
require 'volt/utils/time_opal_patch' if RUBY_PLATFORM == 'opal'
|
|
9
10
|
|
|
10
11
|
require 'volt/config'
|
|
11
12
|
require 'volt/data_stores/data_store' unless RUBY_PLATFORM == 'opal'
|
|
@@ -13,12 +14,12 @@ require 'volt/volt/users'
|
|
|
13
14
|
|
|
14
15
|
module Volt
|
|
15
16
|
@in_browser = if RUBY_PLATFORM == 'opal'
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
# When testing with opal-rspec, it technically is in a browser
|
|
18
|
+
# but its not setup with our own app code.
|
|
19
|
+
`!!document && !window.OPAL_SPEC_PHANTOM && window.$`
|
|
20
|
+
else
|
|
21
|
+
false
|
|
22
|
+
end
|
|
22
23
|
|
|
23
24
|
include Modes
|
|
24
25
|
|
|
@@ -38,12 +39,18 @@ module Volt
|
|
|
38
39
|
!ENV['SERVER']
|
|
39
40
|
end
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
if RUBY_PLATFORM != 'opal'
|
|
43
|
+
def console?
|
|
44
|
+
!!ENV['CONSOLE']
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def source_maps?
|
|
48
|
+
if !ENV['MAPS']
|
|
49
|
+
# If no MAPS is specified, enable it in dev
|
|
50
|
+
Volt.env.development?
|
|
51
|
+
else
|
|
52
|
+
ENV['MAPS'] != 'false'
|
|
53
|
+
end
|
|
47
54
|
end
|
|
48
55
|
end
|
|
49
56
|
|
data/lib/volt/boot.rb
CHANGED
data/lib/volt/cli.rb
CHANGED
|
@@ -6,9 +6,15 @@ require 'volt/extra_core/extra_core'
|
|
|
6
6
|
require 'volt/cli/generators'
|
|
7
7
|
require 'volt/cli/generate'
|
|
8
8
|
require 'volt/cli/destroy'
|
|
9
|
+
require 'volt/cli/migrate'
|
|
9
10
|
require 'volt/version'
|
|
10
11
|
require 'volt/cli/bundle'
|
|
11
12
|
|
|
13
|
+
# new doesn't run inside of a Gemfile, so don't boot the volt app
|
|
14
|
+
unless ARGV[0] == 'new'
|
|
15
|
+
require 'volt/boot'
|
|
16
|
+
end
|
|
17
|
+
|
|
12
18
|
module Volt
|
|
13
19
|
class CLI < Thor
|
|
14
20
|
include Thor::Actions
|
|
@@ -16,10 +22,12 @@ module Volt
|
|
|
16
22
|
|
|
17
23
|
register(Generate, 'generate', 'generate GENERATOR [args]', 'Run a generator.')
|
|
18
24
|
register(Destroy, 'destroy', 'destroy GENERATOR [args]', 'Delete files created by a generator.')
|
|
25
|
+
register(CliSubclasses::Migrate, 'migrate', 'migrate up/down', 'Migrate your app data')
|
|
19
26
|
|
|
20
27
|
desc 'new PROJECT_NAME', 'generates a new project.'
|
|
21
28
|
|
|
22
29
|
def new(name)
|
|
30
|
+
ENV['SKIP_BUNDLER_REQUIRE'] = 'true'
|
|
23
31
|
new_project(name)
|
|
24
32
|
|
|
25
33
|
say ""
|
|
@@ -35,6 +43,7 @@ module Volt
|
|
|
35
43
|
desc 'console', 'run the console on the project in the current directory'
|
|
36
44
|
|
|
37
45
|
def console
|
|
46
|
+
ENV['CONSOLE'] = 'true'
|
|
38
47
|
require 'volt/cli/console'
|
|
39
48
|
Console.start
|
|
40
49
|
end
|
|
@@ -109,11 +118,10 @@ module Volt
|
|
|
109
118
|
def drop_collection(collection)
|
|
110
119
|
ENV['SERVER'] = 'true'
|
|
111
120
|
move_to_root
|
|
112
|
-
require 'volt/boot'
|
|
113
121
|
|
|
114
|
-
Volt.boot(Dir.pwd)
|
|
122
|
+
volt_app = Volt.boot(Dir.pwd)
|
|
115
123
|
|
|
116
|
-
db = Volt::DataStore.fetch
|
|
124
|
+
db = Volt::DataStore.fetch(volt_app)
|
|
117
125
|
drop = db.drop_collection(collection)
|
|
118
126
|
|
|
119
127
|
say("Collection #{collection} could not be dropped", :red) if drop == false
|
|
@@ -128,11 +136,11 @@ module Volt
|
|
|
128
136
|
|
|
129
137
|
# Grab the current volt version
|
|
130
138
|
directory('project', name, {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
version: Volt::Version::STRING,
|
|
140
|
+
name: name,
|
|
141
|
+
domain: name.dasherize.downcase,
|
|
142
|
+
app_name: name.capitalize,
|
|
143
|
+
disable_encryption: disable_encryption
|
|
136
144
|
})
|
|
137
145
|
|
|
138
146
|
unless skip_gemfile
|
|
@@ -172,6 +180,9 @@ module Volt
|
|
|
172
180
|
def self.source_root
|
|
173
181
|
File.expand_path(File.join(File.dirname(__FILE__), '../../templates'))
|
|
174
182
|
end
|
|
183
|
+
|
|
184
|
+
map "d" => "destroy"
|
|
185
|
+
map "dc" => "drop_collection"
|
|
175
186
|
end
|
|
176
187
|
end
|
|
177
188
|
|