asset_finder 1.4.0 → 1.5.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: 292da1b10522e96a042f08c29ce112a39698fdb8534846cdd38e1f72ea8ced85
4
- data.tar.gz: 63570c20523521c1e20dfa0a76984f03152b76967b3467ed35cdb5b77bcc0673
3
+ metadata.gz: 70427858932deb09eb7a148546486959ce33e3f95788a3ef4357dc2cfec283fc
4
+ data.tar.gz: 602e149a58273820e7951f4aa48bdde36b52531688b93a1a06bdf942aa37ca20
5
5
  SHA512:
6
- metadata.gz: 478f389b7ebd3a4dcb40e0241ccc2c38eafb71ca96105c2505dc74455c58e5784957e38738ebdd7f3c7a3b159928f5425670217ef9314f3dcef8706c9febfa84
7
- data.tar.gz: bf7b00fd244d9549d9c3a0ff8d5c7800a9318475aaf81adc4c498351b3748c34b903940ee6f36637c215ae3020d7c1d20eadaf63224028a41b03fed3405bda2d
6
+ metadata.gz: 51713a0f4075a1ff1286b2be2e38b7c7059f0fa1a4b0b5ca004a29b4e50d5f175d980a86d81d2aa30e8ae88408b853c11ab55bb16789d6201147e656d2db49c4
7
+ data.tar.gz: df63004fded2e06f91e0b359559f700997a5eab0814cddc9ecb1e845ac1ec8d10524c4575681421a47832157f96209ce5feed5710945f7f87b56e1940fc0b1ac
@@ -4,17 +4,21 @@ on: [push]
4
4
 
5
5
  jobs:
6
6
  build:
7
-
8
7
  runs-on: ubuntu-latest
9
8
 
9
+ strategy:
10
+ matrix:
11
+ ruby: ['2.6', '2.7']
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: actions/setup-ruby@v1
14
17
  with:
15
- ruby-version: 2.6.x
16
- - name: Build and test with Rake
17
- run: |
18
+ ruby-version: ${{ matrix.ruby }}
19
+
20
+ - run: |
18
21
  gem install bundler
22
+ bundle config path vendor/bundle
19
23
  bundle install --jobs 4 --retry 3
20
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://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
 
@@ -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.delete_prefix(@root_dir).delete_suffix('/index') + '.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.4.0"
2
+ VERSION = "1.5.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.4.0
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: 2020-01-30 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties