lolcommits-yammer 0.0.4 → 0.0.5

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: c9ea8f74e12842296bf334f8a99ee029b043e439
4
- data.tar.gz: f384e0024ed3b5ddd79fecd2453250b868b37717
2
+ SHA256:
3
+ metadata.gz: 266f3f5b30c81456ccda01ed9d3c68d50f493d687ca468e780b4b34c4fc641cb
4
+ data.tar.gz: 7a27ba82818b97f7162943795f850fb8f61088d98099fb073da10db45ed7eabf
5
5
  SHA512:
6
- metadata.gz: a06deed14f85544ecd2a546186e3052a56807493e49c3f4bc17c2f8dfda94a689dd9860e867d7867dccd05eee2ef4355a1a76de2188cfb1329484bc3d0cdec9e
7
- data.tar.gz: c7492621ce2a83620a561aa95bc879ea808c9d51574e662cb424819ec96bfb822e2cc87e2bb6bf68c0031edab7f68f0cc279c8c36fa0c55977205422764c258e
6
+ metadata.gz: d35905e72761615ab8351182a2a3c2578f710f5dc8a646f12511db85c8c4d24784c1a48f8cb16ed14f041241562bcd901c42a11e686029553a7040939c384d73
7
+ data.tar.gz: be7f0bbdb92719617cc4b9454a6af412bb5fbee7e82adba4f6c7277787d954ad3b2ae609f68faaf5adcbcf05678aac93f8b36e29524d2f0d69954471521b6cfc
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:
@@ -15,15 +15,6 @@ module Lolcommits
15
15
  OAUTH_REDIRECT_PORT = 5429
16
16
  OAUTH_REDIRECT_URL = "http://localhost:#{OAUTH_REDIRECT_PORT}".freeze
17
17
 
18
- ##
19
- # Returns the name of the plugin.
20
- #
21
- # @return [String] the plugin name
22
- #
23
- def self.name
24
- 'yammer'
25
- end
26
-
27
18
  ##
28
19
  # Returns position(s) of when this plugin should run during the capture
29
20
  # process. Posting to Yammer happens when a new capture is ready.
@@ -35,13 +26,13 @@ module Lolcommits
35
26
  end
36
27
 
37
28
  ##
38
- # Returns true if the plugin has been configured.
39
- #
40
- # @return [Boolean] true/false indicating if plugin has been configured.
29
+ # Returns true if the plugin has been configured correctly.
41
30
  # The access_token must be set.
42
31
  #
43
- def configured?
44
- !configuration['access_token'].nil?
32
+ # @return [Boolean] true/false
33
+ #
34
+ def valid_configuration?
35
+ !configuration[:access_token].nil?
45
36
  end
46
37
 
47
38
  ##
@@ -56,13 +47,13 @@ module Lolcommits
56
47
  #
57
48
  def configure_options!
58
49
  options = super
59
- if options['enabled']
50
+ if options[:enabled]
60
51
  oauth_access_token = fetch_access_token
61
52
  if oauth_access_token
62
- options.merge!('access_token' => oauth_access_token)
53
+ options.merge!(access_token: oauth_access_token)
63
54
  else
64
55
  puts "Aborting.. Plugin disabled since Yammer Oauth was denied"
65
- options['enabled'] = false
56
+ options[:enabled] = false
66
57
  end
67
58
  end
68
59
  options
@@ -80,7 +71,7 @@ module Lolcommits
80
71
  response = RestClient.post(
81
72
  "https://www.yammer.com/api/v1/messages",
82
73
  { body: yammer_message, attachment1: File.new(runner.main_image) },
83
- { 'Authorization' => "Bearer #{configuration["access_token"]}" }
74
+ { 'Authorization' => "Bearer #{configuration[:access_token]}" }
84
75
  )
85
76
 
86
77
  if response.code != 201
@@ -1,5 +1,5 @@
1
1
  module Lolcommits
2
2
  module Yammer
3
- VERSION = "0.0.4".freeze
3
+ VERSION = "0.0.5".freeze
4
4
  end
5
5
  end
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_runtime_dependency "rest-client"
39
39
  spec.add_runtime_dependency "webrick"
40
40
 
41
- spec.add_development_dependency "lolcommits", ">= 0.9.5"
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::Yammer do
6
6
  include Lolcommits::TestHelpers::GitRepo
7
7
  include Lolcommits::TestHelpers::FakeIO
8
8
 
9
- def plugin_name
10
- "yammer"
11
- end
12
-
13
- it "should have a name" do
14
- ::Lolcommits::Plugin::Yammer.name.must_equal plugin_name
15
- end
16
-
17
9
  it "should run on capture ready" do
18
10
  ::Lolcommits::Plugin::Yammer.runner_order.must_equal [:capture_ready]
19
11
  end
@@ -22,11 +14,7 @@ describe Lolcommits::Plugin::Yammer 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,30 +23,26 @@ describe Lolcommits::Plugin::Yammer do
35
23
  end
36
24
 
37
25
  def valid_enabled_config
38
- @config ||= OpenStruct.new(
39
- read_configuration: {
40
- "yammer" => {
41
- "enabled" => true,
42
- "access_token" => "oV4MuwnNKql3ebJMAYZRaD"
43
- }
44
- }
45
- )
26
+ {
27
+ enabled: true,
28
+ access_token: "oV4MuwnNKql3ebJMAYZRaD"
29
+ }
46
30
  end
47
31
 
48
32
  describe "#enabled?" do
49
33
  it "is false by default" do
50
- plugin.enabled?.must_equal false
34
+ assert_nil plugin.enabled?
51
35
  end
52
36
 
53
37
  it "is true when configured" do
54
- plugin.config = valid_enabled_config
38
+ plugin.configuration = valid_enabled_config
55
39
  plugin.enabled?.must_equal true
56
40
  end
57
41
  end
58
42
 
59
43
  describe "run_capture_ready" do
60
44
  before do
61
- plugin.config = valid_enabled_config
45
+ plugin.configuration = valid_enabled_config
62
46
  commit_repo_with_message("first commit!")
63
47
  end
64
48
 
@@ -96,13 +80,16 @@ describe Lolcommits::Plugin::Yammer do
96
80
  end
97
81
 
98
82
  describe "configuration" do
99
- it "returns false when not configured" do
100
- plugin.configured?.must_equal false
101
- end
102
83
 
103
- it "returns true when configured" do
104
- plugin.config = valid_enabled_config
105
- plugin.configured?.must_equal true
84
+ describe "#valid_configuration?" do
85
+ it "returns false when not configured correctly" do
86
+ plugin.valid_configuration?.must_equal false
87
+ end
88
+
89
+ it "returns true when configured" do
90
+ plugin.configuration = valid_enabled_config
91
+ plugin.valid_configuration?.must_equal true
92
+ end
106
93
  end
107
94
 
108
95
  describe "configuring with Yammer Oauth" do
@@ -127,7 +114,7 @@ describe Lolcommits::Plugin::Yammer do
127
114
  "Aborting.. Plugin disabled since Yammer Oauth was denied"
128
115
  )
129
116
 
130
- configured_plugin_options.must_equal({ "enabled" => false })
117
+ configured_plugin_options.must_equal({ enabled: false })
131
118
  end
132
119
 
133
120
  it "configures successfully with a Yammer Oauth access token" do
@@ -158,8 +145,8 @@ describe Lolcommits::Plugin::Yammer do
158
145
  end
159
146
 
160
147
  configured_plugin_options.must_equal({
161
- "enabled" => true,
162
- "access_token" => "yam-oauth-token"
148
+ enabled: true,
149
+ access_token: "yam-oauth-token"
163
150
  })
164
151
  end
165
152
  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-yammer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.9.5
47
+ version: 0.10.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.9.5
54
+ version: 0.10.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.6.13
186
+ rubygems_version: 2.7.3
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Uploads lolcommits to Yammer