asset_finder 1.3.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +11 -10
- data/README.md +3 -1
- data/asset_finder.gemspec +1 -1
- data/lib/asset_finder/configuration.rb +6 -3
- data/lib/asset_finder/javascript/finder.rb +5 -1
- data/lib/asset_finder/javascript/normalizer.rb +5 -2
- data/lib/asset_finder/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1dc0bac12859ae8c078f18e7ced136ff53e7f78e5e1f8246a842c95653d1093
|
4
|
+
data.tar.gz: fe8e0498025196c99593e760c4dfbe8791031b2e8ff64d997694088e614e4bd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b749d80652a5fbc9ae05f1f4eb0c6256c953c1ca178bf0ce01516ce36b1c197a8698983748c19047b68332149f25ec37a5b27b78325e05841291777bdb641d6f
|
7
|
+
data.tar.gz: bc8016df114c316c54a302d4a568b055631a67788199fe50ac2a94a56afc254509d10a5831c679894831c6590135043edf20fa8a09d756f2dd61401e35e2aacd
|
data/.github/workflows/ruby.yml
CHANGED
@@ -3,18 +3,19 @@ name: Ruby
|
|
3
3
|
on: [push]
|
4
4
|
|
5
5
|
jobs:
|
6
|
-
|
7
|
-
|
6
|
+
test:
|
8
7
|
runs-on: ubuntu-latest
|
9
8
|
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby: ['2.7', '3.0', '3.1']
|
12
|
+
|
10
13
|
steps:
|
11
14
|
- uses: actions/checkout@v2
|
12
|
-
|
13
|
-
|
15
|
+
|
16
|
+
- uses: ruby/setup-ruby@v1
|
14
17
|
with:
|
15
|
-
ruby-version:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
bundle install --jobs 4 --retry 3
|
20
|
-
bundle exec rake
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
bundler-cache: true
|
20
|
+
|
21
|
+
- run: bundle exec rspec
|
data/README.md
CHANGED
@@ -5,7 +5,9 @@ Find javascripts and stylesheets for `rake asset:precompile`.
|
|
5
5
|
## Build Status
|
6
6
|
|
7
7
|
### master
|
8
|
-
[![Build Status](https://
|
8
|
+
[![Build Status](https://github.com/taka0125/asset_finder/workflows/Ruby/badge.svg)](https://github.com/taka0125/asset_finder/actions)
|
9
|
+
|
10
|
+
|
9
11
|
|
10
12
|
## Installation
|
11
13
|
|
data/asset_finder.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency 'railties', '>=
|
22
|
+
spec.add_dependency 'railties', '>= 6.0', '< 7.1'
|
23
23
|
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "rspec"
|
@@ -1,14 +1,17 @@
|
|
1
1
|
module AssetFinder
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :javascript_patterns
|
3
|
+
attr_accessor :javascript_patterns
|
4
|
+
attr_accessor :stylesheet_patterns
|
5
|
+
attr_accessor :normalize_index_file
|
4
6
|
|
5
7
|
DEFAULT = {
|
6
8
|
javascript_patterns: [],
|
7
|
-
stylesheet_patterns: []
|
9
|
+
stylesheet_patterns: [],
|
10
|
+
normalize_index_file: true
|
8
11
|
}.freeze
|
9
12
|
|
10
13
|
def initialize(options = {})
|
11
|
-
%i(javascript_patterns stylesheet_patterns).each do |k|
|
14
|
+
%i(javascript_patterns stylesheet_patterns normalize_index_file).each do |k|
|
12
15
|
send(:"#{k}=", options[k] || DEFAULT[k])
|
13
16
|
end
|
14
17
|
end
|
@@ -6,7 +6,11 @@ module AssetFinder
|
|
6
6
|
def self.execute
|
7
7
|
[].tap do |paths|
|
8
8
|
root_dir = File.join(Rails.root, 'app/assets/javascripts/')
|
9
|
-
normalizer = Normalizer.new(
|
9
|
+
normalizer = Normalizer.new(
|
10
|
+
root_dir,
|
11
|
+
AssetFinder.configuration.javascript_patterns,
|
12
|
+
normalize_index_file: AssetFinder.configuration.normalize_index_file
|
13
|
+
)
|
10
14
|
|
11
15
|
Find.find(root_dir).each do |path|
|
12
16
|
normalized_path = normalizer.normalize(path)
|
@@ -7,15 +7,18 @@ module AssetFinder
|
|
7
7
|
/^(.*)\.js$/
|
8
8
|
].freeze
|
9
9
|
|
10
|
-
def initialize(root_dir, patterns = [])
|
10
|
+
def initialize(root_dir, patterns = [], normalize_index_file: true)
|
11
11
|
@root_dir = root_dir.to_s
|
12
12
|
@patterns = patterns + DEFAULT_PATTERNS
|
13
|
+
@normalize_index_file = normalize_index_file
|
13
14
|
end
|
14
15
|
|
15
16
|
def normalize(path)
|
16
17
|
@patterns.each do |pattern|
|
17
18
|
if path.match(pattern)
|
18
|
-
|
19
|
+
normalized_path = $1.delete_prefix(@root_dir)
|
20
|
+
normalized_path = normalized_path.delete_suffix('/index') if @normalize_index_file
|
21
|
+
return normalized_path + '.js'
|
19
22
|
end
|
20
23
|
end
|
21
24
|
nil
|
data/lib/asset_finder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '7.
|
22
|
+
version: '7.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '6.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '7.
|
32
|
+
version: '7.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,7 +102,7 @@ homepage: https://github.com/taka0125/asset_finder
|
|
102
102
|
licenses:
|
103
103
|
- MIT
|
104
104
|
metadata: {}
|
105
|
-
post_install_message:
|
105
|
+
post_install_message:
|
106
106
|
rdoc_options: []
|
107
107
|
require_paths:
|
108
108
|
- lib
|
@@ -117,8 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
|
-
rubygems_version: 3.1.
|
121
|
-
signing_key:
|
120
|
+
rubygems_version: 3.1.6
|
121
|
+
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Find javascripts and stylesheets for `rake asset:precompile`.
|
124
124
|
test_files: []
|