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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c521924efaffad48737b7b0ad0d70fcac2926831a4ca1c6f8092c1e4305cb99
4
- data.tar.gz: 63ba755332fa3d2a1d12284de822ba80f24529d6072f9daf0c541853e6cafae5
3
+ metadata.gz: e1dc0bac12859ae8c078f18e7ced136ff53e7f78e5e1f8246a842c95653d1093
4
+ data.tar.gz: fe8e0498025196c99593e760c4dfbe8791031b2e8ff64d997694088e614e4bd3
5
5
  SHA512:
6
- metadata.gz: e02fc7e56645a6d47f3fcf84dd073fddaad53ed5a789acc9591985783704ef7064f15d60ef6a28ede8a060bddf1d099e6f88edd0db090b7e25a96c9899673828
7
- data.tar.gz: 33b991a9c7d2c6886a9c619452f2835e796b253d74410e518a8aa14aaed76ff30a93f8a490c58e72a3f3c9cce0dccb3596afdf96eac010476e4c8c9a55666ea5
6
+ metadata.gz: b749d80652a5fbc9ae05f1f4eb0c6256c953c1ca178bf0ce01516ce36b1c197a8698983748c19047b68332149f25ec37a5b27b78325e05841291777bdb641d6f
7
+ data.tar.gz: bc8016df114c316c54a302d4a568b055631a67788199fe50ac2a94a56afc254509d10a5831c679894831c6590135043edf20fa8a09d756f2dd61401e35e2aacd
@@ -3,18 +3,19 @@ name: Ruby
3
3
  on: [push]
4
4
 
5
5
  jobs:
6
- build:
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
- - name: Set up Ruby 2.6
13
- uses: actions/setup-ruby@v1
15
+
16
+ - uses: ruby/setup-ruby@v1
14
17
  with:
15
- ruby-version: 2.6.x
16
- - name: Build and test with Rake
17
- run: |
18
- gem install bundler
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://travis-ci.org/taka0125/asset_finder.svg?branch=master)](https://travis-ci.org/taka0125/asset_finder)
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', '>= 3.1', '< 7.0'
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, :stylesheet_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(root_dir, AssetFinder.configuration.javascript_patterns)
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
- return $1.sub(@root_dir, '') + '.js'
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
@@ -1,3 +1,3 @@
1
1
  module AssetFinder
2
- VERSION = "1.3.0"
2
+ VERSION = "1.6.0"
3
3
  end
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.3.0
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: 2020-01-30 00:00:00.000000000 Z
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: '3.1'
19
+ version: '6.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.0'
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: '3.1'
29
+ version: '6.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.0'
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.2
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: []