asset_finder 1.6.0 → 2.1.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/release.yml +33 -0
- data/.github/workflows/ruby.yml +1 -1
- data/.rspec +1 -0
- data/README.md +21 -1
- data/asset_finder.gemspec +1 -1
- data/lib/asset_finder/configuration.rb +6 -2
- data/lib/asset_finder/javascript/normalizer.rb +14 -16
- data/lib/asset_finder/javascript/path_collector.rb +28 -0
- data/lib/asset_finder/javascript/path_pattern_collection.rb +16 -0
- data/lib/asset_finder/javascript/sprockets_config_generator.rb +24 -0
- data/lib/asset_finder/path_pattern.rb +19 -0
- data/lib/asset_finder/path_pattern_collection.rb +30 -0
- data/lib/asset_finder/railtie.rb +0 -2
- data/lib/asset_finder/sprockets_config_generator.rb +11 -0
- data/lib/asset_finder/stylesheet/dartsass_config_generator.rb +31 -0
- data/lib/asset_finder/stylesheet/normalizer.rb +12 -14
- data/lib/asset_finder/stylesheet/path_collector.rb +28 -0
- data/lib/asset_finder/stylesheet/path_pattern_collection.rb +16 -0
- data/lib/asset_finder/stylesheet/sprockets_config_generator.rb +24 -0
- data/lib/asset_finder/version.rb +1 -1
- data/lib/asset_finder.rb +18 -8
- metadata +17 -15
- data/lib/asset_finder/finder.rb +0 -7
- data/lib/asset_finder/javascript/finder.rb +0 -24
- data/lib/asset_finder/stylesheet/finder.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d25517bbac695431afc4943b43d120d5c9c57ae35c670ed87e8dd7200f9ba272
|
4
|
+
data.tar.gz: 6609fdbd827c88f0928797a4dee643456413fc1d6ae8f50bd5538787d9225197
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eeff6696737e15719527b9a41e89a4d6efcdba53f376c221f38d1cbc91e5687c4189cf8b9b426775139444e1a80edf86356b40b2b95d1939378ae22fc789df0
|
7
|
+
data.tar.gz: 5ad11793f8dc2fa089858413fc2f8261f8a587b69e702f7598eb699173ed420ff9f1fbc93b50f8bca4bb83480a54ac883e59617def6e4c74f9b07c4b86ce1eaf
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Release gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
rubygems-otp-code:
|
7
|
+
description: RubyGems OTP code
|
8
|
+
required: true
|
9
|
+
|
10
|
+
permissions:
|
11
|
+
contents: write
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
release-gem:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
env:
|
17
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
18
|
+
GEM_HOST_OTP_CODE: ${{ github.event.inputs.rubygems-otp-code }}
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
with:
|
22
|
+
fetch-depth: 0 # bundle exec rake release で git tag を見るため、tagをfetchするようにしている
|
23
|
+
- uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: 3.2
|
26
|
+
- name: Bundle install
|
27
|
+
run: bundle install
|
28
|
+
- name: Setup git config # bundle exec rake release でgit tagが打たれていない場合、タグを打ってpushしてくれるため用意している
|
29
|
+
run: |
|
30
|
+
git config --global user.email "taka0125@gmail.com"
|
31
|
+
git config --global user.name "Takahiro Ooishi"
|
32
|
+
- name: Release gem
|
33
|
+
run: bundle exec rake release
|
data/.github/workflows/ruby.yml
CHANGED
data/.rspec
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Find javascripts and stylesheets for `rake asset:precompile`.
|
|
4
4
|
|
5
5
|
## Build Status
|
6
6
|
|
7
|
-
###
|
7
|
+
### main
|
8
8
|
[![Build Status](https://github.com/taka0125/asset_finder/workflows/Ruby/badge.svg)](https://github.com/taka0125/asset_finder/actions)
|
9
9
|
|
10
10
|
|
@@ -25,6 +25,26 @@ Or install it yourself as:
|
|
25
25
|
|
26
26
|
$ gem install asset_finder
|
27
27
|
|
28
|
+
## config file
|
29
|
+
|
30
|
+
`config/initializers/asset_finder.rb`
|
31
|
+
|
32
|
+
### Sprockets
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Rails.application.config.to_prepare do
|
36
|
+
Rails.application.config.assets.precompile += AssetFinder::SprocketsConfigGenerator.new.execute
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
### dartsass-rails
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
Rails.application.config.to_prepare do
|
44
|
+
Rails.application.config.dartsass.builds = AssetFinder::Stylesheet::DartsassConfigGenerator.new.execute
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
28
48
|
## Development
|
29
49
|
|
30
50
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
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', '>= 6.0'
|
22
|
+
spec.add_dependency 'railties', '>= 6.0'
|
23
23
|
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "rspec"
|
@@ -1,18 +1,22 @@
|
|
1
1
|
module AssetFinder
|
2
2
|
class Configuration
|
3
3
|
attr_accessor :javascript_patterns
|
4
|
+
attr_accessor :javascript_root_path
|
4
5
|
attr_accessor :stylesheet_patterns
|
6
|
+
attr_accessor :stylesheet_root_path
|
5
7
|
attr_accessor :normalize_index_file
|
6
8
|
|
7
9
|
DEFAULT = {
|
8
10
|
javascript_patterns: [],
|
11
|
+
javascript_root_path: 'app/assets/javascripts/',
|
9
12
|
stylesheet_patterns: [],
|
13
|
+
stylesheet_root_path: 'app/assets/stylesheets/',
|
10
14
|
normalize_index_file: true
|
11
15
|
}.freeze
|
12
16
|
|
13
17
|
def initialize(options = {})
|
14
|
-
|
15
|
-
|
18
|
+
DEFAULT.keys.each do |k|
|
19
|
+
public_send(:"#{k}=", options[k] || DEFAULT[k])
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -1,28 +1,26 @@
|
|
1
1
|
module AssetFinder
|
2
2
|
module Javascript
|
3
3
|
class Normalizer
|
4
|
-
|
5
|
-
/^(.*)\.js\.coffee$/,
|
6
|
-
/^(.*)\.coffee$/,
|
7
|
-
/^(.*)\.js$/
|
8
|
-
].freeze
|
9
|
-
|
10
|
-
def initialize(root_dir, patterns = [], normalize_index_file: true)
|
4
|
+
def initialize(root_dir:, path_pattern_collection:, normalize_index_file: true)
|
11
5
|
@root_dir = root_dir.to_s
|
12
|
-
@
|
6
|
+
@path_pattern_collection = path_pattern_collection
|
13
7
|
@normalize_index_file = normalize_index_file
|
8
|
+
|
9
|
+
freeze
|
14
10
|
end
|
15
11
|
|
16
12
|
def normalize(path)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
nil
|
13
|
+
match = path_pattern_collection.match(path: path)
|
14
|
+
return unless match
|
15
|
+
|
16
|
+
normalized_path = match[1].delete_prefix(root_dir)
|
17
|
+
normalized_path = normalized_path.delete_suffix('/index') if normalize_index_file
|
18
|
+
normalized_path + '.js'
|
25
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :root_dir, :path_pattern_collection, :normalize_index_file
|
26
24
|
end
|
27
25
|
end
|
28
26
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
module AssetFinder
|
4
|
+
module Javascript
|
5
|
+
class PathCollector
|
6
|
+
def initialize(root_dir:, path_pattern_collection:)
|
7
|
+
@root_dir = root_dir || File.join(Rails.root, AssetFinder.config.javascript_root_path)
|
8
|
+
@path_pattern_collection = path_pattern_collection || PathPatternCollection.build
|
9
|
+
|
10
|
+
freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute
|
14
|
+
[].tap do |paths|
|
15
|
+
Find.find(root_dir).each do |path|
|
16
|
+
next unless path_pattern_collection.match?(path: path)
|
17
|
+
|
18
|
+
paths << path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :root_dir, :path_pattern_collection
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module AssetFinder
|
2
|
+
module Javascript
|
3
|
+
class PathPatternCollection < AssetFinder::PathPatternCollection
|
4
|
+
DEFAULT_PATTERNS = [
|
5
|
+
/^(.*)\.js\.coffee$/,
|
6
|
+
/^(.*)\.coffee$/,
|
7
|
+
/^(.*)\.js$/
|
8
|
+
].freeze
|
9
|
+
|
10
|
+
def self.build
|
11
|
+
patterns = AssetFinder.config.javascript_patterns + DEFAULT_PATTERNS
|
12
|
+
new(path_patterns: patterns.map { |pattern| PathPattern.new(pattern: pattern) })
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
module AssetFinder
|
4
|
+
module Javascript
|
5
|
+
class SprocketsConfigGenerator
|
6
|
+
def initialize(root_dir: nil)
|
7
|
+
@root_dir = root_dir || File.join(Rails.root, AssetFinder.config.javascript_root_path)
|
8
|
+
@path_pattern_collection = PathPatternCollection.build
|
9
|
+
@path_collector = PathCollector.new(root_dir: @root_dir, path_pattern_collection: @path_pattern_collection)
|
10
|
+
@normalizer = Normalizer.new(root_dir: @root_dir, path_pattern_collection: @path_pattern_collection, normalize_index_file: AssetFinder.config.normalize_index_file)
|
11
|
+
|
12
|
+
freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute
|
16
|
+
path_collector.execute.map { |path| normalizer.normalize(path) }.compact
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :root_dir, :path_pattern_collection, :path_collector, :normalizer
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module AssetFinder
|
2
|
+
class PathPattern
|
3
|
+
attr_reader :pattern
|
4
|
+
|
5
|
+
def initialize(pattern:)
|
6
|
+
@pattern = pattern
|
7
|
+
|
8
|
+
freeze
|
9
|
+
end
|
10
|
+
|
11
|
+
def match?(path:)
|
12
|
+
path.match?(pattern)
|
13
|
+
end
|
14
|
+
|
15
|
+
def match(path:)
|
16
|
+
path.match(pattern)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module AssetFinder
|
2
|
+
class PathPatternCollection
|
3
|
+
def initialize(path_patterns:)
|
4
|
+
@path_patterns = Array(path_patterns)
|
5
|
+
|
6
|
+
freeze
|
7
|
+
end
|
8
|
+
|
9
|
+
def match?(path:)
|
10
|
+
path_patterns.each do |path_pattern|
|
11
|
+
return true if path_pattern.match?(path: path)
|
12
|
+
end
|
13
|
+
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def match(path:)
|
18
|
+
path_patterns.each do |path_pattern|
|
19
|
+
match = path_pattern.match(path: path)
|
20
|
+
return match if match
|
21
|
+
end
|
22
|
+
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :path_patterns
|
29
|
+
end
|
30
|
+
end
|
data/lib/asset_finder/railtie.rb
CHANGED
@@ -9,8 +9,6 @@ module AssetFinder
|
|
9
9
|
config.javascript_patterns = Rails.application.config.asset_finder.javascript_patterns
|
10
10
|
config.stylesheet_patterns = Rails.application.config.asset_finder.stylesheet_patterns
|
11
11
|
end
|
12
|
-
|
13
|
-
Rails.application.config.assets.precompile += AssetFinder::Finder.execute
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
module AssetFinder
|
4
|
+
module Stylesheet
|
5
|
+
class DartsassConfigGenerator
|
6
|
+
def initialize(root_dir: nil)
|
7
|
+
@root_dir = root_dir || File.join(Rails.root, 'app/assets/stylesheets/')
|
8
|
+
@path_pattern_collection = PathPatternCollection.build
|
9
|
+
@path_collector = PathCollector.new(root_dir: @root_dir, path_pattern_collection: @path_pattern_collection)
|
10
|
+
@normalizer = Normalizer.new(root_dir: @root_dir, path_pattern_collection: @path_pattern_collection)
|
11
|
+
|
12
|
+
freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute
|
16
|
+
{}.tap do |results|
|
17
|
+
path_collector.execute.each do |path|
|
18
|
+
key = path.delete_prefix(root_dir)
|
19
|
+
value = normalizer.normalize(path)
|
20
|
+
|
21
|
+
results[key] = value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :root_dir, :path_pattern_collection, :path_collector, :normalizer
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,25 +1,23 @@
|
|
1
1
|
module AssetFinder
|
2
2
|
module Stylesheet
|
3
3
|
class Normalizer
|
4
|
-
|
5
|
-
/^(.*)\.css\.scss$/,
|
6
|
-
/^(.*)\.css$/,
|
7
|
-
/^(.*)\.scss$/
|
8
|
-
].freeze
|
9
|
-
|
10
|
-
def initialize(root_dir, patterns = [])
|
4
|
+
def initialize(root_dir:, path_pattern_collection:)
|
11
5
|
@root_dir = root_dir.to_s
|
12
|
-
@
|
6
|
+
@path_pattern_collection = path_pattern_collection
|
7
|
+
|
8
|
+
freeze
|
13
9
|
end
|
14
10
|
|
15
11
|
def normalize(path)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
nil
|
12
|
+
match = path_pattern_collection.match(path: path)
|
13
|
+
return unless match
|
14
|
+
|
15
|
+
match[1].sub(root_dir, '') + '.css'
|
22
16
|
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_reader :root_dir, :path_pattern_collection
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
module AssetFinder
|
4
|
+
module Stylesheet
|
5
|
+
class PathCollector
|
6
|
+
def initialize(root_dir:, path_pattern_collection:)
|
7
|
+
@root_dir = root_dir
|
8
|
+
@path_pattern_collection = path_pattern_collection
|
9
|
+
|
10
|
+
freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute
|
14
|
+
[].tap do |paths|
|
15
|
+
Find.find(root_dir).each do |path|
|
16
|
+
next unless path_pattern_collection.match?(path: path)
|
17
|
+
|
18
|
+
paths << path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :root_dir, :path_pattern_collection
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module AssetFinder
|
2
|
+
module Stylesheet
|
3
|
+
class PathPatternCollection < AssetFinder::PathPatternCollection
|
4
|
+
DEFAULT_PATTERNS = [
|
5
|
+
/^(.*)\.css\.scss$/,
|
6
|
+
/^(.*)\.css$/,
|
7
|
+
/^(.*)\.scss$/
|
8
|
+
].freeze
|
9
|
+
|
10
|
+
def self.build
|
11
|
+
patterns = AssetFinder.config.stylesheet_patterns + DEFAULT_PATTERNS
|
12
|
+
new(path_patterns: patterns.map { |pattern| PathPattern.new(pattern: pattern) })
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
module AssetFinder
|
4
|
+
module Stylesheet
|
5
|
+
class SprocketsConfigGenerator
|
6
|
+
def initialize(root_dir: nil)
|
7
|
+
@root_dir = root_dir || File.join(Rails.root, 'app/assets/stylesheets/')
|
8
|
+
@path_pattern_collection = PathPatternCollection.build
|
9
|
+
@path_collector = PathCollector.new(root_dir: @root_dir, path_pattern_collection: @path_pattern_collection)
|
10
|
+
@normalizer = Normalizer.new(root_dir: @root_dir, path_pattern_collection: @path_pattern_collection)
|
11
|
+
|
12
|
+
freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute
|
16
|
+
path_collector.execute.map { |path| normalizer.normalize(path) }.compact
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :root_dir, :path_pattern_collection, :path_collector, :normalizer
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/asset_finder/version.rb
CHANGED
data/lib/asset_finder.rb
CHANGED
@@ -1,19 +1,29 @@
|
|
1
1
|
require "asset_finder/version"
|
2
2
|
require "asset_finder/configuration"
|
3
|
-
require "asset_finder/
|
3
|
+
require "asset_finder/sprockets_config_generator"
|
4
|
+
require "asset_finder/path_pattern"
|
5
|
+
require "asset_finder/path_pattern_collection"
|
6
|
+
require "asset_finder/javascript/sprockets_config_generator"
|
4
7
|
require "asset_finder/javascript/normalizer"
|
5
|
-
require "asset_finder/javascript/
|
8
|
+
require "asset_finder/javascript/path_collector"
|
9
|
+
require "asset_finder/javascript/path_pattern_collection"
|
10
|
+
require "asset_finder/stylesheet/dartsass_config_generator"
|
11
|
+
require "asset_finder/stylesheet/sprockets_config_generator"
|
6
12
|
require "asset_finder/stylesheet/normalizer"
|
7
|
-
require "asset_finder/stylesheet/
|
13
|
+
require "asset_finder/stylesheet/path_collector"
|
14
|
+
require "asset_finder/stylesheet/path_pattern_collection"
|
8
15
|
require "asset_finder/railtie" if defined?(::Rails::Railtie)
|
9
16
|
|
10
17
|
module AssetFinder
|
11
18
|
class << self
|
12
|
-
attr_accessor :
|
13
|
-
|
19
|
+
attr_accessor :config
|
20
|
+
|
21
|
+
def config
|
22
|
+
@config ||= Configuration.new
|
23
|
+
end
|
14
24
|
|
15
|
-
|
16
|
-
|
17
|
-
|
25
|
+
def configure
|
26
|
+
yield config
|
27
|
+
end
|
18
28
|
end
|
19
29
|
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
|
+
version: 2.1.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: 2023-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '6.0'
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '7.1'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,9 +24,6 @@ dependencies:
|
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '6.0'
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '7.1'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: bundler
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,6 +73,7 @@ executables: []
|
|
79
73
|
extensions: []
|
80
74
|
extra_rdoc_files: []
|
81
75
|
files:
|
76
|
+
- ".github/workflows/release.yml"
|
82
77
|
- ".github/workflows/ruby.yml"
|
83
78
|
- ".gitignore"
|
84
79
|
- ".rspec"
|
@@ -91,18 +86,25 @@ files:
|
|
91
86
|
- bin/setup
|
92
87
|
- lib/asset_finder.rb
|
93
88
|
- lib/asset_finder/configuration.rb
|
94
|
-
- lib/asset_finder/finder.rb
|
95
|
-
- lib/asset_finder/javascript/finder.rb
|
96
89
|
- lib/asset_finder/javascript/normalizer.rb
|
90
|
+
- lib/asset_finder/javascript/path_collector.rb
|
91
|
+
- lib/asset_finder/javascript/path_pattern_collection.rb
|
92
|
+
- lib/asset_finder/javascript/sprockets_config_generator.rb
|
93
|
+
- lib/asset_finder/path_pattern.rb
|
94
|
+
- lib/asset_finder/path_pattern_collection.rb
|
97
95
|
- lib/asset_finder/railtie.rb
|
98
|
-
- lib/asset_finder/
|
96
|
+
- lib/asset_finder/sprockets_config_generator.rb
|
97
|
+
- lib/asset_finder/stylesheet/dartsass_config_generator.rb
|
99
98
|
- lib/asset_finder/stylesheet/normalizer.rb
|
99
|
+
- lib/asset_finder/stylesheet/path_collector.rb
|
100
|
+
- lib/asset_finder/stylesheet/path_pattern_collection.rb
|
101
|
+
- lib/asset_finder/stylesheet/sprockets_config_generator.rb
|
100
102
|
- lib/asset_finder/version.rb
|
101
103
|
homepage: https://github.com/taka0125/asset_finder
|
102
104
|
licenses:
|
103
105
|
- MIT
|
104
106
|
metadata: {}
|
105
|
-
post_install_message:
|
107
|
+
post_install_message:
|
106
108
|
rdoc_options: []
|
107
109
|
require_paths:
|
108
110
|
- lib
|
@@ -117,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
119
|
- !ruby/object:Gem::Version
|
118
120
|
version: '0'
|
119
121
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
121
|
-
signing_key:
|
122
|
+
rubygems_version: 3.4.10
|
123
|
+
signing_key:
|
122
124
|
specification_version: 4
|
123
125
|
summary: Find javascripts and stylesheets for `rake asset:precompile`.
|
124
126
|
test_files: []
|
data/lib/asset_finder/finder.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'find'
|
2
|
-
|
3
|
-
module AssetFinder
|
4
|
-
module Javascript
|
5
|
-
class Finder
|
6
|
-
def self.execute
|
7
|
-
[].tap do |paths|
|
8
|
-
root_dir = File.join(Rails.root, 'app/assets/javascripts/')
|
9
|
-
normalizer = Normalizer.new(
|
10
|
-
root_dir,
|
11
|
-
AssetFinder.configuration.javascript_patterns,
|
12
|
-
normalize_index_file: AssetFinder.configuration.normalize_index_file
|
13
|
-
)
|
14
|
-
|
15
|
-
Find.find(root_dir).each do |path|
|
16
|
-
normalized_path = normalizer.normalize(path)
|
17
|
-
next if normalized_path.nil?
|
18
|
-
paths << normalized_path
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'find'
|
2
|
-
|
3
|
-
module AssetFinder
|
4
|
-
module Stylesheet
|
5
|
-
class Finder
|
6
|
-
def self.execute
|
7
|
-
[].tap do |paths|
|
8
|
-
root_dir = File.join(Rails.root, 'app/assets/stylesheets/')
|
9
|
-
normalizer = Normalizer.new(root_dir, AssetFinder.configuration.stylesheet_patterns)
|
10
|
-
|
11
|
-
Find.find(root_dir).each do |path|
|
12
|
-
normalized_path = normalizer.normalize(path)
|
13
|
-
next if normalized_path.nil?
|
14
|
-
paths << normalized_path
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|