phlexible 1.0.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf3f2d54135dc708dc50f837b8dc9011c56e180aab472d58f47b8381289ea166
4
- data.tar.gz: 7d01c32e4597aaa907b3bbae4482b54e14166562f239430679a8073a405f0ecd
3
+ metadata.gz: 67a5772f23aaab09628e1f250674e02196ed67245779f66d542a322f8fae0ccc
4
+ data.tar.gz: a861b4de7b33edfbbc2c16f688ab2de1cc5806c3d2715c77e67f4bc91144e23a
5
5
  SHA512:
6
- metadata.gz: 165a9a1d766643dc7957d5c52a5eb91d6d97e48d634effc8f2a3e877536dfb6f95ebd8948c47924d4a637bda6c81618975c5831e252098661ad5478184973c65
7
- data.tar.gz: ba5c5b1f6b433b0e93af5e35b954706f9cb93f43cfee5280776b7475b56048142d14507cc50f4cf2ca39c86d024000c246ac5f3d8a94b6e9a24ff1dffaabb5b1
6
+ metadata.gz: 56bceb89cf1707f6159487538e69447abbf0e069aaf62c0acc7eff9e87e7254d24ef7e3223f51ea5d393bbf706306845e9a06c3ab70ed5b94c54012b65f94d1f
7
+ data.tar.gz: 7a34ba21a321dc20b86e71d1973e13e76dc2ac6d01d6fd79705a7e86841715ce55bb49c28c5469a1c1ffd72d23bb6c366a94b6847bfc188e5c2fb697bfb8a85e
data/Gemfile.lock CHANGED
@@ -1,150 +1,154 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phlexible (1.0.0)
5
- phlex (>= 1.8.1)
6
- phlex-rails (>= 1.0.0)
4
+ phlexible (2.0.1)
5
+ phlex (>= 1.10.0, < 2.0.0)
6
+ phlex-rails (>= 1.2.1, < 2.0.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (7.1.3)
12
- actionview (= 7.1.3)
13
- activesupport (= 7.1.3)
11
+ actionpack (8.0.1)
12
+ actionview (= 8.0.1)
13
+ activesupport (= 8.0.1)
14
14
  nokogiri (>= 1.8.5)
15
- racc
16
15
  rack (>= 2.2.4)
17
16
  rack-session (>= 1.0.1)
18
17
  rack-test (>= 0.6.3)
19
18
  rails-dom-testing (~> 2.2)
20
19
  rails-html-sanitizer (~> 1.6)
21
- actionview (7.1.3)
22
- activesupport (= 7.1.3)
20
+ useragent (~> 0.16)
21
+ actionview (8.0.1)
22
+ activesupport (= 8.0.1)
23
23
  builder (~> 3.1)
24
24
  erubi (~> 1.11)
25
25
  rails-dom-testing (~> 2.2)
26
26
  rails-html-sanitizer (~> 1.6)
27
- activesupport (7.1.3)
27
+ activesupport (8.0.1)
28
28
  base64
29
+ benchmark (>= 0.3)
29
30
  bigdecimal
30
- concurrent-ruby (~> 1.0, >= 1.0.2)
31
+ concurrent-ruby (~> 1.0, >= 1.3.1)
31
32
  connection_pool (>= 2.2.5)
32
33
  drb
33
34
  i18n (>= 1.6, < 2)
35
+ logger (>= 1.4.2)
34
36
  minitest (>= 5.1)
35
- mutex_m
36
- tzinfo (~> 2.0)
37
+ securerandom (>= 0.3)
38
+ tzinfo (~> 2.0, >= 2.0.5)
39
+ uri (>= 0.13.1)
37
40
  ast (2.4.2)
38
41
  base64 (0.2.0)
39
- bigdecimal (3.1.6)
40
- builder (3.2.4)
41
- cgi (0.4.1)
42
- combustion (1.4.0)
42
+ benchmark (0.4.0)
43
+ bigdecimal (3.1.9)
44
+ builder (3.3.0)
45
+ combustion (1.5.0)
43
46
  activesupport (>= 3.0.0)
44
47
  railties (>= 3.0.0)
45
48
  thor (>= 0.14.6)
46
- concurrent-ruby (1.2.3)
47
- connection_pool (2.4.1)
49
+ concurrent-ruby (1.3.5)
50
+ connection_pool (2.5.0)
48
51
  crass (1.0.6)
49
- drb (2.2.0)
50
- ruby2_keywords
51
- erb (4.0.4)
52
- cgi (>= 0.3.3)
53
- erubi (1.12.0)
54
- i18n (1.14.1)
52
+ date (3.4.1)
53
+ drb (2.2.1)
54
+ erubi (1.13.1)
55
+ i18n (1.14.7)
55
56
  concurrent-ruby (~> 1.0)
56
- io-console (0.7.2)
57
- irb (1.11.2)
58
- rdoc
57
+ io-console (0.8.0)
58
+ irb (1.15.1)
59
+ pp (>= 0.6.0)
60
+ rdoc (>= 4.0.0)
59
61
  reline (>= 0.4.2)
60
- json (2.7.1)
61
- language_server-protocol (3.17.0.3)
62
- loofah (2.22.0)
62
+ json (2.9.1)
63
+ language_server-protocol (3.17.0.4)
64
+ logger (1.6.5)
65
+ loofah (2.24.0)
63
66
  crass (~> 1.0.2)
64
67
  nokogiri (>= 1.12.0)
65
- minitest (5.22.2)
66
- mutex_m (0.2.0)
67
- nokogiri (1.16.2-arm64-darwin)
68
+ minitest (5.25.4)
69
+ nokogiri (1.18.2-arm64-darwin)
68
70
  racc (~> 1.4)
69
- nokogiri (1.16.2-x86_64-darwin)
71
+ nokogiri (1.18.2-x86_64-darwin)
70
72
  racc (~> 1.4)
71
- nokogiri (1.16.2-x86_64-linux)
73
+ nokogiri (1.18.2-x86_64-linux-gnu)
72
74
  racc (~> 1.4)
73
- parallel (1.24.0)
74
- parser (3.3.0.5)
75
+ parallel (1.26.3)
76
+ parser (3.3.7.1)
75
77
  ast (~> 2.4.1)
76
78
  racc
77
- phlex (1.9.0)
78
- concurrent-ruby (~> 1.2)
79
- erb (>= 4)
80
- zeitwerk (~> 2.6)
81
- phlex-rails (1.1.1)
82
- phlex (~> 1.9)
83
- railties (>= 6.1, < 8)
84
- zeitwerk (~> 2.6)
79
+ phlex (1.11.0)
80
+ phlex-rails (1.2.2)
81
+ phlex (>= 1.10, < 2)
82
+ railties (>= 6.1, < 9)
85
83
  phlex-testing-nokogiri (0.1.0)
86
84
  nokogiri (~> 1.13)
87
85
  phlex (>= 0.5)
88
- psych (5.1.2)
86
+ pp (0.6.2)
87
+ prettyprint
88
+ prettyprint (0.2.0)
89
+ psych (5.2.3)
90
+ date
89
91
  stringio
90
- racc (1.7.3)
91
- rack (3.0.9)
92
- rack-session (2.0.0)
92
+ racc (1.8.1)
93
+ rack (3.1.9)
94
+ rack-session (2.1.0)
95
+ base64 (>= 0.1.0)
93
96
  rack (>= 3.0.0)
94
- rack-test (2.1.0)
97
+ rack-test (2.2.0)
95
98
  rack (>= 1.3)
96
- rackup (2.1.0)
99
+ rackup (2.2.1)
97
100
  rack (>= 3)
98
- webrick (~> 1.8)
99
101
  rails-dom-testing (2.2.0)
100
102
  activesupport (>= 5.0.0)
101
103
  minitest
102
104
  nokogiri (>= 1.6)
103
- rails-html-sanitizer (1.6.0)
105
+ rails-html-sanitizer (1.6.2)
104
106
  loofah (~> 2.21)
105
- nokogiri (~> 1.14)
106
- railties (7.1.3)
107
- actionpack (= 7.1.3)
108
- activesupport (= 7.1.3)
109
- irb
107
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
108
+ railties (8.0.1)
109
+ actionpack (= 8.0.1)
110
+ activesupport (= 8.0.1)
111
+ irb (~> 1.13)
110
112
  rackup (>= 1.0.0)
111
113
  rake (>= 12.2)
112
114
  thor (~> 1.0, >= 1.2.2)
113
115
  zeitwerk (~> 2.6)
114
116
  rainbow (3.1.1)
115
- rake (13.1.0)
116
- rdoc (6.6.2)
117
+ rake (13.2.1)
118
+ rdoc (6.11.0)
117
119
  psych (>= 4.0.0)
118
- regexp_parser (2.9.0)
119
- reline (0.4.2)
120
+ regexp_parser (2.10.0)
121
+ reline (0.6.0)
120
122
  io-console (~> 0.5)
121
- rexml (3.2.6)
122
- rubocop (1.60.2)
123
+ rubocop (1.71.2)
123
124
  json (~> 2.3)
124
125
  language_server-protocol (>= 3.17.0)
125
126
  parallel (~> 1.10)
126
127
  parser (>= 3.3.0.2)
127
128
  rainbow (>= 2.2.2, < 4.0)
128
- regexp_parser (>= 1.8, < 3.0)
129
- rexml (>= 3.2.5, < 4.0)
130
- rubocop-ast (>= 1.30.0, < 2.0)
129
+ regexp_parser (>= 2.9.3, < 3.0)
130
+ rubocop-ast (>= 1.38.0, < 2.0)
131
131
  ruby-progressbar (~> 1.7)
132
- unicode-display_width (>= 2.4.0, < 3.0)
133
- rubocop-ast (1.30.0)
134
- parser (>= 3.2.1.0)
132
+ unicode-display_width (>= 2.4.0, < 4.0)
133
+ rubocop-ast (1.38.0)
134
+ parser (>= 3.3.1.0)
135
135
  ruby-progressbar (1.13.0)
136
- ruby2_keywords (0.0.5)
137
- stringio (3.1.0)
138
- sus (0.24.6)
139
- thor (1.3.0)
136
+ securerandom (0.4.1)
137
+ stringio (3.1.2)
138
+ sus (0.32.0)
139
+ thor (1.3.2)
140
140
  tzinfo (2.0.6)
141
141
  concurrent-ruby (~> 1.0)
142
- unicode-display_width (2.5.0)
143
- webrick (1.8.1)
144
- zeitwerk (2.6.13)
142
+ unicode-display_width (3.1.4)
143
+ unicode-emoji (~> 4.0, >= 4.0.4)
144
+ unicode-emoji (4.0.4)
145
+ uri (1.0.2)
146
+ useragent (0.16.11)
147
+ zeitwerk (2.7.1)
145
148
 
146
149
  PLATFORMS
147
150
  arm64-darwin-22
151
+ arm64-darwin-24
148
152
  x86_64-darwin-19
149
153
  x86_64-linux
150
154
 
data/README.md CHANGED
@@ -50,7 +50,7 @@ class Views::Users::Index < Views::Base
50
50
 
51
51
  controller_variable :first_name, :last_name
52
52
 
53
- def template
53
+ def view_template
54
54
  h1 { "#{@first_name} #{@last_name}" }
55
55
  end
56
56
  end
@@ -73,7 +73,7 @@ class Views::Users::Index < Views::Base
73
73
 
74
74
  controller_variable last_name: :surname, first_name: { as: :given_name, allow_undefined: true }
75
75
 
76
- def template
76
+ def view_template
77
77
  h1 { "#{@given_name} #{@surname}" }
78
78
  end
79
79
  end
@@ -128,7 +128,7 @@ end
128
128
  class MyView < Phlex::HTML
129
129
  include Phlexible::Rails::AElement
130
130
 
131
- def template
131
+ def view_template
132
132
  a(href: :articles) { 'View articles' }
133
133
  end
134
134
  end
@@ -165,7 +165,6 @@ Phlexible::Rails::ButtonTo.new(:root, method: :patch) { 'My Button' }
165
165
 
166
166
  > Available in **>= 1.0.0**
167
167
 
168
-
169
168
  A super simple way to define and render meta tags in your Phlex views. Just render the
170
169
  `Phlexible::Rails::MetaTagsComponent` component in the head element of your page, and define the
171
170
  meta tags using the `meta_tag` method in your controllers.
@@ -179,7 +178,7 @@ end
179
178
 
180
179
  ```ruby
181
180
  class MyView < Phlex::HTML
182
- def template
181
+ def view_template
183
182
  html do
184
183
  head do
185
184
  render Phlexible::Rails::MetaTagsComponent
@@ -200,7 +199,7 @@ So instead of:
200
199
 
201
200
  ```ruby
202
201
  class MyView < Phlex::HTML
203
- def template
202
+ def view_template
204
203
  div do
205
204
  render My::Awesome::Component.new
206
205
  end
@@ -216,7 +215,7 @@ class MyView < Phlex::HTML
216
215
 
217
216
  alias_view :awesome, -> { My::Awesome::Component }
218
217
 
219
- def template
218
+ def view_template
220
219
  div do
221
220
  awesome
222
221
  end
@@ -3,7 +3,7 @@
3
3
  class Views::Articles::Link < Phlex::HTML
4
4
  include Phlexible::Rails::AElement
5
5
 
6
- def template
6
+ def view_template
7
7
  a(href: :root, class: :foo) { 'A link to root' }
8
8
  end
9
9
  end
@@ -3,5 +3,5 @@
3
3
  class Views::Articles::Show < Phlex::HTML
4
4
  include Phlexible::Rails::ControllerVariables
5
5
 
6
- def template; end
6
+ def view_template; end
7
7
  end
@@ -7,7 +7,7 @@ module Phlexible
7
7
  # So instead of:
8
8
  #
9
9
  # class MyView < Phlex::HTML
10
- # def template
10
+ # def view_template
11
11
  # div do
12
12
  # render My::Awesome::Component.new
13
13
  # end
@@ -21,7 +21,7 @@ module Phlexible
21
21
  #
22
22
  # alias_view :awesome, -> { My::Awesome::Component }
23
23
  #
24
- # def template
24
+ # def view_template
25
25
  # div do
26
26
  # awesome
27
27
  # end
@@ -24,7 +24,7 @@ module Phlexible
24
24
  @options = options
25
25
  end
26
26
 
27
- def template(&block) # rubocop:disable Metrics/AbcSize
27
+ def view_template(&block) # rubocop:disable Metrics/AbcSize
28
28
  action = helpers.url_for(@url)
29
29
  @options = DEFAULT_OPTIONS.merge((@options || {}).symbolize_keys)
30
30
 
@@ -9,7 +9,7 @@
9
9
  # class Views::Users::Index < Views::Base
10
10
  # controller_variable :user_name
11
11
  #
12
- # def template
12
+ # def view_template
13
13
  # h1 { @user_name }
14
14
  # end
15
15
  # end
@@ -31,16 +31,18 @@ module Phlexible
31
31
  class UndefinedVariable < NameError
32
32
  def initialize(name)
33
33
  @variable_name = name
34
- super "Attempted to expose controller variable `#{@variable_name}`, but instance " \
35
- 'variable is not defined in the controller.'
34
+ super("Attempted to expose controller variable `#{@variable_name}`, but instance " \
35
+ 'variable is not defined in the controller.')
36
36
  end
37
37
  end
38
38
 
39
- def before_template
39
+ def before_template # rubocop:disable Metrics
40
40
  if respond_to?(:__controller_variables__)
41
41
  view_assigns = helpers.controller.view_assigns
42
+ view = @view
42
43
 
43
- __controller_variables__.each do |k, v|
44
+ vars = (view&.__controller_variables__ || Set.new) + __controller_variables__
45
+ vars.each do |k, v|
44
46
  allow_undefined = true
45
47
  if k.ends_with?('!')
46
48
  allow_undefined = false
@@ -50,6 +52,7 @@ module Phlexible
50
52
  raise ControllerVariables::UndefinedVariable, k if !allow_undefined && !view_assigns.key?(k)
51
53
 
52
54
  instance_variable_set(:"@#{v}", view_assigns[k])
55
+ view&.instance_variable_set(:"@#{v}", view_assigns[k])
53
56
  end
54
57
  end
55
58
 
@@ -3,7 +3,7 @@
3
3
  module Phlexible
4
4
  module Rails
5
5
  class MetaTagsComponent < Phlex::HTML
6
- def template
6
+ def view_template
7
7
  helpers.controller.view_assigns['meta_tags']&.each do |name, content|
8
8
  meta name: name, content: content.is_a?(String) ? content : content.to_json
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phlexible
4
- VERSION = '1.0.0'
4
+ VERSION = '2.0.1'
5
5
  end
data/phlexible.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/phlexible/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'phlexible'
7
+ spec.version = Phlexible::VERSION
8
+ spec.authors = ['Joel Moss']
9
+ spec.email = ['joel@developwithstyle.com']
10
+
11
+ spec.summary = 'A bunch of helpers and goodies intended to make life with Phlex even easier!'
12
+ spec.description = 'A bunch of helpers and goodies intended to make life with Phlex even easier!'
13
+ spec.homepage = 'https://github.com/joelmoss/phlexible'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 3.0.0'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/joelmoss/phlexible'
19
+ spec.metadata['changelog_uri'] = 'https://github.com/joelmoss/phlexible/releases'
20
+ spec.metadata['rubygems_mfa_required'] = 'true'
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = 'exe'
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ['lib']
32
+
33
+ spec.add_dependency 'phlex', '>= 1.10.0', '< 2.0.0'
34
+ spec.add_dependency 'phlex-rails', '>= 1.2.1', '< 2.0.0'
35
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlexible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Moss
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-02-21 00:00:00.000000000 Z
10
+ date: 2025-02-05 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: phlex
@@ -16,28 +15,40 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 1.8.1
18
+ version: 1.10.0
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.0
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - ">="
25
27
  - !ruby/object:Gem::Version
26
- version: 1.8.1
28
+ version: 1.10.0
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: 2.0.0
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: phlex-rails
29
34
  requirement: !ruby/object:Gem::Requirement
30
35
  requirements:
31
36
  - - ">="
32
37
  - !ruby/object:Gem::Version
33
- version: 1.0.0
38
+ version: 1.2.1
39
+ - - "<"
40
+ - !ruby/object:Gem::Version
41
+ version: 2.0.0
34
42
  type: :runtime
35
43
  prerelease: false
36
44
  version_requirements: !ruby/object:Gem::Requirement
37
45
  requirements:
38
46
  - - ">="
39
47
  - !ruby/object:Gem::Version
40
- version: 1.0.0
48
+ version: 1.2.1
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: 2.0.0
41
52
  description: A bunch of helpers and goodies intended to make life with Phlex even
42
53
  easier!
43
54
  email:
@@ -78,6 +89,7 @@ files:
78
89
  - lib/phlexible/rails/meta_tags_component.rb
79
90
  - lib/phlexible/rails/responder.rb
80
91
  - lib/phlexible/version.rb
92
+ - phlexible.gemspec
81
93
  homepage: https://github.com/joelmoss/phlexible
82
94
  licenses:
83
95
  - MIT
@@ -86,7 +98,6 @@ metadata:
86
98
  source_code_uri: https://github.com/joelmoss/phlexible
87
99
  changelog_uri: https://github.com/joelmoss/phlexible/releases
88
100
  rubygems_mfa_required: 'true'
89
- post_install_message:
90
101
  rdoc_options: []
91
102
  require_paths:
92
103
  - lib
@@ -101,8 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
112
  - !ruby/object:Gem::Version
102
113
  version: '0'
103
114
  requirements: []
104
- rubygems_version: 3.5.5
105
- signing_key:
115
+ rubygems_version: 3.6.3
106
116
  specification_version: 4
107
117
  summary: A bunch of helpers and goodies intended to make life with Phlex even easier!
108
118
  test_files: []