lolcommits-lolsrv 0.0.5 → 0.0.6
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 +5 -5
- data/.travis.yml +5 -4
- data/lib/lolcommits/lolsrv/version.rb +1 -1
- data/lib/lolcommits/plugin/lolsrv.rb +5 -14
- data/lolcommits-lolsrv.gemspec +1 -1
- data/test/lolcommits/plugin/lolsrv_test.rb +13 -44
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 468cfa2577bf86022ec68a8ee3e88a719be4940a18a773d72d3cf67282301e29
|
4
|
+
data.tar.gz: e24a4bb2b49ce3114ed770bec218c1cbba8b261c1fcb4f661002446659aa8f60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce2ce5780a2f8eaf1ed20a19f058fac3308a04984e5a0e759e7a1a55f60cdddbd025712781963113f739df6c9b8f668f743c6b0a5de418bd71f442d933096c6f
|
7
|
+
data.tar.gz: 4dfdbc3dab4e21297a47e9a3d0a81159f1659ac88d0f67d10999505cd8dca12a6c02702876ea081e835d4b95b470d82ffca353660970dffa5d98349288ae376b
|
data/.travis.yml
CHANGED
@@ -4,13 +4,14 @@ cache: bundler
|
|
4
4
|
rvm:
|
5
5
|
- 2.0.0
|
6
6
|
- 2.1.10
|
7
|
-
- 2.2.
|
8
|
-
- 2.3.
|
9
|
-
- 2.4.
|
7
|
+
- 2.2.9
|
8
|
+
- 2.3.6
|
9
|
+
- 2.4.3
|
10
|
+
- 2.5.0
|
10
11
|
- ruby-head
|
11
12
|
|
12
13
|
before_install:
|
13
|
-
- gem
|
14
|
+
- gem update --system
|
14
15
|
- git --version
|
15
16
|
- git config --global user.email "lol@commits.org"
|
16
17
|
- git config --global user.name "Lolcommits"
|
@@ -5,15 +5,6 @@ module Lolcommits
|
|
5
5
|
module Plugin
|
6
6
|
class Lolsrv < Base
|
7
7
|
|
8
|
-
##
|
9
|
-
# Returns the name of the plugin. Identifies the plugin to lolcommits.
|
10
|
-
#
|
11
|
-
# @return [String] the plugin name
|
12
|
-
#
|
13
|
-
def self.name
|
14
|
-
'lolsrv'
|
15
|
-
end
|
16
|
-
|
17
8
|
##
|
18
9
|
# Returns position(s) of when this plugin should run during the capture
|
19
10
|
# process. Sync/uploading happens when a new capture is ready.
|
@@ -33,7 +24,7 @@ module Lolcommits
|
|
33
24
|
# configured
|
34
25
|
#
|
35
26
|
def valid_configuration?
|
36
|
-
!!(configuration[
|
27
|
+
!!(configuration[:server] =~ /^http(s)?:\/\//)
|
37
28
|
end
|
38
29
|
|
39
30
|
##
|
@@ -43,9 +34,9 @@ module Lolcommits
|
|
43
34
|
#
|
44
35
|
def configure_options!
|
45
36
|
options = super
|
46
|
-
if options[
|
37
|
+
if options[:enabled]
|
47
38
|
print "server: "
|
48
|
-
options.merge!(
|
39
|
+
options.merge!(server: parse_user_input(gets.strip))
|
49
40
|
puts '---------------------------------------------------------------'
|
50
41
|
puts ' Lolsrv - Sync lolcommits to a remote server'
|
51
42
|
puts ''
|
@@ -183,7 +174,7 @@ module Lolcommits
|
|
183
174
|
# @return [String] `server` config option + '/uplol'
|
184
175
|
#
|
185
176
|
def upload_endpoint
|
186
|
-
configuration[
|
177
|
+
configuration[:server] + '/uplol'
|
187
178
|
end
|
188
179
|
|
189
180
|
##
|
@@ -195,7 +186,7 @@ module Lolcommits
|
|
195
186
|
# @return [String] `server` config option + '/lols'
|
196
187
|
#
|
197
188
|
def lols_endpoint
|
198
|
-
configuration[
|
189
|
+
configuration[:server] + '/lols'
|
199
190
|
end
|
200
191
|
end
|
201
192
|
end
|
data/lolcommits-lolsrv.gemspec
CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
|
39
39
|
spec.add_runtime_dependency "rest-client"
|
40
40
|
|
41
|
-
spec.add_development_dependency "lolcommits", ">= 0.
|
41
|
+
spec.add_development_dependency "lolcommits", ">= 0.10.0"
|
42
42
|
spec.add_development_dependency "bundler"
|
43
43
|
spec.add_development_dependency "webmock"
|
44
44
|
spec.add_development_dependency "pry"
|
@@ -6,14 +6,6 @@ describe Lolcommits::Plugin::Lolsrv do
|
|
6
6
|
include Lolcommits::TestHelpers::GitRepo
|
7
7
|
include Lolcommits::TestHelpers::FakeIO
|
8
8
|
|
9
|
-
def plugin_name
|
10
|
-
"lolsrv"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should have a name" do
|
14
|
-
::Lolcommits::Plugin::Lolsrv.name.must_equal plugin_name
|
15
|
-
end
|
16
|
-
|
17
9
|
it "should run on capture ready" do
|
18
10
|
::Lolcommits::Plugin::Lolsrv.runner_order.must_equal [:capture_ready]
|
19
11
|
end
|
@@ -24,7 +16,6 @@ describe Lolcommits::Plugin::Lolsrv do
|
|
24
16
|
@runner ||= Lolcommits::Runner.new(
|
25
17
|
main_image: Tempfile.new('main_image.jpg'),
|
26
18
|
config: OpenStruct.new(
|
27
|
-
read_configuration: {},
|
28
19
|
loldir: File.expand_path("#{__dir__}../../../images")
|
29
20
|
)
|
30
21
|
)
|
@@ -35,30 +26,19 @@ describe Lolcommits::Plugin::Lolsrv do
|
|
35
26
|
end
|
36
27
|
|
37
28
|
def valid_enabled_config
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
"server" => "https://lolsrv.com"
|
43
|
-
}
|
44
|
-
}
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "initalizing" do
|
49
|
-
it "assigns runner and an enabled option" do
|
50
|
-
plugin.runner.must_equal runner
|
51
|
-
plugin.options.must_equal ["enabled"]
|
52
|
-
end
|
29
|
+
{
|
30
|
+
enabled: true,
|
31
|
+
server: "https://lolsrv.com"
|
32
|
+
}
|
53
33
|
end
|
54
34
|
|
55
35
|
describe "#enabled?" do
|
56
|
-
it "is
|
57
|
-
plugin.enabled
|
36
|
+
it "it is disabled by default" do
|
37
|
+
assert_nil plugin.enabled?
|
58
38
|
end
|
59
39
|
|
60
40
|
it "is true when configured" do
|
61
|
-
plugin.
|
41
|
+
plugin.configuration = valid_enabled_config
|
62
42
|
plugin.enabled?.must_equal true
|
63
43
|
end
|
64
44
|
end
|
@@ -72,7 +52,7 @@ describe Lolcommits::Plugin::Lolsrv do
|
|
72
52
|
|
73
53
|
it "syncs lolcommits" do
|
74
54
|
in_repo do
|
75
|
-
plugin.
|
55
|
+
plugin.configuration = valid_enabled_config
|
76
56
|
existing_sha = "sha123"
|
77
57
|
|
78
58
|
stub_request(:get, "https://lolsrv.com/lols").
|
@@ -97,7 +77,7 @@ describe Lolcommits::Plugin::Lolsrv do
|
|
97
77
|
|
98
78
|
it "shows error and aborts on failed lols endpoint" do
|
99
79
|
in_repo do
|
100
|
-
plugin.
|
80
|
+
plugin.configuration = valid_enabled_config
|
101
81
|
stub_request(:get, "https://lolsrv.com/lols").to_return(status: 404)
|
102
82
|
|
103
83
|
output = fake_io_capture do
|
@@ -111,15 +91,6 @@ describe Lolcommits::Plugin::Lolsrv do
|
|
111
91
|
end
|
112
92
|
|
113
93
|
describe "configuration" do
|
114
|
-
it "returns false when not configured" do
|
115
|
-
plugin.configured?.must_equal false
|
116
|
-
end
|
117
|
-
|
118
|
-
it "returns true when configured" do
|
119
|
-
plugin.config = valid_enabled_config
|
120
|
-
plugin.configured?.must_equal true
|
121
|
-
end
|
122
|
-
|
123
94
|
it "allows plugin options to be configured" do
|
124
95
|
# enabled and server option
|
125
96
|
inputs = ["true", "https://my-lolsrv.com"]
|
@@ -130,21 +101,19 @@ describe Lolcommits::Plugin::Lolsrv do
|
|
130
101
|
end
|
131
102
|
|
132
103
|
configured_plugin_options.must_equal({
|
133
|
-
|
134
|
-
|
104
|
+
enabled: true,
|
105
|
+
server: "https://my-lolsrv.com"
|
135
106
|
})
|
136
107
|
end
|
137
108
|
|
138
109
|
describe "#valid_configuration?" do
|
139
110
|
it "returns false for an invalid configuration" do
|
140
|
-
plugin.
|
141
|
-
"lolsrv" => { "server" => "gibberish" }
|
142
|
-
})
|
111
|
+
plugin.configuration = { server: "gibberish" }
|
143
112
|
plugin.valid_configuration?.must_equal false
|
144
113
|
end
|
145
114
|
|
146
115
|
it "returns true with a valid configuration" do
|
147
|
-
plugin.
|
116
|
+
plugin.configuration = valid_enabled_config
|
148
117
|
plugin.valid_configuration?.must_equal true
|
149
118
|
end
|
150
119
|
end
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Hutchinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.10.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.10.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
174
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.7.3
|
176
176
|
signing_key:
|
177
177
|
specification_version: 4
|
178
178
|
summary: Sync lolcommits to a remote server
|