js_assets 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ebe0fa5c9ae154f5ac53513f6359ca097fdedad
4
- data.tar.gz: 861bea94bb12c70ed4004462c3834500453e0559
3
+ metadata.gz: 237eaf5e9692bb47d8c034053b37d0157fe91598
4
+ data.tar.gz: 37103bc00378399fa92e7feefbbcf256df0a523b
5
5
  SHA512:
6
- metadata.gz: ba50f7a1985d37176aba018027ee0f9fca599535dd2c11e17b4334d9c1cc87ff400c4811957edc82e1865b51d4b6aa1c070424a6ada9074afcd84e838d1a2591
7
- data.tar.gz: 4297847f5897b22cd9fb1d32bb0ec6f9ea9d4b5753ac1a90555f81d816df80f80d881f8c7a10e15fc247b209bb1193d3042380abcba69f059a6b0f6c1f52fbbb
6
+ metadata.gz: d35409b898d09e36c1898ee5214a8770509d96cb9061f09aab57a7785048b43fff5dc9a05c1a4ed3bcaff1a108780e9e00e9469dbb8a64279c2428cb0eb78653
7
+ data.tar.gz: 070b623a1982ae03f36983748d2b720a46d610b56fe5ccd4e4be84d8c09178b072d715b994ce4aef8cfd147c80d34a746046e1f0b8d756d01724d20fe4f9f210
@@ -2,41 +2,40 @@ module JsAssets
2
2
  class List
3
3
  class << self
4
4
  attr_accessor :exclude, :allow
5
-
6
- @exclude = ['application.js']
7
- @allow = ['*.html']
8
- def self.fetch
9
- project_assets = {}
10
- assets_filters = ::Rails.application.config.assets.precompile
11
- ::Rails.application.assets.each_file do |filename|
12
- if logical_path = ::Rails.application.assets.send(:logical_path_for_filename, filename, assets_filters)
13
- next if matches_filter(@exclude, logical_path, filename)
14
- next unless matches_filter(@allow, logical_path, filename)
15
- project_assets[logical_path] = ::ApplicationController.helpers.asset_path(logical_path)
16
- end
5
+ end
6
+ @exclude = ['application.js']
7
+ @allow = ['*.html']
8
+ def self.fetch
9
+ project_assets = {}
10
+ assets_filters = ::Rails.application.config.assets.precompile
11
+ ::Rails.application.assets.each_file do |filename|
12
+ if logical_path = ::Rails.application.assets.send(:logical_path_for_filename, filename, assets_filters)
13
+ next if matches_filter(@exclude, logical_path, filename)
14
+ next unless matches_filter(@allow, logical_path, filename)
15
+ project_assets[logical_path] = ::ApplicationController.helpers.asset_path(logical_path)
17
16
  end
18
- return project_assets
19
17
  end
18
+ return project_assets
19
+ end
20
20
 
21
- protected
22
- # from
23
- # https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/base.rb:418
24
- def self.matches_filter(filters, logical_path, filename)
25
- return true if filters.empty?
21
+ protected
22
+ # from
23
+ # https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/base.rb:418
24
+ def self.matches_filter(filters, logical_path, filename)
25
+ return true if filters.nil? || filters.empty?
26
26
 
27
- filters.any? do |filter|
28
- if filter.is_a?(Regexp)
29
- filter.match(logical_path)
30
- elsif filter.respond_to?(:call)
31
- if filter.arity == 1
32
- filter.call(logical_path)
33
- else
34
- filter.call(logical_path, filename.to_s)
35
- end
27
+ filters.any? do |filter|
28
+ if filter.is_a?(Regexp)
29
+ filter.match(logical_path)
30
+ elsif filter.respond_to?(:call)
31
+ if filter.arity == 1
32
+ filter.call(logical_path)
36
33
  else
37
- # puts filter
38
- File.fnmatch(filter.to_s, logical_path)
34
+ filter.call(logical_path, filename.to_s)
39
35
  end
36
+ else
37
+ # puts filter
38
+ File.fnmatch(filter.to_s, logical_path)
40
39
  end
41
40
  end
42
41
  end
@@ -1,3 +1,3 @@
1
1
  module JsAssets
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaur Abasmirzoev