lolcommits 0.9.2 → 0.9.3.pre1
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 +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/CONTRIBUTING.md
CHANGED
@@ -22,7 +22,7 @@ ensure Ruby style guidelines. If you want to run tests before conforming to this
|
|
22
22
|
to verify functionality, just run `rake test` and `rake features` manually.
|
23
23
|
|
24
24
|
With a passing test suite, commit your changes, push and submit a new [Pull
|
25
|
-
Request](https://github.com/mroth/
|
25
|
+
Request](https://github.com/mroth/lolcommits/compare/):
|
26
26
|
|
27
27
|
git commit -am 'Added some feature'
|
28
28
|
git push origin my-new-feature
|
@@ -34,7 +34,7 @@ request gets accepted:
|
|
34
34
|
|
35
35
|
* Explain what your are doing (and why) in your Pull Request description.
|
36
36
|
* If you are fixing an
|
37
|
-
[issue](https://github.com/mroth/
|
37
|
+
[issue](https://github.com/mroth/lolcommits/issues), link to
|
38
38
|
it in your description and [mention
|
39
39
|
it](https://help.github.com/articles/closing-issues-via-commit-messages/) in
|
40
40
|
the commit message.
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ makes this easy.
|
|
40
40
|
|
41
41
|
brew install imagemagick
|
42
42
|
|
43
|
-
Then install
|
43
|
+
Then install with:
|
44
44
|
|
45
45
|
[sudo] gem install lolcommits
|
46
46
|
|
@@ -51,7 +51,7 @@ If [Boxen](https://boxen.github.com) is your thing, [try
|
|
51
51
|
this](https://github.com/AssuredLabor/puppet-lolcommits).
|
52
52
|
|
53
53
|
Lolcommits v0.8.1 was the last release to support Ruby < 2.0. If you'd like to
|
54
|
-
use this
|
54
|
+
use this program on older rubies try:
|
55
55
|
|
56
56
|
[sudo] gem install lolcommits --version 0.8.1 # for Ruby 1.9
|
57
57
|
[sudo] gem install lolcommits --version 0.7.0 # for Ruby 1.8
|
@@ -68,7 +68,7 @@ For Ubuntu 14.04 or newer, you need to manually install ffmpeg since it no
|
|
68
68
|
longer ships with the default Ubuntu sources. [Downloads for
|
69
69
|
ffmpeg](http://ffmpeg.org/download.html)
|
70
70
|
|
71
|
-
Then install
|
71
|
+
Then install with:
|
72
72
|
|
73
73
|
gem install lolcommits
|
74
74
|
|
@@ -209,3 +209,10 @@ issue](https://github.com/mroth/lolcommits/issues) (and please take a little
|
|
209
209
|
time to check if we haven't [already
|
210
210
|
addressed](https://github.com/mroth/lolcommits/issues?q=is%3Aissue+is%3Aclosed)
|
211
211
|
it).
|
212
|
+
|
213
|
+
|
214
|
+
## License
|
215
|
+
|
216
|
+
The program is available as open source under the terms of
|
217
|
+
[LGPL-3](https://opensource.org/licenses/LGPL-3.0).
|
218
|
+
|
data/bin/lolcommits
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# -*- encoding: utf-8 -*-
|
3
2
|
|
4
3
|
begin
|
5
4
|
require 'lolcommits'
|
@@ -37,6 +36,9 @@ class App
|
|
37
36
|
debug 'Outputting at DEBUG verbosity'
|
38
37
|
end
|
39
38
|
|
39
|
+
# TODO: move to a better place
|
40
|
+
load_plugins
|
41
|
+
|
40
42
|
if options[:'show-config']
|
41
43
|
puts configuration
|
42
44
|
elsif options[:plugins]
|
@@ -123,6 +125,12 @@ class App
|
|
123
125
|
options[:debug] || ENV['LOLCOMMITS_DEBUG'] || false
|
124
126
|
end
|
125
127
|
|
128
|
+
def self.load_plugins
|
129
|
+
pm = Lolcommits::PluginManager.new
|
130
|
+
pm.locate_plugins
|
131
|
+
pm.load_plugins
|
132
|
+
end
|
133
|
+
|
126
134
|
def self.device_list_help
|
127
135
|
'Specify a device with --device "{device name}" or set the LOLCOMMITS_DEVICE env variable'
|
128
136
|
end
|
@@ -196,16 +204,6 @@ class App
|
|
196
204
|
capture_animate > 0
|
197
205
|
end
|
198
206
|
|
199
|
-
# TODO: remove this after implementing gem based plugins
|
200
|
-
# https://github.com/mroth/lolcommits/issues/99
|
201
|
-
# Until then for local plugin dev, use $LOLCOMMITS_DIR/.plugins directory
|
202
|
-
def self.load_local_plugins!
|
203
|
-
plugins_dir = Configuration.loldir_for('.plugins')
|
204
|
-
Dir.glob("#{plugins_dir}/*.rb").each do |plugin|
|
205
|
-
load plugin
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
207
|
#
|
210
208
|
# change working dir to either a repo or the fs root
|
211
209
|
#
|
@@ -223,10 +221,5 @@ class App
|
|
223
221
|
end
|
224
222
|
end
|
225
223
|
|
226
|
-
#
|
227
|
-
# load plugins
|
228
|
-
#
|
229
|
-
load_local_plugins!
|
230
|
-
|
231
224
|
go!
|
232
225
|
end
|
data/features/support/env.rb
CHANGED
data/lib/lolcommits.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
$LOAD_PATH.unshift File.expand_path('.')
|
3
2
|
|
4
|
-
require 'core_ext/class'
|
5
3
|
require 'mini_magick'
|
6
4
|
require 'core_ext/mini_magick/utilities'
|
7
5
|
require 'fileutils'
|
@@ -17,8 +15,9 @@ require 'lolcommits/configuration'
|
|
17
15
|
require 'lolcommits/capturer'
|
18
16
|
require 'lolcommits/vcs_info'
|
19
17
|
require 'lolcommits/installation'
|
20
|
-
require 'lolcommits/plugin'
|
21
18
|
require 'lolcommits/platform'
|
19
|
+
require 'lolcommits/gem_plugin'
|
20
|
+
require 'lolcommits/plugin_manager'
|
22
21
|
|
23
22
|
# after lolcommits/platform, so that we can do platform-conditional override
|
24
23
|
require 'core_ext/mercurial-ruby/command'
|
@@ -29,19 +28,20 @@ require 'lolcommits/backends/installation_mercurial'
|
|
29
28
|
require 'lolcommits/backends/git_info'
|
30
29
|
require 'lolcommits/backends/mercurial_info'
|
31
30
|
|
32
|
-
require 'lolcommits/
|
33
|
-
require 'lolcommits/
|
34
|
-
require 'lolcommits/
|
35
|
-
require 'lolcommits/
|
36
|
-
require 'lolcommits/
|
37
|
-
require 'lolcommits/
|
38
|
-
require 'lolcommits/
|
39
|
-
require 'lolcommits/
|
40
|
-
require 'lolcommits/
|
41
|
-
require 'lolcommits/
|
42
|
-
require 'lolcommits/
|
43
|
-
require 'lolcommits/
|
44
|
-
require 'lolcommits/
|
31
|
+
require 'lolcommits/plugin/base'
|
32
|
+
require 'lolcommits/plugin/loltext'
|
33
|
+
require 'lolcommits/plugin/dot_com'
|
34
|
+
require 'lolcommits/plugin/tranzlate'
|
35
|
+
require 'lolcommits/plugin/lol_twitter'
|
36
|
+
require 'lolcommits/plugin/uploldz'
|
37
|
+
require 'lolcommits/plugin/term_output'
|
38
|
+
require 'lolcommits/plugin/lolsrv'
|
39
|
+
require 'lolcommits/plugin/lol_yammer'
|
40
|
+
require 'lolcommits/plugin/lol_protonet'
|
41
|
+
require 'lolcommits/plugin/lol_tumblr'
|
42
|
+
require 'lolcommits/plugin/lol_slack'
|
43
|
+
require 'lolcommits/plugin/lol_flowdock'
|
44
|
+
require 'lolcommits/plugin/lol_hipchat'
|
45
45
|
|
46
46
|
# require runner after all the plugins have been required
|
47
47
|
require 'lolcommits/runner'
|
data/lib/lolcommits/capturer.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
require 'lolcommits/platform'
|
3
2
|
require 'methadone'
|
4
3
|
|
@@ -28,13 +27,6 @@ module Lolcommits
|
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
31
|
-
# make sure we can find the default font
|
32
|
-
unless File.readable? Lolcommits::Loltext::DEFAULT_FONT_PATH
|
33
|
-
fatal "Couldn't properly read Impact font from gem package, "\
|
34
|
-
'please file a bug?!'
|
35
|
-
exit 1
|
36
|
-
end
|
37
|
-
|
38
30
|
# make sure imagemagick is around and good to go
|
39
31
|
unless Platform.valid_imagemagick_installed?
|
40
32
|
fatal 'FATAL: ImageMagick does not appear to be properly installed!'\
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
1
|
module Lolcommits
|
4
2
|
class Configuration
|
5
3
|
LOLCOMMITS_BASE = ENV['LOLCOMMITS_DIR'] || File.join(ENV['HOME'], '.lolcommits')
|
@@ -14,6 +12,8 @@ module Lolcommits
|
|
14
12
|
|
15
13
|
def read_configuration
|
16
14
|
return unless File.exist?(configuration_file)
|
15
|
+
# TODO: change to safe_load when Ruby 2.0.0 support drops
|
16
|
+
# YAML.safe_load(File.open(configuration_file), [Symbol])
|
17
17
|
YAML.load(File.open(configuration_file))
|
18
18
|
end
|
19
19
|
|
@@ -68,31 +68,34 @@ module Lolcommits
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def plugins_list
|
71
|
-
"Available plugins: \n * #{Lolcommits::Runner.plugins.map(&:name).join("\n * ")}"
|
71
|
+
"Available plugins: \n * #{Lolcommits::Runner.plugins.map(&:name).sort.join("\n * ")}"
|
72
72
|
end
|
73
73
|
|
74
74
|
def ask_for_plugin_name
|
75
75
|
puts plugins_list
|
76
76
|
print 'Name of plugin to configure: '
|
77
|
-
|
77
|
+
gets.strip
|
78
78
|
end
|
79
79
|
|
80
|
-
def find_plugin(
|
80
|
+
def find_plugin(plugin_name_option)
|
81
|
+
plugin_name = plugin_name_option.empty? ? ask_for_plugin_name : plugin_name_option
|
82
|
+
|
81
83
|
Lolcommits::Runner.plugins.each do |plugin|
|
82
84
|
return plugin.new(nil) if plugin.name == plugin_name
|
83
85
|
end
|
84
86
|
|
85
87
|
puts "Unable to find plugin: '#{plugin_name}'"
|
88
|
+
return if plugin_name_option.empty?
|
86
89
|
puts plugins_list
|
87
90
|
end
|
88
91
|
|
89
92
|
def do_configure!(plugin_name)
|
90
93
|
$stdout.sync = true
|
91
|
-
plugin_name = ask_for_plugin_name if plugin_name.to_s.strip.empty?
|
92
94
|
|
93
|
-
plugin = find_plugin(plugin_name)
|
95
|
+
plugin = find_plugin(plugin_name.to_s.strip)
|
94
96
|
return unless plugin
|
95
97
|
config = read_configuration || {}
|
98
|
+
plugin_name = plugin.class.name
|
96
99
|
plugin_config = plugin.configure_options!
|
97
100
|
# having a plugin_config, means configuring went OK
|
98
101
|
if plugin_config
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Lolcommits
|
2
|
+
class GemPlugin
|
3
|
+
attr_accessor :name, :gem_name, :spec, :required
|
4
|
+
|
5
|
+
def initialize(name, gem_name, spec)
|
6
|
+
@name = name
|
7
|
+
@gem_name = gem_name
|
8
|
+
@spec = spec
|
9
|
+
@required = false
|
10
|
+
end
|
11
|
+
|
12
|
+
# activate the plugin (require the gem - enables/loads the plugin
|
13
|
+
# immediately at point of call if not already required)
|
14
|
+
def activate!
|
15
|
+
begin
|
16
|
+
require gem_path unless required?
|
17
|
+
rescue LoadError => e
|
18
|
+
warn "Found plugin #{gem_name}, but could not require '#{gem_name}'"
|
19
|
+
warn e
|
20
|
+
rescue => e
|
21
|
+
warn "require '#{gem_name}' # Failed, saying: #{e}"
|
22
|
+
end
|
23
|
+
|
24
|
+
self.required = true
|
25
|
+
end
|
26
|
+
|
27
|
+
alias required? required
|
28
|
+
|
29
|
+
def supported?
|
30
|
+
# false if the plugin gem does not support this version of Lolcommits
|
31
|
+
lolcommits_version = Gem::Version.new(::Lolcommits::VERSION)
|
32
|
+
spec.dependencies.each do |dependency|
|
33
|
+
if dependency.name == Lolcommits::GEM_NAME
|
34
|
+
return dependency.requirement.satisfied_by?(lolcommits_version)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def gem_path
|
43
|
+
gem_name.gsub(/-|_/, '/')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/lolcommits/platform.rb
CHANGED
@@ -0,0 +1,110 @@
|
|
1
|
+
module Lolcommits
|
2
|
+
module Plugin
|
3
|
+
class Base
|
4
|
+
attr_accessor :runner, :options
|
5
|
+
|
6
|
+
def initialize(runner)
|
7
|
+
self.runner = runner
|
8
|
+
self.options = ['enabled']
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute_precapture
|
12
|
+
return unless valid_configuration?
|
13
|
+
return unless enabled?
|
14
|
+
debug 'I am enabled, about to run precapture'
|
15
|
+
run_precapture
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute_postcapture
|
19
|
+
return unless valid_configuration?
|
20
|
+
return unless enabled?
|
21
|
+
debug 'I am enabled, about to run postcapture'
|
22
|
+
run_postcapture
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_precapture; end
|
26
|
+
|
27
|
+
def run_postcapture; end
|
28
|
+
|
29
|
+
def configuration
|
30
|
+
config = runner.config.read_configuration if runner
|
31
|
+
return {} unless config
|
32
|
+
config[self.class.name] || {}
|
33
|
+
end
|
34
|
+
|
35
|
+
# ask for plugin options
|
36
|
+
def configure_options!
|
37
|
+
puts "Configuring plugin: #{self.class.name}\n"
|
38
|
+
options.reduce({}) do |acc, option|
|
39
|
+
print "#{option}: "
|
40
|
+
val = parse_user_input(gets.strip)
|
41
|
+
# check enabled option isn't a String
|
42
|
+
if (option == 'enabled') && ![true, false].include?(val)
|
43
|
+
puts "Aborting - please respond with 'true' or 'false'"
|
44
|
+
exit 1
|
45
|
+
else
|
46
|
+
acc.merge(option => val)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def parse_user_input(str)
|
52
|
+
# cater for bools, strings, ints and blanks
|
53
|
+
if 'true'.casecmp(str).zero?
|
54
|
+
true
|
55
|
+
elsif 'false'.casecmp(str).zero?
|
56
|
+
false
|
57
|
+
elsif str =~ /^[0-9]+$/
|
58
|
+
str.to_i
|
59
|
+
elsif str.strip.empty?
|
60
|
+
nil
|
61
|
+
else
|
62
|
+
str
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def enabled?
|
67
|
+
configuration['enabled'] == true
|
68
|
+
end
|
69
|
+
|
70
|
+
# check config is valid
|
71
|
+
def valid_configuration?
|
72
|
+
configured?
|
73
|
+
end
|
74
|
+
|
75
|
+
# empty plugin configuration
|
76
|
+
def configured?
|
77
|
+
!configuration.empty?
|
78
|
+
end
|
79
|
+
|
80
|
+
# uniform puts for plugins
|
81
|
+
# dont puts if the runner wants to be silent (stealth mode)
|
82
|
+
def puts(*args)
|
83
|
+
return if runner && runner.capture_stealth
|
84
|
+
super(args)
|
85
|
+
end
|
86
|
+
|
87
|
+
# helper to log errors with a message via debug
|
88
|
+
def log_error(e, message)
|
89
|
+
debug message
|
90
|
+
debug e.backtrace.join("\n")
|
91
|
+
end
|
92
|
+
|
93
|
+
# uniform debug logging for plugins
|
94
|
+
def debug(msg)
|
95
|
+
super("#{self.class}: " + msg)
|
96
|
+
end
|
97
|
+
|
98
|
+
# identifying plugin name (for config, listing)
|
99
|
+
def self.name
|
100
|
+
'plugin'
|
101
|
+
end
|
102
|
+
|
103
|
+
# a plugin requests to be run by the runner in one of these positions
|
104
|
+
# valid options are [:precapture, :postcapture]
|
105
|
+
def self.runner_order
|
106
|
+
nil
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|