view_component-scoped_styles 0.8.0 → 0.8.1

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
  SHA256:
3
- metadata.gz: cbe5f5accd78d4f725e75db0267dad949175cbe53ed68bb003dccc4745c294f4
4
- data.tar.gz: 2f90b7dd291d0b5b3910a8c4e5e8be1e9c5000d8a69b07315582afac30abd2df
3
+ metadata.gz: 7a5b9375fce9459d0ff5176843540baf0af45fc19c75771f9e55a23bd400f0ad
4
+ data.tar.gz: b153dd8c88aabf25dbfdbcb1a74584f35a7c58a57b1394de77fad68765f16b18
5
5
  SHA512:
6
- metadata.gz: 89c318654efd8e5dbba628f5aade499754d32588b35fee364c7e91a45bc3fb0ae2001c1e1b3fdd390ede8890f081d060ed221551e513ee021c5639aafc708b4b
7
- data.tar.gz: 0d6adc27535b6ab7219935e78964b305cc13fd5b8590a82487b9dbc2d418deaddc15d0d870cd87bf8d1a4d62e96a993437909f4fe807d0a413dda3851a5eb05d
6
+ metadata.gz: b43ff7e5452e2cddfe8e40dcabcffe184dcab1ca0d8a43bc037689b6c3b742440a3eba4805ad17727304b1e5404739638d13c45f45eed4e965bf10861a3ed2c4
7
+ data.tar.gz: c53b57921b99b62b247f080087152056dcefc9529dbe00b5c213fa5ce8511baadcd906739991fba0c72b4d96e23f2733dce637ec3084134c6e0e4112c22a50d4
@@ -16,9 +16,12 @@ module ViewComponent
16
16
  component_class.instance_variable_get(:@component_id)
17
17
  styles = component_class.component_styles
18
18
 
19
- ensure_stylesheet_exists!
20
-
21
- update_stylesheet_with(component_name, styles)
19
+ FileUtils.mkdir_p(File.dirname(stylesheet_path))
20
+ File.open("#{stylesheet_path}.lock", "a") do |lock|
21
+ lock.flock(File::LOCK_EX)
22
+ ensure_stylesheet_exists!
23
+ update_stylesheet_with(component_name, styles)
24
+ end
22
25
  end
23
26
 
24
27
  private
@@ -26,7 +29,6 @@ module ViewComponent
26
29
  def ensure_stylesheet_exists!
27
30
  return if File.exist?(stylesheet_path)
28
31
 
29
- FileUtils.mkdir_p(File.dirname(stylesheet_path))
30
32
  File.write(stylesheet_path, initial_content)
31
33
  end
32
34
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ViewComponent
4
4
  module ScopedStyles
5
- VERSION = "0.8.0"
5
+ VERSION = "0.8.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_component-scoped_styles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Edwards