lolcommits-dotcom 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: c26d62730fa7ca1e96b79c5366637f0a9f7fbdf3
4
- data.tar.gz: ec06eb2d245009ec5049918d7bf82a912d78c969
2
+ SHA256:
3
+ metadata.gz: 6673616dd32c9642387841696bd8b826b45bbf2751c9f06a9ce979955a0315a8
4
+ data.tar.gz: 3e0fa1a3023631bf50b2f7eafea55a7525e98800c96d22d804f5e5780358fcc6
5
5
  SHA512:
6
- metadata.gz: f1f18f121c4d2811d5814e200b2d69beb44ddd575ea7d7056a650ead253a0ce2576ac7da64d7cb442d2ba7ef6526a9a35097bbba2ce08e494d576d6825d9cdac
7
- data.tar.gz: 0fc7245554214d9ae74e69e35b6e3f5cb4988e49448ce6df71a3420435591f1d0e615ebac5158c42c96624817938007adce31e494f71d20eb7303b7faf5ced7c
6
+ metadata.gz: a2dd6c722ec9ff0de484f3558fd605d2eb23ec8fb0abca12a1b6d3a2431b1112eb44e132a9647d7747f675c413d0cb37a0f3778491b2f811d7081d668068b34f
7
+ data.tar.gz: 5b34e9d8d9a2e61c5cfce1e1b18f06d5e4b34e9bd8c6c1276628efe8eab298c02fd202849a5a5d4598f713ae5f665bd0029732d8922ec56538dcf34957ce043c
data/.travis.yml CHANGED
@@ -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:
@@ -1,5 +1,5 @@
1
1
  module Lolcommits
2
2
  module Dotcom
3
- VERSION = "0.0.2".freeze
3
+ VERSION = "0.0.3".freeze
4
4
  end
5
5
  end
@@ -15,15 +15,6 @@ module Lolcommits
15
15
  options.concat(plugin_options)
16
16
  end
17
17
 
18
- ##
19
- # Returns the name of the plugin to identify the plugin to lolcommits.
20
- #
21
- # @return [String] the plugin name
22
- #
23
- def self.name
24
- 'dotcom'
25
- end
26
-
27
18
  ##
28
19
  # Returns position(s) of when this plugin should run during the capture
29
20
  # process. Uploading happens when a new capture is ready.
@@ -34,16 +25,6 @@ module Lolcommits
34
25
  [:capture_ready]
35
26
  end
36
27
 
37
- ##
38
- # Returns true if the plugin has been configured.
39
- #
40
- # @return [Boolean] true/false indicating if plugin is configured
41
- #
42
- def configured?
43
- !configuration.values.empty? &&
44
- configuration.values.all? { |value| !value.nil? }
45
- end
46
-
47
28
  ##
48
29
  # Returns true/false indicating if the plugin has been correctly
49
30
  # configured. All options must be set with 32 character alphanumeric keys.
@@ -84,13 +65,13 @@ module Lolcommits
84
65
  {
85
66
  git_commit: {
86
67
  sha: runner.sha,
87
- repo_external_id: configuration['repo_id'],
68
+ repo_external_id: configuration[:repo_id],
88
69
  image: File.open(runner.main_image),
89
70
  raw: File.open(runner.snapshot_loc)
90
71
  },
91
- key: configuration['api_key'],
72
+ key: configuration[:api_key],
92
73
  t: t,
93
- token: Digest::SHA1.hexdigest(configuration['api_secret'] + t)
74
+ token: Digest::SHA1.hexdigest(configuration[:api_secret] + t)
94
75
  }
95
76
  )
96
77
  rescue => e
@@ -107,7 +88,7 @@ module Lolcommits
107
88
  # @return [Array] the option names
108
89
  #
109
90
  def plugin_options
110
- %w(api_key api_secret repo_id)
91
+ [:api_key, :api_secret, :repo_id]
111
92
  end
112
93
  end
113
94
  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::Dotcom do
6
6
  include Lolcommits::TestHelpers::GitRepo
7
7
  include Lolcommits::TestHelpers::FakeIO
8
8
 
9
- def plugin_name
10
- "dotcom"
11
- end
12
-
13
- it "should have a name" do
14
- ::Lolcommits::Plugin::Dotcom.name.must_equal plugin_name
15
- end
16
-
17
9
  it "should run on capture ready" do
18
10
  ::Lolcommits::Plugin::Dotcom.runner_order.must_equal [:capture_ready]
19
11
  end
@@ -24,10 +16,6 @@ describe Lolcommits::Plugin::Dotcom do
24
16
  @runner ||= Lolcommits::Runner.new(
25
17
  main_image: Tempfile.new('main_image.jpg'),
26
18
  snapshot_loc: Tempfile.new('snapshot_loc.jpg'),
27
- config: OpenStruct.new(
28
- read_configuration: {},
29
- loldir: File.expand_path("#{__dir__}../../../images")
30
- )
31
19
  )
32
20
  end
33
21
 
@@ -36,37 +24,28 @@ describe Lolcommits::Plugin::Dotcom do
36
24
  end
37
25
 
38
26
  def valid_enabled_config
39
- @config ||= OpenStruct.new(
40
- read_configuration: {
41
- "dotcom" => {
42
- "enabled" => true,
43
- "api_key" => 'aaa8e2404ef6013556db5a9828apikey',
44
- 'api_secret' => 'aaa8e2404ef6013556db5a9apisecret',
45
- "repo_id" => "aaa8e2404ef6013556db5a9828repoid"
46
- }
47
- }
48
- )
27
+ {
28
+ enabled: true,
29
+ api_key: 'aaa8e2404ef6013556db5a9828apikey',
30
+ api_secret: 'aaa8e2404ef6013556db5a9apisecret',
31
+ repo_id: "aaa8e2404ef6013556db5a9828repoid"
32
+ }
49
33
  end
50
34
 
51
35
  describe "initalizing" do
52
36
  it "assigns runner and all plugin options" do
53
37
  plugin.runner.must_equal runner
54
- plugin.options.must_equal %w(
55
- enabled
56
- api_key
57
- api_secret
58
- repo_id
59
- )
38
+ plugin.options.must_equal [:enabled, :api_key, :api_secret, :repo_id]
60
39
  end
61
40
  end
62
41
 
63
42
  describe "#enabled?" do
64
43
  it "is false by default" do
65
- plugin.enabled?.must_equal false
44
+ assert_nil plugin.enabled?
66
45
  end
67
46
 
68
47
  it "is true when configured" do
69
- plugin.config = valid_enabled_config
48
+ plugin.configuration = valid_enabled_config
70
49
  plugin.enabled?.must_equal true
71
50
  end
72
51
  end
@@ -77,7 +56,7 @@ describe Lolcommits::Plugin::Dotcom do
77
56
 
78
57
  it "uploads lolcommits to dot com server endpoint" do
79
58
  in_repo do
80
- plugin.config = valid_enabled_config
59
+ plugin.configuration = valid_enabled_config
81
60
  stub_request(:post, /^http\:\/\/lolcommits-dot-com.herokuapp.com/).to_return(status: 200)
82
61
 
83
62
  plugin.run_capture_ready
@@ -101,15 +80,6 @@ describe Lolcommits::Plugin::Dotcom do
101
80
  end
102
81
 
103
82
  describe "configuration" do
104
- it "returns false when not configured" do
105
- plugin.configured?.must_equal false
106
- end
107
-
108
- it "returns true when configured" do
109
- plugin.config = valid_enabled_config
110
- plugin.configured?.must_equal true
111
- end
112
-
113
83
  it "allows plugin options to be configured" do
114
84
  # enabled, api_key, api_secret repo_id
115
85
  inputs = %w(
@@ -125,23 +95,21 @@ describe Lolcommits::Plugin::Dotcom do
125
95
  end
126
96
 
127
97
  configured_plugin_options.must_equal({
128
- "enabled" => true,
129
- "api_key" => "aaa8e2404ef6013556db5a9828apikey",
130
- "api_secret" => "aaa8e2404ef6013556db5a9apisecret",
131
- "repo_id" => "aaa8e2404ef6013556db5a9828repoid"
98
+ enabled: true,
99
+ api_key: "aaa8e2404ef6013556db5a9828apikey",
100
+ api_secret: "aaa8e2404ef6013556db5a9apisecret",
101
+ repo_id: "aaa8e2404ef6013556db5a9828repoid"
132
102
  })
133
103
  end
134
104
 
135
105
  describe "#valid_configuration?" do
136
106
  it "returns false for an invalid configuration" do
137
- plugin.config = OpenStruct.new(read_configuration: {
138
- "dotcom" => { "repo_id" => "gibberish" }
139
- })
107
+ plugin.configuration = { repo_id: "gibberish" }
140
108
  plugin.valid_configuration?.must_equal false
141
109
  end
142
110
 
143
111
  it "returns true with a valid configuration" do
144
- plugin.config = valid_enabled_config
112
+ plugin.configuration = valid_enabled_config
145
113
  plugin.valid_configuration?.must_equal true
146
114
  end
147
115
  end
data/test/test_helper.rb CHANGED
@@ -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-dotcom
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