asset_finder 1.6.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +20 -0
- 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 -9
- 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: 6b42d4d846d0942fc672608a5d18a3455c04f08039d24fe1231141696c5268a5
|
4
|
+
data.tar.gz: bcd437ad57e470d1de5859dcb5aaa6f431720bb6a428cc48221c400e0d33b146
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c3ad1b9e349fad8b29f82cdc986f0c3136f1c2cab21f7fc950343d5dda9784d1d8582734400381da5af3b52e460e9e3f85be96ed753a617c6869c11f2214f4f
|
7
|
+
data.tar.gz: ec196605594d0b86509db2569e98d72a08d06971c7468c94fecb61a424045fd228fceb9cb6982b193076348a3e4888679eae6c6a1394a4d6837bf7d02fbc4844
|
@@ -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
@@ -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/assets_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.
|
@@ -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:
|
4
|
+
version: 2.0.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-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -79,6 +79,7 @@ executables: []
|
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
|
+
- ".github/workflows/release.yml"
|
82
83
|
- ".github/workflows/ruby.yml"
|
83
84
|
- ".gitignore"
|
84
85
|
- ".rspec"
|
@@ -91,18 +92,25 @@ files:
|
|
91
92
|
- bin/setup
|
92
93
|
- lib/asset_finder.rb
|
93
94
|
- lib/asset_finder/configuration.rb
|
94
|
-
- lib/asset_finder/finder.rb
|
95
|
-
- lib/asset_finder/javascript/finder.rb
|
96
95
|
- lib/asset_finder/javascript/normalizer.rb
|
96
|
+
- lib/asset_finder/javascript/path_collector.rb
|
97
|
+
- lib/asset_finder/javascript/path_pattern_collection.rb
|
98
|
+
- lib/asset_finder/javascript/sprockets_config_generator.rb
|
99
|
+
- lib/asset_finder/path_pattern.rb
|
100
|
+
- lib/asset_finder/path_pattern_collection.rb
|
97
101
|
- lib/asset_finder/railtie.rb
|
98
|
-
- lib/asset_finder/
|
102
|
+
- lib/asset_finder/sprockets_config_generator.rb
|
103
|
+
- lib/asset_finder/stylesheet/dartsass_config_generator.rb
|
99
104
|
- lib/asset_finder/stylesheet/normalizer.rb
|
105
|
+
- lib/asset_finder/stylesheet/path_collector.rb
|
106
|
+
- lib/asset_finder/stylesheet/path_pattern_collection.rb
|
107
|
+
- lib/asset_finder/stylesheet/sprockets_config_generator.rb
|
100
108
|
- lib/asset_finder/version.rb
|
101
109
|
homepage: https://github.com/taka0125/asset_finder
|
102
110
|
licenses:
|
103
111
|
- MIT
|
104
112
|
metadata: {}
|
105
|
-
post_install_message:
|
113
|
+
post_install_message:
|
106
114
|
rdoc_options: []
|
107
115
|
require_paths:
|
108
116
|
- lib
|
@@ -117,8 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
125
|
- !ruby/object:Gem::Version
|
118
126
|
version: '0'
|
119
127
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
121
|
-
signing_key:
|
128
|
+
rubygems_version: 3.4.10
|
129
|
+
signing_key:
|
122
130
|
specification_version: 4
|
123
131
|
summary: Find javascripts and stylesheets for `rake asset:precompile`.
|
124
132
|
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
|