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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d69b975e6e32cf132f56deeb2510fe0710331f79ef9e9348b7e6d5f477e3599e
4
- data.tar.gz: ba9bce01e408ab2e23899114d2e3adee6b3d35c976e910f7d15e525ba4647500
3
+ metadata.gz: eada746d573b18d6db7daf25db7c36e9894ea0c88148cd052742d397d011e4bf
4
+ data.tar.gz: f4bfe23524ae8b5709eccc4a0a276815de8061a6cd403a4b0831db278b4cab5c
5
5
  SHA512:
6
- metadata.gz: bf938de04f21e4301ea8018dbec06ce71e873baa2f25b6d18b26a6fd1aacc926529d57e1ee08bf7655ba57876fb61370ab709416c8dcb76d4adc56763977a5af
7
- data.tar.gz: aef3ab87109617daf167faa57b14879b56aa5b96002dd4125962cb61a1aa3d9e959fbe24ba0ce02b6c1c57c276d2f4c6065d697b3d316438a26983a0d6c5902c
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.1)
13
- actionpack (= 6.0.2.1)
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.1)
17
- actionpack (= 6.0.2.1)
18
- activejob (= 6.0.2.1)
19
- activerecord (= 6.0.2.1)
20
- activestorage (= 6.0.2.1)
21
- activesupport (= 6.0.2.1)
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.1)
24
- actionpack (= 6.0.2.1)
25
- actionview (= 6.0.2.1)
26
- activejob (= 6.0.2.1)
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.1)
30
- actionview (= 6.0.2.1)
31
- activesupport (= 6.0.2.1)
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.1)
37
- actionpack (= 6.0.2.1)
38
- activerecord (= 6.0.2.1)
39
- activestorage (= 6.0.2.1)
40
- activesupport (= 6.0.2.1)
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.1)
43
- activesupport (= 6.0.2.1)
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.1)
49
- activesupport (= 6.0.2.1)
48
+ activejob (6.0.2.2)
49
+ activesupport (= 6.0.2.2)
50
50
  globalid (>= 0.3.6)
51
- activemodel (6.0.2.1)
52
- activesupport (= 6.0.2.1)
53
- activerecord (6.0.2.1)
54
- activemodel (= 6.0.2.1)
55
- activesupport (= 6.0.2.1)
56
- activestorage (6.0.2.1)
57
- actionpack (= 6.0.2.1)
58
- activejob (= 6.0.2.1)
59
- activerecord (= 6.0.2.1)
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.1)
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.8)
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.1)
107
- actioncable (= 6.0.2.1)
108
- actionmailbox (= 6.0.2.1)
109
- actionmailer (= 6.0.2.1)
110
- actionpack (= 6.0.2.1)
111
- actiontext (= 6.0.2.1)
112
- actionview (= 6.0.2.1)
113
- activejob (= 6.0.2.1)
114
- activemodel (= 6.0.2.1)
115
- activerecord (= 6.0.2.1)
116
- activestorage (= 6.0.2.1)
117
- activesupport (= 6.0.2.1)
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.1)
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.1)
127
- actionpack (= 6.0.2.1)
128
- activesupport (= 6.0.2.1)
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 (10.5.0)
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.2.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 (~> 10.0)
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} #{model.errors.messages[attribute.to_sym].first}#{Optimism.suffix}"
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: "app/javascript/channels/optimism_channel.js", template_path: "../templates/optimism_channel.js" },
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"
@@ -1,3 +1,3 @@
1
1
  module Optimism
2
- VERSION = "0.2.10"
2
+ VERSION = "0.2.11"
3
3
  end
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", ">= 5.2"
30
- spec.add_dependency "cable_ready", "~> 4.0.9"
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.10
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-03-02 00:00:00.000000000 Z
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: '0'
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: '0'
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: '0'
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: '0'
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: '0'
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: '0'
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.0.9
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.0.9
124
+ version: '4.1'
125
125
  description: Realtime remote form input validations delivered via websockets
126
126
  email:
127
127
  - hello@leastbad.com