bd_pod_cache_lock 1.0.0 → 1.0.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: a7d197be46b15e04b7b0e9a19f3888da02014a2fdb9b997fd060ca28c69a9d96
4
- data.tar.gz: 9017c45dc3f2621edbb9a89408cc8b7855da19b252421945725d115b059a25fa
3
+ metadata.gz: 39f06457454a7e8cf5a0a07b8af301b3cdd199ead72a469ae7464397226cf166
4
+ data.tar.gz: 5f7e6c150730e4956a2dc7d530a8259b7e0392ed415963091c0da04a40f4bc44
5
5
  SHA512:
6
- metadata.gz: aa8e2e6090717098c8c8037d8d61385c4d6f84fd16ecbd598fd0d7f94f043f5f678f732aa60b5a8a37d916b3dcd373ddaac25fb74d7e3df4207880a3c8e42774
7
- data.tar.gz: 13db93584b4e4d273dd13350541ea9c3ffa3b7d109f3e59089c1e7684f3c39869b96b4f66384f9c7f91ee6f3a332c50e05b2ae30f28dfde749f54a1a8c4869ef
6
+ metadata.gz: 3d6eb03c5b46f7fc772d550f3397044bf180de8f436e26b17172fa81bd04b696b2c5469acfe371a84b8182605f82f32715fd3d04bd92dfeda9d7d617ebb332fa
7
+ data.tar.gz: 630d515b7ccc9c7f0cf671abc04f0ffccae1eb5c71391a6073f634484e032b6dc1cb86e325eb9ed876fc67a8e03e11327fef4c4752160b9d464969ca3e25d865
@@ -1,3 +1,3 @@
1
1
  module BdPodCacheLock
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,6 +1,18 @@
1
1
  require "bd_pod_cache_lock/version"
2
2
  require 'fileutils'
3
3
  require 'tmpdir'
4
+ require 'digest/sha1'
5
+
6
+ ROOT_PROCESS_ID = Process.pid
7
+
8
+ $pod_cache_lock_dir = Pod::Config.instance.cache_root + 'Pods' + 'CacheLock'
9
+
10
+ at_exit do
11
+ if(Process.pid == ROOT_PROCESS_ID)
12
+ FileUtils.rm_rf($pod_cache_lock_dir)
13
+ puts "Unlocked"
14
+ end
15
+ end
4
16
 
5
17
  module Pod
6
18
  module Downloader
@@ -20,7 +32,10 @@ module Pod
20
32
  # `request`.
21
33
  #
22
34
  def lock_path_for_pod(request, slug_opts = {})
23
- path_for_pod(request, slug_opts).to_s + '.lock'
35
+ lock_dir = root + "CacheLock"
36
+ Dir.mkdir($pod_cache_lock_dir) unless Dir.exist?($pod_cache_lock_dir)
37
+ request_sha1 = Digest::SHA1.hexdigest(request.slug(slug_opts))
38
+ return ($pod_cache_lock_dir + request_sha1).to_s + '.lock'
24
39
  end
25
40
 
26
41
  # @param [Request] request
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bd_pod_cache_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - liuyan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-31 00:00:00.000000000 Z
11
+ date: 2018-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler