lolcommits-uploldz 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ae45eeab78fa99bdbc87098624e7c14c1de47c20
4
- data.tar.gz: f2ebff5d427fe370ea6b005ff35fdb5b65897570
2
+ SHA256:
3
+ metadata.gz: ce77eebc0710354cfe830be0a57a742709bb2cc8ce44e7a0c546f568144750b5
4
+ data.tar.gz: af4a350514b825c830a355e41a659206a55382c4532513be335fffe2e39bdd32
5
5
  SHA512:
6
- metadata.gz: b72af5118e0a9c8e3c66d6b89319ad11e5c9c33bf9a529fbf0cf4aa5a343b975b20adc43dfc95c86e161c7e37f279360c1fced40662d1f0ff5d668148600cbd4
7
- data.tar.gz: 69b948bf52f86b49cb4f0ff712a672ba210677ac3e3c02aa3fa6e127d76e31309ab18126c4b49035e28216b051348050731b9060c2ad548a923a6828e175d1d2
6
+ metadata.gz: ba6a26e52cc2bcbd1b84ccc6a0ff67d442b2d300e1dd421103f1229f13948c6634a0c346ff95d162dd870289b88aeed2e22f8cd40f81cae7f9eb8f1c0789a439
7
+ data.tar.gz: a652739ff472eed65a28704ffaaa019fdd91d48c2b8a0a11a3f45e6151da0e28bff8cd0d7737074a0704fac5e7680be8cd59b0c4493ccffc7f6e7b7019ca49d6
@@ -2,18 +2,19 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.0.0
6
- - 2.1.10
7
- - 2.2.8
8
- - 2.3.5
9
- - 2.4.2
10
- - ruby-head
5
+ - 2.0.0
6
+ - 2.1.10
7
+ - 2.2.9
8
+ - 2.3.6
9
+ - 2.4.3
10
+ - 2.5.0
11
+ - ruby-head
11
12
 
12
13
  before_install:
13
- - gem install bundler -v 1.13.7
14
- - git --version
15
- - git config --global user.email "lol@commits.org"
16
- - git config --global user.name "Lolcommits"
14
+ - gem update --system
15
+ - git --version
16
+ - git config --global user.email "lol@commits.org"
17
+ - git config --global user.name "Lolcommits"
17
18
 
18
19
  matrix:
19
20
  allow_failures:
@@ -16,15 +16,6 @@ module Lolcommits
16
16
  options.concat(plugin_options)
17
17
  end
18
18
 
19
- ##
20
- # Returns the name of the plugin to identify the plugin to lolcommits.
21
- #
22
- # @return [String] the plugin name
23
- #
24
- def self.name
25
- 'uploldz'
26
- end
27
-
28
19
  ##
29
20
  # Returns position(s) of when this plugin should run during the capture
30
21
  # process. Uploading happens when a new capture is ready.
@@ -35,15 +26,6 @@ module Lolcommits
35
26
  [:capture_ready]
36
27
  end
37
28
 
38
- ##
39
- # Returns true if the plugin has been configured.
40
- #
41
- # @return [Boolean] true/false indicating if plugin is configured
42
- #
43
- def configured?
44
- !!(!configuration['enabled'].nil? && configuration['endpoint'])
45
- end
46
-
47
29
  ##
48
30
  # Returns true/false indicating if the plugin has been correctly
49
31
  # configured. The `endpoint` option must be set with a URL beginning with
@@ -53,7 +35,7 @@ module Lolcommits
53
35
  # configured
54
36
  #
55
37
  def valid_configuration?
56
- !!(configuration['endpoint'] =~ /^http(s)?:\/\//)
38
+ !!(configuration[:endpoint] =~ /^http(s)?:\/\//)
57
39
  end
58
40
 
59
41
  ##
@@ -73,9 +55,9 @@ module Lolcommits
73
55
  # @return [Nil] if any error occurs
74
56
  #
75
57
  def run_capture_ready
76
- debug "Posting capture to #{configuration['endpoint']}"
58
+ debug "Posting capture to #{configuration[:endpoint]}"
77
59
  RestClient.post(
78
- configuration['endpoint'],
60
+ configuration[:endpoint],
79
61
  {
80
62
  file: File.new(runner.main_image),
81
63
  message: runner.message,
@@ -83,7 +65,7 @@ module Lolcommits
83
65
  author_name: runner.vcs_info.author_name,
84
66
  author_email: runner.vcs_info.author_email,
85
67
  sha: runner.sha,
86
- key: configuration['optional_key']
68
+ key: configuration[:optional_key]
87
69
  },
88
70
  Authorization: authorization_header
89
71
  )
@@ -100,12 +82,12 @@ module Lolcommits
100
82
  # @return [Array] the option names
101
83
  #
102
84
  def plugin_options
103
- %w(
104
- endpoint
105
- optional_key
106
- optional_http_auth_username
107
- optional_http_auth_password
108
- )
85
+ [
86
+ :endpoint,
87
+ :optional_key,
88
+ :optional_http_auth_username,
89
+ :optional_http_auth_password
90
+ ]
109
91
  end
110
92
 
111
93
  ##
@@ -116,8 +98,8 @@ module Lolcommits
116
98
  # @return [Nil] if no username or password option set
117
99
  #
118
100
  def authorization_header
119
- user = configuration['optional_http_auth_username']
120
- password = configuration['optional_http_auth_password']
101
+ user = configuration[:optional_http_auth_username]
102
+ password = configuration[:optional_http_auth_password]
121
103
  return unless user || password
122
104
 
123
105
  'Basic ' + Base64.encode64("#{user}:#{password}").chomp
@@ -1,5 +1,5 @@
1
1
  module Lolcommits
2
2
  module Uploldz
3
- VERSION = "0.0.2".freeze
3
+ VERSION = "0.0.3".freeze
4
4
  end
5
5
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_runtime_dependency "rest-client"
39
39
 
40
- spec.add_development_dependency "lolcommits", ">= 0.9.5"
40
+ spec.add_development_dependency "lolcommits", ">= 0.10.0"
41
41
  spec.add_development_dependency "bundler"
42
42
  spec.add_development_dependency "webmock"
43
43
  spec.add_development_dependency "pry"
@@ -6,14 +6,6 @@ describe Lolcommits::Plugin::Uploldz do
6
6
  include Lolcommits::TestHelpers::GitRepo
7
7
  include Lolcommits::TestHelpers::FakeIO
8
8
 
9
- def plugin_name
10
- "uploldz"
11
- end
12
-
13
- it "should have a name" do
14
- ::Lolcommits::Plugin::Uploldz.name.must_equal plugin_name
15
- end
16
-
17
9
  it "should run on capture ready" do
18
10
  ::Lolcommits::Plugin::Uploldz.runner_order.must_equal [:capture_ready]
19
11
  end
@@ -22,11 +14,7 @@ describe Lolcommits::Plugin::Uploldz do
22
14
  def runner
23
15
  # a simple lolcommits runner with an empty configuration Hash
24
16
  @runner ||= Lolcommits::Runner.new(
25
- main_image: Tempfile.new('main_image.jpg'),
26
- config: OpenStruct.new(
27
- read_configuration: {},
28
- loldir: File.expand_path("#{__dir__}../../../images")
29
- )
17
+ main_image: Tempfile.new('main_image.jpg')
30
18
  )
31
19
  end
32
20
 
@@ -35,38 +23,34 @@ describe Lolcommits::Plugin::Uploldz do
35
23
  end
36
24
 
37
25
  def valid_enabled_config
38
- @config ||= OpenStruct.new(
39
- read_configuration: {
40
- "uploldz" => {
41
- "enabled" => true,
42
- "endpoint" => "https://uploldz.com/uplol",
43
- 'optional_http_auth_username' => 'joe',
44
- 'optional_http_auth_password' => '1234'
45
- }
46
- }
47
- )
26
+ {
27
+ enabled: true,
28
+ endpoint: "https://uploldz.com/uplol",
29
+ optional_http_auth_username: 'joe',
30
+ optional_http_auth_password: '1234'
31
+ }
48
32
  end
49
33
 
50
34
  describe "initalizing" do
51
35
  it "assigns runner and all plugin options" do
52
36
  plugin.runner.must_equal runner
53
- plugin.options.must_equal %w(
54
- enabled
55
- endpoint
56
- optional_key
57
- optional_http_auth_username
58
- optional_http_auth_password
59
- )
37
+ plugin.options.must_equal [
38
+ :enabled,
39
+ :endpoint,
40
+ :optional_key,
41
+ :optional_http_auth_username,
42
+ :optional_http_auth_password
43
+ ]
60
44
  end
61
45
  end
62
46
 
63
47
  describe "#enabled?" do
64
48
  it "is false by default" do
65
- plugin.enabled?.must_equal false
49
+ assert_nil plugin.enabled?
66
50
  end
67
51
 
68
52
  it "is true when configured" do
69
- plugin.config = valid_enabled_config
53
+ plugin.configuration = valid_enabled_config
70
54
  plugin.enabled?.must_equal true
71
55
  end
72
56
  end
@@ -77,7 +61,7 @@ describe Lolcommits::Plugin::Uploldz do
77
61
 
78
62
  it "syncs lolcommits" do
79
63
  in_repo do
80
- plugin.config = valid_enabled_config
64
+ plugin.configuration = valid_enabled_config
81
65
 
82
66
  stub_request(:post, "https://uploldz.com/uplol").to_return(status: 200)
83
67
 
@@ -99,15 +83,6 @@ describe Lolcommits::Plugin::Uploldz do
99
83
  end
100
84
 
101
85
  describe "configuration" do
102
- it "returns false when not configured" do
103
- plugin.configured?.must_equal false
104
- end
105
-
106
- it "returns true when configured" do
107
- plugin.config = valid_enabled_config
108
- plugin.configured?.must_equal true
109
- end
110
-
111
86
  it "allows plugin options to be configured" do
112
87
  # enabled, endpoint, key, user, password
113
88
  inputs = %w(
@@ -124,24 +99,22 @@ describe Lolcommits::Plugin::Uploldz do
124
99
  end
125
100
 
126
101
  configured_plugin_options.must_equal({
127
- "enabled" => true,
128
- "endpoint" => "https://my-server.com/uplol",
129
- "optional_key" => "key-123",
130
- "optional_http_auth_username" => "joe",
131
- "optional_http_auth_password" => "1337pass"
102
+ enabled: true,
103
+ endpoint: "https://my-server.com/uplol",
104
+ optional_key: "key-123",
105
+ optional_http_auth_username: "joe",
106
+ optional_http_auth_password: "1337pass"
132
107
  })
133
108
  end
134
109
 
135
110
  describe "#valid_configuration?" do
136
111
  it "returns false for an invalid configuration" do
137
- plugin.config = OpenStruct.new(read_configuration: {
138
- "lolsrv" => { "endpoint" => "gibberish" }
139
- })
112
+ plugin.configuration = { endpoint: "gibberish" }
140
113
  plugin.valid_configuration?.must_equal false
141
114
  end
142
115
 
143
116
  it "returns true with a valid configuration" do
144
- plugin.config = valid_enabled_config
117
+ plugin.configuration = valid_enabled_config
145
118
  plugin.valid_configuration?.must_equal true
146
119
  end
147
120
  end
@@ -1,10 +1,7 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
 
3
- # necessary libs from lolcommits (allowing plugin to run)
4
- require 'git'
5
- require 'lolcommits/runner'
6
- require 'lolcommits/vcs_info'
7
- require 'lolcommits/backends/git_info'
3
+ # lolcommits gem
4
+ require 'lolcommits'
8
5
 
9
6
  # lolcommit test helpers
10
7
  require 'lolcommits/test_helpers/git_repo'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolcommits-uploldz
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: 2018-01-22 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.9.5
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.9.5
40
+ version: 0.10.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  version: '0'
170
170
  requirements: []
171
171
  rubyforge_project:
172
- rubygems_version: 2.6.13
172
+ rubygems_version: 2.7.3
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Uploads lolcommits to a remote server