lolcommits-lolsrv 0.0.2 → 0.0.3
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 +4 -4
- data/lib/lolcommits/lolsrv/version.rb +1 -1
- data/lib/lolcommits/plugin/lolsrv.rb +20 -6
- data/test/lolcommits/plugin/lolsrv_test.rb +1 -1
- 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: e50c83486cf5146e9f9c96e853e934aa90da4af3
|
4
|
+
data.tar.gz: 02a923be72368002ec890aeb83211a7e580d343d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f54506b3ed4a07f69ff448272bc09bcdd75cacdbafe4a3fb9cb5377863a89bde24bcadc4c62c6fc88e7577b4acb3462b870f2aeda7ac67ac20118c3fcae968
|
7
|
+
data.tar.gz: eb8d7672a36f12d0dcf8230e28412a0a82f09503f9a385ba5a09eaa18dd98ef0456cbc73d2e1cdd3f2e8990b313662ac3cf0727263ae8c4ffbb4ad18ddb7dbb3
|
@@ -47,7 +47,7 @@ module Lolcommits
|
|
47
47
|
print "server: "
|
48
48
|
options.merge!('server' => parse_user_input(gets.strip))
|
49
49
|
puts '---------------------------------------------------------------'
|
50
|
-
puts ' Lolsrv -
|
50
|
+
puts ' Lolsrv - Upload and sync lolcommits to a remote server'
|
51
51
|
puts ''
|
52
52
|
puts ' Handle POST /uplol with these request params'
|
53
53
|
puts ''
|
@@ -82,6 +82,15 @@ module Lolcommits
|
|
82
82
|
|
83
83
|
private
|
84
84
|
|
85
|
+
##
|
86
|
+
# Message to show if syncing fails
|
87
|
+
#
|
88
|
+
# @return [String] message text
|
89
|
+
#
|
90
|
+
def fail_message
|
91
|
+
"failed :( (try again with --debug)\n"
|
92
|
+
end
|
93
|
+
|
85
94
|
##
|
86
95
|
#
|
87
96
|
# Syncs lolcommmit images to the remote server
|
@@ -94,18 +103,23 @@ module Lolcommits
|
|
94
103
|
# Upload requests that fail are skipped.
|
95
104
|
#
|
96
105
|
def sync
|
106
|
+
print "Syncing with lolsrv ... "
|
97
107
|
existing = existing_lols
|
98
108
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
return
|
109
|
+
# abort sync when invalid response or error from lols_endpoint
|
110
|
+
unless existing
|
111
|
+
print fail_message; return
|
103
112
|
end
|
104
113
|
|
105
114
|
Dir[runner.config.loldir + '/*.{jpg,gif}'].each do |image|
|
106
115
|
sha = File.basename(image, '.*')
|
107
|
-
upload(image, sha) unless existing.include?(sha) || sha == 'tmp_snapshot'
|
116
|
+
response = upload(image, sha) unless existing.include?(sha) || sha == 'tmp_snapshot'
|
117
|
+
unless response
|
118
|
+
print fail_message; return
|
119
|
+
end
|
108
120
|
end
|
121
|
+
|
122
|
+
print "done!\n"
|
109
123
|
end
|
110
124
|
|
111
125
|
##
|
@@ -77,7 +77,7 @@ describe Lolcommits::Plugin::Lolsrv do
|
|
77
77
|
|
78
78
|
stub_request(:post, "https://lolsrv.com/uplol").to_return(status: 200)
|
79
79
|
|
80
|
-
plugin.run_capture_ready(do_fork: false)
|
80
|
+
fake_io_capture { plugin.run_capture_ready(do_fork: false) }
|
81
81
|
|
82
82
|
assert_requested :get, "https://lolsrv.com/lols", times: 1
|
83
83
|
assert_requested :post, "https://lolsrv.com/uplol", times: 1,
|
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.3
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|