lolcommits 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -3
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +13 -1
- data/README.md +3 -3
- data/bin/lolcommits +3 -7
- data/lib/lolcommits.rb +0 -1
- data/lib/lolcommits/backends/git_info.rb +1 -4
- data/lib/lolcommits/backends/installation_git.rb +1 -1
- data/lib/lolcommits/backends/installation_mercurial.rb +1 -1
- data/lib/lolcommits/backends/mercurial_info.rb +1 -4
- data/lib/lolcommits/capturer.rb +1 -0
- data/lib/lolcommits/capturer/capture_linux_animated.rb +1 -1
- data/lib/lolcommits/capturer/capture_mac_animated.rb +1 -1
- data/lib/lolcommits/capturer/capture_windows_animated.rb +106 -0
- data/lib/lolcommits/platform.rb +3 -3
- data/lib/lolcommits/plugin/base.rb +0 -10
- data/lib/lolcommits/plugin/lol_hipchat.rb +1 -1
- data/lib/lolcommits/plugin_manager.rb +1 -5
- data/lib/lolcommits/vcs_info.rb +0 -44
- data/lib/lolcommits/version.rb +1 -1
- data/lolcommits.gemspec +4 -3
- metadata +21 -7
- data/lib/lolcommits/plugin/lol_slack.rb +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33ddf0cccf67ca8a53bca770511378f57aa078fa
|
4
|
+
data.tar.gz: 9d2daa0667501a5586cc2c3ed5cba15edff372a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b7f3e952d3cd800e07b9a13569b35bf4f6a74d303ec56ec44147629b78b105dbc2b1f32300c1dedc12a2c1eb1d90e6b2259e31f44b8e4ed1093a22e7fab40ea
|
7
|
+
data.tar.gz: 46b71b2b04d56a99dc7240dea7d431599136f6780575725d5c260011c1eaa6bec87463dbfe13f6b4b9ca524a80746e365e1eefa50320eb99428ce7b0bd0c3f37
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,13 @@ project adheres to [Semantic Versioning][Semver].
|
|
8
8
|
* WIP - extract more plugins to gems ...
|
9
9
|
* Your contribution here!
|
10
10
|
|
11
|
+
## [0.9.6][] (28 August 2017)
|
12
|
+
* Clean legacy plugin methods (@matthutchinson [#348][])
|
13
|
+
* Extract Slack Plugin to gem (@matthutchinson [#349][])
|
14
|
+
* Fix Windows install hook (@matthutchinson)
|
15
|
+
* Animated capturing for Windows via ffmpeg (@freehugs [#351][])
|
16
|
+
* Pin `public_suffix` gem version (@matthutchinson [#352][])
|
17
|
+
|
11
18
|
## [0.9.5][] (21 July 2017)
|
12
19
|
* Extract Twitter Plugin / refactor Plugin::Base (@matthutchinson [#347][])
|
13
20
|
|
@@ -282,7 +289,8 @@ project adheres to [Semantic Versioning][Semver].
|
|
282
289
|
instead of compositing multiply image Caption objects (this seems to be more
|
283
290
|
reliable to not glitch.)
|
284
291
|
|
285
|
-
[Unreleased]: https://github.com/mroth/lolcommits/compare/v0.9.
|
292
|
+
[Unreleased]: https://github.com/mroth/lolcommits/compare/v0.9.6...HEAD
|
293
|
+
[0.9.5]: https://github.com/mroth/lolcommits/compare/v0.9.5...v0.9.6
|
286
294
|
[0.9.5]: https://github.com/mroth/lolcommits/compare/v0.9.4...v0.9.5
|
287
295
|
[0.9.4]: https://github.com/mroth/lolcommits/compare/v0.9.3...v0.9.4
|
288
296
|
[0.9.3]: https://github.com/mroth/lolcommits/compare/v0.9.2...v0.9.3
|
@@ -448,3 +456,7 @@ project adheres to [Semantic Versioning][Semver].
|
|
448
456
|
[#341]: https://github.com/mroth/lolcommits/pull/341
|
449
457
|
[#342]: https://github.com/mroth/lolcommits/pull/342
|
450
458
|
[#347]: https://github.com/mroth/lolcommits/pull/347
|
459
|
+
[#348]: https://github.com/mroth/lolcommits/pull/348
|
460
|
+
[#349]: https://github.com/mroth/lolcommits/pull/349
|
461
|
+
[#351]: https://github.com/mroth/lolcommits/pull/351
|
462
|
+
[#352]: https://github.com/mroth/lolcommits/pull/352
|
data/README.md
CHANGED
@@ -125,7 +125,7 @@ forked process. See the section below for more capture configuration options.
|
|
125
125
|
lolcommits has some capture options for additional lulz. You can enable these
|
126
126
|
via environment variables like so;
|
127
127
|
|
128
|
-
* `LOLCOMMITS_DEVICE` set a webcam device - **
|
128
|
+
* `LOLCOMMITS_DEVICE` set a webcam device - **except windows (non-animated) captures**
|
129
129
|
* `LOLCOMMITS_ANIMATE` (in seconds) set time for capturing an animated gif -
|
130
130
|
**requires ffmpeg**
|
131
131
|
* `LOLCOMMITS_DELAY` (in seconds) set delay time before capturing (for slow
|
@@ -169,11 +169,11 @@ you capture and the capabilities of your machine).
|
|
169
169
|
|
170
170
|
* Linux - [follow this guide](https://www.ffmpeg.org/download.html#build-linux)
|
171
171
|
* macOS - `brew install ffmpeg`
|
172
|
+
* Windows - [follow this guide](https://ffmpeg.org/download.html#build-windows)
|
172
173
|
|
173
174
|
To enable, just set the `LOLCOMMITS_ANIMATE` environment variable with the
|
174
175
|
number of seconds to capture. If you find animated capturing takes too long, try
|
175
|
-
setting `LOLCOMMITS_FORK=true`.
|
176
|
-
supported on Windows.
|
176
|
+
setting `LOLCOMMITS_FORK=true`.
|
177
177
|
|
178
178
|
![Example animated lolcommit
|
179
179
|
gif](http://cdn2.usa.bugleblogs.com/blogs/000/000/003/de0eb9aa695.gif "Example
|
data/bin/lolcommits
CHANGED
@@ -171,16 +171,12 @@ class App
|
|
171
171
|
# Duration for animated capturing
|
172
172
|
#
|
173
173
|
# If animation is enabled, returns an integer > 0 representing seconds.
|
174
|
-
# Seconds will be 0 if no option set,
|
175
|
-
#
|
174
|
+
# Seconds will be 0 if no option set, meaning no animated capture will take
|
175
|
+
# place.
|
176
176
|
#
|
177
177
|
# @return [Integer]
|
178
178
|
def self.capture_animate
|
179
|
-
|
180
|
-
(options[:animate] || ENV['LOLCOMMITS_ANIMATE']).to_i
|
181
|
-
else
|
182
|
-
0
|
183
|
-
end
|
179
|
+
(options[:animate] || ENV['LOLCOMMITS_ANIMATE']).to_i
|
184
180
|
end
|
185
181
|
|
186
182
|
def self.capture_animated?
|
data/lib/lolcommits.rb
CHANGED
@@ -36,7 +36,6 @@ require 'lolcommits/plugin/lolsrv'
|
|
36
36
|
require 'lolcommits/plugin/lol_yammer'
|
37
37
|
require 'lolcommits/plugin/lol_protonet'
|
38
38
|
require 'lolcommits/plugin/lol_tumblr'
|
39
|
-
require 'lolcommits/plugin/lol_slack'
|
40
39
|
require 'lolcommits/plugin/lol_flowdock'
|
41
40
|
require 'lolcommits/plugin/lol_hipchat'
|
42
41
|
|
@@ -64,7 +64,7 @@ module Lolcommits
|
|
64
64
|
exports = "LANG=\"#{ENV['LANG']}\" && PATH=\"#{ruby_path}:#{imagick_path}:$PATH\""
|
65
65
|
|
66
66
|
if Lolcommits::Platform.platform_windows?
|
67
|
-
exports = "set path
|
67
|
+
exports = "set path=\"#{ruby_path};#{imagick_path};%PATH%\""
|
68
68
|
end
|
69
69
|
|
70
70
|
<<-EOS
|
@@ -44,7 +44,7 @@ module Lolcommits
|
|
44
44
|
exports = "LANG=\"#{ENV['LANG']}\" && PATH=\"#{ruby_path}:#{imagick_path}:$PATH\""
|
45
45
|
|
46
46
|
if Lolcommits::Platform.platform_windows?
|
47
|
-
exports = "set path
|
47
|
+
exports = "set path=\"#{ruby_path};#{imagick_path};%PATH%\""
|
48
48
|
end
|
49
49
|
|
50
50
|
"#{exports} && #{capture_cmd}"
|
data/lib/lolcommits/capturer.rb
CHANGED
@@ -17,5 +17,6 @@ require 'lolcommits/capturer/capture_mac_animated'
|
|
17
17
|
require 'lolcommits/capturer/capture_linux'
|
18
18
|
require 'lolcommits/capturer/capture_linux_animated'
|
19
19
|
require 'lolcommits/capturer/capture_windows'
|
20
|
+
require 'lolcommits/capturer/capture_windows_animated'
|
20
21
|
require 'lolcommits/capturer/capture_cygwin'
|
21
22
|
require 'lolcommits/capturer/capture_fake'
|
@@ -15,7 +15,7 @@ module Lolcommits
|
|
15
15
|
fps = video_fps(video_location)
|
16
16
|
skip = frame_skip(fps)
|
17
17
|
delay = frame_delay(fps, skip)
|
18
|
-
debug "Capturer: anaimated gif choosing every #{skip} frames with a frame delay of #{delay}"
|
18
|
+
debug "Capturer: anaimated gif choosing every #{skip} frames with a frame delay of #{delay} (video fps: #{fps})"
|
19
19
|
|
20
20
|
# create the looping animated gif from frames (picks nth frame with seq,
|
21
21
|
# quotes output and concats to a single line with tr)
|
@@ -16,7 +16,7 @@ module Lolcommits
|
|
16
16
|
# use fps to set delay and number of frames to skip (for lower filesized gifs)
|
17
17
|
skip = frame_skip(fps)
|
18
18
|
delay = frame_delay(fps, skip)
|
19
|
-
debug "Capturer: animated gif choosing every #{skip} frames with a frame delay of #{delay}"
|
19
|
+
debug "Capturer: animated gif choosing every #{skip} frames with a frame delay of #{delay} (video fps: #{fps})"
|
20
20
|
|
21
21
|
# create the looping animated gif from frames (picks nth frame with seq,
|
22
22
|
# quotes output and concats to a single line with tr)
|
@@ -0,0 +1,106 @@
|
|
1
|
+
module Lolcommits
|
2
|
+
class CaptureWindowsAnimated < Capturer
|
3
|
+
def capture
|
4
|
+
# make a fresh frames directory
|
5
|
+
FileUtils.rm_rf(frames_location)
|
6
|
+
FileUtils.mkdir_p(frames_location)
|
7
|
+
|
8
|
+
# abort capture if we don't have a device name
|
9
|
+
return unless capture_device_string
|
10
|
+
|
11
|
+
# capture raw video with ffmpeg dshow
|
12
|
+
system_call "ffmpeg -v quiet -y -f dshow -i video=\"#{capture_device_string}\" -video_size 320x240 -t #{capture_duration} \"#{video_location}\" > NUL"
|
13
|
+
|
14
|
+
return unless File.exist?(video_location)
|
15
|
+
# convert raw video to png frames with ffmpeg
|
16
|
+
system_call "ffmpeg #{capture_delay_string} -v quiet -i \"#{video_location}\" -t #{animated_duration} \"#{frames_location}/%09d.png\" > NUL"
|
17
|
+
|
18
|
+
# use fps to set delay and number of frames to skip (for lower filesized gifs)
|
19
|
+
fps = video_fps(video_location)
|
20
|
+
skip = frame_skip(fps)
|
21
|
+
delay = frame_delay(fps, skip)
|
22
|
+
debug "Capturer: animated gif choosing every #{skip} frames with a frame delay of #{delay} (video fps: #{fps})"
|
23
|
+
|
24
|
+
# create the looping animated gif from frames (delete frame files except every #{skip} frame)
|
25
|
+
Dir["#{frames_location}/*.png"].each do |frame_filename|
|
26
|
+
basename = File.basename(frame_filename)
|
27
|
+
frame_number = basename.split('.').first.to_i
|
28
|
+
File.delete(frame_filename) if frame_number % skip != 0
|
29
|
+
end
|
30
|
+
|
31
|
+
# convert to animated gif with delay and gif optimisation
|
32
|
+
system_call "convert -layers OptimizeTransparency -delay #{delay} -loop 0 \"#{frames_location}/*.png\" -coalesce \"#{snapshot_location}\""
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def ffpmeg_list_devices_cmd
|
38
|
+
'ffmpeg -list_devices true -f dshow -i dummy 2>&1'
|
39
|
+
end
|
40
|
+
|
41
|
+
# inspired by this code from @rdp http://tinyurl.com/y7t276bh
|
42
|
+
def device_names
|
43
|
+
@_device_names ||= begin
|
44
|
+
names = []
|
45
|
+
cmd_output = ''
|
46
|
+
count = 0
|
47
|
+
while cmd_output.empty? || !cmd_output.split('DirectShow')[2]
|
48
|
+
cmd_output = system_call(ffpmeg_list_devices_cmd, true)
|
49
|
+
count += 1
|
50
|
+
raise 'failed to find a video capture device with ffmpeg -list_devices' if count == 5
|
51
|
+
sleep 0.1
|
52
|
+
end
|
53
|
+
cmd_output.gsub!("\r\n", "\n")
|
54
|
+
video = cmd_output.split('DirectShow')[1]
|
55
|
+
|
56
|
+
video.lines.map do |line|
|
57
|
+
names << Regexp.last_match(1) if line =~ /"(.+)"\n/
|
58
|
+
end
|
59
|
+
|
60
|
+
debug "Capturer: found #{names.length} video devices: #{names.join(', ')}"
|
61
|
+
names
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def system_call(call_str, capture_output = false)
|
66
|
+
debug "Capturer: making system call for \n #{call_str}"
|
67
|
+
capture_output ? `#{call_str}` : system(call_str)
|
68
|
+
end
|
69
|
+
|
70
|
+
def frame_delay(fps, skip)
|
71
|
+
# calculate frame delay
|
72
|
+
delay = ((100.0 * skip) / fps.to_f).to_i
|
73
|
+
delay < 6 ? 6 : delay # hard limit for IE browsers
|
74
|
+
end
|
75
|
+
|
76
|
+
def video_fps(file)
|
77
|
+
# inspect fps of the captured video file (default to 29.97)
|
78
|
+
fps = system_call("ffmpeg -i \"#{file}\" 2>&1 | sed -n \"s/.*, \\(.*\\) fp.*/\\1/p\"", true)
|
79
|
+
fps.to_i < 1 ? 29.97 : fps.to_f
|
80
|
+
end
|
81
|
+
|
82
|
+
def frame_skip(fps)
|
83
|
+
# of frames to skip depends on movie fps
|
84
|
+
case fps
|
85
|
+
when 0..15
|
86
|
+
2
|
87
|
+
when 16..28
|
88
|
+
3
|
89
|
+
else
|
90
|
+
4
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def capture_device_string
|
95
|
+
capture_device || device_names.first
|
96
|
+
end
|
97
|
+
|
98
|
+
def capture_delay_string
|
99
|
+
" -ss #{capture_delay}" if capture_delay.to_i > 0
|
100
|
+
end
|
101
|
+
|
102
|
+
def capture_duration
|
103
|
+
animated_duration.to_i + capture_delay.to_i
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
data/lib/lolcommits/platform.rb
CHANGED
@@ -13,7 +13,7 @@ module Lolcommits
|
|
13
13
|
elsif platform_linux?
|
14
14
|
animate ? CaptureLinuxAnimated : CaptureLinux
|
15
15
|
elsif platform_windows?
|
16
|
-
CaptureWindows
|
16
|
+
animate ? CaptureWindowsAnimated : CaptureWindows
|
17
17
|
elsif platform_cygwin?
|
18
18
|
CaptureCygwin
|
19
19
|
else
|
@@ -54,7 +54,7 @@ module Lolcommits
|
|
54
54
|
# Is the platform capable of capturing animated GIFs from webcam?
|
55
55
|
# @return Boolean
|
56
56
|
def self.can_animate?
|
57
|
-
platform_linux? || platform_mac?
|
57
|
+
platform_linux? || platform_mac? || platform_windows?
|
58
58
|
end
|
59
59
|
|
60
60
|
# Is a valid install of imagemagick present on the system?
|
@@ -116,7 +116,7 @@ module Lolcommits
|
|
116
116
|
# @note Currently only functions on Mac.
|
117
117
|
# @return String
|
118
118
|
def self.device_list
|
119
|
-
# TODO: handle other platforms here (linux/windows)
|
119
|
+
# TODO: handle other platforms here (linux/windows) e.g with ffmpeg -list_devices
|
120
120
|
return unless Platform.platform_mac?
|
121
121
|
capturer = Lolcommits::CaptureMacAnimated.new
|
122
122
|
`#{capturer.executable_path} -l`
|
@@ -12,21 +12,18 @@ module Lolcommits
|
|
12
12
|
def execute_pre_capture
|
13
13
|
return unless configured_and_enabled?
|
14
14
|
debug 'I am enabled, about to run pre capture'
|
15
|
-
run_precapture # TODO: remove me (legacy method)
|
16
15
|
run_pre_capture
|
17
16
|
end
|
18
17
|
|
19
18
|
def execute_post_capture
|
20
19
|
return unless configured_and_enabled?
|
21
20
|
debug 'I am enabled, about to run post capture'
|
22
|
-
run_postcapture # TODO: remove me (legacy method)
|
23
21
|
run_post_capture
|
24
22
|
end
|
25
23
|
|
26
24
|
def execute_capture_ready
|
27
25
|
return unless configured_and_enabled?
|
28
26
|
debug 'I am enabled, about to run capture ready'
|
29
|
-
run_captureready # TODO: remove me (legacy method)
|
30
27
|
run_capture_ready
|
31
28
|
end
|
32
29
|
|
@@ -133,13 +130,6 @@ module Lolcommits
|
|
133
130
|
def self.runner_order
|
134
131
|
[]
|
135
132
|
end
|
136
|
-
|
137
|
-
# TODO: remove these legacy methods
|
138
|
-
def run_precapture; end
|
139
|
-
|
140
|
-
def run_postcapture; end
|
141
|
-
|
142
|
-
def run_captureready; end
|
143
133
|
end
|
144
134
|
end
|
145
135
|
end
|
@@ -74,7 +74,7 @@ module Lolcommits
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def api_url
|
77
|
-
URI(format('http://%<api_team
|
77
|
+
URI(format('http://%<api_team>s.hipchat.com/v2/room/%<api_room>s/share/file?auth_token=%<api_token>s', symbolized_configuration))
|
78
78
|
end
|
79
79
|
|
80
80
|
def symbolized_configuration
|
@@ -19,11 +19,7 @@ module Lolcommits
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def plugins_for(position)
|
22
|
-
plugin_klasses.select
|
23
|
-
# TODO: remove (legacy support) position munging after 0.9.5 release
|
24
|
-
Array(p.runner_order).include?(position) ||
|
25
|
-
Array(p.runner_order).include?(position.to_s.delete('_').to_sym)
|
26
|
-
end
|
22
|
+
plugin_klasses.select { |p| Array(p.runner_order).include?(position) }
|
27
23
|
end
|
28
24
|
|
29
25
|
# @return [Lolcommits::Plugin] find first plugin matching name
|
data/lib/lolcommits/vcs_info.rb
CHANGED
@@ -1,17 +1,9 @@
|
|
1
1
|
module Lolcommits
|
2
|
-
# base class ala plugin.rb
|
3
2
|
class VCSInfo
|
4
|
-
attr_accessor :sha, :message, :repo_internal_path, :repo, :url,
|
5
|
-
:author_name, :author_email, :branch
|
6
|
-
|
7
3
|
def self.repo_root?(path = '.')
|
8
4
|
GitInfo.repo_root?(path) || MercurialInfo.repo_root?(path)
|
9
5
|
end
|
10
6
|
|
11
|
-
def self.base_message(method)
|
12
|
-
raise NotImplementedError, "#{self.class.name} is a base class; implement '#{method}' in a subclass", caller
|
13
|
-
end
|
14
|
-
|
15
7
|
def self.local_name(path = '.')
|
16
8
|
if GitInfo.repo_root?(path)
|
17
9
|
GitInfo.local_name(path)
|
@@ -21,41 +13,5 @@ module Lolcommits
|
|
21
13
|
raise "'#{File.expand_path(path)}' is not the root of a supported VCS"
|
22
14
|
end
|
23
15
|
end
|
24
|
-
|
25
|
-
def initialize
|
26
|
-
base_message(__method__)
|
27
|
-
end
|
28
|
-
|
29
|
-
def branch
|
30
|
-
base_message(__method__)
|
31
|
-
end
|
32
|
-
|
33
|
-
def message
|
34
|
-
base_message(__method__)
|
35
|
-
end
|
36
|
-
|
37
|
-
def sha
|
38
|
-
base_message(__method__)
|
39
|
-
end
|
40
|
-
|
41
|
-
def repo_internal_path
|
42
|
-
base_message(__method__)
|
43
|
-
end
|
44
|
-
|
45
|
-
def url
|
46
|
-
base_message(__method__)
|
47
|
-
end
|
48
|
-
|
49
|
-
def repo
|
50
|
-
base_message(__method__)
|
51
|
-
end
|
52
|
-
|
53
|
-
def author_name
|
54
|
-
base_message(__method__)
|
55
|
-
end
|
56
|
-
|
57
|
-
def author_email
|
58
|
-
base_message(__method__)
|
59
|
-
end
|
60
16
|
end
|
61
17
|
end
|
data/lib/lolcommits/version.rb
CHANGED
data/lolcommits.gemspec
CHANGED
@@ -49,9 +49,10 @@ EOF
|
|
49
49
|
s.requirements << 'a webcam'
|
50
50
|
|
51
51
|
# hold back upgrading (and why)
|
52
|
-
s.add_development_dependency('aruba', '=0.6.2')
|
53
|
-
s.add_development_dependency('rake', '=10.5.0')
|
52
|
+
s.add_development_dependency('aruba', '=0.6.2') # upgrading requires a lot of test code changes
|
53
|
+
s.add_development_dependency('rake', '=10.5.0') # ~> 11+ introduces lots of warnings from other deps
|
54
54
|
s.add_runtime_dependency('net-http-persistent', '=2.9.4') # ~> 3+ requires Ruby 2.1
|
55
|
+
s.add_runtime_dependency('public_suffix', '~>2.0.0') # ~> 3+ requires Ruby 2.1
|
55
56
|
|
56
57
|
# core
|
57
58
|
s.add_runtime_dependency('methadone', '~> 1.9.5')
|
@@ -62,7 +63,7 @@ EOF
|
|
62
63
|
s.add_runtime_dependency('git', '~> 1.3.0')
|
63
64
|
|
64
65
|
# built-in lolcommits plugin
|
65
|
-
s.add_runtime_dependency('lolcommits-loltext'
|
66
|
+
s.add_runtime_dependency('lolcommits-loltext', '~> 0.0.4')
|
66
67
|
|
67
68
|
# plugin gems
|
68
69
|
s.add_runtime_dependency('yam', '~> 2.5.0') # yammer
|
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.6
|
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-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aruba
|
@@ -53,6 +53,20 @@ dependencies:
|
|
53
53
|
- - '='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 2.9.4
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: public_suffix
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.0.0
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.0.0
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
71
|
name: methadone
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,16 +155,16 @@ dependencies:
|
|
141
155
|
name: lolcommits-loltext
|
142
156
|
requirement: !ruby/object:Gem::Requirement
|
143
157
|
requirements:
|
144
|
-
- - "
|
158
|
+
- - "~>"
|
145
159
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
160
|
+
version: 0.0.4
|
147
161
|
type: :runtime
|
148
162
|
prerelease: false
|
149
163
|
version_requirements: !ruby/object:Gem::Requirement
|
150
164
|
requirements:
|
151
|
-
- - "
|
165
|
+
- - "~>"
|
152
166
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
167
|
+
version: 0.0.4
|
154
168
|
- !ruby/object:Gem::Dependency
|
155
169
|
name: yam
|
156
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -357,6 +371,7 @@ files:
|
|
357
371
|
- lib/lolcommits/capturer/capture_mac.rb
|
358
372
|
- lib/lolcommits/capturer/capture_mac_animated.rb
|
359
373
|
- lib/lolcommits/capturer/capture_windows.rb
|
374
|
+
- lib/lolcommits/capturer/capture_windows_animated.rb
|
360
375
|
- lib/lolcommits/cli.rb
|
361
376
|
- lib/lolcommits/cli/fatals.rb
|
362
377
|
- lib/lolcommits/cli/launcher.rb
|
@@ -371,7 +386,6 @@ files:
|
|
371
386
|
- lib/lolcommits/plugin/lol_flowdock.rb
|
372
387
|
- lib/lolcommits/plugin/lol_hipchat.rb
|
373
388
|
- lib/lolcommits/plugin/lol_protonet.rb
|
374
|
-
- lib/lolcommits/plugin/lol_slack.rb
|
375
389
|
- lib/lolcommits/plugin/lol_tumblr.rb
|
376
390
|
- lib/lolcommits/plugin/lol_yammer.rb
|
377
391
|
- lib/lolcommits/plugin/lolsrv.rb
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'rest_client'
|
2
|
-
|
3
|
-
module Lolcommits
|
4
|
-
module Plugin
|
5
|
-
class LolSlack < Base
|
6
|
-
ENDPOINT_URL = 'https://slack.com/api/files.upload'.freeze
|
7
|
-
RETRY_COUNT = 2
|
8
|
-
|
9
|
-
def self.name
|
10
|
-
'slack'
|
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:\n"
|
23
|
-
print "https://api.slack.com/web\n"
|
24
|
-
print "Enter the generated token below, then press enter: (e.g. xxxx-xxxxxxxxx-xxxx) \n"
|
25
|
-
code = gets.to_s.strip
|
26
|
-
print "Enter a comma-seperated list of channel IDs to post images in, then press enter: (e.g. C1234567890,C1234567890)\n"
|
27
|
-
print "NOTE: you must use channel IDs (not channel names). Grab them from here; https://api.slack.com/methods/channels.list/test\n"
|
28
|
-
channels = gets.to_s.strip
|
29
|
-
|
30
|
-
{ 'access_token' => code,
|
31
|
-
'channels' => channels }
|
32
|
-
end
|
33
|
-
|
34
|
-
def configure_options!
|
35
|
-
options = super
|
36
|
-
if options['enabled']
|
37
|
-
config = configure
|
38
|
-
options.merge!(config)
|
39
|
-
end
|
40
|
-
options
|
41
|
-
end
|
42
|
-
|
43
|
-
def run_capture_ready
|
44
|
-
retries = RETRY_COUNT
|
45
|
-
begin
|
46
|
-
|
47
|
-
response = RestClient.post(
|
48
|
-
ENDPOINT_URL,
|
49
|
-
file: File.new(runner.main_image),
|
50
|
-
token: configuration['access_token'],
|
51
|
-
filetype: 'jpg',
|
52
|
-
filename: runner.sha,
|
53
|
-
title: runner.message + "[#{runner.vcs_info.repo}]",
|
54
|
-
channels: configuration['channels']
|
55
|
-
)
|
56
|
-
|
57
|
-
debug response
|
58
|
-
rescue => e
|
59
|
-
retries -= 1
|
60
|
-
retry if retries > 0
|
61
|
-
puts "Posting to slack failed - #{e.message}"
|
62
|
-
puts 'Try running config again:'
|
63
|
-
puts "\tlolcommits --config --plugin slack"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|