actionview-component 1.8.1 → 1.9.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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby_on_rails.yml +2 -2
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +6 -1
- data/lib/action_view/component/base.rb +15 -10
- data/lib/action_view/component/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67d62ba2c307963de0523a13f554d1e78b9e76990ace76c36b7d982ec83ef2cb
|
4
|
+
data.tar.gz: 66682a57cd5504b054c7c21227bbfb6cdc2c14f0ac151f2d6bb136a1f2e7a6cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f5b33cb1dfff517ae58afb9167a5f0370f40902eef1ecfef1d6ee0e9f589a255826b92cbccf3bec5fd0a91d487601ec273f6238ddc029a3daade14aa5cd8a5a
|
7
|
+
data.tar.gz: f2f58364fba2269e40bf5bd1040872f826365f67e09679996c79999a0755a1ffdbe06f89bb661f80e7a23a2b4791dff6618b28da9a9cf062b1ca41f65ee69dfa
|
@@ -8,7 +8,7 @@ jobs:
|
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
10
|
rails_version: [5.0.0, 5.2.3, 6.0.0, master]
|
11
|
-
ruby_version: [2.
|
11
|
+
ruby_version: [2.5.x, 2.6.x, 2.7.x]
|
12
12
|
exclude:
|
13
13
|
- rails_version: master
|
14
14
|
ruby_version: 2.4.x
|
@@ -22,7 +22,7 @@ jobs:
|
|
22
22
|
ruby-version: ${{ matrix.ruby_version }}
|
23
23
|
- name: Build and test with Rake
|
24
24
|
run: |
|
25
|
-
gem install bundler:1.
|
25
|
+
gem install bundler:1.17.3
|
26
26
|
bundle update
|
27
27
|
bundle install --jobs 4 --retry 3
|
28
28
|
bundle exec rake
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -34,7 +34,7 @@ Here are a few things you can do that will increase the likelihood of your pull
|
|
34
34
|
If you are the current maintainer of this gem:
|
35
35
|
|
36
36
|
1. Create a branch for the release: `git checkout -b release-vxx.xx.xx`
|
37
|
-
1. Bump gem version in `lib/action_view/component/version.rb`.
|
37
|
+
1. Bump gem version in `lib/action_view/component/version.rb`. Try to adhere to SemVer.
|
38
38
|
1. Add version heading/entries to `CHANGELOG.md`.
|
39
39
|
1. Make sure your local dependencies are up to date: `bundle`
|
40
40
|
1. Ensure that tests are green: `bundle exec rake`
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -15,7 +15,7 @@ As the goal of this gem is to be upstreamed into Rails, it is designed to integr
|
|
15
15
|
|
16
16
|
## Compatibility
|
17
17
|
|
18
|
-
`actionview-component` is tested for compatibility with combinations of Ruby `2.
|
18
|
+
`actionview-component` is tested for compatibility with combinations of Ruby `2.5`/`2.6` and Rails `5.0.0`/`5.2.3`/`6.0.0`/`6.1.0.alpha`.
|
19
19
|
|
20
20
|
## Installation
|
21
21
|
Add this line to your application's Gemfile:
|
@@ -528,6 +528,11 @@ To use component previews, set the following in `config/application.rb`:
|
|
528
528
|
config.action_view_component.preview_path = "#{Rails.root}/spec/components/previews"
|
529
529
|
```
|
530
530
|
|
531
|
+
### Initializer requirement
|
532
|
+
|
533
|
+
In Ruby 2.6.x and below, ActionView::Component requires the presence of an `initialize` method in each component.
|
534
|
+
However, `initialize` is no longer required for projects using 2.7.x and above.
|
535
|
+
|
531
536
|
## Frequently Asked Questions
|
532
537
|
|
533
538
|
### Can I use other templating languages besides ERB?
|
@@ -142,15 +142,11 @@ module ActionView
|
|
142
142
|
|
143
143
|
def source_location
|
144
144
|
@source_location ||=
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
#
|
149
|
-
#
|
150
|
-
# If we were able to only support Ruby 2.7+,
|
151
|
-
# We could just use Module#const_source_location,
|
152
|
-
# rendering this unnecessary.
|
153
|
-
#
|
145
|
+
if const_source_location_supported?
|
146
|
+
const_source_location(self.name)[0]
|
147
|
+
else
|
148
|
+
# Require `#initialize` to be defined so that we can use `method#source_location`
|
149
|
+
# to look up the filename of the component.
|
154
150
|
initialize_method = instance_method(:initialize)
|
155
151
|
initialize_method.source_location[0] if initialize_method.owner == self
|
156
152
|
end
|
@@ -210,6 +206,10 @@ module ActionView
|
|
210
206
|
|
211
207
|
private
|
212
208
|
|
209
|
+
def const_source_location_supported?
|
210
|
+
respond_to? :const_source_location # introduced in Ruby 2.7
|
211
|
+
end
|
212
|
+
|
213
213
|
def matching_views_in_source_location
|
214
214
|
return [] unless source_location
|
215
215
|
(Dir["#{source_location.chomp(File.extname(source_location))}.*{#{ActionView::Template.template_handler_extensions.join(',')}}"] - [source_location])
|
@@ -232,7 +232,12 @@ module ActionView
|
|
232
232
|
@template_errors ||=
|
233
233
|
begin
|
234
234
|
errors = []
|
235
|
-
|
235
|
+
if source_location.nil? && !const_source_location_supported?
|
236
|
+
# Require `#initialize` to be defined so that we can use `method#source_location`
|
237
|
+
# to look up the filename of the component.
|
238
|
+
errors << "#{self} must implement #initialize."
|
239
|
+
end
|
240
|
+
|
236
241
|
errors << "Could not find a template file for #{self}." if templates.empty?
|
237
242
|
|
238
243
|
if templates.count { |template| template[:variant].nil? } > 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionview-component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|