optimism 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +54 -54
- data/lib/optimism.rb +1 -1
- data/lib/optimism/rake.rb +5 -1
- data/lib/optimism/version.rb +1 -1
- data/optimism.gemspec +6 -6
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eada746d573b18d6db7daf25db7c36e9894ea0c88148cd052742d397d011e4bf
|
4
|
+
data.tar.gz: f4bfe23524ae8b5709eccc4a0a276815de8061a6cd403a4b0831db278b4cab5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b1c131e2a6bbb6da54c8a670b9c51ea898b7228655426a074cf139f800a45d897182e7379689a114eb19362d917a5f28d02c7baf8b1dd970ff34b12b3229c6e
|
7
|
+
data.tar.gz: 9c6a88a62e7ba585110e4643c2ad3b6d55fe8e7003479842d2e4a42c27213bac0284b16b3259b885c7095087482f42c1322affdfb7d6b35d35a1242c289af0d4
|
data/Gemfile.lock
CHANGED
@@ -9,56 +9,56 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actioncable (6.0.2.
|
13
|
-
actionpack (= 6.0.2.
|
12
|
+
actioncable (6.0.2.2)
|
13
|
+
actionpack (= 6.0.2.2)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (6.0.2.
|
17
|
-
actionpack (= 6.0.2.
|
18
|
-
activejob (= 6.0.2.
|
19
|
-
activerecord (= 6.0.2.
|
20
|
-
activestorage (= 6.0.2.
|
21
|
-
activesupport (= 6.0.2.
|
16
|
+
actionmailbox (6.0.2.2)
|
17
|
+
actionpack (= 6.0.2.2)
|
18
|
+
activejob (= 6.0.2.2)
|
19
|
+
activerecord (= 6.0.2.2)
|
20
|
+
activestorage (= 6.0.2.2)
|
21
|
+
activesupport (= 6.0.2.2)
|
22
22
|
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.0.2.
|
24
|
-
actionpack (= 6.0.2.
|
25
|
-
actionview (= 6.0.2.
|
26
|
-
activejob (= 6.0.2.
|
23
|
+
actionmailer (6.0.2.2)
|
24
|
+
actionpack (= 6.0.2.2)
|
25
|
+
actionview (= 6.0.2.2)
|
26
|
+
activejob (= 6.0.2.2)
|
27
27
|
mail (~> 2.5, >= 2.5.4)
|
28
28
|
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.0.2.
|
30
|
-
actionview (= 6.0.2.
|
31
|
-
activesupport (= 6.0.2.
|
29
|
+
actionpack (6.0.2.2)
|
30
|
+
actionview (= 6.0.2.2)
|
31
|
+
activesupport (= 6.0.2.2)
|
32
32
|
rack (~> 2.0, >= 2.0.8)
|
33
33
|
rack-test (>= 0.6.3)
|
34
34
|
rails-dom-testing (~> 2.0)
|
35
35
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (6.0.2.
|
37
|
-
actionpack (= 6.0.2.
|
38
|
-
activerecord (= 6.0.2.
|
39
|
-
activestorage (= 6.0.2.
|
40
|
-
activesupport (= 6.0.2.
|
36
|
+
actiontext (6.0.2.2)
|
37
|
+
actionpack (= 6.0.2.2)
|
38
|
+
activerecord (= 6.0.2.2)
|
39
|
+
activestorage (= 6.0.2.2)
|
40
|
+
activesupport (= 6.0.2.2)
|
41
41
|
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.0.2.
|
43
|
-
activesupport (= 6.0.2.
|
42
|
+
actionview (6.0.2.2)
|
43
|
+
activesupport (= 6.0.2.2)
|
44
44
|
builder (~> 3.1)
|
45
45
|
erubi (~> 1.4)
|
46
46
|
rails-dom-testing (~> 2.0)
|
47
47
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
-
activejob (6.0.2.
|
49
|
-
activesupport (= 6.0.2.
|
48
|
+
activejob (6.0.2.2)
|
49
|
+
activesupport (= 6.0.2.2)
|
50
50
|
globalid (>= 0.3.6)
|
51
|
-
activemodel (6.0.2.
|
52
|
-
activesupport (= 6.0.2.
|
53
|
-
activerecord (6.0.2.
|
54
|
-
activemodel (= 6.0.2.
|
55
|
-
activesupport (= 6.0.2.
|
56
|
-
activestorage (6.0.2.
|
57
|
-
actionpack (= 6.0.2.
|
58
|
-
activejob (= 6.0.2.
|
59
|
-
activerecord (= 6.0.2.
|
51
|
+
activemodel (6.0.2.2)
|
52
|
+
activesupport (= 6.0.2.2)
|
53
|
+
activerecord (6.0.2.2)
|
54
|
+
activemodel (= 6.0.2.2)
|
55
|
+
activesupport (= 6.0.2.2)
|
56
|
+
activestorage (6.0.2.2)
|
57
|
+
actionpack (= 6.0.2.2)
|
58
|
+
activejob (= 6.0.2.2)
|
59
|
+
activerecord (= 6.0.2.2)
|
60
60
|
marcel (~> 0.3.1)
|
61
|
-
activesupport (6.0.2.
|
61
|
+
activesupport (6.0.2.2)
|
62
62
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
63
63
|
i18n (>= 0.7, < 2)
|
64
64
|
minitest (~> 5.1)
|
@@ -90,7 +90,7 @@ GEM
|
|
90
90
|
mini_portile2 (2.4.0)
|
91
91
|
minitest (5.14.0)
|
92
92
|
nio4r (2.5.2)
|
93
|
-
nokogiri (1.10.
|
93
|
+
nokogiri (1.10.9)
|
94
94
|
mini_portile2 (~> 2.4.0)
|
95
95
|
parallel (1.19.1)
|
96
96
|
parser (2.7.0.2)
|
@@ -103,34 +103,34 @@ GEM
|
|
103
103
|
rack (2.2.2)
|
104
104
|
rack-test (1.1.0)
|
105
105
|
rack (>= 1.0, < 3)
|
106
|
-
rails (6.0.2.
|
107
|
-
actioncable (= 6.0.2.
|
108
|
-
actionmailbox (= 6.0.2.
|
109
|
-
actionmailer (= 6.0.2.
|
110
|
-
actionpack (= 6.0.2.
|
111
|
-
actiontext (= 6.0.2.
|
112
|
-
actionview (= 6.0.2.
|
113
|
-
activejob (= 6.0.2.
|
114
|
-
activemodel (= 6.0.2.
|
115
|
-
activerecord (= 6.0.2.
|
116
|
-
activestorage (= 6.0.2.
|
117
|
-
activesupport (= 6.0.2.
|
106
|
+
rails (6.0.2.2)
|
107
|
+
actioncable (= 6.0.2.2)
|
108
|
+
actionmailbox (= 6.0.2.2)
|
109
|
+
actionmailer (= 6.0.2.2)
|
110
|
+
actionpack (= 6.0.2.2)
|
111
|
+
actiontext (= 6.0.2.2)
|
112
|
+
actionview (= 6.0.2.2)
|
113
|
+
activejob (= 6.0.2.2)
|
114
|
+
activemodel (= 6.0.2.2)
|
115
|
+
activerecord (= 6.0.2.2)
|
116
|
+
activestorage (= 6.0.2.2)
|
117
|
+
activesupport (= 6.0.2.2)
|
118
118
|
bundler (>= 1.3.0)
|
119
|
-
railties (= 6.0.2.
|
119
|
+
railties (= 6.0.2.2)
|
120
120
|
sprockets-rails (>= 2.0.0)
|
121
121
|
rails-dom-testing (2.0.3)
|
122
122
|
activesupport (>= 4.2.0)
|
123
123
|
nokogiri (>= 1.6)
|
124
124
|
rails-html-sanitizer (1.3.0)
|
125
125
|
loofah (~> 2.3)
|
126
|
-
railties (6.0.2.
|
127
|
-
actionpack (= 6.0.2.
|
128
|
-
activesupport (= 6.0.2.
|
126
|
+
railties (6.0.2.2)
|
127
|
+
actionpack (= 6.0.2.2)
|
128
|
+
activesupport (= 6.0.2.2)
|
129
129
|
method_source
|
130
130
|
rake (>= 0.8.7)
|
131
131
|
thor (>= 0.20.3, < 2.0)
|
132
132
|
rainbow (3.0.0)
|
133
|
-
rake (
|
133
|
+
rake (13.0.1)
|
134
134
|
rubocop (0.79.0)
|
135
135
|
jaro_winkler (~> 1.5.1)
|
136
136
|
parallel (~> 1.10)
|
@@ -161,7 +161,7 @@ GEM
|
|
161
161
|
websocket-driver (0.7.1)
|
162
162
|
websocket-extensions (>= 0.1.0)
|
163
163
|
websocket-extensions (0.1.4)
|
164
|
-
zeitwerk (2.
|
164
|
+
zeitwerk (2.3.0)
|
165
165
|
|
166
166
|
PLATFORMS
|
167
167
|
ruby
|
@@ -171,7 +171,7 @@ DEPENDENCIES
|
|
171
171
|
optimism!
|
172
172
|
pry
|
173
173
|
pry-nav
|
174
|
-
rake (~>
|
174
|
+
rake (~> 13.0)
|
175
175
|
standardrb
|
176
176
|
|
177
177
|
BUNDLED WITH
|
data/lib/optimism.rb
CHANGED
@@ -71,7 +71,7 @@ module Optimism
|
|
71
71
|
resource += "_#{ancestry.shift}_attributes_#{ancestry.shift}" until ancestry.empty?
|
72
72
|
container_selector, error_selector = Optimism.container_selector.sub("RESOURCE", resource).sub("ATTRIBUTE", attribute), Optimism.error_selector.sub("RESOURCE", resource).sub("ATTRIBUTE", attribute)
|
73
73
|
if model.errors.messages.map(&:first).include?(attribute.to_sym)
|
74
|
-
message = "#{attribute.humanize
|
74
|
+
message = "#{model.errors.full_message(attribute.humanize, model.errors.messages[attribute.to_sym].first)}#{Optimism.suffix}"
|
75
75
|
cable_ready[Optimism.channel].dispatch_event(name: "optimism:attribute:invalid", detail: {resource: resource, attribute: attribute, text: message}) if Optimism.emit_events
|
76
76
|
cable_ready[Optimism.channel].add_css_class(selector: container_selector, name: Optimism.error_class) if Optimism.add_css
|
77
77
|
cable_ready[Optimism.channel].text_content(selector: error_selector, text: message) if Optimism.inject_inline
|
data/lib/optimism/rake.rb
CHANGED
@@ -2,11 +2,15 @@ require "fileutils"
|
|
2
2
|
|
3
3
|
desc "Inject some optimism into this application"
|
4
4
|
task :"optimism:install" do
|
5
|
+
app_path_part = (Webpacker && Rails) ? Webpacker.config.source_path.relative_path_from(Rails.root) : "app/javascript"
|
6
|
+
|
5
7
|
CHANNELS = [
|
6
|
-
{app_path: "
|
8
|
+
{app_path: "#{app_path_part}/channels/optimism_channel.js", template_path: "../templates/optimism_channel.js" },
|
7
9
|
{app_path: "app/channels/optimism_channel.rb", template_path: "../templates/optimism_channel.rb" },
|
8
10
|
]
|
9
11
|
|
12
|
+
FileUtils.mkdir_p "./#{app_path_part}/channels"
|
13
|
+
|
10
14
|
CHANNELS.each do |channel|
|
11
15
|
if File.exist?("./#{channel[:app_path]}")
|
12
16
|
$stderr.puts "=> [ skipping ] #{channel[:app_path]} already exists"
|
data/lib/optimism/version.rb
CHANGED
data/optimism.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 2.0"
|
24
24
|
spec.add_development_dependency "rake", "~> 13.0"
|
25
|
-
spec.add_development_dependency "pry"
|
26
|
-
spec.add_development_dependency "pry-nav"
|
27
|
-
spec.add_development_dependency "standardrb"
|
28
|
-
spec.add_dependency "rack"
|
29
|
-
spec.add_dependency "rails", "
|
30
|
-
spec.add_dependency "cable_ready", "~> 4.
|
25
|
+
spec.add_development_dependency "pry", "~> 0.12.2"
|
26
|
+
spec.add_development_dependency "pry-nav", "~> 0.3.0"
|
27
|
+
spec.add_development_dependency "standardrb", "~> 1.0.0"
|
28
|
+
spec.add_dependency "rack", "~> 2.0"
|
29
|
+
spec.add_dependency "rails", "~> 5.2"
|
30
|
+
spec.add_dependency "cable_ready", "~> 4.1"
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optimism
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leastbad
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,70 +42,70 @@ dependencies:
|
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.12.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.12.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry-nav
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.3.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.3.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: standardrb
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.0.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.0.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '2.0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '2.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '5.2'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '5.2'
|
111
111
|
- !ruby/object:Gem::Dependency
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 4.
|
117
|
+
version: '4.1'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 4.
|
124
|
+
version: '4.1'
|
125
125
|
description: Realtime remote form input validations delivered via websockets
|
126
126
|
email:
|
127
127
|
- hello@leastbad.com
|