lolcommits 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +23 -13
- data/CHANGELOG.md +9 -2
- data/README.md +2 -3
- data/Rakefile +11 -1
- data/lib/lolcommits/backends/git_info.rb +1 -1
- data/lib/lolcommits/backends/mercurial_info.rb +1 -1
- data/lib/lolcommits/capturer/capture_windows_animated.rb +1 -1
- data/lib/lolcommits/configuration.rb +1 -1
- data/lib/lolcommits/gem_plugin.rb +5 -4
- data/lib/lolcommits/platform.rb +2 -2
- data/lib/lolcommits/plugin/base.rb +5 -19
- data/lib/lolcommits/plugin_manager.rb +7 -6
- data/lib/lolcommits/runner.rb +7 -11
- data/lib/lolcommits/version.rb +1 -1
- data/lolcommits.gemspec +2 -2
- data/test/permissions_test.rb +20 -0
- data/test/test_helper.rb +11 -0
- metadata +7 -5
- data/test/lolcommits_test.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5674698718c6e29b478a9c7e333b5a2983535f444b5aee83d0d5612a22d5ee73
|
4
|
+
data.tar.gz: 9de7e8e711ceaffd45d37d98c0a3878104505d174ff4f6cb1676ff077ec016f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 716f490a4943d472f9fbcff961572ce97c981552a9f115b8f96c8a53717190eb53aa25755eb70133fd3566c31966c69868f638388ec01863872eafe5e3c9e8a8
|
7
|
+
data.tar.gz: 5634f2dc4c8a6ae5c465a3eedaa08a5968468dea9d95cf59706386e3c1a1e196ab3fc6d585e1eb7fb9f74ba3082651dafa4c955fbbd669e2263c3493800452ea
|
data/.travis.yml
CHANGED
@@ -2,21 +2,21 @@ sudo: false
|
|
2
2
|
language: ruby
|
3
3
|
cache: bundler
|
4
4
|
rvm:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
- 2.1.10
|
6
|
+
- 2.2.9
|
7
|
+
- 2.3.6
|
8
|
+
- 2.4.3
|
9
|
+
- 2.5.0
|
10
|
+
- ruby-head
|
11
11
|
|
12
12
|
before_install:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
# stub mplayer/ffmpeg so it looks like they are installed
|
14
|
+
- mkdir -p ~/bin
|
15
|
+
- touch ~/bin/mplayer ~/bin/ffmpeg
|
16
|
+
- chmod +x ~/bin/mplayer ~/bin/ffmpeg
|
17
|
+
- export PATH=~/bin:$PATH
|
18
|
+
- gem update --system
|
19
|
+
- git --version
|
20
20
|
|
21
21
|
matrix:
|
22
22
|
allow_failures:
|
@@ -35,3 +35,13 @@ deploy:
|
|
35
35
|
tags: true
|
36
36
|
all_branches: true
|
37
37
|
repo: mroth/lolcommits
|
38
|
+
|
39
|
+
env:
|
40
|
+
global:
|
41
|
+
- CC_TEST_REPORTER_ID=b8f6cc45b054ac68b7fddf7bb99379efb3dbc6fb728506d9975c63064d971071
|
42
|
+
before_script:
|
43
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
44
|
+
- chmod +x ./cc-test-reporter
|
45
|
+
- ./cc-test-reporter before-build
|
46
|
+
after_script:
|
47
|
+
- ./cc-test-reporter after-build
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ project adheres to [Semantic Versioning][Semver].
|
|
7
7
|
|
8
8
|
* Your contribution here!
|
9
9
|
|
10
|
+
## [0.12.0][] (15 March 2018)
|
11
|
+
* Use CodeClimate and simplecov for coverage reports (@matthutchinson [#367][])
|
12
|
+
* Remove plugin runner order (@matthutchinson [#369][])
|
13
|
+
|
10
14
|
## [0.11.0][] (4 February 2018)
|
11
15
|
* Require at least Ruby 2.1 (@matthutchinson [#366][])
|
12
16
|
- drop support for Ruby 2.0
|
@@ -316,8 +320,9 @@ project adheres to [Semantic Versioning][Semver].
|
|
316
320
|
instead of compositing multiply image Caption objects (this seems to be more
|
317
321
|
reliable to not glitch.)
|
318
322
|
|
319
|
-
[Unreleased]: https://github.com/mroth/lolcommits/compare/v0.
|
320
|
-
[0.
|
323
|
+
[Unreleased]: https://github.com/mroth/lolcommits/compare/v0.12.0...HEAD
|
324
|
+
[0.12.0]: https://github.com/mroth/lolcommits/compare/v0.11.0...v0.12.0
|
325
|
+
[0.11.0]: https://github.com/mroth/lolcommits/compare/v0.10.0...v0.11.0
|
321
326
|
[0.10.0]: https://github.com/mroth/lolcommits/compare/v0.9.8...v0.10.0
|
322
327
|
[0.9.8]: https://github.com/mroth/lolcommits/compare/v0.9.7...v0.9.8
|
323
328
|
[0.9.7]: https://github.com/mroth/lolcommits/compare/v0.9.6...v0.9.7
|
@@ -503,3 +508,5 @@ project adheres to [Semantic Versioning][Semver].
|
|
503
508
|
[#363]: https://github.com/mroth/lolcommits/pull/363
|
504
509
|
[#365]: https://github.com/mroth/lolcommits/pull/365
|
505
510
|
[#366]: https://github.com/mroth/lolcommits/pull/366
|
511
|
+
[#367]: https://github.com/mroth/lolcommits/pull/367
|
512
|
+
[#369]: https://github.com/mroth/lolcommits/pull/369
|
data/README.md
CHANGED
@@ -10,9 +10,8 @@ By default, the lol images are stored by a Github style short SHA in a
|
|
10
10
|
[![Gem Version](https://badge.fury.io/rb/lolcommits.svg)](https://rubygems.org/gems/lolcommits)
|
11
11
|
[![Build Status](https://travis-ci.org/mroth/lolcommits.svg?branch=master)](https://travis-ci.org/mroth/lolcommits)
|
12
12
|
[![Dependency Status](https://gemnasium.com/mroth/lolcommits.svg)](https://gemnasium.com/mroth/lolcommits)
|
13
|
-
[![
|
14
|
-
[![Coverage
|
15
|
-
|
13
|
+
[![Maintainability](https://img.shields.io/codeclimate/maintainability/mroth/lolcommits.svg)](https://codeclimate.com/github/mroth/lolcommits/maintainability)
|
14
|
+
[![Test Coverage](https://img.shields.io/codeclimate/c/mroth/lolcommits.svg)](https://codeclimate.com/github/mroth/lolcommits/test_coverage)
|
16
15
|
|
17
16
|
## Sample images
|
18
17
|
|
data/Rakefile
CHANGED
@@ -48,7 +48,6 @@ end
|
|
48
48
|
|
49
49
|
require 'rubocop/rake_task'
|
50
50
|
RuboCop::RakeTask.new
|
51
|
-
task default: [:rubocop, :test, :features]
|
52
51
|
|
53
52
|
desc 'Migrate an existing local .lolcommits directory to Dropbox'
|
54
53
|
task :dropboxify do
|
@@ -71,3 +70,14 @@ task :dropboxify do
|
|
71
70
|
# copy over existing files
|
72
71
|
FileUtils.cp_r("#{backup_loldir}/.", loldir)
|
73
72
|
end
|
73
|
+
|
74
|
+
# run tests with code coverage
|
75
|
+
namespace :test do
|
76
|
+
desc 'Run all unit tests and generate a coverage report'
|
77
|
+
task :coverage do
|
78
|
+
ENV['COVERAGE'] = 'true'
|
79
|
+
Rake::Task[:test].execute
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
task default: [:rubocop, 'test:coverage', :features]
|
@@ -12,7 +12,7 @@ module Lolcommits
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def yaml
|
15
|
-
@
|
15
|
+
@yaml ||= begin
|
16
16
|
return Hash.new({}) unless File.exist?(configuration_file)
|
17
17
|
# TODO: change to safe_load when Ruby 2.0.0 support drops
|
18
18
|
# YAML.safe_load(File.open(configuration_file), [Symbol])
|
@@ -34,10 +34,6 @@ module Lolcommits
|
|
34
34
|
true
|
35
35
|
end
|
36
36
|
|
37
|
-
def name
|
38
|
-
gem_name.split('-', 2).last
|
39
|
-
end
|
40
|
-
|
41
37
|
def plugin_klass
|
42
38
|
self.class.const_get(plugin_klass_name)
|
43
39
|
rescue StandardError => e
|
@@ -45,6 +41,7 @@ module Lolcommits
|
|
45
41
|
end
|
46
42
|
|
47
43
|
def plugin_instance(runner)
|
44
|
+
# TODO: pass name to initializer as arg when all gems updated to accept
|
48
45
|
plugin_klass.new(runner: runner, config: runner.config.yaml[name])
|
49
46
|
end
|
50
47
|
|
@@ -52,6 +49,10 @@ module Lolcommits
|
|
52
49
|
gem_spec.name
|
53
50
|
end
|
54
51
|
|
52
|
+
def name
|
53
|
+
gem_name.split('-', 2).last
|
54
|
+
end
|
55
|
+
|
55
56
|
private
|
56
57
|
|
57
58
|
def gem_path
|
data/lib/lolcommits/platform.rb
CHANGED
@@ -65,8 +65,8 @@ module Lolcommits
|
|
65
65
|
# cli_version check will throw a MiniMagick::Error exception if IM is not
|
66
66
|
# installed in PATH, since it attempts to parse output from `identify`
|
67
67
|
!MiniMagick.cli_version.nil?
|
68
|
-
rescue
|
69
|
-
|
68
|
+
rescue MiniMagick::Error
|
69
|
+
false
|
70
70
|
end
|
71
71
|
|
72
72
|
# Is a valid install of ffmpeg present on the system?
|
@@ -5,10 +5,11 @@ module Lolcommits
|
|
5
5
|
class Base
|
6
6
|
include Lolcommits::Plugin::ConfigurationHelper
|
7
7
|
|
8
|
-
attr_accessor :runner, :configuration, :options
|
8
|
+
attr_accessor :runner, :configuration, :options, :name
|
9
9
|
|
10
|
-
def initialize(runner: nil, config: {})
|
10
|
+
def initialize(runner: nil, name: nil, config: {})
|
11
11
|
self.runner = runner
|
12
|
+
self.name = name || self.class.to_s
|
12
13
|
self.configuration = config || {}
|
13
14
|
self.options = [:enabled]
|
14
15
|
end
|
@@ -89,9 +90,9 @@ module Lolcommits
|
|
89
90
|
end
|
90
91
|
|
91
92
|
# helper to log errors with a message via debug
|
92
|
-
def log_error(
|
93
|
+
def log_error(error, message)
|
93
94
|
debug message
|
94
|
-
debug
|
95
|
+
debug error.backtrace.join("\n")
|
95
96
|
end
|
96
97
|
|
97
98
|
# uniform debug logging for plugins
|
@@ -99,21 +100,6 @@ module Lolcommits
|
|
99
100
|
super("#{self.class}: " + msg)
|
100
101
|
end
|
101
102
|
|
102
|
-
# Returns position(s) of when a plugin should run during the capture
|
103
|
-
# process.
|
104
|
-
#
|
105
|
-
# Defines when the plugin will execute in the capture process. This must
|
106
|
-
# be defined, if the method returns nil, or [] the plugin will never run.
|
107
|
-
# Three hook positions exist, your plugin code can execute in one or more
|
108
|
-
# of these.
|
109
|
-
#
|
110
|
-
# @return [Array] the position(s) (:pre_capture, :post_capture,
|
111
|
-
# :capture_ready)
|
112
|
-
#
|
113
|
-
def self.runner_order
|
114
|
-
[]
|
115
|
-
end
|
116
|
-
|
117
103
|
private
|
118
104
|
|
119
105
|
def configure_option_hash(option_hash, spacing_count = 0)
|
@@ -20,12 +20,6 @@ module Lolcommits
|
|
20
20
|
@plugins.map(&:activate!)
|
21
21
|
end
|
22
22
|
|
23
|
-
def plugins_for(position)
|
24
|
-
@plugins.select do |plugin|
|
25
|
-
Array(plugin.plugin_klass.runner_order).include?(position)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
23
|
# @return [Lolcommits::Plugin] finds the first plugin matching name
|
30
24
|
def find_by_name(name)
|
31
25
|
@plugins.find { |plugin| plugin.name =~ /^#{name}/ } unless name.empty?
|
@@ -35,6 +29,13 @@ module Lolcommits
|
|
35
29
|
@plugins.map(&:name).sort
|
36
30
|
end
|
37
31
|
|
32
|
+
def enabled_plugins_for(runner)
|
33
|
+
@plugins.map do |gem_plugin|
|
34
|
+
plugin = gem_plugin.plugin_instance(runner)
|
35
|
+
plugin.enabled? ? plugin : nil
|
36
|
+
end.compact
|
37
|
+
end
|
38
|
+
|
38
39
|
private
|
39
40
|
|
40
41
|
# @return [Array] find all installed and supported plugins, populate
|
data/lib/lolcommits/runner.rb
CHANGED
@@ -20,21 +20,17 @@ module Lolcommits
|
|
20
20
|
raise('Unknown VCS')
|
21
21
|
end
|
22
22
|
|
23
|
-
self.sha
|
24
|
-
self.message
|
23
|
+
self.sha = vcs_info.sha if sha.nil?
|
24
|
+
self.message = vcs_info.message if message.nil?
|
25
25
|
end
|
26
26
|
|
27
27
|
def execute_plugins_for(hook)
|
28
|
-
|
29
|
-
|
30
|
-
plugin = gem_plugin.plugin_instance(self)
|
31
|
-
next unless plugin.enabled?
|
32
|
-
|
28
|
+
debug "#{self.class}: running all enabled plugin hooks for #{hook}"
|
29
|
+
enabled_plugins.each do |plugin|
|
33
30
|
if plugin.valid_configuration?
|
34
|
-
debug "Runner: #{plugin_name} is enabled with valid config, running #{hook}"
|
35
31
|
plugin.send("run_#{hook}")
|
36
32
|
else
|
37
|
-
puts "Warning: skipping plugin #{
|
33
|
+
puts "Warning: skipping plugin #{plugin.name} (invalid configuration, fix with: lolcommits --config -p #{plugin.name})"
|
38
34
|
end
|
39
35
|
end
|
40
36
|
end
|
@@ -91,8 +87,8 @@ module Lolcommits
|
|
91
87
|
|
92
88
|
private
|
93
89
|
|
94
|
-
def
|
95
|
-
@
|
90
|
+
def enabled_plugins
|
91
|
+
@enabled_plugins ||= config.plugin_manager.enabled_plugins_for(self)
|
96
92
|
end
|
97
93
|
|
98
94
|
def image_file_type
|
data/lib/lolcommits/version.rb
CHANGED
data/lolcommits.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
lib = File.expand_path('
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require 'lolcommits/version'
|
4
4
|
|
@@ -66,6 +66,6 @@ POSTINSTALL
|
|
66
66
|
s.add_development_dependency('pry')
|
67
67
|
s.add_development_dependency('rubocop')
|
68
68
|
s.add_development_dependency('minitest')
|
69
|
-
s.add_development_dependency('
|
69
|
+
s.add_development_dependency('simplecov')
|
70
70
|
s.add_development_dependency('ffaker')
|
71
71
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
2
|
+
|
3
|
+
class PermissionsTest < Minitest::Test
|
4
|
+
#
|
5
|
+
# issue #53, https://github.com/mroth/lolcommits/issues/53
|
6
|
+
# this will test the permissions but only locally, important before building a gem package!
|
7
|
+
#
|
8
|
+
def test_permissions
|
9
|
+
imagesnap_perms = File.lstat(File.join(Lolcommits::Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'imagesnap', 'imagesnap')).mode & 0o777
|
10
|
+
videosnap_perms = File.lstat(File.join(Lolcommits::Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'videosnap', 'videosnap')).mode & 0o777
|
11
|
+
commandcam_perms = File.lstat(File.join(Lolcommits::Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'CommandCam', 'CommandCam.exe')).mode & 0o777
|
12
|
+
|
13
|
+
assert imagesnap_perms == 0o755 || imagesnap_perms == 0o775,
|
14
|
+
"expected perms of 755/775 but instead got #{format '%<perms>o', perms: imagesnap_perms}"
|
15
|
+
assert videosnap_perms == 0o755 || videosnap_perms == 0o775,
|
16
|
+
"expected perms of 755/775 but instead got #{format '%<perms>o', perms: videosnap_perms}"
|
17
|
+
assert commandcam_perms == 0o755 || commandcam_perms == 0o775,
|
18
|
+
"expected perms of 755/775 but instead got #{format '%<perms>o', perms: commandcam_perms}"
|
19
|
+
end
|
20
|
+
end
|
data/test/test_helper.rb
ADDED
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.
|
4
|
+
version: 0.12.0
|
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: 2018-
|
12
|
+
date: 2018-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: methadone
|
@@ -194,7 +194,7 @@ dependencies:
|
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
196
|
- !ruby/object:Gem::Dependency
|
197
|
-
name:
|
197
|
+
name: simplecov
|
198
198
|
requirement: !ruby/object:Gem::Requirement
|
199
199
|
requirements:
|
200
200
|
- - ">="
|
@@ -294,7 +294,8 @@ files:
|
|
294
294
|
- lib/lolcommits/version.rb
|
295
295
|
- lolcommits.gemspec
|
296
296
|
- test/images/test_image.jpg
|
297
|
-
- test/
|
297
|
+
- test/permissions_test.rb
|
298
|
+
- test/test_helper.rb
|
298
299
|
- vendor/ext/CommandCam/COPYING
|
299
300
|
- vendor/ext/CommandCam/CommandCam.exe
|
300
301
|
- vendor/ext/CommandCam/LICENSE
|
@@ -351,4 +352,5 @@ test_files:
|
|
351
352
|
- features/support/env.rb
|
352
353
|
- features/support/path_helpers.rb
|
353
354
|
- test/images/test_image.jpg
|
354
|
-
- test/
|
355
|
+
- test/permissions_test.rb
|
356
|
+
- test/test_helper.rb
|
data/test/lolcommits_test.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'coveralls'
|
2
|
-
Coveralls.wear!
|
3
|
-
|
4
|
-
require 'minitest/autorun'
|
5
|
-
|
6
|
-
# Loads lolcommits directly from the lib folder so don't have to create
|
7
|
-
# a gem before testing
|
8
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
9
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
10
|
-
require 'lolcommits'
|
11
|
-
|
12
|
-
include Lolcommits
|
13
|
-
include Methadone::CLILogging
|
14
|
-
|
15
|
-
class LolTest < MiniTest::Test
|
16
|
-
#
|
17
|
-
# issue #53, https://github.com/mroth/lolcommits/issues/53
|
18
|
-
# this will test the permissions but only locally, important before building a gem package!
|
19
|
-
#
|
20
|
-
def test_permissions
|
21
|
-
imagesnap_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'imagesnap', 'imagesnap')).mode & 0o777
|
22
|
-
videosnap_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'videosnap', 'videosnap')).mode & 0o777
|
23
|
-
commandcam_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'CommandCam', 'CommandCam.exe')).mode & 0o777
|
24
|
-
|
25
|
-
assert imagesnap_perms == 0o755 || imagesnap_perms == 0o775,
|
26
|
-
"expected perms of 755/775 but instead got #{format '%<perms>o', perms: imagesnap_perms}"
|
27
|
-
assert videosnap_perms == 0o755 || videosnap_perms == 0o775,
|
28
|
-
"expected perms of 755/775 but instead got #{format '%<perms>o', perms: videosnap_perms}"
|
29
|
-
assert commandcam_perms == 0o755 || commandcam_perms == 0o775,
|
30
|
-
"expected perms of 755/775 but instead got #{format '%<perms>o', perms: commandcam_perms}"
|
31
|
-
end
|
32
|
-
end
|