sewing_kit 0.6.1 → 0.6.2

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: dd6d8566a1e5aa23a61ab09d05db586b8796980c
4
- data.tar.gz: e57000e3f5a067a4d9df4b952a3080f40886dc63
3
+ metadata.gz: a7f11b53cd7599867f27fe7bba0af1435d27713a
4
+ data.tar.gz: 9729034b26d91852ce43904dc8aa4b45198613a3
5
5
  SHA512:
6
- metadata.gz: 540507d95a28fe65b2321c489c561465e4bf2898e7d2335ecc904da113339dac63c14682f41da2ce4bf489b07ece61ded91706772c3cbf3ce67178ca33a0239f
7
- data.tar.gz: c2ab65ce4396c1c93e5c3cf90206ed8c8e780a507f2ea20cb5f49099446d53650ac33f66c1947eda384bf11e047e40b7e8808b509b77b42123cdcf572ecc0120
6
+ metadata.gz: 3fe8cb746cbd96023e855ba86ed583c2b86abd712e401999f1f960a75d94f24832f4d21aa1ba08890fc39d1d0471d6eff7fb65c428942dc4e10effe524cfe972
7
+ data.tar.gz: b30db6c8bf6f28aaf267ab79f4f1ecd797f6d7b1a618b8c7949efef6081e21a4dfbdfbe158e8bc428aaffe8030a15cd8c24c44cfb7b37e82b2dfba7fadb605dd
@@ -1,3 +1,3 @@
1
1
  module SewingKit
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -18,14 +18,27 @@ module SewingKit
18
18
  paths || {}
19
19
  end
20
20
 
21
+ def clear_cache!
22
+ @manifest = nil
23
+ @manifest_expiry_time = nil
24
+ end
25
+
21
26
  def manifest
22
27
  if ::Rails.env.production?
23
28
  # Cache at class level, as JSON loading/parsing can be expensive.
24
29
  @manifest ||= load_manifest
25
30
  else
26
- # Don't cache outside of production; manifest may change.
27
- load_manifest
31
+ # In development, the manifest may change.
32
+ # A short cache lifetime avoids time consuming node callouts.
33
+ if self.instance_variable_defined?('@manifest_expiry_time') && @manifest_expiry_time && @manifest_expiry_time >= Time.now
34
+ @manifest
35
+ else
36
+ @manifest = load_manifest
37
+ @manifest_expiry_time = Time.now + 4
38
+ end
28
39
  end
40
+
41
+ @manifest
29
42
  end
30
43
 
31
44
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sewing_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Sauve
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-17 00:00:00.000000000 Z
11
+ date: 2017-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties