lolcommits-lolsrv 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bb54f67f47bc65ee2caefe840fbf0bafd94b35d
4
- data.tar.gz: fabe4b3cb797971fe9143a233274f5a770c7f7b8
3
+ metadata.gz: e50c83486cf5146e9f9c96e853e934aa90da4af3
4
+ data.tar.gz: 02a923be72368002ec890aeb83211a7e580d343d
5
5
  SHA512:
6
- metadata.gz: 6849216bd9091f8f31ecc2af788fe44d21231b625c202b15a1178553b97624282872150d8ba4635049b59dc85f512201d973967f82e82ea9c330aa9177bbccf7
7
- data.tar.gz: cf33ba750fc98a2ee35ae968d931d8534241a14fc7c80b1715362433a0709bc72f8bac32be03e662eded578106bef4c2f2f6f4145bb7e89f1ab03c6c81023090
6
+ metadata.gz: f9f54506b3ed4a07f69ff448272bc09bcdd75cacdbafe4a3fb9cb5377863a89bde24bcadc4c62c6fc88e7577b4acb3462b870f2aeda7ac67ac20118c3fcae968
7
+ data.tar.gz: eb8d7672a36f12d0dcf8230e28412a0a82f09503f9a385ba5a09eaa18dd98ef0456cbc73d2e1cdd3f2e8990b313662ac3cf0727263ae8c4ffbb4ad18ddb7dbb3
@@ -1,5 +1,5 @@
1
1
  module Lolcommits
2
2
  module Lolsrv
3
- VERSION = "0.0.2".freeze
3
+ VERSION = "0.0.3".freeze
4
4
  end
5
5
  end
@@ -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 - Sync and upload lolcommits to a remote Server'
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
- if existing.nil?
100
- # abort sync when invalid response or error from lols_endpoint
101
- debug "aborting sync, #{lols_endpoint} failed to return a valid JSON response"
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.2
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-06 00:00:00.000000000 Z
11
+ date: 2017-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client