lolcommits-lolsrv 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 331ae4bed89222c2ed6c6987a550c087f722ee9f
4
- data.tar.gz: ed0f42d81741114b3d346bf985f1333285427d81
3
+ metadata.gz: 0faac8f4f97346ba5d9c9051568b7d29140e13c7
4
+ data.tar.gz: 471e84328f17c36894949e45b33a82e412c3d767
5
5
  SHA512:
6
- metadata.gz: 5766e45c68caa163fab9edcefa683fe235809469c4c5a8906e47c4f78c26ea548137a4408f2db9a30cfbee3ce988ef4ad3b3c3dcad09928bc8b14bd7e72e00cc
7
- data.tar.gz: acd9396d02f088c4facf10136f7d18bb5e068cfb2952da0980748863500df2469f1f23c8efcb20f4b599e827af86da21bf4d6a5c5330f6a78526fd9ebdedb826
6
+ metadata.gz: e21ba06befe194cd95d29423d7c21cbed06a7970ea911ecdb5eeea7772a968de2c76fb9e41503eda936480d8eb57dfa9a9093e3521b03a7b65f8617e42c70002
7
+ data.tar.gz: 992510e23e933834451388f9503a27daf3d65f09d3672444fb8907efd8344687c9d08a80e8806eb8220acac507f0c0dc0f74688e885b6706c41abfcfe6437c2c
@@ -1,5 +1,5 @@
1
1
  module Lolcommits
2
2
  module Lolsrv
3
- VERSION = "0.0.4".freeze
3
+ VERSION = "0.0.5".freeze
4
4
  end
5
5
  end
@@ -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 ? fork { sync } : sync
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. Then for
90
- # each image found in the local loldir folder, check if it has already
91
- # been uploaded. If not, upload the image with a POST request and
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 RuntimeError => e
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
- return nil
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
- return nil
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
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-17 00:00:00.000000000 Z
11
+ date: 2017-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client