asset_finder 1.1.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +24 -0
- data/README.md +3 -1
- data/asset_finder.gemspec +3 -3
- 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 +16 -17
- data/.travis.yml +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 70427858932deb09eb7a148546486959ce33e3f95788a3ef4357dc2cfec283fc
|
4
|
+
data.tar.gz: 602e149a58273820e7951f4aa48bdde36b52531688b93a1a06bdf942aa37ca20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51713a0f4075a1ff1286b2be2e38b7c7059f0fa1a4b0b5ca004a29b4e50d5f175d980a86d81d2aa30e8ae88408b853c11ab55bb16789d6201147e656d2db49c4
|
7
|
+
data.tar.gz: df63004fded2e06f91e0b359559f700997a5eab0814cddc9ecb1e845ac1ec8d10524c4575681421a47832157f96209ce5feed5710945f7f87b56e1940fc0b1ac
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby: ['2.6', '2.7']
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
|
16
|
+
- uses: actions/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
|
20
|
+
- run: |
|
21
|
+
gem install bundler
|
22
|
+
bundle config path vendor/bundle
|
23
|
+
bundle install --jobs 4 --retry 3
|
24
|
+
bundle exec rake
|
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,8 +19,8 @@ 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', '>=
|
23
|
-
spec.add_development_dependency "bundler"
|
24
|
-
spec.add_development_dependency "rake"
|
22
|
+
spec.add_dependency 'railties', '>= 6.0', '< 7.0'
|
23
|
+
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
26
|
end
|
@@ -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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -16,48 +16,48 @@ 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: '
|
22
|
+
version: '7.0'
|
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: '
|
32
|
+
version: '7.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,9 +79,9 @@ executables: []
|
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
|
+
- ".github/workflows/ruby.yml"
|
82
83
|
- ".gitignore"
|
83
84
|
- ".rspec"
|
84
|
-
- ".travis.yml"
|
85
85
|
- Gemfile
|
86
86
|
- LICENSE
|
87
87
|
- README.md
|
@@ -117,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
|
-
|
121
|
-
rubygems_version: 2.4.5
|
120
|
+
rubygems_version: 3.1.2
|
122
121
|
signing_key:
|
123
122
|
specification_version: 4
|
124
123
|
summary: Find javascripts and stylesheets for `rake asset:precompile`.
|
data/.travis.yml
DELETED