lolcommits 0.9.7 → 0.9.8.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop_todo.yml +3 -0
- data/.travis.yml +4 -5
- data/CHANGELOG.md +17 -2
- data/lib/lolcommits.rb +1 -8
- data/lib/lolcommits/gem_plugin.rb +1 -1
- data/lib/lolcommits/plugin/lol_yammer.rb +0 -84
- data/lib/lolcommits/version.rb +1 -1
- data/lolcommits.gemspec +10 -16
- metadata +26 -59
- data/lib/lolcommits/plugin/lol_flowdock.rb +0 -69
- data/lib/lolcommits/plugin/lol_hipchat.rb +0 -124
- data/lib/lolcommits/plugin/lol_protonet.rb +0 -68
- data/lib/lolcommits/plugin/lol_tumblr.rb +0 -129
- data/lib/lolcommits/plugin/term_output.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d31898a2726f26689886084c4b0e8f49a33b2d84d11335691249060aba41c678
|
4
|
+
data.tar.gz: 4aa011c7b5f18e4101dd593f813a8effda883ec4edec90e71c0bd0ea0f645fdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae5f92f2b3b8be24f26b8167cba433588ce130dcc26ebc3a564b11d6f89750a1380a5ed97cff22e5fd7dca12ebb76c0fd6b6a6bef536bec9b2c07f68f89e901
|
7
|
+
data.tar.gz: 4ff58c8a955f74feb364800f1ddb44050c32efbc805e4416145f32a30e90d6a2b78d1cb99501f69930894ac72b6957b0b065dbe6843b5b9f71189dfc1e406c62
|
data/.rubocop_todo.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,9 +5,17 @@ project adheres to [Semantic Versioning][Semver].
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
-
* WIP - extract more plugins to gems ...
|
9
8
|
* Your contribution here!
|
10
9
|
|
10
|
+
## [0.9.8][] (3 December 2017)
|
11
|
+
* Extract protonet to gem (@matthutchinson [#361][])
|
12
|
+
* Extract flowdock to gem (@matthutchinson [#360][])
|
13
|
+
* Extract yammer to gem (@matthutchinson [#359][])
|
14
|
+
* Extract hipchat to gem (@matthutchinson [#358][])
|
15
|
+
* Extract tumblr to gem (@matthutchinson [#357][])
|
16
|
+
* Extract term_output to gem (@matthutchinson [#356][])
|
17
|
+
* Add Ruby 2.4.2 to Travis config (@matthutchinson)
|
18
|
+
|
11
19
|
## [0.9.7][] (17 September 2017)
|
12
20
|
* Extract dotcom to gem (@matthutchinson [#355][])
|
13
21
|
* Extract uploldz to gem (@matthutchinson [#354][])
|
@@ -294,7 +302,8 @@ project adheres to [Semantic Versioning][Semver].
|
|
294
302
|
instead of compositing multiply image Caption objects (this seems to be more
|
295
303
|
reliable to not glitch.)
|
296
304
|
|
297
|
-
[Unreleased]: https://github.com/mroth/lolcommits/compare/v0.9.
|
305
|
+
[Unreleased]: https://github.com/mroth/lolcommits/compare/v0.9.8...HEAD
|
306
|
+
[0.9.8]: https://github.com/mroth/lolcommits/compare/v0.9.7...v0.9.8
|
298
307
|
[0.9.7]: https://github.com/mroth/lolcommits/compare/v0.9.6...v0.9.7
|
299
308
|
[0.9.6]: https://github.com/mroth/lolcommits/compare/v0.9.5...v0.9.6
|
300
309
|
[0.9.5]: https://github.com/mroth/lolcommits/compare/v0.9.4...v0.9.5
|
@@ -469,3 +478,9 @@ project adheres to [Semantic Versioning][Semver].
|
|
469
478
|
[#353]: https://github.com/mroth/lolcommits/pull/353
|
470
479
|
[#354]: https://github.com/mroth/lolcommits/pull/354
|
471
480
|
[#355]: https://github.com/mroth/lolcommits/pull/355
|
481
|
+
[#356]: https://github.com/mroth/lolcommits/pull/356
|
482
|
+
[#357]: https://github.com/mroth/lolcommits/pull/357
|
483
|
+
[#358]: https://github.com/mroth/lolcommits/pull/358
|
484
|
+
[#359]: https://github.com/mroth/lolcommits/pull/359
|
485
|
+
[#360]: https://github.com/mroth/lolcommits/pull/360
|
486
|
+
[#361]: https://github.com/mroth/lolcommits/pull/361
|
data/lib/lolcommits.rb
CHANGED
@@ -18,6 +18,7 @@ require 'lolcommits/installation'
|
|
18
18
|
require 'lolcommits/platform'
|
19
19
|
require 'lolcommits/gem_plugin'
|
20
20
|
require 'lolcommits/plugin_manager'
|
21
|
+
require 'lolcommits/plugin/base'
|
21
22
|
|
22
23
|
# after lolcommits/platform, so that we can do platform-conditional override
|
23
24
|
require 'core_ext/mercurial-ruby/command'
|
@@ -28,13 +29,5 @@ require 'lolcommits/backends/installation_mercurial'
|
|
28
29
|
require 'lolcommits/backends/git_info'
|
29
30
|
require 'lolcommits/backends/mercurial_info'
|
30
31
|
|
31
|
-
require 'lolcommits/plugin/base'
|
32
|
-
require 'lolcommits/plugin/term_output'
|
33
|
-
require 'lolcommits/plugin/lol_yammer'
|
34
|
-
require 'lolcommits/plugin/lol_protonet'
|
35
|
-
require 'lolcommits/plugin/lol_tumblr'
|
36
|
-
require 'lolcommits/plugin/lol_flowdock'
|
37
|
-
require 'lolcommits/plugin/lol_hipchat'
|
38
|
-
|
39
32
|
# require runner after all the plugins have been required
|
40
33
|
require 'lolcommits/runner'
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'yammer'
|
2
|
-
require 'rest_client'
|
3
|
-
|
4
|
-
# https://developer.yammer.com/oauth2-quickstart/
|
5
|
-
YAMMER_CLIENT_ID = 'bgORyeKtnjZJSMwp8oln9g'.freeze
|
6
|
-
YAMMER_CLIENT_SECRET = 'oer2WdGzh74a5QBbW3INUxblHK3yg9KvCZmiBa2r0'.freeze
|
7
|
-
YAMMER_ACCESS_TOKEN_URL = 'https://www.yammer.com/oauth2/access_token.json'.freeze
|
8
|
-
YAMMER_RETRY_COUNT = 2
|
9
|
-
|
10
|
-
module Lolcommits
|
11
|
-
module Plugin
|
12
|
-
class LolYammer < Base
|
13
|
-
def self.name
|
14
|
-
'yammer'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.runner_order
|
18
|
-
:capture_ready
|
19
|
-
end
|
20
|
-
|
21
|
-
def configured?
|
22
|
-
!configuration['access_token'].nil?
|
23
|
-
end
|
24
|
-
|
25
|
-
def configure_access_token
|
26
|
-
print "Open the URL below and copy the `code` param from query after redirected, enter it as `access_token`:\n"
|
27
|
-
print "https://www.yammer.com/dialog/oauth?client_id=#{YAMMER_CLIENT_ID}&response_type=code\n"
|
28
|
-
print 'Enter code param from the redirected URL, then press enter: '
|
29
|
-
code = gets.to_s.strip
|
30
|
-
|
31
|
-
url = YAMMER_ACCESS_TOKEN_URL
|
32
|
-
debug "access_token url: #{url}"
|
33
|
-
params = {
|
34
|
-
'client_id' => YAMMER_CLIENT_ID,
|
35
|
-
'client_secret' => YAMMER_CLIENT_SECRET,
|
36
|
-
'code' => code
|
37
|
-
}
|
38
|
-
debug "params : #{params.inspect}"
|
39
|
-
result = JSON.parse(RestClient.post(url, params))
|
40
|
-
debug "response : #{result.inspect}"
|
41
|
-
# no need for 'return', last line is always the return value
|
42
|
-
{ 'access_token' => result['access_token']['token'] }
|
43
|
-
end
|
44
|
-
|
45
|
-
def configure_options!
|
46
|
-
options = super
|
47
|
-
# ask user to configure tokens if enabling
|
48
|
-
if options['enabled']
|
49
|
-
auth_config = configure_access_token
|
50
|
-
return unless auth_config
|
51
|
-
options.merge!(auth_config)
|
52
|
-
end
|
53
|
-
options
|
54
|
-
end
|
55
|
-
|
56
|
-
def run_capture_ready
|
57
|
-
commit_msg = runner.message
|
58
|
-
post = "#{commit_msg} #lolcommits"
|
59
|
-
puts "Yammer post: #{post}" unless runner.capture_stealth
|
60
|
-
|
61
|
-
Yammer.configure do |c|
|
62
|
-
c.client_id = YAMMER_CLIENT_ID
|
63
|
-
c.client_secret = YAMMER_CLIENT_SECRET
|
64
|
-
end
|
65
|
-
|
66
|
-
client = Yammer::Client.new(access_token: configuration['access_token'])
|
67
|
-
|
68
|
-
retries = YAMMER_RETRY_COUNT
|
69
|
-
begin
|
70
|
-
lolimage = File.new(runner.main_image)
|
71
|
-
response = client.create_message(post, attachment1: lolimage)
|
72
|
-
debug response.body.inspect
|
73
|
-
puts "\t--> Status posted!" if response
|
74
|
-
rescue StandardError => e
|
75
|
-
retries -= 1
|
76
|
-
retry if retries > 0
|
77
|
-
puts "Status not posted - #{e.message}"
|
78
|
-
puts 'Try running config again:'
|
79
|
-
puts "\tlolcommits --config --plugin yammer"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
data/lib/lolcommits/version.rb
CHANGED
data/lolcommits.gemspec
CHANGED
@@ -21,17 +21,17 @@ DESC
|
|
21
21
|
s.post_install_message = <<-POSTINSTALL
|
22
22
|
-------------------------------------------------------------------------------
|
23
23
|
|
24
|
-
Lolcommits: quick message from the dev team!
|
25
|
-
|
26
|
-
the
|
24
|
+
Lolcommits: A quick message from the dev team! All plugins have now been
|
25
|
+
extracted to external gems. To continue using a (previously built-in) plugin,
|
26
|
+
first install the gem then configure to enable it e.g.
|
27
27
|
|
28
28
|
gem install lolcommits-twitter
|
29
|
-
lolcommits --config
|
30
|
-
# confirm PIN, options and there's one new setting to auto-open the tweet URL
|
29
|
+
lolcommits --config
|
31
30
|
|
32
|
-
|
31
|
+
See https://github.com/mroth/lolcommits/wiki/Configuring-Plugins for details.
|
33
32
|
|
34
|
-
|
33
|
+
Future plugin developers should check out this repo to get started:
|
34
|
+
https://github.com/lolcommits/lolcommits-plugin-sample
|
35
35
|
|
36
36
|
Happy Lol'ing!
|
37
37
|
|
@@ -51,6 +51,7 @@ POSTINSTALL
|
|
51
51
|
# hold back upgrading (and why)
|
52
52
|
s.add_development_dependency('aruba', '=0.6.2') # upgrading requires a lot of test code changes
|
53
53
|
s.add_development_dependency('rake', '=10.5.0') # ~> 11+ introduces lots of warnings from other deps
|
54
|
+
s.add_development_dependency('cucumber', '~> 2.4.0') # > 2.4 breaks aruba, since aruba_timeout_seconds not set
|
54
55
|
s.add_runtime_dependency('net-http-persistent', '=2.9.4') # ~> 3+ requires Ruby 2.1
|
55
56
|
s.add_runtime_dependency('public_suffix', '~>2.0.0') # ~> 3+ requires Ruby 2.1
|
56
57
|
|
@@ -62,22 +63,15 @@ POSTINSTALL
|
|
62
63
|
s.add_runtime_dependency('open4', '~> 1.3.4')
|
63
64
|
s.add_runtime_dependency('git', '~> 1.3.0')
|
64
65
|
|
65
|
-
#
|
66
|
+
# included plugins
|
66
67
|
s.add_runtime_dependency('lolcommits-loltext', '~> 0.0.4')
|
67
68
|
|
68
|
-
#
|
69
|
-
s.add_runtime_dependency('yam', '~> 2.5.0') # yammer
|
70
|
-
s.add_runtime_dependency('tumblr_client', '~> 0.8.5') # tumblr
|
71
|
-
|
72
|
-
# development gems
|
69
|
+
# development & test gems
|
73
70
|
s.add_development_dependency('rdoc')
|
74
71
|
s.add_development_dependency('pry')
|
75
|
-
|
76
|
-
# testing gems (latest versions)
|
77
72
|
s.add_development_dependency('rubocop')
|
78
73
|
s.add_development_dependency('travis')
|
79
74
|
s.add_development_dependency('minitest')
|
80
75
|
s.add_development_dependency('coveralls')
|
81
76
|
s.add_development_dependency('ffaker')
|
82
|
-
s.add_development_dependency('cucumber')
|
83
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Rothenberg
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aruba
|
@@ -39,6 +39,20 @@ dependencies:
|
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 10.5.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: cucumber
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 2.4.0
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 2.4.0
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: net-http-persistent
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,34 +179,6 @@ dependencies:
|
|
165
179
|
- - "~>"
|
166
180
|
- !ruby/object:Gem::Version
|
167
181
|
version: 0.0.4
|
168
|
-
- !ruby/object:Gem::Dependency
|
169
|
-
name: yam
|
170
|
-
requirement: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - "~>"
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: 2.5.0
|
175
|
-
type: :runtime
|
176
|
-
prerelease: false
|
177
|
-
version_requirements: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - "~>"
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: 2.5.0
|
182
|
-
- !ruby/object:Gem::Dependency
|
183
|
-
name: tumblr_client
|
184
|
-
requirement: !ruby/object:Gem::Requirement
|
185
|
-
requirements:
|
186
|
-
- - "~>"
|
187
|
-
- !ruby/object:Gem::Version
|
188
|
-
version: 0.8.5
|
189
|
-
type: :runtime
|
190
|
-
prerelease: false
|
191
|
-
version_requirements: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - "~>"
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: 0.8.5
|
196
182
|
- !ruby/object:Gem::Dependency
|
197
183
|
name: rdoc
|
198
184
|
requirement: !ruby/object:Gem::Requirement
|
@@ -291,20 +277,6 @@ dependencies:
|
|
291
277
|
- - ">="
|
292
278
|
- !ruby/object:Gem::Version
|
293
279
|
version: '0'
|
294
|
-
- !ruby/object:Gem::Dependency
|
295
|
-
name: cucumber
|
296
|
-
requirement: !ruby/object:Gem::Requirement
|
297
|
-
requirements:
|
298
|
-
- - ">="
|
299
|
-
- !ruby/object:Gem::Version
|
300
|
-
version: '0'
|
301
|
-
type: :development
|
302
|
-
prerelease: false
|
303
|
-
version_requirements: !ruby/object:Gem::Requirement
|
304
|
-
requirements:
|
305
|
-
- - ">="
|
306
|
-
- !ruby/object:Gem::Version
|
307
|
-
version: '0'
|
308
280
|
description: |2
|
309
281
|
lolcommits takes a snapshot with your webcam every time you git commit code,
|
310
282
|
and archives a lolcat style image with it. It's selfies for software
|
@@ -368,12 +340,7 @@ files:
|
|
368
340
|
- lib/lolcommits/installation.rb
|
369
341
|
- lib/lolcommits/platform.rb
|
370
342
|
- lib/lolcommits/plugin/base.rb
|
371
|
-
- lib/lolcommits/plugin/lol_flowdock.rb
|
372
|
-
- lib/lolcommits/plugin/lol_hipchat.rb
|
373
|
-
- lib/lolcommits/plugin/lol_protonet.rb
|
374
|
-
- lib/lolcommits/plugin/lol_tumblr.rb
|
375
343
|
- lib/lolcommits/plugin/lol_yammer.rb
|
376
|
-
- lib/lolcommits/plugin/term_output.rb
|
377
344
|
- lib/lolcommits/plugin_manager.rb
|
378
345
|
- lib/lolcommits/runner.rb
|
379
346
|
- lib/lolcommits/test_helpers/fake_io.rb
|
@@ -396,17 +363,17 @@ metadata: {}
|
|
396
363
|
post_install_message: |2
|
397
364
|
-------------------------------------------------------------------------------
|
398
365
|
|
399
|
-
Lolcommits: quick message from the dev team!
|
400
|
-
|
401
|
-
the
|
366
|
+
Lolcommits: A quick message from the dev team! All plugins have now been
|
367
|
+
extracted to external gems. To continue using a (previously built-in) plugin,
|
368
|
+
first install the gem then configure to enable it e.g.
|
402
369
|
|
403
370
|
gem install lolcommits-twitter
|
404
|
-
lolcommits --config
|
405
|
-
# confirm PIN, options and there's one new setting to auto-open the tweet URL
|
371
|
+
lolcommits --config
|
406
372
|
|
407
|
-
|
373
|
+
See https://github.com/mroth/lolcommits/wiki/Configuring-Plugins for details.
|
408
374
|
|
409
|
-
|
375
|
+
Future plugin developers should check out this repo to get started:
|
376
|
+
https://github.com/lolcommits/lolcommits-plugin-sample
|
410
377
|
|
411
378
|
Happy Lol'ing!
|
412
379
|
|
@@ -421,14 +388,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
421
388
|
version: '2.0'
|
422
389
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
423
390
|
requirements:
|
424
|
-
- - "
|
391
|
+
- - ">"
|
425
392
|
- !ruby/object:Gem::Version
|
426
|
-
version:
|
393
|
+
version: 1.3.1
|
427
394
|
requirements:
|
428
395
|
- imagemagick
|
429
396
|
- a webcam
|
430
397
|
rubyforge_project:
|
431
|
-
rubygems_version: 2.
|
398
|
+
rubygems_version: 2.7.3
|
432
399
|
signing_key:
|
433
400
|
specification_version: 4
|
434
401
|
summary: Capture webcam image on git commit for lulz.
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'rest_client'
|
2
|
-
|
3
|
-
module Lolcommits
|
4
|
-
module Plugin
|
5
|
-
class LolFlowdock < Base
|
6
|
-
ENDPOINT_URL = 'api.flowdock.com/flows/'.freeze
|
7
|
-
RETRY_COUNT = 2
|
8
|
-
|
9
|
-
def self.name
|
10
|
-
'flowdock'
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.runner_order
|
14
|
-
:capture_ready
|
15
|
-
end
|
16
|
-
|
17
|
-
def configured?
|
18
|
-
!configuration['access_token'].nil?
|
19
|
-
end
|
20
|
-
|
21
|
-
def configure
|
22
|
-
print "Open the URL below and issue a token for your user (Personal API token):\n"
|
23
|
-
print "https://flowdock.com/account/tokens\n"
|
24
|
-
print "Enter the generated token below, then press enter: \n"
|
25
|
-
code = gets.to_s.strip
|
26
|
-
print "Enter the machine name of the flow you want to post to from this repo.\n"
|
27
|
-
print "Go to https://www.flowdock.com/account and click Flows, then click the flow, then get the machine name from the URL:\n"
|
28
|
-
flow = gets.to_s.strip.downcase
|
29
|
-
print "Enter the name of the organization for this Flowdock account.\n"
|
30
|
-
organization = gets.to_s.strip.downcase
|
31
|
-
|
32
|
-
{
|
33
|
-
'access_token' => code,
|
34
|
-
'flow' => flow,
|
35
|
-
'organization' => organization
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
def configure_options!
|
40
|
-
options = super
|
41
|
-
if options['enabled']
|
42
|
-
config = configure
|
43
|
-
options.merge!(config)
|
44
|
-
end
|
45
|
-
options
|
46
|
-
end
|
47
|
-
|
48
|
-
def run_capture_ready
|
49
|
-
retries = RETRY_COUNT
|
50
|
-
begin
|
51
|
-
|
52
|
-
endpoint = 'https://' + configuration['access_token'] + '@' + ENDPOINT_URL + configuration['organization'] + '/' + configuration['flow'] + '/messages'
|
53
|
-
response = RestClient.post(
|
54
|
-
endpoint,
|
55
|
-
event: 'file',
|
56
|
-
content: File.new(runner.main_image)
|
57
|
-
)
|
58
|
-
debug response
|
59
|
-
rescue StandardError => e
|
60
|
-
retries -= 1
|
61
|
-
retry if retries > 0
|
62
|
-
puts "Posting to flowdock failed - #{e.message}"
|
63
|
-
puts 'Try running config again:'
|
64
|
-
puts "\tlolcommits --config --plugin flowdock"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,124 +0,0 @@
|
|
1
|
-
module Lolcommits
|
2
|
-
module Plugin
|
3
|
-
class LolHipchat < Base
|
4
|
-
def configure_options!
|
5
|
-
options = super
|
6
|
-
options.merge! configure_auth_options if options['enabled']
|
7
|
-
options
|
8
|
-
end
|
9
|
-
|
10
|
-
def configure_auth_options
|
11
|
-
puts '-' * 50
|
12
|
-
puts ' Lolcommits HipChat Plugin Configuration'
|
13
|
-
puts '-' * 50
|
14
|
-
|
15
|
-
puts '1.) I need your Team Name '
|
16
|
-
puts 'teamname as in teamname.hipchat.com, without .hipchat.com'
|
17
|
-
print 'Your Teamname: '
|
18
|
-
teamname = gets.to_s.strip
|
19
|
-
puts "2.) We need a Authentication Token, get yours at https://#{teamname}.hipchat.com/account/api"
|
20
|
-
puts 'make sure to select scope "Send Message"'
|
21
|
-
print 'Your auth_token: '
|
22
|
-
token = gets.to_s.strip
|
23
|
-
puts '3.) Which Room should be we post to?'
|
24
|
-
puts 'can be a id or name'
|
25
|
-
print 'Your Room: '
|
26
|
-
room = gets.to_s.strip
|
27
|
-
|
28
|
-
{
|
29
|
-
'api_token' => token,
|
30
|
-
'api_team' => teamname,
|
31
|
-
'api_room' => room
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
def run_capture_ready
|
36
|
-
http = Net::HTTP.new(api_url.host, api_url.port)
|
37
|
-
# http.set_debug_output $stderr # nice for debugging, never ever release with it
|
38
|
-
http.start do |connection|
|
39
|
-
header = { 'Content-Type' => 'multipart/related; boundary=0123456789ABLEWASIEREISAWELBA9876543210' }
|
40
|
-
data = [message_part, picture_part].map do |part|
|
41
|
-
"--0123456789ABLEWASIEREISAWELBA9876543210\r\n#{part}"
|
42
|
-
end.join('') << '--0123456789ABLEWASIEREISAWELBA9876543210--'
|
43
|
-
connection.post("#{api_url.path}?#{api_url.query}", data, header)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def message_part
|
48
|
-
[
|
49
|
-
'Content-Type: application/json; charset=UTF-8',
|
50
|
-
'Content-Disposition: attachment; name="metadata"',
|
51
|
-
'',
|
52
|
-
message_json,
|
53
|
-
''
|
54
|
-
].join "\r\n"
|
55
|
-
end
|
56
|
-
|
57
|
-
def message_json
|
58
|
-
{ message: message }.to_json.force_encoding('utf-8')
|
59
|
-
end
|
60
|
-
|
61
|
-
def picture_part
|
62
|
-
mime_type = MIME::Types.type_for(picture.path)[0] || MIME::Types['application/octet-stream'][0]
|
63
|
-
[
|
64
|
-
format('Content-Type: %s', mime_type.simplified),
|
65
|
-
format('Content-Disposition: attachment; name="file"; filename="%s"', picture.path),
|
66
|
-
'',
|
67
|
-
"#{picture.read} ",
|
68
|
-
''
|
69
|
-
].join "\r\n"
|
70
|
-
end
|
71
|
-
|
72
|
-
def picture
|
73
|
-
@picture ||= File.new(runner.main_image)
|
74
|
-
end
|
75
|
-
|
76
|
-
def api_url
|
77
|
-
URI(format('http://%<api_team>s.hipchat.com/v2/room/%<api_room>s/share/file?auth_token=%<api_token>s', symbolized_configuration))
|
78
|
-
end
|
79
|
-
|
80
|
-
def symbolized_configuration
|
81
|
-
@symbolized_configuration ||= configuration.each_with_object({}) { |(k, v), obj| obj[k.to_sym] = v }
|
82
|
-
end
|
83
|
-
|
84
|
-
def message
|
85
|
-
"commited some #{random_adjective} #{random_object} to #{runner.vcs_info.repo}@#{runner.sha} (#{runner.vcs_info.branch}) "
|
86
|
-
end
|
87
|
-
|
88
|
-
def random_object
|
89
|
-
objects = %w(screws bolts exceptions errors cookies)
|
90
|
-
|
91
|
-
objects.sample
|
92
|
-
end
|
93
|
-
|
94
|
-
def random_adjective
|
95
|
-
adjectives = %w(adaptable adventurous affable affectionate agreeable ambitious amiable amicable amusing brave \
|
96
|
-
bright broad-minded calm careful charming communicative compassionate conscientious considerate \
|
97
|
-
convivial courageous courteous creative decisive determined diligent diplomatic discreet dynamic \
|
98
|
-
easygoing emotional energetic enthusiastic exuberant fair-minded faithful fearless forceful \
|
99
|
-
frank friendly funny generous gentle good gregarious hard-working helpful honest humorous \
|
100
|
-
imaginative impartial independent intellectual intelligent intuitive inventive kind loving loyal \
|
101
|
-
modest neat nice optimistic passionate patient persistent pioneering philosophical placid plucky \
|
102
|
-
polite powerful practical pro-active quick-witted quiet rational reliable reserved resourceful \
|
103
|
-
romantic self-confident self-disciplined sensible sensitive shy sincere sociable straightforward \
|
104
|
-
sympathetic thoughtful tidy tough unassuming understanding versatile warmhearted willing witty)
|
105
|
-
adjectives.sample
|
106
|
-
end
|
107
|
-
|
108
|
-
def configured?
|
109
|
-
super &&
|
110
|
-
configuration['api_token'] &&
|
111
|
-
configuration['api_team'] &&
|
112
|
-
configuration['api_room']
|
113
|
-
end
|
114
|
-
|
115
|
-
def self.name
|
116
|
-
'hipchat'
|
117
|
-
end
|
118
|
-
|
119
|
-
def self.runner_order
|
120
|
-
:capture_ready
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'rest_client'
|
2
|
-
|
3
|
-
module Lolcommits
|
4
|
-
module Plugin
|
5
|
-
class LolProtonet < Base
|
6
|
-
def initialize(runner: nil, config: nil)
|
7
|
-
super
|
8
|
-
options.concat(%w(api_token api_endpoint))
|
9
|
-
end
|
10
|
-
|
11
|
-
def run_capture_ready
|
12
|
-
debug "Posting capture to #{configuration['endpoint']}"
|
13
|
-
RestClient.post(
|
14
|
-
api_url,
|
15
|
-
{
|
16
|
-
files: [File.new(runner.main_image)],
|
17
|
-
message: message
|
18
|
-
},
|
19
|
-
'X-Protonet-Token' => configuration['api_token']
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
def api_url
|
24
|
-
configuration['api_endpoint']
|
25
|
-
end
|
26
|
-
|
27
|
-
def message
|
28
|
-
"commited some #{random_adjective} #{random_object} to #{runner.vcs_info.repo}@#{runner.sha} (#{runner.vcs_info.branch}) "
|
29
|
-
end
|
30
|
-
|
31
|
-
def random_object
|
32
|
-
objects = %w(screws bolts exceptions errors cookies)
|
33
|
-
|
34
|
-
objects.sample
|
35
|
-
end
|
36
|
-
|
37
|
-
def random_adjective
|
38
|
-
adjectives = [
|
39
|
-
'awesome', 'great', 'interesting', 'cool', 'EPIC', 'gut', 'good', 'pansy',
|
40
|
-
'powerful', 'boring', 'quirky', 'untested', 'german', 'iranian', 'neutral', 'crazy', 'well tested',
|
41
|
-
'jimmy style', 'nasty', 'bibliographical (we received complaints about the original wording)',
|
42
|
-
'bombdiggidy', 'narly', 'spiffy', 'smashing', 'xing style',
|
43
|
-
'leo apotheker style', 'black', 'white', 'yellow', 'shaggy', 'tasty', 'mind bending', 'JAY-Z',
|
44
|
-
'Kanye (the best ever)', '* Toby Keith was here *', 'splendid', 'stupendulous',
|
45
|
-
'(freedom fries!)', '[vote RON PAUL]', '- these are not my glasses -', 'typical pansy',
|
46
|
-
'- ze goggles zey do nothing! -', 'almost working', 'legen- wait for it -', '-dairy!',
|
47
|
-
' - Tavonius would be proud of this - ', 'Meg FAILMAN!', '- very brofessional of you -',
|
48
|
-
'heartbleeding', 'juciy', 'supercalifragilisticexpialidocious', 'failing', 'loving'
|
49
|
-
]
|
50
|
-
adjectives.sample
|
51
|
-
end
|
52
|
-
|
53
|
-
def configured?
|
54
|
-
!configuration['enabled'].nil? &&
|
55
|
-
configuration['api_token'] &&
|
56
|
-
configuration['api_endpoint']
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.name
|
60
|
-
'lolprotonet'
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.runner_order
|
64
|
-
:capture_ready
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'oauth'
|
3
|
-
require 'webrick'
|
4
|
-
require 'cgi'
|
5
|
-
require 'tumblr_client'
|
6
|
-
|
7
|
-
module Lolcommits
|
8
|
-
module Plugin
|
9
|
-
class LolTumblr < Base
|
10
|
-
TUMBLR_API_ENDPOINT = 'https://www.tumblr.com'.freeze
|
11
|
-
TUMBLR_CONSUMER_KEY = '2FtMEDpEPkxjoUdkpHh42h9wqTu9IVS7Ra0QyNZGixdCvhllN2'.freeze
|
12
|
-
TUMBLR_CONSUMER_SECRET = 'qWuvxgFUR2YyWKtbWOkDTMAiBEbj7ZGaNLaNQPba0PI1N4JpBs'.freeze
|
13
|
-
|
14
|
-
def run_capture_ready
|
15
|
-
puts 'Posting to Tumblr'
|
16
|
-
r = client.photo(configuration['tumblr_name'], data: runner.main_image)
|
17
|
-
if r.key?('id')
|
18
|
-
puts "\t--> Post successful!"
|
19
|
-
else
|
20
|
-
puts "Tumblr post FAILED! #{r}"
|
21
|
-
end
|
22
|
-
rescue Faraday::Error => e
|
23
|
-
puts "Tumblr post FAILED! #{e.message}"
|
24
|
-
end
|
25
|
-
|
26
|
-
def configure_options!
|
27
|
-
options = super
|
28
|
-
# ask user to configure tokens if enabling
|
29
|
-
if options['enabled']
|
30
|
-
auth_config = configure_auth!
|
31
|
-
return unless auth_config
|
32
|
-
options = options.merge(auth_config).merge(configure_tumblr_name)
|
33
|
-
end
|
34
|
-
options
|
35
|
-
end
|
36
|
-
|
37
|
-
def configure_auth!
|
38
|
-
puts '---------------------------'
|
39
|
-
puts 'Need to grab tumblr tokens'
|
40
|
-
puts '---------------------------'
|
41
|
-
|
42
|
-
request_token = oauth_consumer.get_request_token(exclude_callback: true)
|
43
|
-
print "\n1) Please open this url in your browser to authorize lolcommits:\n\n"
|
44
|
-
puts request_token.authorize_url
|
45
|
-
print "\n2) Launching a local server to complete the OAuth authentication process:\n\n"
|
46
|
-
begin
|
47
|
-
server = WEBrick::HTTPServer.new Port: 3000
|
48
|
-
server.mount_proc '/', server_callback(server)
|
49
|
-
server.start
|
50
|
-
debug "Requesting Tumblr OAuth Token with verifier: #{@verifier}"
|
51
|
-
access_token = request_token.get_access_token(oauth_verifier: @verifier)
|
52
|
-
rescue Errno::EADDRINUSE
|
53
|
-
puts "\nERROR You have something running on port 3000. Please turn it off to complete the authorization process"
|
54
|
-
return
|
55
|
-
rescue OAuth::Unauthorized
|
56
|
-
puts "\nERROR: Tumblr OAuth verification faile!"
|
57
|
-
return
|
58
|
-
end
|
59
|
-
return unless access_token.token && access_token.secret
|
60
|
-
puts ''
|
61
|
-
puts '------------------------------'
|
62
|
-
puts 'Thanks! Tumblr Auth Succeeded'
|
63
|
-
puts '------------------------------'
|
64
|
-
|
65
|
-
{
|
66
|
-
'access_token' => access_token.token,
|
67
|
-
'secret' => access_token.secret
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
def configure_tumblr_name
|
72
|
-
print "\n3) What's your tumblr name? (i.e. 'http://[THIS PART HERE].tumblr.com'): "
|
73
|
-
{ 'tumblr_name' => gets.strip }
|
74
|
-
end
|
75
|
-
|
76
|
-
def configured?
|
77
|
-
!configuration['enabled'].nil? &&
|
78
|
-
configuration['access_token'] &&
|
79
|
-
configuration['secret']
|
80
|
-
end
|
81
|
-
|
82
|
-
def client
|
83
|
-
@client ||= Tumblr.new(
|
84
|
-
consumer_key: TUMBLR_CONSUMER_KEY,
|
85
|
-
consumer_secret: TUMBLR_CONSUMER_SECRET,
|
86
|
-
oauth_token: configuration['access_token'],
|
87
|
-
oauth_token_secret: configuration['secret']
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
|
-
def oauth_consumer
|
92
|
-
@oauth_consumer ||= OAuth::Consumer.new(
|
93
|
-
TUMBLR_CONSUMER_KEY,
|
94
|
-
TUMBLR_CONSUMER_SECRET,
|
95
|
-
site: TUMBLR_API_ENDPOINT,
|
96
|
-
request_endpoint: TUMBLR_API_ENDPOINT,
|
97
|
-
http_method: :get
|
98
|
-
)
|
99
|
-
end
|
100
|
-
|
101
|
-
def config_with_default(key, default = nil)
|
102
|
-
if configuration[key]
|
103
|
-
configuration[key].strip.empty? ? default : configuration[key]
|
104
|
-
else
|
105
|
-
default
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.name
|
110
|
-
'tumblr'
|
111
|
-
end
|
112
|
-
|
113
|
-
def self.runner_order
|
114
|
-
:capture_ready
|
115
|
-
end
|
116
|
-
|
117
|
-
protected
|
118
|
-
|
119
|
-
def server_callback(server)
|
120
|
-
proc do |req, res|
|
121
|
-
q = CGI.parse req.request_uri.query
|
122
|
-
@verifier = q['oauth_verifier'][0]
|
123
|
-
server.stop
|
124
|
-
res.body = 'Lolcommits authorization complete!'
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'base64'
|
2
|
-
|
3
|
-
module Lolcommits
|
4
|
-
module Plugin
|
5
|
-
class TermOutput < Base
|
6
|
-
def run_capture_ready
|
7
|
-
if terminal_supported?
|
8
|
-
if !runner.vcs_info || runner.vcs_info.repo.empty?
|
9
|
-
debug 'repo is empty, skipping term output'
|
10
|
-
else
|
11
|
-
base64 = Base64.encode64(open(runner.main_image, &:read))
|
12
|
-
puts "#{begin_escape}1337;File=inline=1:#{base64};alt=#{runner.message};#{end_escape}\n"
|
13
|
-
end
|
14
|
-
else
|
15
|
-
debug 'Disabled, your terminal is not supported (requires iTerm2)'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.name
|
20
|
-
'term_output'
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.runner_order
|
24
|
-
:capture_ready
|
25
|
-
end
|
26
|
-
|
27
|
-
def configure_options!
|
28
|
-
if terminal_supported?
|
29
|
-
super
|
30
|
-
else
|
31
|
-
puts "Sorry, your terminal does not support the #{self.class.name} plugin (requires iTerm2)"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
# escape sequences for tmux sessions differ
|
38
|
-
def begin_escape
|
39
|
-
tmux? ? "\033Ptmux;\033\033]" : "\033]"
|
40
|
-
end
|
41
|
-
|
42
|
-
def end_escape
|
43
|
-
tmux? ? "\a\033\\" : "\a"
|
44
|
-
end
|
45
|
-
|
46
|
-
def tmux?
|
47
|
-
!ENV['TMUX'].nil?
|
48
|
-
end
|
49
|
-
|
50
|
-
def terminal_supported?
|
51
|
-
ENV['TERM_PROGRAM'] =~ /iTerm/
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|