jackal-code-fetcher 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/jackal-code-fetcher/git_hub.rb +27 -0
- data/lib/jackal-code-fetcher/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 215d1c0d6b8c6997b4474a34124024318f5ce105
|
4
|
+
data.tar.gz: 0cf8e802c632acc4b6be7c80e9b4441f3579fb91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbb0959c92dd1259ef4edcf6250ee3cd38db7e3d44f1d65d9d0ade459f1c807774f9bb4d543479ddbb7c86cd0e3df492adeeb8f8ee99a1759698f66d282e9029
|
7
|
+
data.tar.gz: ed8f3480738581419bd20a2705a08de7822182113a904e97c36b773a6e16162977f683f36c8d079a3bdb527fff5f5f350d96aa7309a647b7f417f065161305cb
|
data/CHANGELOG.md
CHANGED
@@ -37,6 +37,7 @@ module Jackal
|
|
37
37
|
def execute(message)
|
38
38
|
failure_wrap(message) do |payload|
|
39
39
|
retried = false
|
40
|
+
locked = lock_repo(payload)
|
40
41
|
begin
|
41
42
|
store_reference(payload)
|
42
43
|
rescue Git::GitExecuteError => e
|
@@ -48,11 +49,37 @@ module Jackal
|
|
48
49
|
else
|
49
50
|
raise
|
50
51
|
end
|
52
|
+
ensure
|
53
|
+
unlock_repo(locked)
|
51
54
|
end
|
52
55
|
job_completed(:code_fetcher, payload, message)
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
59
|
+
# Lock repository via lock file
|
60
|
+
#
|
61
|
+
# @param payload[Smash]
|
62
|
+
# @return [File]
|
63
|
+
def lock_repo(payload)
|
64
|
+
lock_path = File.join(
|
65
|
+
working_directory,
|
66
|
+
"#{payload.get(:data, :code_fetcher, :info, :owner)}-" <<
|
67
|
+
"#{payload.get(:data, :code_fetcher, :info, :name)}.lock"
|
68
|
+
)
|
69
|
+
lock_file = File.open(lock_path, 'w')
|
70
|
+
lock_file.flock(File::LOCK_EX)
|
71
|
+
lock_file
|
72
|
+
end
|
73
|
+
|
74
|
+
# Unlock the repository via lock file
|
75
|
+
#
|
76
|
+
# @param lock_file [File]
|
77
|
+
# @return [File]
|
78
|
+
def unlock_repo(lock_file)
|
79
|
+
lock_file.close
|
80
|
+
lock_file
|
81
|
+
end
|
82
|
+
|
56
83
|
# Delete local repository path
|
57
84
|
#
|
58
85
|
# @param payload [Smash]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jackal-code-fetcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03
|
11
|
+
date: 2015-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jackal
|
@@ -77,4 +77,3 @@ signing_key:
|
|
77
77
|
specification_version: 4
|
78
78
|
summary: Message processing helper
|
79
79
|
test_files: []
|
80
|
-
has_rdoc:
|