motion 0.1.2 → 0.4.0
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/lib/generators/motion/component_generator.rb +34 -0
- data/lib/generators/motion/install_generator.rb +10 -3
- data/lib/generators/motion/templates/motion.js +37 -0
- data/lib/generators/motion/templates/motion.rb +54 -15
- data/lib/motion.rb +6 -0
- data/lib/motion/action_cable_extentions.rb +6 -0
- data/lib/motion/action_cable_extentions/declarative_notifications.rb +101 -0
- data/lib/motion/action_cable_extentions/declarative_streams.rb +9 -43
- data/lib/motion/action_cable_extentions/synchronization.rb +34 -0
- data/lib/motion/callback.rb +35 -0
- data/lib/motion/channel.rb +13 -5
- data/lib/motion/component.rb +4 -0
- data/lib/motion/component/broadcasts.rb +40 -26
- data/lib/motion/component/callbacks.rb +19 -0
- data/lib/motion/component/lifecycle.rb +91 -9
- data/lib/motion/component/motions.rb +26 -16
- data/lib/motion/component/periodic_timers.rb +68 -0
- data/lib/motion/component/rendering.rb +25 -16
- data/lib/motion/component_connection.rb +18 -2
- data/lib/motion/configuration.rb +18 -11
- data/lib/motion/errors.rb +102 -71
- data/lib/motion/event.rb +9 -1
- data/lib/motion/log_helper.rb +2 -0
- data/lib/motion/markup_transformer.rb +6 -21
- data/lib/motion/railtie.rb +1 -0
- data/lib/motion/revision_calculator.rb +48 -0
- data/lib/motion/serializer.rb +4 -0
- data/lib/motion/version.rb +1 -1
- metadata +11 -4
- data/lib/generators/motion/templates/motion_controller.js +0 -28
data/lib/motion/railtie.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "digest"
|
4
|
+
require "motion"
|
5
|
+
|
6
|
+
module Motion
|
7
|
+
class RevisionCalculator
|
8
|
+
attr_reader :revision_paths
|
9
|
+
|
10
|
+
def initialize(revision_paths:)
|
11
|
+
@revision_paths = revision_paths
|
12
|
+
end
|
13
|
+
|
14
|
+
def perform
|
15
|
+
derive_file_hash
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def derive_file_hash
|
21
|
+
digest = Digest::MD5.new
|
22
|
+
|
23
|
+
files.each do |file|
|
24
|
+
digest << file # include filename as well as contents
|
25
|
+
digest << File.read(file)
|
26
|
+
end
|
27
|
+
|
28
|
+
digest.hexdigest
|
29
|
+
end
|
30
|
+
|
31
|
+
def existent_paths
|
32
|
+
@existent_paths ||=
|
33
|
+
begin
|
34
|
+
revision_paths.all_paths.flat_map(&:existent)
|
35
|
+
rescue
|
36
|
+
raise BadRevisionPathsError
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def existent_files(path)
|
41
|
+
Dir["#{path}/**/*", path].reject { |f| File.directory?(f) }.uniq
|
42
|
+
end
|
43
|
+
|
44
|
+
def files
|
45
|
+
@files ||= existent_paths.flat_map { |path| existent_files(path) }.sort
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/motion/serializer.rb
CHANGED
data/lib/motion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alec Larsen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -49,18 +49,24 @@ executables: []
|
|
49
49
|
extensions: []
|
50
50
|
extra_rdoc_files: []
|
51
51
|
files:
|
52
|
+
- lib/generators/motion/component_generator.rb
|
52
53
|
- lib/generators/motion/install_generator.rb
|
54
|
+
- lib/generators/motion/templates/motion.js
|
53
55
|
- lib/generators/motion/templates/motion.rb
|
54
|
-
- lib/generators/motion/templates/motion_controller.js
|
55
56
|
- lib/motion.rb
|
56
57
|
- lib/motion/action_cable_extentions.rb
|
58
|
+
- lib/motion/action_cable_extentions/declarative_notifications.rb
|
57
59
|
- lib/motion/action_cable_extentions/declarative_streams.rb
|
58
60
|
- lib/motion/action_cable_extentions/log_suppression.rb
|
61
|
+
- lib/motion/action_cable_extentions/synchronization.rb
|
62
|
+
- lib/motion/callback.rb
|
59
63
|
- lib/motion/channel.rb
|
60
64
|
- lib/motion/component.rb
|
61
65
|
- lib/motion/component/broadcasts.rb
|
66
|
+
- lib/motion/component/callbacks.rb
|
62
67
|
- lib/motion/component/lifecycle.rb
|
63
68
|
- lib/motion/component/motions.rb
|
69
|
+
- lib/motion/component/periodic_timers.rb
|
64
70
|
- lib/motion/component/rendering.rb
|
65
71
|
- lib/motion/component_connection.rb
|
66
72
|
- lib/motion/configuration.rb
|
@@ -70,6 +76,7 @@ files:
|
|
70
76
|
- lib/motion/log_helper.rb
|
71
77
|
- lib/motion/markup_transformer.rb
|
72
78
|
- lib/motion/railtie.rb
|
79
|
+
- lib/motion/revision_calculator.rb
|
73
80
|
- lib/motion/serializer.rb
|
74
81
|
- lib/motion/test_helpers.rb
|
75
82
|
- lib/motion/version.rb
|
@@ -81,7 +88,7 @@ metadata:
|
|
81
88
|
source_code_uri: https://github.com/unabridged/motion
|
82
89
|
post_install_message: |
|
83
90
|
Friendly reminder: When updating the motion gem, don't forget to update the
|
84
|
-
NPM package as well (`bin/yarn add '@unabridged/motion@0.
|
91
|
+
NPM package as well (`bin/yarn add '@unabridged/motion@0.4.0'`).
|
85
92
|
rdoc_options: []
|
86
93
|
require_paths:
|
87
94
|
- lib
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { Controller } from "@unabridged/motion";
|
2
|
-
import consumer from "../channels/consumer";
|
3
|
-
|
4
|
-
// If you change the name of this controller (determined by the file name),
|
5
|
-
// make sure to update `Motion.config.stimulus_controller_identifier`.
|
6
|
-
export default class extends Controller {
|
7
|
-
// To avoid creating a second websocket, make sure to reuse the application's
|
8
|
-
// ActionCable consumer.
|
9
|
-
getConsumer() {
|
10
|
-
return consumer;
|
11
|
-
}
|
12
|
-
|
13
|
-
// It is possible to additionally customize the behavior of the client by
|
14
|
-
// overriding these properties and methods:
|
15
|
-
|
16
|
-
// getExtraDataForEvent(event) {} // `Motion::Event#extra_data`
|
17
|
-
|
18
|
-
// keyAttribute = "data-motion-key"; // `Motion.config.key_attribute`
|
19
|
-
// stateAttribute = "data-motion-state"; // `Motion.config.state_attribute`
|
20
|
-
// motionAttribute = "data-motion"; // `Motion.config.motion_attribute`
|
21
|
-
|
22
|
-
// beforeConnect() { /* by default, dispatches `motion:before-connect` */ }
|
23
|
-
// connected() { /* by default, dispatches `motion:connected` */ }
|
24
|
-
// connectFailed() { /* by default, dispatches `motion:connect-failed` */ }
|
25
|
-
// disconnected() { /* by default, dispatches `motion:disconnected` */ }
|
26
|
-
// beforeRender() { /* by default, dispatches `motion:before-render` */ }
|
27
|
-
// rendered() { /* by default, dispatches `motion:rendered` */ }
|
28
|
-
}
|