lolcommits 0.9.2 → 0.9.3.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +6 -0
- data/CHANGELOG.md +243 -105
- data/CONTRIBUTING.md +2 -2
- data/README.md +10 -3
- data/bin/lolcommits +9 -16
- data/features/step_definitions/lolcommits_steps.rb +0 -1
- data/features/support/env.rb +0 -1
- data/features/support/path_helpers.rb +0 -1
- data/lib/core_ext/mini_magick/utilities.rb +0 -1
- data/lib/lolcommits.rb +16 -16
- data/lib/lolcommits/backends/git_info.rb +0 -1
- data/lib/lolcommits/backends/installation_git.rb +0 -1
- data/lib/lolcommits/backends/installation_mercurial.rb +0 -1
- data/lib/lolcommits/backends/mercurial_info.rb +0 -1
- data/lib/lolcommits/capturer.rb +0 -1
- data/lib/lolcommits/capturer/capture_cygwin.rb +0 -1
- data/lib/lolcommits/capturer/capture_fake.rb +0 -1
- data/lib/lolcommits/capturer/capture_linux.rb +0 -1
- data/lib/lolcommits/capturer/capture_linux_animated.rb +0 -1
- data/lib/lolcommits/capturer/capture_mac.rb +0 -1
- data/lib/lolcommits/capturer/capture_mac_animated.rb +0 -1
- data/lib/lolcommits/capturer/capture_windows.rb +0 -1
- data/lib/lolcommits/cli/fatals.rb +0 -8
- data/lib/lolcommits/cli/launcher.rb +0 -1
- data/lib/lolcommits/cli/process_runner.rb +0 -2
- data/lib/lolcommits/cli/timelapse_gif.rb +0 -1
- data/lib/lolcommits/configuration.rb +10 -7
- data/lib/lolcommits/gem_plugin.rb +46 -0
- data/lib/lolcommits/installation.rb +0 -1
- data/lib/lolcommits/platform.rb +0 -1
- data/lib/lolcommits/plugin/base.rb +110 -0
- data/lib/lolcommits/plugin/dot_com.rb +50 -0
- data/lib/lolcommits/plugin/lol_flowdock.rb +69 -0
- data/lib/lolcommits/plugin/lol_hipchat.rb +124 -0
- data/lib/lolcommits/plugin/lol_protonet.rb +68 -0
- data/lib/lolcommits/plugin/lol_slack.rb +68 -0
- data/lib/lolcommits/plugin/lol_tumblr.rb +129 -0
- data/lib/lolcommits/plugin/lol_twitter.rb +176 -0
- data/lib/lolcommits/plugin/lol_yammer.rb +84 -0
- data/lib/lolcommits/plugin/lolsrv.rb +58 -0
- data/lib/lolcommits/plugin/loltext.rb +190 -0
- data/lib/lolcommits/plugin/term_output.rb +55 -0
- data/lib/lolcommits/{plugins → plugin}/tranzlate.rb +14 -15
- data/lib/lolcommits/plugin/uploldz.rb +65 -0
- data/lib/lolcommits/plugin_manager.rb +48 -0
- data/lib/lolcommits/runner.rb +4 -5
- data/lib/lolcommits/test_helpers/fake_io.rb +20 -0
- data/lib/lolcommits/test_helpers/git_repo.rb +44 -0
- data/lib/lolcommits/vcs_info.rb +0 -1
- data/lib/lolcommits/version.rb +2 -2
- data/lolcommits.gemspec +2 -2
- data/test/lolcommits_test.rb +1 -2
- data/test/plugins_test.rb +7 -8
- metadata +22 -19
- data/lib/core_ext/class.rb +0 -8
- data/lib/lolcommits/plugin.rb +0 -123
- data/lib/lolcommits/plugins/dot_com.rb +0 -51
- data/lib/lolcommits/plugins/lol_flowdock.rb +0 -70
- data/lib/lolcommits/plugins/lol_hipchat.rb +0 -125
- data/lib/lolcommits/plugins/lol_protonet.rb +0 -69
- data/lib/lolcommits/plugins/lol_slack.rb +0 -69
- data/lib/lolcommits/plugins/lol_tumblr.rb +0 -129
- data/lib/lolcommits/plugins/lol_twitter.rb +0 -176
- data/lib/lolcommits/plugins/lol_yammer.rb +0 -85
- data/lib/lolcommits/plugins/lolsrv.rb +0 -58
- data/lib/lolcommits/plugins/loltext.rb +0 -184
- data/lib/lolcommits/plugins/term_output.rb +0 -54
- data/lib/lolcommits/plugins/uploldz.rb +0 -66
data/lib/core_ext/class.rb
DELETED
data/lib/lolcommits/plugin.rb
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module Lolcommits
|
3
|
-
class Plugin
|
4
|
-
attr_accessor :runner, :options
|
5
|
-
|
6
|
-
def initialize(runner)
|
7
|
-
debug 'Initializing'
|
8
|
-
self.runner = runner
|
9
|
-
self.options = ['enabled']
|
10
|
-
end
|
11
|
-
|
12
|
-
def execute_precapture
|
13
|
-
if enabled?
|
14
|
-
debug 'I am enabled, about to run precapture'
|
15
|
-
run_precapture
|
16
|
-
else
|
17
|
-
debug 'Disabled, doing nothing for precapture execution'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def execute_postcapture
|
22
|
-
if enabled?
|
23
|
-
debug 'I am enabled, about to run postcapture'
|
24
|
-
run_postcapture
|
25
|
-
else
|
26
|
-
debug 'Disabled, doing nothing for postcapture execution'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def run_precapture
|
31
|
-
debug 'base plugin, does nothing to anything'
|
32
|
-
end
|
33
|
-
|
34
|
-
def run_postcapture
|
35
|
-
debug 'base plugin, does nothing to anything'
|
36
|
-
end
|
37
|
-
|
38
|
-
def configuration
|
39
|
-
config = runner.config.read_configuration if runner
|
40
|
-
return {} unless config
|
41
|
-
config[self.class.name] || {}
|
42
|
-
end
|
43
|
-
|
44
|
-
# ask for plugin options
|
45
|
-
def configure_options!
|
46
|
-
puts "Configuring plugin: #{self.class.name}\n"
|
47
|
-
options.reduce({}) do |acc, option|
|
48
|
-
print "#{option}: "
|
49
|
-
val = parse_user_input(STDIN.gets.strip)
|
50
|
-
# check enabled option isn't a String
|
51
|
-
if (option == 'enabled') && ![true, false].include?(val)
|
52
|
-
puts "Aborting - please respond with 'true' or 'false'"
|
53
|
-
exit 1
|
54
|
-
else
|
55
|
-
acc.merge(option => val)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def parse_user_input(str)
|
61
|
-
# cater for bools, strings, ints and blanks
|
62
|
-
if 'true'.casecmp(str).zero?
|
63
|
-
true
|
64
|
-
elsif 'false'.casecmp(str).zero?
|
65
|
-
false
|
66
|
-
elsif str =~ /^[0-9]+$/
|
67
|
-
str.to_i
|
68
|
-
elsif str.strip.empty?
|
69
|
-
nil
|
70
|
-
else
|
71
|
-
str
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def enabled?
|
76
|
-
configuration['enabled'] == true
|
77
|
-
end
|
78
|
-
|
79
|
-
# check config is valid
|
80
|
-
def valid_configuration?
|
81
|
-
if configured?
|
82
|
-
true
|
83
|
-
else
|
84
|
-
puts "Missing #{self.class.name} config - configure with: lolcommits --config -p #{self.class.name}"
|
85
|
-
false
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
# empty plugin configuration
|
90
|
-
def configured?
|
91
|
-
!configuration.empty?
|
92
|
-
end
|
93
|
-
|
94
|
-
# uniform puts for plugins
|
95
|
-
# dont puts if the runner wants to be silent (stealth mode)
|
96
|
-
def puts(*args)
|
97
|
-
return if runner && runner.capture_stealth
|
98
|
-
super(args)
|
99
|
-
end
|
100
|
-
|
101
|
-
# helper to log errors with a message via debug
|
102
|
-
def log_error(e, message)
|
103
|
-
debug message
|
104
|
-
debug e.backtrace.join("\n")
|
105
|
-
end
|
106
|
-
|
107
|
-
# uniform debug logging for plugins
|
108
|
-
def debug(msg)
|
109
|
-
super("Plugin: #{self.class}: " + msg)
|
110
|
-
end
|
111
|
-
|
112
|
-
# identifying plugin name (for config, listing)
|
113
|
-
def self.name
|
114
|
-
'plugin'
|
115
|
-
end
|
116
|
-
|
117
|
-
# a plugin requests to be run by the runner in one of the possible positions.
|
118
|
-
# valid options are [:precapture, :postcapture]
|
119
|
-
def self.runner_order
|
120
|
-
nil
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'httmultiparty'
|
3
|
-
|
4
|
-
module Lolcommits
|
5
|
-
class DotCom < Plugin
|
6
|
-
BASE_URL = 'http://lolcommits-dot-com.herokuapp.com'.freeze
|
7
|
-
|
8
|
-
def initialize(runner)
|
9
|
-
super
|
10
|
-
options.concat(%w(api_key api_secret repo_id))
|
11
|
-
end
|
12
|
-
|
13
|
-
def run_postcapture
|
14
|
-
return unless valid_configuration?
|
15
|
-
|
16
|
-
t = Time.now.to_i.to_s
|
17
|
-
HTTMultiParty.post(
|
18
|
-
"#{BASE_URL}/git_commits.json",
|
19
|
-
body: {
|
20
|
-
git_commit: {
|
21
|
-
sha: runner.sha,
|
22
|
-
repo_external_id: configuration['repo_id'],
|
23
|
-
image: File.open(runner.main_image),
|
24
|
-
raw: File.open(runner.snapshot_loc)
|
25
|
-
},
|
26
|
-
|
27
|
-
key: configuration['api_key'],
|
28
|
-
t: t,
|
29
|
-
token: Digest::SHA1.hexdigest(configuration['api_secret'] + t)
|
30
|
-
}
|
31
|
-
)
|
32
|
-
rescue => e
|
33
|
-
log_error(e, "ERROR: HTTMultiParty POST FAILED #{e.class} - #{e.message}")
|
34
|
-
end
|
35
|
-
|
36
|
-
def configured?
|
37
|
-
!configuration['enabled'].nil? &&
|
38
|
-
configuration['api_key'] &&
|
39
|
-
configuration['api_secret'] &&
|
40
|
-
configuration['repo_id']
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.name
|
44
|
-
'dot_com'
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.runner_order
|
48
|
-
:postcapture
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'rest_client'
|
3
|
-
|
4
|
-
module Lolcommits
|
5
|
-
class LolFlowdock < Plugin
|
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
|
-
:postcapture
|
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 = STDIN.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 = STDIN.gets.to_s.strip.downcase
|
29
|
-
print "Enter the name of the organization for this Flowdock account.\n"
|
30
|
-
organization = STDIN.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_postcapture
|
49
|
-
return unless valid_configuration?
|
50
|
-
|
51
|
-
retries = RETRY_COUNT
|
52
|
-
begin
|
53
|
-
|
54
|
-
endpoint = 'https://' + configuration['access_token'] + '@' + ENDPOINT_URL + configuration['organization'] + '/' + configuration['flow'] + '/messages'
|
55
|
-
response = RestClient.post(
|
56
|
-
endpoint,
|
57
|
-
event: 'file',
|
58
|
-
content: File.new(runner.main_image)
|
59
|
-
)
|
60
|
-
debug response
|
61
|
-
rescue => e
|
62
|
-
retries -= 1
|
63
|
-
retry if retries > 0
|
64
|
-
puts "Posting to flowdock failed - #{e.message}"
|
65
|
-
puts 'Try running config again:'
|
66
|
-
puts "\tlolcommits --config --plugin flowdock"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module Lolcommits
|
3
|
-
class LolHipchat < Plugin
|
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 = STDIN.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 = STDIN.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 = STDIN.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_postcapture
|
36
|
-
return unless valid_configuration?
|
37
|
-
|
38
|
-
http = Net::HTTP.new(api_url.host, api_url.port)
|
39
|
-
# http.set_debug_output $stderr # nice for debugging, never ever release with it
|
40
|
-
http.start do |connection|
|
41
|
-
header = { 'Content-Type' => 'multipart/related; boundary=0123456789ABLEWASIEREISAWELBA9876543210' }
|
42
|
-
data = [message_part, picture_part].map do |part|
|
43
|
-
"--0123456789ABLEWASIEREISAWELBA9876543210\r\n#{part}"
|
44
|
-
end.join('') << '--0123456789ABLEWASIEREISAWELBA9876543210--'
|
45
|
-
connection.post("#{api_url.path}?#{api_url.query}", data, header)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def message_part
|
50
|
-
[
|
51
|
-
'Content-Type: application/json; charset=UTF-8',
|
52
|
-
'Content-Disposition: attachment; name="metadata"',
|
53
|
-
'',
|
54
|
-
message_json,
|
55
|
-
''
|
56
|
-
].join "\r\n"
|
57
|
-
end
|
58
|
-
|
59
|
-
def message_json
|
60
|
-
{ message: message }.to_json.force_encoding('utf-8')
|
61
|
-
end
|
62
|
-
|
63
|
-
def picture_part
|
64
|
-
mime_type = MIME::Types.type_for(picture.path)[0] || MIME::Types['application/octet-stream'][0]
|
65
|
-
[
|
66
|
-
format('Content-Type: %s', mime_type.simplified),
|
67
|
-
format('Content-Disposition: attachment; name="file"; filename="%s"', picture.path),
|
68
|
-
'',
|
69
|
-
"#{picture.read} ",
|
70
|
-
''
|
71
|
-
].join "\r\n"
|
72
|
-
end
|
73
|
-
|
74
|
-
def picture
|
75
|
-
@picture ||= File.new(runner.main_image)
|
76
|
-
end
|
77
|
-
|
78
|
-
def api_url
|
79
|
-
URI(format('http://%{api_team}.hipchat.com/v2/room/%{api_room}/share/file?auth_token=%{api_token}', symbolized_configuration))
|
80
|
-
end
|
81
|
-
|
82
|
-
def symbolized_configuration
|
83
|
-
@symbolized_configuration ||= configuration.each_with_object({}) { |(k, v), obj| obj[k.to_sym] = v }
|
84
|
-
end
|
85
|
-
|
86
|
-
def message
|
87
|
-
"commited some #{random_adjective} #{random_object} to #{runner.vcs_info.repo}@#{runner.sha} (#{runner.vcs_info.branch}) "
|
88
|
-
end
|
89
|
-
|
90
|
-
def random_object
|
91
|
-
objects = %w(screws bolts exceptions errors cookies)
|
92
|
-
|
93
|
-
objects.sample
|
94
|
-
end
|
95
|
-
|
96
|
-
def random_adjective
|
97
|
-
adjectives = %w(adaptable adventurous affable affectionate agreeable ambitious amiable amicable amusing brave \
|
98
|
-
bright broad-minded calm careful charming communicative compassionate conscientious considerate \
|
99
|
-
convivial courageous courteous creative decisive determined diligent diplomatic discreet dynamic \
|
100
|
-
easygoing emotional energetic enthusiastic exuberant fair-minded faithful fearless forceful \
|
101
|
-
frank friendly funny generous gentle good gregarious hard-working helpful honest humorous \
|
102
|
-
imaginative impartial independent intellectual intelligent intuitive inventive kind loving loyal \
|
103
|
-
modest neat nice optimistic passionate patient persistent pioneering philosophical placid plucky \
|
104
|
-
polite powerful practical pro-active quick-witted quiet rational reliable reserved resourceful \
|
105
|
-
romantic self-confident self-disciplined sensible sensitive shy sincere sociable straightforward \
|
106
|
-
sympathetic thoughtful tidy tough unassuming understanding versatile warmhearted willing witty)
|
107
|
-
adjectives.sample
|
108
|
-
end
|
109
|
-
|
110
|
-
def configured?
|
111
|
-
super &&
|
112
|
-
configuration['api_token'] &&
|
113
|
-
configuration['api_team'] &&
|
114
|
-
configuration['api_room']
|
115
|
-
end
|
116
|
-
|
117
|
-
def self.name
|
118
|
-
'hipchat'
|
119
|
-
end
|
120
|
-
|
121
|
-
def self.runner_order
|
122
|
-
:postcapture
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'rest_client'
|
3
|
-
|
4
|
-
module Lolcommits
|
5
|
-
class LolProtonet < Plugin
|
6
|
-
def initialize(runner)
|
7
|
-
super
|
8
|
-
options.concat(%w(api_token api_endpoint))
|
9
|
-
end
|
10
|
-
|
11
|
-
def run_postcapture
|
12
|
-
return unless valid_configuration?
|
13
|
-
|
14
|
-
debug "Posting capture to #{configuration['endpoint']}"
|
15
|
-
RestClient.post(
|
16
|
-
api_url,
|
17
|
-
{
|
18
|
-
files: [File.new(runner.main_image)],
|
19
|
-
message: message
|
20
|
-
},
|
21
|
-
'X-Protonet-Token' => configuration['api_token']
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
def api_url
|
26
|
-
configuration['api_endpoint']
|
27
|
-
end
|
28
|
-
|
29
|
-
def message
|
30
|
-
"commited some #{random_adjective} #{random_object} to #{runner.vcs_info.repo}@#{runner.sha} (#{runner.vcs_info.branch}) "
|
31
|
-
end
|
32
|
-
|
33
|
-
def random_object
|
34
|
-
objects = %w(screws bolts exceptions errors cookies)
|
35
|
-
|
36
|
-
objects.sample
|
37
|
-
end
|
38
|
-
|
39
|
-
def random_adjective
|
40
|
-
adjectives = [
|
41
|
-
'awesome', 'great', 'interesting', 'cool', 'EPIC', 'gut', 'good', 'pansy',
|
42
|
-
'powerful', 'boring', 'quirky', 'untested', 'german', 'iranian', 'neutral', 'crazy', 'well tested',
|
43
|
-
'jimmy style', 'nasty', 'bibliographical (we received complaints about the original wording)',
|
44
|
-
'bombdiggidy', 'narly', 'spiffy', 'smashing', 'xing style',
|
45
|
-
'leo apotheker style', 'black', 'white', 'yellow', 'shaggy', 'tasty', 'mind bending', 'JAY-Z',
|
46
|
-
'Kanye (the best ever)', '* Toby Keith was here *', 'splendid', 'stupendulous',
|
47
|
-
'(freedom fries!)', '[vote RON PAUL]', '- these are not my glasses -', 'typical pansy',
|
48
|
-
'- ze goggles zey do nothing! -', 'almost working', 'legen- wait for it -', '-dairy!',
|
49
|
-
' - Tavonius would be proud of this - ', 'Meg FAILMAN!', '- very brofessional of you -',
|
50
|
-
'heartbleeding', 'juciy', 'supercalifragilisticexpialidocious', 'failing', 'loving'
|
51
|
-
]
|
52
|
-
adjectives.sample
|
53
|
-
end
|
54
|
-
|
55
|
-
def configured?
|
56
|
-
!configuration['enabled'].nil? &&
|
57
|
-
configuration['api_token'] &&
|
58
|
-
configuration['api_endpoint']
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.name
|
62
|
-
'lolprotonet'
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.runner_order
|
66
|
-
:postcapture
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|