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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a283f0226d5232d1e4be28c672c14c840f93a8b3ce5a69da433ed96ce08f8164
4
- data.tar.gz: 84d20b570725fe5616fe712c34c30292001763fead3bb39610a5d6b14396a139
3
+ metadata.gz: 5674698718c6e29b478a9c7e333b5a2983535f444b5aee83d0d5612a22d5ee73
4
+ data.tar.gz: 9de7e8e711ceaffd45d37d98c0a3878104505d174ff4f6cb1676ff077ec016f5
5
5
  SHA512:
6
- metadata.gz: 6c067bb4881cf4443cc66d711d7c0b273425ff1f6b65b77bda2c78beefb0d7305185fcaab3396477af74b785343c62fb1ee2e4d247697f0d1ddf0ea3ab46dc10
7
- data.tar.gz: aef9ad689994047883837153e4ae3719d542608ab91366b64cb6980a68bad6023ec806b9148b9dfe82c0d751617c00367e19f45e2c9d83a855a194ea4bbb68b3
6
+ metadata.gz: 716f490a4943d472f9fbcff961572ce97c981552a9f115b8f96c8a53717190eb53aa25755eb70133fd3566c31966c69868f638388ec01863872eafe5e3c9e8a8
7
+ data.tar.gz: 5634f2dc4c8a6ae5c465a3eedaa08a5968468dea9d95cf59706386e3c1a1e196ab3fc6d585e1eb7fb9f74ba3082651dafa4c955fbbd669e2263c3493800452ea
@@ -2,21 +2,21 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.1.10
6
- - 2.2.9
7
- - 2.3.6
8
- - 2.4.3
9
- - 2.5.0
10
- - ruby-head
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
- # 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
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
@@ -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.11.0...HEAD
320
- [0.10.0]: https://github.com/mroth/lolcommits/compare/v0.10.0...v0.11.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
- [![CodeClimate Status](https://d3s6mut3hikguw.cloudfront.net/github/mroth/lolcommits/badges/gpa.svg)](https://codeclimate.com/github/mroth/lolcommits)
14
- [![Coverage Status](https://coveralls.io/repos/mroth/lolcommits/badge.svg?branch=master&service=github)](https://coveralls.io/r/mroth/lolcommits)
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]
@@ -80,7 +80,7 @@ module Lolcommits
80
80
  end
81
81
 
82
82
  def last_commit
83
- @commit ||= repository.log.first
83
+ @last_commit ||= repository.log.first
84
84
  end
85
85
 
86
86
  def remote_repo?
@@ -75,7 +75,7 @@ module Lolcommits
75
75
  end
76
76
 
77
77
  def last_commit
78
- @commit ||= repository.commits.parent
78
+ @last_commit ||= repository.commits.parent
79
79
  end
80
80
  end
81
81
  end
@@ -40,7 +40,7 @@ module Lolcommits
40
40
 
41
41
  # inspired by this code from @rdp http://tinyurl.com/y7t276bh
42
42
  def device_names
43
- @_device_names ||= begin
43
+ @device_names ||= begin
44
44
  names = []
45
45
  cmd_output = ''
46
46
  count = 0
@@ -12,7 +12,7 @@ module Lolcommits
12
12
  end
13
13
 
14
14
  def yaml
15
- @_yaml ||= begin
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
@@ -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 StandardError
69
- return false
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(e, message)
93
+ def log_error(error, message)
93
94
  debug message
94
- debug e.backtrace.join("\n")
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
@@ -20,21 +20,17 @@ module Lolcommits
20
20
  raise('Unknown VCS')
21
21
  end
22
22
 
23
- self.sha = vcs_info.sha if sha.nil?
24
- self.message = vcs_info.message if message.nil?
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
- plugin_manager.plugins_for(hook).each do |gem_plugin|
29
- plugin_name = gem_plugin.name
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 #{plugin_name} (invalid configuration, try: lolcommits --config -p #{plugin_name})"
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 plugin_manager
95
- @plugin_manager ||= config.plugin_manager
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
@@ -1,4 +1,4 @@
1
1
  module Lolcommits
2
- VERSION = '0.11.0'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  GEM_NAME = 'lolcommits'.freeze
4
4
  end
@@ -1,4 +1,4 @@
1
- lib = File.expand_path('../lib', __FILE__)
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('coveralls')
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
@@ -0,0 +1,11 @@
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ SimpleCov.at_exit do
5
+ SimpleCov.result.format!
6
+ `open ./coverage/index.html` if RUBY_PLATFORM =~ /darwin/
7
+ end
8
+ end
9
+
10
+ require 'lolcommits'
11
+ require 'minitest/autorun'
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.11.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-02-04 00:00:00.000000000 Z
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: coveralls
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/lolcommits_test.rb
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/lolcommits_test.rb
355
+ - test/permissions_test.rb
356
+ - test/test_helper.rb
@@ -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