nacelle 0.4.1 → 0.5.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.
data/lib/nacelle/cell.rb CHANGED
@@ -4,12 +4,36 @@ module Nacelle
4
4
  class Cell < Cell::Base
5
5
  self.view_paths += %w[app/cells app/views]
6
6
 
7
- def self.new_with_request request
8
- new.tap { |cell| cell.instance_variable_set :@request, request }
7
+ def self.new_with_controller controller
8
+ new.tap do |cell|
9
+ cell.instance_variable_set :@controller, controller
10
+ cell.instance_variable_set :@request, controller.request
11
+ cell.instance_variable_set :@session, controller.session
12
+ cell.instance_variable_set :@cookies, controller.send(:cookies)
13
+ end
9
14
  end
10
15
 
11
- private def request
12
- @request
16
+ def self.updated_at
17
+ Time.new(2000) # can be overriden to bust caches
18
+ end
19
+
20
+ def self.cache_key
21
+ to_s # can be overriden to bust caches
22
+ end
23
+
24
+ attr_reader :request, :session, :cookies
25
+
26
+ delegate :perform_caching, :read_fragment, :write_fragment, to: :@controller
27
+
28
+ def self.action_methods
29
+ super - %w[
30
+ cookies
31
+ request
32
+ session
33
+ read_fragment
34
+ write_fragment
35
+ perform_caching
36
+ ]
13
37
  end
14
38
  end
15
39
  end
@@ -19,5 +43,9 @@ if Rails.version >= "6.1.0"
19
43
  def compiled_method_container
20
44
  ActionView::Base
21
45
  end
46
+
47
+ def view_cache_dependencies
48
+ []
49
+ end
22
50
  end
23
51
  end
@@ -0,0 +1,17 @@
1
+ module Nacelle
2
+ module HasCells
3
+ def has_cells *columns
4
+ define_method :cells do
5
+ columns.flat_map do |column|
6
+ send(column).to_s.scan(/(<cell[^>]*\/\s*>|<cell[^>]*>.*?<\/cell>)/m).map do |matches|
7
+ tag = matches.first
8
+ attrs = Hash.from_xml(tag)['cell']
9
+ name, _ = attrs.delete('name').split('/')
10
+ "#{name.camelize}Cell".constantize
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+
@@ -1,3 +1,3 @@
1
1
  module Nacelle
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/nacelle.rb CHANGED
@@ -2,12 +2,14 @@ require "nacelle/version"
2
2
  require "action_controller/railtie"
3
3
  require "sprockets/railtie"
4
4
  require "nacelle/cell"
5
- require "nacelle/middleware"
5
+ require "nacelle/has_cells"
6
+ require "nacelle/after_filter"
6
7
 
7
8
  module Nacelle
8
9
  class Engine < ::Rails::Engine
9
10
  initializer "nacelle.init" do |app|
10
- app.config.middleware.use Nacelle::Middleware
11
+ ActionController::Base.after_action AfterFilter
12
+ ActiveRecord::Base.extend HasCells if defined?(ActiveRecord)
11
13
  end
12
14
 
13
15
  initializer "nacelle.assets.precompile" do |app|
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.4.1
4
+ version: 0.5.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: 2022-09-22 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -161,10 +161,6 @@ files:
161
161
  - bin/setup
162
162
  - config/routes.rb
163
163
  - gemfiles/.bundle/config
164
- - gemfiles/rails_5.1.gemfile
165
- - gemfiles/rails_5.1.gemfile.lock
166
- - gemfiles/rails_5.2.gemfile
167
- - gemfiles/rails_5.2.gemfile.lock
168
164
  - gemfiles/rails_6.0.gemfile
169
165
  - gemfiles/rails_6.0.gemfile.lock
170
166
  - gemfiles/rails_6.1.gemfile
@@ -172,9 +168,10 @@ files:
172
168
  - gemfiles/rails_7.0.gemfile
173
169
  - gemfiles/rails_7.0.gemfile.lock
174
170
  - lib/nacelle.rb
171
+ - lib/nacelle/after_filter.rb
175
172
  - lib/nacelle/cell.rb
176
173
  - lib/nacelle/cells_serializer.rb
177
- - lib/nacelle/middleware.rb
174
+ - lib/nacelle/has_cells.rb
178
175
  - lib/nacelle/version.rb
179
176
  - nacelle.gemspec
180
177
  homepage: https://github.com/botandrose/nacelle
@@ -196,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
193
  - !ruby/object:Gem::Version
197
194
  version: '0'
198
195
  requirements: []
199
- rubygems_version: 3.2.32
196
+ rubygems_version: 3.3.26
200
197
  signing_key:
201
198
  specification_version: 4
202
199
  summary: Embed cells in the markup of your CMS.
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~>5.1.0"
6
- gem "sprockets", "~>3.0"
7
-
8
- gemspec path: "../"
@@ -1,165 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- nacelle (0.4.1)
5
- cells (~> 3.0)
6
- rails
7
- sprockets-rails
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actioncable (5.1.7)
13
- actionpack (= 5.1.7)
14
- nio4r (~> 2.0)
15
- websocket-driver (~> 0.6.1)
16
- actionmailer (5.1.7)
17
- actionpack (= 5.1.7)
18
- actionview (= 5.1.7)
19
- activejob (= 5.1.7)
20
- mail (~> 2.5, >= 2.5.4)
21
- rails-dom-testing (~> 2.0)
22
- actionpack (5.1.7)
23
- actionview (= 5.1.7)
24
- activesupport (= 5.1.7)
25
- rack (~> 2.0)
26
- rack-test (>= 0.6.3)
27
- rails-dom-testing (~> 2.0)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.1.7)
30
- activesupport (= 5.1.7)
31
- builder (~> 3.1)
32
- erubi (~> 1.4)
33
- rails-dom-testing (~> 2.0)
34
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.1.7)
36
- activesupport (= 5.1.7)
37
- globalid (>= 0.3.6)
38
- activemodel (5.1.7)
39
- activesupport (= 5.1.7)
40
- activerecord (5.1.7)
41
- activemodel (= 5.1.7)
42
- activesupport (= 5.1.7)
43
- arel (~> 8.0)
44
- activesupport (5.1.7)
45
- concurrent-ruby (~> 1.0, >= 1.0.2)
46
- i18n (>= 0.7, < 2)
47
- minitest (~> 5.1)
48
- tzinfo (~> 1.1)
49
- addressable (2.8.0)
50
- public_suffix (>= 2.0.2, < 5.0)
51
- appraisal (2.4.1)
52
- bundler
53
- rake
54
- thor (>= 0.14.0)
55
- arel (8.0.0)
56
- builder (3.2.4)
57
- byebug (11.1.3)
58
- capybara (3.32.2)
59
- addressable
60
- mini_mime (>= 0.1.3)
61
- nokogiri (~> 1.8)
62
- rack (>= 1.6.0)
63
- rack-test (>= 0.6.3)
64
- regexp_parser (~> 1.5)
65
- xpath (~> 3.2)
66
- cells (3.11.3)
67
- actionpack (>= 3.0)
68
- railties (>= 3.0)
69
- uber (~> 0.0.8)
70
- concurrent-ruby (1.1.9)
71
- crass (1.0.6)
72
- diff-lcs (1.5.0)
73
- erubi (1.10.0)
74
- globalid (0.4.2)
75
- activesupport (>= 4.2.0)
76
- i18n (1.8.11)
77
- concurrent-ruby (~> 1.0)
78
- loofah (2.13.0)
79
- crass (~> 1.0.2)
80
- nokogiri (>= 1.5.9)
81
- mail (2.7.1)
82
- mini_mime (>= 0.1.1)
83
- method_source (1.0.0)
84
- mini_mime (1.1.2)
85
- mini_portile2 (2.4.0)
86
- minitest (5.15.0)
87
- nio4r (2.5.8)
88
- nokogiri (1.10.10)
89
- mini_portile2 (~> 2.4.0)
90
- public_suffix (4.0.6)
91
- rack (2.2.3)
92
- rack-test (1.1.0)
93
- rack (>= 1.0, < 3)
94
- rails (5.1.7)
95
- actioncable (= 5.1.7)
96
- actionmailer (= 5.1.7)
97
- actionpack (= 5.1.7)
98
- actionview (= 5.1.7)
99
- activejob (= 5.1.7)
100
- activemodel (= 5.1.7)
101
- activerecord (= 5.1.7)
102
- activesupport (= 5.1.7)
103
- bundler (>= 1.3.0)
104
- railties (= 5.1.7)
105
- sprockets-rails (>= 2.0.0)
106
- rails-dom-testing (2.0.3)
107
- activesupport (>= 4.2.0)
108
- nokogiri (>= 1.6)
109
- rails-html-sanitizer (1.4.2)
110
- loofah (~> 2.3)
111
- railties (5.1.7)
112
- actionpack (= 5.1.7)
113
- activesupport (= 5.1.7)
114
- method_source
115
- rake (>= 0.8.7)
116
- thor (>= 0.18.1, < 2.0)
117
- rake (13.0.6)
118
- regexp_parser (1.8.2)
119
- rspec (3.10.0)
120
- rspec-core (~> 3.10.0)
121
- rspec-expectations (~> 3.10.0)
122
- rspec-mocks (~> 3.10.0)
123
- rspec-core (3.10.1)
124
- rspec-support (~> 3.10.0)
125
- rspec-expectations (3.10.1)
126
- diff-lcs (>= 1.2.0, < 2.0)
127
- rspec-support (~> 3.10.0)
128
- rspec-mocks (3.10.2)
129
- diff-lcs (>= 1.2.0, < 2.0)
130
- rspec-support (~> 3.10.0)
131
- rspec-support (3.10.3)
132
- sprockets (3.7.2)
133
- concurrent-ruby (~> 1.0)
134
- rack (> 1, < 3)
135
- sprockets-rails (3.2.2)
136
- actionpack (>= 4.0)
137
- activesupport (>= 4.0)
138
- sprockets (>= 3.0.0)
139
- thor (1.1.0)
140
- thread_safe (0.3.6)
141
- tzinfo (1.2.9)
142
- thread_safe (~> 0.1)
143
- uber (0.0.15)
144
- websocket-driver (0.6.5)
145
- websocket-extensions (>= 0.1.0)
146
- websocket-extensions (0.1.5)
147
- xpath (3.2.0)
148
- nokogiri (~> 1.8)
149
-
150
- PLATFORMS
151
- ruby
152
-
153
- DEPENDENCIES
154
- appraisal
155
- bundler
156
- byebug
157
- capybara
158
- nacelle!
159
- rails (~> 5.1.0)
160
- rake
161
- rspec
162
- sprockets (~> 3.0)
163
-
164
- BUNDLED WITH
165
- 2.2.32
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~>5.2.0"
6
- gem "sprockets", "~>3.0"
7
-
8
- gemspec path: "../"
@@ -1,171 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- nacelle (0.4.1)
5
- cells (~> 3.0)
6
- rails
7
- sprockets-rails
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actioncable (5.2.6)
13
- actionpack (= 5.2.6)
14
- nio4r (~> 2.0)
15
- websocket-driver (>= 0.6.1)
16
- actionmailer (5.2.6)
17
- actionpack (= 5.2.6)
18
- actionview (= 5.2.6)
19
- activejob (= 5.2.6)
20
- mail (~> 2.5, >= 2.5.4)
21
- rails-dom-testing (~> 2.0)
22
- actionpack (5.2.6)
23
- actionview (= 5.2.6)
24
- activesupport (= 5.2.6)
25
- rack (~> 2.0, >= 2.0.8)
26
- rack-test (>= 0.6.3)
27
- rails-dom-testing (~> 2.0)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.2.6)
30
- activesupport (= 5.2.6)
31
- builder (~> 3.1)
32
- erubi (~> 1.4)
33
- rails-dom-testing (~> 2.0)
34
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.2.6)
36
- activesupport (= 5.2.6)
37
- globalid (>= 0.3.6)
38
- activemodel (5.2.6)
39
- activesupport (= 5.2.6)
40
- activerecord (5.2.6)
41
- activemodel (= 5.2.6)
42
- activesupport (= 5.2.6)
43
- arel (>= 9.0)
44
- activestorage (5.2.6)
45
- actionpack (= 5.2.6)
46
- activerecord (= 5.2.6)
47
- marcel (~> 1.0.0)
48
- activesupport (5.2.6)
49
- concurrent-ruby (~> 1.0, >= 1.0.2)
50
- i18n (>= 0.7, < 2)
51
- minitest (~> 5.1)
52
- tzinfo (~> 1.1)
53
- addressable (2.8.0)
54
- public_suffix (>= 2.0.2, < 5.0)
55
- appraisal (2.4.1)
56
- bundler
57
- rake
58
- thor (>= 0.14.0)
59
- arel (9.0.0)
60
- builder (3.2.4)
61
- byebug (11.1.3)
62
- capybara (3.32.2)
63
- addressable
64
- mini_mime (>= 0.1.3)
65
- nokogiri (~> 1.8)
66
- rack (>= 1.6.0)
67
- rack-test (>= 0.6.3)
68
- regexp_parser (~> 1.5)
69
- xpath (~> 3.2)
70
- cells (3.11.3)
71
- actionpack (>= 3.0)
72
- railties (>= 3.0)
73
- uber (~> 0.0.8)
74
- concurrent-ruby (1.1.9)
75
- crass (1.0.6)
76
- diff-lcs (1.5.0)
77
- erubi (1.10.0)
78
- globalid (0.4.2)
79
- activesupport (>= 4.2.0)
80
- i18n (1.8.11)
81
- concurrent-ruby (~> 1.0)
82
- loofah (2.13.0)
83
- crass (~> 1.0.2)
84
- nokogiri (>= 1.5.9)
85
- mail (2.7.1)
86
- mini_mime (>= 0.1.1)
87
- marcel (1.0.2)
88
- method_source (1.0.0)
89
- mini_mime (1.1.2)
90
- mini_portile2 (2.4.0)
91
- minitest (5.15.0)
92
- nio4r (2.5.8)
93
- nokogiri (1.10.10)
94
- mini_portile2 (~> 2.4.0)
95
- public_suffix (4.0.6)
96
- rack (2.2.3)
97
- rack-test (1.1.0)
98
- rack (>= 1.0, < 3)
99
- rails (5.2.6)
100
- actioncable (= 5.2.6)
101
- actionmailer (= 5.2.6)
102
- actionpack (= 5.2.6)
103
- actionview (= 5.2.6)
104
- activejob (= 5.2.6)
105
- activemodel (= 5.2.6)
106
- activerecord (= 5.2.6)
107
- activestorage (= 5.2.6)
108
- activesupport (= 5.2.6)
109
- bundler (>= 1.3.0)
110
- railties (= 5.2.6)
111
- sprockets-rails (>= 2.0.0)
112
- rails-dom-testing (2.0.3)
113
- activesupport (>= 4.2.0)
114
- nokogiri (>= 1.6)
115
- rails-html-sanitizer (1.4.2)
116
- loofah (~> 2.3)
117
- railties (5.2.6)
118
- actionpack (= 5.2.6)
119
- activesupport (= 5.2.6)
120
- method_source
121
- rake (>= 0.8.7)
122
- thor (>= 0.19.0, < 2.0)
123
- rake (13.0.6)
124
- regexp_parser (1.8.2)
125
- rspec (3.10.0)
126
- rspec-core (~> 3.10.0)
127
- rspec-expectations (~> 3.10.0)
128
- rspec-mocks (~> 3.10.0)
129
- rspec-core (3.10.1)
130
- rspec-support (~> 3.10.0)
131
- rspec-expectations (3.10.1)
132
- diff-lcs (>= 1.2.0, < 2.0)
133
- rspec-support (~> 3.10.0)
134
- rspec-mocks (3.10.2)
135
- diff-lcs (>= 1.2.0, < 2.0)
136
- rspec-support (~> 3.10.0)
137
- rspec-support (3.10.3)
138
- sprockets (3.7.2)
139
- concurrent-ruby (~> 1.0)
140
- rack (> 1, < 3)
141
- sprockets-rails (3.2.2)
142
- actionpack (>= 4.0)
143
- activesupport (>= 4.0)
144
- sprockets (>= 3.0.0)
145
- thor (1.1.0)
146
- thread_safe (0.3.6)
147
- tzinfo (1.2.9)
148
- thread_safe (~> 0.1)
149
- uber (0.0.15)
150
- websocket-driver (0.7.5)
151
- websocket-extensions (>= 0.1.0)
152
- websocket-extensions (0.1.5)
153
- xpath (3.2.0)
154
- nokogiri (~> 1.8)
155
-
156
- PLATFORMS
157
- ruby
158
-
159
- DEPENDENCIES
160
- appraisal
161
- bundler
162
- byebug
163
- capybara
164
- nacelle!
165
- rails (~> 5.2.0)
166
- rake
167
- rspec
168
- sprockets (~> 3.0)
169
-
170
- BUNDLED WITH
171
- 2.2.32