ae_skip_asset_pipeline 0.2.0 → 0.3.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: 06f627bc793fe7dc5e264919b5cf80a35a3108fb8c89c652e0aaa1c826f15e3d
4
- data.tar.gz: fa972e368f8d4acb7200e33651620cce1b82a8bb2cbfdf853effb070e7038848
3
+ metadata.gz: a74a60a685e3481ef8a5e5e3d395602f7822db9d0fa805e8357c435425823ecd
4
+ data.tar.gz: ac711aa1326855309527760e3d06a1c8bca533849dafa8bd944de7e646be9f4e
5
5
  SHA512:
6
- metadata.gz: cb715e0d9303d32df8081ffc5ae30ae5e1c19bf29cf5598f307f2c82bdf69c51e8daa4af4d17f28ee9a3f18a5b5c5aeff714748fafc62f4e5aa9600a525b0f63
7
- data.tar.gz: 8bbb336823262d2e91d6b1bc3e6fadf14dd871ab83878898029f7381956b0d93b2d97eaadccbd8292104b857ed65337736ec7fd524c110edc12bd6232e4ce432
6
+ metadata.gz: f647e91aaf518d8ce7667e138ad8b0e370159b39130b416e69bcd4c38d926837ff5b29333f99b42ccb991897b1ec27f7d2e3025367aa29c8a6c41cc55b585da9
7
+ data.tar.gz: 7d8e8cc97e5bf852d1d023946fd64cb963079480fc2fca554ef6ba41d8f1236e6e4c154bb59446904cfd1198d3fedee511c138dcf48f88cf5fefb5388af50f11
@@ -6,28 +6,47 @@ require 'ae_skip_asset_pipeline/version'
6
6
  module AeSkipAssetPipeline
7
7
  mattr_accessor :enabled
8
8
 
9
- def javascript_packs_with_chunks_tag(*args)
10
- super unless AeSkipAssetPipeline.enabled
9
+ module AssetPipelineMethods
10
+ def javascript_packs_with_chunks_tag(*args)
11
+ super unless AeSkipAssetPipeline.enabled
12
+ end
13
+
14
+ def javascript_include_tag(*args)
15
+ super unless AeSkipAssetPipeline.enabled
16
+ end
17
+
18
+ def stylesheet_packs_with_chunks_tag(*args)
19
+ super unless AeSkipAssetPipeline.enabled
20
+ end
21
+
22
+ def stylesheet_link_tag(*args)
23
+ super unless AeSkipAssetPipeline.enabled
24
+ end
25
+
26
+ def path_to_asset(source, options={})
27
+ super(source, options.merge(skip_pipeline: AeSkipAssetPipeline.enabled))
28
+ end
11
29
  end
12
30
 
13
- def javascript_include_tag(*args)
14
- super unless AeSkipAssetPipeline.enabled
15
- end
16
-
17
- def stylesheet_packs_with_chunks_tag(*args)
18
- super unless AeSkipAssetPipeline.enabled
19
- end
20
-
21
- def stylesheet_link_tag(*args)
22
- super unless AeSkipAssetPipeline.enabled
23
- end
24
-
25
- def path_to_asset(source, options = {})
26
- super(source, options.merge(skip_pipeline: AeSkipAssetPipeline.enabled))
31
+ module HelperMethods
32
+ def save_current_state_and_set_asset_pipeline_enabled(enabled = true)
33
+ @current_skip_status = AeSkipAssetPipeline.enabled
34
+ AeSkipAssetPipeline.enabled = !enabled
35
+ end
36
+
37
+ def restore_old_state_of_asset_pipeline_enabled
38
+ AeSkipAssetPipeline.enabled = @current_skip_status
39
+ end
40
+
41
+ def with_asset_pipeline_enabled(enabled = true)
42
+ save_current_state_and_set_asset_pipeline_enabled(enabled)
43
+ yield
44
+ restore_old_state_of_asset_pipeline_enabled
45
+ end
27
46
  end
28
47
  end
29
48
 
30
49
  AeSkipAssetPipeline.enabled = true
31
50
 
32
- ActionView::Base.prepend AeSkipAssetPipeline
51
+ ActionView::Base.prepend AeSkipAssetPipeline::AssetPipelineMethods
33
52
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AeSkipAssetPipeline
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_skip_asset_pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appfolio