lolcommits-lolsrv 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lolcommits/lolsrv/version.rb +1 -1
- data/lib/lolcommits/plugin/lolsrv.rb +15 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0faac8f4f97346ba5d9c9051568b7d29140e13c7
|
4
|
+
data.tar.gz: 471e84328f17c36894949e45b33a82e412c3d767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e21ba06befe194cd95d29423d7c21cbed06a7970ea911ecdb5eeea7772a968de2c76fb9e41503eda936480d8eb57dfa9a9093e3521b03a7b65f8617e42c70002
|
7
|
+
data.tar.gz: 992510e23e933834451388f9503a27daf3d65f09d3672444fb8907efd8344687c9d08a80e8806eb8220acac507f0c0dc0f74688e885b6706c41abfcfe6437c2c
|
@@ -71,12 +71,17 @@ module Lolcommits
|
|
71
71
|
#
|
72
72
|
# Post-capture hook, runs after lolcommits captures a snapshot.
|
73
73
|
#
|
74
|
-
# Syncs lolcommit images to the remote server (forked)
|
74
|
+
# Syncs lolcommit images to the remote server (forked and detached)
|
75
75
|
#
|
76
76
|
# @return [Integer] forked process id
|
77
77
|
#
|
78
78
|
def run_capture_ready(do_fork: true)
|
79
|
-
do_fork
|
79
|
+
if do_fork
|
80
|
+
pid = fork { sync }
|
81
|
+
Process.detach(pid)
|
82
|
+
else
|
83
|
+
sync
|
84
|
+
end
|
80
85
|
end
|
81
86
|
|
82
87
|
|
@@ -86,12 +91,12 @@ module Lolcommits
|
|
86
91
|
#
|
87
92
|
# Syncs lolcommmit images to the remote server
|
88
93
|
#
|
89
|
-
# Fetches from /lols and iterates over shas in the JSON array.
|
90
|
-
#
|
91
|
-
#
|
94
|
+
# Fetches from /lols and iterates over shas in the JSON array. For each
|
95
|
+
# image found in the local loldir folder, check if it has already been
|
96
|
+
# uploaded. If not, upload the image with a POST request and
|
92
97
|
# upload_params.
|
93
98
|
#
|
94
|
-
# Upload requests that fail abort the sync
|
99
|
+
# Upload requests that fail abort the sync.
|
95
100
|
#
|
96
101
|
def sync
|
97
102
|
print "Syncing lols ... "
|
@@ -106,8 +111,9 @@ module Lolcommits
|
|
106
111
|
end
|
107
112
|
|
108
113
|
print "done!\n"
|
109
|
-
rescue
|
114
|
+
rescue StandardError => e
|
110
115
|
print "#{e.message} (try again with --debug)\n"
|
116
|
+
nil
|
111
117
|
end
|
112
118
|
|
113
119
|
##
|
@@ -124,7 +130,7 @@ module Lolcommits
|
|
124
130
|
lols.map { |lol| lol['sha'] }
|
125
131
|
rescue JSON::ParserError, SocketError, RestClient::RequestFailed => e
|
126
132
|
log_error(e, "ERROR: existing lols could not be retrieved #{e.class} - #{e.message}")
|
127
|
-
|
133
|
+
nil
|
128
134
|
end
|
129
135
|
end
|
130
136
|
|
@@ -139,7 +145,7 @@ module Lolcommits
|
|
139
145
|
RestClient.post(upload_endpoint, upload_params_for(image, sha))
|
140
146
|
rescue SocketError, RestClient::RequestFailed => e
|
141
147
|
log_error(e, "ERROR: Upload of lol #{sha} to #{upload_endpoint} FAILED #{e.class} - #{e.message}")
|
142
|
-
|
148
|
+
nil
|
143
149
|
end
|
144
150
|
|
145
151
|
##
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits-lolsrv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Hutchinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|