lolcommits-protonet 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 +5 -5
- data/.travis.yml +5 -4
- data/lib/lolcommits/plugin/protonet.rb +4 -35
- data/lib/lolcommits/protonet/version.rb +1 -1
- data/lolcommits-protonet.gemspec +1 -1
- data/test/lolcommits/plugin/protonet_test.rb +13 -35
- 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: 5d5c6d6dcf571bb25ddafc41ae5e6310279d7add83e7c72180bd5235676ed78b
|
4
|
+
data.tar.gz: 922722865b187778e492c352deecf0e6f81888fc3ac926fb4d6598257a1bc42c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 052c32971e12c4ff0bfb6964a81d976befd08ebdcdd84690e2207a03566423be608ce1c8eed1d90912d97c3e0509936df13b1ae0b98468ef041b21f9f5425bf9
|
7
|
+
data.tar.gz: 988be000eba92897f14fce1decdf29a2534da8f7b8693ddd97b34f23fbdd1c2b129caa5fd9a3c8d62f76eedf5ac7413e136d11b43b6fc570b1484982303c4c7f
|
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"
|
@@ -10,16 +10,7 @@ module Lolcommits
|
|
10
10
|
#
|
11
11
|
def initialize(runner: nil, config: nil)
|
12
12
|
super
|
13
|
-
options.concat(
|
14
|
-
end
|
15
|
-
|
16
|
-
##
|
17
|
-
# Returns the name of the plugin to identify the plugin to lolcommits.
|
18
|
-
#
|
19
|
-
# @return [String] the plugin name
|
20
|
-
#
|
21
|
-
def self.name
|
22
|
-
'protonet'
|
13
|
+
options.concat([:api_endpoint, :api_token])
|
23
14
|
end
|
24
15
|
|
25
16
|
##
|
@@ -49,18 +40,6 @@ module Lolcommits
|
|
49
40
|
super
|
50
41
|
end
|
51
42
|
|
52
|
-
##
|
53
|
-
# Returns true if the plugin has been configured.
|
54
|
-
#
|
55
|
-
# @return [Boolean] true/false indicating if plugin is configured. An API
|
56
|
-
# token and endpoint are required.
|
57
|
-
#
|
58
|
-
def configured?
|
59
|
-
!!(configuration['enabled'] &&
|
60
|
-
configuration['api_token'] &&
|
61
|
-
configuration['api_endpoint'])
|
62
|
-
end
|
63
|
-
|
64
43
|
##
|
65
44
|
# Post-capture hook, runs after lolcommits captures a snapshot. Posts the
|
66
45
|
# lolcommit image with a message to the Protonet box. API Documentation
|
@@ -70,14 +49,14 @@ module Lolcommits
|
|
70
49
|
# @return [Nil] if any error occurs
|
71
50
|
#
|
72
51
|
def run_capture_ready
|
73
|
-
debug "Posting image (and message) to #{configuration[
|
52
|
+
debug "Posting image (and message) to #{configuration[:api_endpoint]}"
|
74
53
|
RestClient.post(
|
75
|
-
configuration[
|
54
|
+
configuration[:api_endpoint],
|
76
55
|
{
|
77
56
|
files: [File.new(runner.main_image)],
|
78
57
|
message: message
|
79
58
|
},
|
80
|
-
'X-Protonet-Token' => configuration[
|
59
|
+
'X-Protonet-Token' => configuration[:api_token]
|
81
60
|
)
|
82
61
|
rescue => e
|
83
62
|
log_error(e, "ERROR: RestClient POST FAILED #{e.class} - #{e.message}")
|
@@ -125,16 +104,6 @@ module Lolcommits
|
|
125
104
|
'heartbleeding', 'juciy', 'supercalifragilisticexpialidocious', 'failing', 'loving'
|
126
105
|
].sample
|
127
106
|
end
|
128
|
-
|
129
|
-
##
|
130
|
-
# Returns all configuration options available for this plugin. An API
|
131
|
-
# endpoint and token.
|
132
|
-
#
|
133
|
-
# @return [Array] the option names
|
134
|
-
#
|
135
|
-
def plugin_options
|
136
|
-
%w(api_endpoint api_token)
|
137
|
-
end
|
138
107
|
end
|
139
108
|
end
|
140
109
|
end
|
data/lolcommits-protonet.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
|
37
37
|
spec.add_runtime_dependency "rest-client"
|
38
38
|
|
39
|
-
spec.add_development_dependency "lolcommits", ">= 0.
|
39
|
+
spec.add_development_dependency "lolcommits", ">= 0.10.0"
|
40
40
|
spec.add_development_dependency "bundler"
|
41
41
|
spec.add_development_dependency "webmock"
|
42
42
|
spec.add_development_dependency "pry"
|
@@ -5,14 +5,6 @@ describe Lolcommits::Plugin::Protonet do
|
|
5
5
|
include Lolcommits::TestHelpers::GitRepo
|
6
6
|
include Lolcommits::TestHelpers::FakeIO
|
7
7
|
|
8
|
-
def plugin_name
|
9
|
-
"protonet"
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should have a name" do
|
13
|
-
::Lolcommits::Plugin::Protonet.name.must_equal plugin_name
|
14
|
-
end
|
15
|
-
|
16
8
|
it "should run on capture ready" do
|
17
9
|
::Lolcommits::Plugin::Protonet.runner_order.must_equal [:capture_ready]
|
18
10
|
end
|
@@ -22,7 +14,6 @@ describe Lolcommits::Plugin::Protonet do
|
|
22
14
|
# a simple lolcommits runner with an empty configuration Hash
|
23
15
|
@runner ||= Lolcommits::Runner.new(
|
24
16
|
main_image: Tempfile.new('main_image.jpg'),
|
25
|
-
config: OpenStruct.new(read_configuration: {})
|
26
17
|
)
|
27
18
|
end
|
28
19
|
|
@@ -31,15 +22,11 @@ describe Lolcommits::Plugin::Protonet do
|
|
31
22
|
end
|
32
23
|
|
33
24
|
def valid_enabled_config
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
"api_token" => "proto-token"
|
40
|
-
}
|
41
|
-
}
|
42
|
-
)
|
25
|
+
{
|
26
|
+
enabled: true,
|
27
|
+
api_endpoint: api_endpoint,
|
28
|
+
api_token: "proto-token"
|
29
|
+
}
|
43
30
|
end
|
44
31
|
|
45
32
|
def api_endpoint
|
@@ -49,17 +36,17 @@ describe Lolcommits::Plugin::Protonet do
|
|
49
36
|
describe "initalizing" do
|
50
37
|
it "assigns runner and all plugin options" do
|
51
38
|
plugin.runner.must_equal runner
|
52
|
-
plugin.options.must_equal
|
39
|
+
plugin.options.must_equal [:enabled, :api_endpoint, :api_token]
|
53
40
|
end
|
54
41
|
end
|
55
42
|
|
56
43
|
describe "#enabled?" do
|
57
44
|
it "is false by default" do
|
58
|
-
plugin.enabled
|
45
|
+
assert_nil plugin.enabled?
|
59
46
|
end
|
60
47
|
|
61
48
|
it "is true when configured" do
|
62
|
-
plugin.
|
49
|
+
plugin.configuration = valid_enabled_config
|
63
50
|
plugin.enabled?.must_equal true
|
64
51
|
end
|
65
52
|
end
|
@@ -70,7 +57,7 @@ describe Lolcommits::Plugin::Protonet do
|
|
70
57
|
|
71
58
|
it "posts lolcommit with message to protonet box" do
|
72
59
|
in_repo do
|
73
|
-
plugin.
|
60
|
+
plugin.configuration = valid_enabled_config
|
74
61
|
|
75
62
|
stub_request(:post, api_endpoint).to_return(status: 200)
|
76
63
|
|
@@ -87,7 +74,7 @@ describe Lolcommits::Plugin::Protonet do
|
|
87
74
|
|
88
75
|
it "returns nil if an error occurs" do
|
89
76
|
in_repo do
|
90
|
-
plugin.
|
77
|
+
plugin.configuration = valid_enabled_config
|
91
78
|
stub_request(:post, api_endpoint).to_return(status: 501)
|
92
79
|
|
93
80
|
assert_nil plugin.run_capture_ready
|
@@ -96,15 +83,6 @@ describe Lolcommits::Plugin::Protonet do
|
|
96
83
|
end
|
97
84
|
|
98
85
|
describe "configuration" do
|
99
|
-
it "returns false when not configured" do
|
100
|
-
plugin.configured?.must_equal false
|
101
|
-
end
|
102
|
-
|
103
|
-
it "returns true when configured" do
|
104
|
-
plugin.config = valid_enabled_config
|
105
|
-
plugin.configured?.must_equal true
|
106
|
-
end
|
107
|
-
|
108
86
|
it "allows plugin options to be configured" do
|
109
87
|
# enabled, api endpoint, api token
|
110
88
|
inputs = %W(true #{api_endpoint} proto-token)
|
@@ -116,9 +94,9 @@ describe Lolcommits::Plugin::Protonet do
|
|
116
94
|
end
|
117
95
|
|
118
96
|
configured_plugin_options.must_equal({
|
119
|
-
|
120
|
-
|
121
|
-
|
97
|
+
enabled: true,
|
98
|
+
api_endpoint: api_endpoint,
|
99
|
+
api_token: inputs[2]
|
122
100
|
})
|
123
101
|
end
|
124
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits-protonet
|
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:
|
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
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
170
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.7.3
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Posts lolcommits to a Protonet box
|