generated-assets 2.1.2 → 2.1.3

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
  SHA1:
3
- metadata.gz: fdfd9d3b89b7877113076c54310e7521980433dd
4
- data.tar.gz: 5449da6fb013a7b786750879e86829928577a4e2
3
+ metadata.gz: 270d5c1b58c3e458b4498ef3316f98e2797352ee
4
+ data.tar.gz: 6225de66325286d4bb96c09497029865fd4cd9de
5
5
  SHA512:
6
- metadata.gz: cb82efa467f8a7cd5d0daa1240779b2428eee47961b9f625a422337f3411a0d9ee8ec974057794c31787e8df17992678c14f2ca12465fbe7b9113048da4efecf
7
- data.tar.gz: a7703d6a137204919904f714ffc5b7757f21fe8acdc252b8f21a01ad5ce25070df2b282f482745d8a0a99744656c53088a15d3902a5e107b18710f1c71cb5982
6
+ metadata.gz: b29756801f0a778c1acb2207c8c5333564ebb72551c4aa2d34dbb8229c9108e169f2d4e866908e315301ff35d29f2d0f266930048f10190fa22ec3483497f1a5
7
+ data.tar.gz: abbf1bfd03a585c3bcc44ec568502d6f575c0d6ea75657f4c9f1a77aa8cc1b679a62e42cd84b6bc2f284b2359c35955c6985fcbe2d0c45fbbacab7105c7feb9d
@@ -7,6 +7,17 @@ module GeneratedAssets
7
7
  attr_reader :app, :prefix, :entries
8
8
  attr_reader :before_hooks, :after_hooks
9
9
 
10
+ # Force generated-assets to write files and add stuff to the precompile
11
+ # list. It works similarly to config.assets compile, but applies only to
12
+ # generated assets. Under normal circumstances, generated-assets will
13
+ # detect when it should do these things for you, usually when
14
+ # 1) config.assets.compile is true, or 2) when running
15
+ # rake assets:precompile. If you've got a non-standard setup though,
16
+ # set this property to a truthy value when you're compiling assets or
17
+ # running your app in an environment (i.e. development) that requires
18
+ # generated assets to be available.
19
+ attr_accessor :compile
20
+
10
21
  def initialize(app, prefix)
11
22
  @app = app
12
23
  @prefix = prefix
@@ -20,6 +31,7 @@ module GeneratedAssets
20
31
  end
21
32
 
22
33
  def apply!
34
+ return unless should_apply?
23
35
  before_hooks.each(&:call)
24
36
 
25
37
  write_files
@@ -46,6 +58,14 @@ module GeneratedAssets
46
58
  end
47
59
  end
48
60
 
61
+ def should_apply?
62
+ app.config.assets.compile ||
63
+ compile || (
64
+ defined?(::Rake) &&
65
+ ::Rake.application.top_level_tasks.include?('assets:precompile')
66
+ )
67
+ end
68
+
49
69
  def ensure_prefix_dir_exists
50
70
  FileUtils.mkdir_p(prefix)
51
71
  end
@@ -9,9 +9,7 @@ module GeneratedAssets
9
9
  end
10
10
 
11
11
  config.after_initialize do |app|
12
- if app.config.assets.compile
13
- app.config.assets.generated.apply!
14
- end
12
+ app.config.assets.generated.apply!
15
13
  end
16
14
 
17
15
  initializer :generated_assets, group: :all do |app|
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module GeneratedAssets
4
- VERSION = '2.1.2'
4
+ VERSION = '2.1.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generated-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-18 00:00:00.000000000 Z
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties