nacelle 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,238 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ nacelle (0.5.0)
5
+ rails
6
+ sprockets-rails
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (7.2.1)
12
+ actionpack (= 7.2.1)
13
+ activesupport (= 7.2.1)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ zeitwerk (~> 2.6)
17
+ actionmailbox (7.2.1)
18
+ actionpack (= 7.2.1)
19
+ activejob (= 7.2.1)
20
+ activerecord (= 7.2.1)
21
+ activestorage (= 7.2.1)
22
+ activesupport (= 7.2.1)
23
+ mail (>= 2.8.0)
24
+ actionmailer (7.2.1)
25
+ actionpack (= 7.2.1)
26
+ actionview (= 7.2.1)
27
+ activejob (= 7.2.1)
28
+ activesupport (= 7.2.1)
29
+ mail (>= 2.8.0)
30
+ rails-dom-testing (~> 2.2)
31
+ actionpack (7.2.1)
32
+ actionview (= 7.2.1)
33
+ activesupport (= 7.2.1)
34
+ nokogiri (>= 1.8.5)
35
+ racc
36
+ rack (>= 2.2.4, < 3.2)
37
+ rack-session (>= 1.0.1)
38
+ rack-test (>= 0.6.3)
39
+ rails-dom-testing (~> 2.2)
40
+ rails-html-sanitizer (~> 1.6)
41
+ useragent (~> 0.16)
42
+ actiontext (7.2.1)
43
+ actionpack (= 7.2.1)
44
+ activerecord (= 7.2.1)
45
+ activestorage (= 7.2.1)
46
+ activesupport (= 7.2.1)
47
+ globalid (>= 0.6.0)
48
+ nokogiri (>= 1.8.5)
49
+ actionview (7.2.1)
50
+ activesupport (= 7.2.1)
51
+ builder (~> 3.1)
52
+ erubi (~> 1.11)
53
+ rails-dom-testing (~> 2.2)
54
+ rails-html-sanitizer (~> 1.6)
55
+ activejob (7.2.1)
56
+ activesupport (= 7.2.1)
57
+ globalid (>= 0.3.6)
58
+ activemodel (7.2.1)
59
+ activesupport (= 7.2.1)
60
+ activerecord (7.2.1)
61
+ activemodel (= 7.2.1)
62
+ activesupport (= 7.2.1)
63
+ timeout (>= 0.4.0)
64
+ activestorage (7.2.1)
65
+ actionpack (= 7.2.1)
66
+ activejob (= 7.2.1)
67
+ activerecord (= 7.2.1)
68
+ activesupport (= 7.2.1)
69
+ marcel (~> 1.0)
70
+ activesupport (7.2.1)
71
+ base64
72
+ bigdecimal
73
+ concurrent-ruby (~> 1.0, >= 1.3.1)
74
+ connection_pool (>= 2.2.5)
75
+ drb
76
+ i18n (>= 1.6, < 2)
77
+ logger (>= 1.4.2)
78
+ minitest (>= 5.1)
79
+ securerandom (>= 0.3)
80
+ tzinfo (~> 2.0, >= 2.0.5)
81
+ addressable (2.8.7)
82
+ public_suffix (>= 2.0.2, < 7.0)
83
+ appraisal (2.5.0)
84
+ bundler
85
+ rake
86
+ thor (>= 0.14.0)
87
+ base64 (0.2.0)
88
+ bigdecimal (3.1.8)
89
+ builder (3.3.0)
90
+ byebug (11.1.3)
91
+ capybara (3.40.0)
92
+ addressable
93
+ matrix
94
+ mini_mime (>= 0.1.3)
95
+ nokogiri (~> 1.11)
96
+ rack (>= 1.6.0)
97
+ rack-test (>= 0.6.3)
98
+ regexp_parser (>= 1.5, < 3.0)
99
+ xpath (~> 3.2)
100
+ concurrent-ruby (1.3.4)
101
+ connection_pool (2.4.1)
102
+ crass (1.0.6)
103
+ date (3.3.4)
104
+ diff-lcs (1.5.1)
105
+ drb (2.2.1)
106
+ erubi (1.13.0)
107
+ globalid (1.2.1)
108
+ activesupport (>= 6.1)
109
+ i18n (1.14.5)
110
+ concurrent-ruby (~> 1.0)
111
+ io-console (0.7.2)
112
+ irb (1.14.0)
113
+ rdoc (>= 4.0.0)
114
+ reline (>= 0.4.2)
115
+ logger (1.6.0)
116
+ loofah (2.22.0)
117
+ crass (~> 1.0.2)
118
+ nokogiri (>= 1.12.0)
119
+ mail (2.8.1)
120
+ mini_mime (>= 0.1.1)
121
+ net-imap
122
+ net-pop
123
+ net-smtp
124
+ marcel (1.0.4)
125
+ matrix (0.4.2)
126
+ mini_mime (1.1.5)
127
+ minitest (5.25.1)
128
+ net-imap (0.4.14)
129
+ date
130
+ net-protocol
131
+ net-pop (0.1.2)
132
+ net-protocol
133
+ net-protocol (0.2.2)
134
+ timeout
135
+ net-smtp (0.5.0)
136
+ net-protocol
137
+ nio4r (2.7.3)
138
+ nokogiri (1.16.7-x86_64-linux)
139
+ racc (~> 1.4)
140
+ psych (5.1.2)
141
+ stringio
142
+ public_suffix (6.0.1)
143
+ racc (1.8.1)
144
+ rack (2.2.9)
145
+ rack-session (1.0.2)
146
+ rack (< 3)
147
+ rack-test (2.1.0)
148
+ rack (>= 1.3)
149
+ rackup (1.0.0)
150
+ rack (< 3)
151
+ webrick
152
+ rails (7.2.1)
153
+ actioncable (= 7.2.1)
154
+ actionmailbox (= 7.2.1)
155
+ actionmailer (= 7.2.1)
156
+ actionpack (= 7.2.1)
157
+ actiontext (= 7.2.1)
158
+ actionview (= 7.2.1)
159
+ activejob (= 7.2.1)
160
+ activemodel (= 7.2.1)
161
+ activerecord (= 7.2.1)
162
+ activestorage (= 7.2.1)
163
+ activesupport (= 7.2.1)
164
+ bundler (>= 1.15.0)
165
+ railties (= 7.2.1)
166
+ rails-dom-testing (2.2.0)
167
+ activesupport (>= 5.0.0)
168
+ minitest
169
+ nokogiri (>= 1.6)
170
+ rails-html-sanitizer (1.6.0)
171
+ loofah (~> 2.21)
172
+ nokogiri (~> 1.14)
173
+ railties (7.2.1)
174
+ actionpack (= 7.2.1)
175
+ activesupport (= 7.2.1)
176
+ irb (~> 1.13)
177
+ rackup (>= 1.0.0)
178
+ rake (>= 12.2)
179
+ thor (~> 1.0, >= 1.2.2)
180
+ zeitwerk (~> 2.6)
181
+ rake (13.2.1)
182
+ rdoc (6.7.0)
183
+ psych (>= 4.0.0)
184
+ regexp_parser (2.9.2)
185
+ reline (0.5.9)
186
+ io-console (~> 0.5)
187
+ rspec (3.13.0)
188
+ rspec-core (~> 3.13.0)
189
+ rspec-expectations (~> 3.13.0)
190
+ rspec-mocks (~> 3.13.0)
191
+ rspec-core (3.13.0)
192
+ rspec-support (~> 3.13.0)
193
+ rspec-expectations (3.13.2)
194
+ diff-lcs (>= 1.2.0, < 2.0)
195
+ rspec-support (~> 3.13.0)
196
+ rspec-mocks (3.13.1)
197
+ diff-lcs (>= 1.2.0, < 2.0)
198
+ rspec-support (~> 3.13.0)
199
+ rspec-support (3.13.1)
200
+ securerandom (0.3.1)
201
+ sprockets (3.7.3)
202
+ base64
203
+ concurrent-ruby (~> 1.0)
204
+ rack (> 1, < 3)
205
+ sprockets-rails (3.5.2)
206
+ actionpack (>= 6.1)
207
+ activesupport (>= 6.1)
208
+ sprockets (>= 3.0.0)
209
+ stringio (3.1.1)
210
+ thor (1.3.1)
211
+ timeout (0.4.1)
212
+ tzinfo (2.0.6)
213
+ concurrent-ruby (~> 1.0)
214
+ useragent (0.16.10)
215
+ webrick (1.8.1)
216
+ websocket-driver (0.7.6)
217
+ websocket-extensions (>= 0.1.0)
218
+ websocket-extensions (0.1.5)
219
+ xpath (3.2.0)
220
+ nokogiri (~> 1.8)
221
+ zeitwerk (2.6.17)
222
+
223
+ PLATFORMS
224
+ x86_64-linux
225
+
226
+ DEPENDENCIES
227
+ appraisal
228
+ bundler
229
+ byebug
230
+ capybara
231
+ nacelle!
232
+ rails (~> 7.2.0)
233
+ rake
234
+ rspec
235
+ sprockets (~> 3.0)
236
+
237
+ BUNDLED WITH
238
+ 2.4.19
@@ -15,16 +15,20 @@ module Nacelle
15
15
  cells = cells controller.response.body
16
16
 
17
17
  controller.response.body.gsub!(/(#{cells.keys.join('|')})/) do |tag|
18
- name, state, attrs = cells[tag]
18
+ name, action, attrs = cells[tag]
19
+ action = action.to_sym
19
20
  attrs = HashWithIndifferentAccess.new(attrs)
20
21
  cell = "#{name.camelize}Cell".constantize.new_with_controller(controller)
21
- args = [state]
22
22
  attrs.delete "class" # ignore styling class
23
- args << attrs unless attrs.empty?
24
- begin
25
- cell.render_state *args
26
- rescue AbstractController::ActionNotFound
27
- "<strong>Cell “#{name.capitalize} #{state}” not found!</strong>"
23
+ if cell.class.action_methods.include?(action)
24
+ cell.action = action
25
+ if cell.method(action).arity.zero? && attrs.empty?
26
+ cell.send(action)
27
+ else
28
+ cell.send(action, attrs)
29
+ end
30
+ else
31
+ "<strong>Cell “#{name.capitalize} #{action}” not found!</strong>"
28
32
  end
29
33
  end unless cells.empty?
30
34
  end
data/lib/nacelle/cell.rb CHANGED
@@ -1,9 +1,5 @@
1
- require "cells"
2
-
3
1
  module Nacelle
4
- class Cell < Cell::Base
5
- self.view_paths += %w[app/cells app/views]
6
-
2
+ class Cell
7
3
  def self.new_with_controller controller
8
4
  new.tap do |cell|
9
5
  cell.instance_variable_set :@controller, controller
@@ -26,26 +22,47 @@ module Nacelle
26
22
  delegate :perform_caching, :read_fragment, :write_fragment, to: :@controller
27
23
 
28
24
  def self.action_methods
29
- super - %w[
30
- cookies
31
- request
32
- session
33
- read_fragment
34
- write_fragment
35
- perform_caching
36
- ]
25
+ instance_methods - Class.new(superclass).instance_methods
37
26
  end
38
- end
39
- end
40
27
 
41
- if Rails.version >= "6.1.0"
42
- Cell::Base::View.class_eval do
43
- def compiled_method_container
44
- ActionView::Base
28
+ def self.name
29
+ to_s.underscore.sub("_cell","")
30
+ end
31
+
32
+ cattr_accessor(:view_path) { "app/cells" }
33
+ attr_accessor :action
34
+
35
+ class_attribute :helpers, default: []
36
+ def self.helper mod
37
+ helpers << mod
45
38
  end
46
39
 
47
- def view_cache_dependencies
48
- []
40
+ class_attribute :helper_methods, default: []
41
+ def self.helper_method meth
42
+ helper_methods << meth
43
+ end
44
+
45
+ def render template: nil
46
+ template ||= "#{self.class.name}/#{action}"
47
+ assigns = instance_variables.reduce({}) do |hash, key|
48
+ new_key = key.to_s.split("@").last.to_sym
49
+ value = instance_variable_get(key)
50
+ hash.merge(new_key => value)
51
+ end
52
+ view_context = @controller.view_context.dup
53
+ paths = view_context.lookup_context.view_paths + [view_path]
54
+ view_context.lookup_context.instance_variable_set :@view_paths, paths
55
+ view_context.assign assigns
56
+ cell = self
57
+
58
+ helper_methods.each do |meth|
59
+ view_context.compiled_method_container.define_method meth do
60
+ cell.send(meth)
61
+ end
62
+ end
63
+
64
+ view_context.render template: template
49
65
  end
50
66
  end
51
67
  end
68
+
@@ -9,7 +9,7 @@ class Nacelle::CellsSerializer
9
9
  cell = klass.to_s.sub("Cell", "").underscore
10
10
  cell_name = cell.humanize
11
11
 
12
- klass.action_methods.map do |action|
12
+ klass.action_methods.sort.map do |action|
13
13
  action_name = action.to_s.humanize
14
14
  {
15
15
  id: "#{cell}/#{action}",
@@ -1,3 +1,3 @@
1
1
  module Nacelle
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/nacelle.gemspec CHANGED
@@ -28,5 +28,4 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "rails"
30
30
  spec.add_dependency "sprockets-rails"
31
- spec.add_dependency "cells", "~>3.0"
32
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nacelle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2024-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,20 +122,6 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: cells
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '3.0'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.0'
139
125
  description: Embed cells in the markup of your CMS.
140
126
  email:
141
127
  - micah@botandrose.com
@@ -151,6 +137,7 @@ files:
151
137
  - LICENSE.txt
152
138
  - README.md
153
139
  - Rakefile
140
+ - app/assets/config/manifest.js
154
141
  - app/assets/javascripts/ckeditor/plugins/cells.js
155
142
  - app/assets/javascripts/ckeditor/plugins/cells/dialogs/cells.js
156
143
  - app/assets/javascripts/ckeditor/plugins/cells/icons/insertcell.png
@@ -161,12 +148,12 @@ files:
161
148
  - bin/setup
162
149
  - config/routes.rb
163
150
  - gemfiles/.bundle/config
164
- - gemfiles/rails_6.0.gemfile
165
- - gemfiles/rails_6.0.gemfile.lock
166
- - gemfiles/rails_6.1.gemfile
167
- - gemfiles/rails_6.1.gemfile.lock
168
151
  - gemfiles/rails_7.0.gemfile
169
152
  - gemfiles/rails_7.0.gemfile.lock
153
+ - gemfiles/rails_7.1.gemfile
154
+ - gemfiles/rails_7.1.gemfile.lock
155
+ - gemfiles/rails_7.2.gemfile
156
+ - gemfiles/rails_7.2.gemfile.lock
170
157
  - lib/nacelle.rb
171
158
  - lib/nacelle/after_filter.rb
172
159
  - lib/nacelle/cell.rb
@@ -193,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
180
  - !ruby/object:Gem::Version
194
181
  version: '0'
195
182
  requirements: []
196
- rubygems_version: 3.3.26
183
+ rubygems_version: 3.4.19
197
184
  signing_key:
198
185
  specification_version: 4
199
186
  summary: Embed cells in the markup of your CMS.
@@ -1,205 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- nacelle (0.4.2)
5
- cells (~> 3.0)
6
- rails
7
- sprockets-rails
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actioncable (6.0.6.1)
13
- actionpack (= 6.0.6.1)
14
- nio4r (~> 2.0)
15
- websocket-driver (>= 0.6.1)
16
- actionmailbox (6.0.6.1)
17
- actionpack (= 6.0.6.1)
18
- activejob (= 6.0.6.1)
19
- activerecord (= 6.0.6.1)
20
- activestorage (= 6.0.6.1)
21
- activesupport (= 6.0.6.1)
22
- mail (>= 2.7.1)
23
- actionmailer (6.0.6.1)
24
- actionpack (= 6.0.6.1)
25
- actionview (= 6.0.6.1)
26
- activejob (= 6.0.6.1)
27
- mail (~> 2.5, >= 2.5.4)
28
- rails-dom-testing (~> 2.0)
29
- actionpack (6.0.6.1)
30
- actionview (= 6.0.6.1)
31
- activesupport (= 6.0.6.1)
32
- rack (~> 2.0, >= 2.0.8)
33
- rack-test (>= 0.6.3)
34
- rails-dom-testing (~> 2.0)
35
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.0.6.1)
37
- actionpack (= 6.0.6.1)
38
- activerecord (= 6.0.6.1)
39
- activestorage (= 6.0.6.1)
40
- activesupport (= 6.0.6.1)
41
- nokogiri (>= 1.8.5)
42
- actionview (6.0.6.1)
43
- activesupport (= 6.0.6.1)
44
- builder (~> 3.1)
45
- erubi (~> 1.4)
46
- rails-dom-testing (~> 2.0)
47
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.0.6.1)
49
- activesupport (= 6.0.6.1)
50
- globalid (>= 0.3.6)
51
- activemodel (6.0.6.1)
52
- activesupport (= 6.0.6.1)
53
- activerecord (6.0.6.1)
54
- activemodel (= 6.0.6.1)
55
- activesupport (= 6.0.6.1)
56
- activestorage (6.0.6.1)
57
- actionpack (= 6.0.6.1)
58
- activejob (= 6.0.6.1)
59
- activerecord (= 6.0.6.1)
60
- marcel (~> 1.0)
61
- activesupport (6.0.6.1)
62
- concurrent-ruby (~> 1.0, >= 1.0.2)
63
- i18n (>= 0.7, < 2)
64
- minitest (~> 5.1)
65
- tzinfo (~> 1.1)
66
- zeitwerk (~> 2.2, >= 2.2.2)
67
- addressable (2.8.1)
68
- public_suffix (>= 2.0.2, < 6.0)
69
- appraisal (2.4.1)
70
- bundler
71
- rake
72
- thor (>= 0.14.0)
73
- builder (3.2.4)
74
- byebug (11.1.3)
75
- capybara (3.38.0)
76
- addressable
77
- matrix
78
- mini_mime (>= 0.1.3)
79
- nokogiri (~> 1.8)
80
- rack (>= 1.6.0)
81
- rack-test (>= 0.6.3)
82
- regexp_parser (>= 1.5, < 3.0)
83
- xpath (~> 3.2)
84
- cells (3.11.3)
85
- actionpack (>= 3.0)
86
- railties (>= 3.0)
87
- uber (~> 0.0.8)
88
- concurrent-ruby (1.2.2)
89
- crass (1.0.6)
90
- date (3.3.3)
91
- diff-lcs (1.5.0)
92
- erubi (1.12.0)
93
- globalid (1.1.0)
94
- activesupport (>= 5.0)
95
- i18n (1.12.0)
96
- concurrent-ruby (~> 1.0)
97
- loofah (2.19.1)
98
- crass (~> 1.0.2)
99
- nokogiri (>= 1.5.9)
100
- mail (2.8.1)
101
- mini_mime (>= 0.1.1)
102
- net-imap
103
- net-pop
104
- net-smtp
105
- marcel (1.0.2)
106
- matrix (0.4.2)
107
- method_source (1.0.0)
108
- mini_mime (1.1.2)
109
- mini_portile2 (2.8.1)
110
- minitest (5.18.0)
111
- net-imap (0.3.4)
112
- date
113
- net-protocol
114
- net-pop (0.1.2)
115
- net-protocol
116
- net-protocol (0.2.1)
117
- timeout
118
- net-smtp (0.3.3)
119
- net-protocol
120
- nio4r (2.5.8)
121
- nokogiri (1.14.2)
122
- mini_portile2 (~> 2.8.0)
123
- racc (~> 1.4)
124
- public_suffix (5.0.1)
125
- racc (1.6.2)
126
- rack (2.2.6.4)
127
- rack-test (2.1.0)
128
- rack (>= 1.3)
129
- rails (6.0.6.1)
130
- actioncable (= 6.0.6.1)
131
- actionmailbox (= 6.0.6.1)
132
- actionmailer (= 6.0.6.1)
133
- actionpack (= 6.0.6.1)
134
- actiontext (= 6.0.6.1)
135
- actionview (= 6.0.6.1)
136
- activejob (= 6.0.6.1)
137
- activemodel (= 6.0.6.1)
138
- activerecord (= 6.0.6.1)
139
- activestorage (= 6.0.6.1)
140
- activesupport (= 6.0.6.1)
141
- bundler (>= 1.3.0)
142
- railties (= 6.0.6.1)
143
- sprockets-rails (>= 2.0.0)
144
- rails-dom-testing (2.0.3)
145
- activesupport (>= 4.2.0)
146
- nokogiri (>= 1.6)
147
- rails-html-sanitizer (1.5.0)
148
- loofah (~> 2.19, >= 2.19.1)
149
- railties (6.0.6.1)
150
- actionpack (= 6.0.6.1)
151
- activesupport (= 6.0.6.1)
152
- method_source
153
- rake (>= 0.8.7)
154
- thor (>= 0.20.3, < 2.0)
155
- rake (13.0.6)
156
- regexp_parser (2.7.0)
157
- rspec (3.12.0)
158
- rspec-core (~> 3.12.0)
159
- rspec-expectations (~> 3.12.0)
160
- rspec-mocks (~> 3.12.0)
161
- rspec-core (3.12.1)
162
- rspec-support (~> 3.12.0)
163
- rspec-expectations (3.12.2)
164
- diff-lcs (>= 1.2.0, < 2.0)
165
- rspec-support (~> 3.12.0)
166
- rspec-mocks (3.12.4)
167
- diff-lcs (>= 1.2.0, < 2.0)
168
- rspec-support (~> 3.12.0)
169
- rspec-support (3.12.0)
170
- sprockets (3.7.2)
171
- concurrent-ruby (~> 1.0)
172
- rack (> 1, < 3)
173
- sprockets-rails (3.4.2)
174
- actionpack (>= 5.2)
175
- activesupport (>= 5.2)
176
- sprockets (>= 3.0.0)
177
- thor (1.2.1)
178
- thread_safe (0.3.6)
179
- timeout (0.3.2)
180
- tzinfo (1.2.11)
181
- thread_safe (~> 0.1)
182
- uber (0.0.15)
183
- websocket-driver (0.7.5)
184
- websocket-extensions (>= 0.1.0)
185
- websocket-extensions (0.1.5)
186
- xpath (3.2.0)
187
- nokogiri (~> 1.8)
188
- zeitwerk (2.6.7)
189
-
190
- PLATFORMS
191
- ruby
192
-
193
- DEPENDENCIES
194
- appraisal
195
- bundler
196
- byebug
197
- capybara
198
- nacelle!
199
- rails (~> 6.0.0)
200
- rake
201
- rspec
202
- sprockets (~> 3.0)
203
-
204
- BUNDLED WITH
205
- 2.4.10