lolcommits 0.16.2 → 0.16.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 164b3de849954edf608d49789f55504eb4b64a5e9a75eaa543536e22cf7ee354
4
- data.tar.gz: 566c9199274b5fb28501daa75ffccf0366ec58079ebb8f7b544b0d605a4991c4
3
+ metadata.gz: 3b77f42634dc21e58f7c16311a6da2ddd82b957d97e3433b66622fdd5a4fac71
4
+ data.tar.gz: 19b7b1eb0f9a8f33712e0dd74fe4f99c1d2e83f444a292b0f75099e1545fb509
5
5
  SHA512:
6
- metadata.gz: 213a07bd6e7e6072de06247805da3f390d465d873dd4174e70337cf324a3c6b697209ebb4c42de7c7cbab065fd9cd3f7417bf9a830ac58d50209f96bcec24fe5
7
- data.tar.gz: 12acf1920f4901338887f8363a8500a92444d7072650c420683b27021f621bcbfd06d47c882088b603bb31bdf18f3afbf0c7f9326b9bc99626286401579dcf9f
6
+ metadata.gz: dbade52499cd8f0b0259b0d3af947606a666d4fb790e5da44128c5ee07e22a4d1fd8fb1204c7d059a8e67e101a841abdc0a9f5cf03cab69d3e251078bccb7e31
7
+ data.tar.gz: 417ea2aefa9b94f275fed65cfd5d0abb57d1162ec9a864833cde125d76527065d41093791fb5696a46338c90b860b5bea20cdee7cc86a3ced096fa20558cd343
@@ -1,20 +1,15 @@
1
1
  AllCops:
2
+ SuggestExtensions: false
3
+ NewCops: enable
2
4
  Exclude:
3
5
  - 'vendor/bundle/**/*'
4
6
  - 'vendor/bundle/**/.*'
5
7
  - '.bundle/**/*'
6
8
  - 'bin/lolcommits'
7
-
8
- Metrics/BlockLength:
9
- Exclude:
10
9
  - 'lolcommits.gemspec'
11
10
 
12
11
  # don't agree with this one, can lead to long lines that are harder to parse
13
12
  Style/IfUnlessModifier:
14
13
  Enabled: false
15
14
 
16
- # our gem supports 2.0+ but Rubocop only supports 2.1+
17
- Gemspec/RequiredRubyVersion:
18
- Enabled: false
19
-
20
15
  inherit_from: .rubocop_todo.yml
@@ -2,10 +2,11 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.4.9
6
- - 2.5.7
7
- - 2.6.5
8
- - 2.7.1
5
+ - 2.4.10
6
+ - 2.5.8
7
+ - 2.6.6
8
+ - 2.7.2
9
+ - 3.0.0
9
10
  - ruby-head
10
11
 
11
12
  matrix:
@@ -7,6 +7,13 @@ This project adheres to [Semantic Versioning][Semver].
7
7
 
8
8
  * Your contribution here!
9
9
 
10
+ ## [0.16.3][] (28 Jan 2021)
11
+ * Upgrade gem dependencies (for Ruby 3.0 compatibility)
12
+ * Patched `mercurial-ruby` to work with Ruby 3.0 [#411][])
13
+ * Fixed up the formatting of generated hooks in `.hg/hgrc` [#411][])
14
+ * Fix failing RuboCops and update config
15
+ * Update Travis CI rubies
16
+
10
17
  ## [0.16.2][] (24 Aug 2020)
11
18
  * Support delays w/ Linux animated GIFs (@theY4Kman [#405][])
12
19
  * Upgrade git gem to version 1.6.0 (@depfu [#402][])
@@ -378,7 +385,8 @@ This project adheres to [Semantic Versioning][Semver].
378
385
  reliable to not glitch.)
379
386
 
380
387
  [Semver]: http://semver.org
381
- [Unreleased]: https://github.com/lolcommits/lolcommits/compare/v0.16.2...HEAD
388
+ [Unreleased]: https://github.com/lolcommits/lolcommits/compare/v0.16.3...HEAD
389
+ [0.16.3]: https://github.com/lolcommits/lolcommits/compare/v0.16.2...v0.16.3
382
390
  [0.16.2]: https://github.com/lolcommits/lolcommits/compare/v0.16.1...v0.16.2
383
391
  [0.16.1]: https://github.com/lolcommits/lolcommits/compare/v0.16.0...v0.16.1
384
392
  [0.16.0]: https://github.com/lolcommits/lolcommits/compare/v0.15.1...v0.16.0
@@ -590,3 +598,4 @@ This project adheres to [Semantic Versioning][Semver].
590
598
  [#401]: https://github.com/lolcommits/lolcommits/pull/401
591
599
  [#402]: https://github.com/lolcommits/lolcommits/pull/402
592
600
  [#405]: https://github.com/lolcommits/lolcommits/pull/405
601
+ [#411]: https://github.com/lolcommits/lolcommits/pull/411
data/README.md CHANGED
@@ -39,7 +39,7 @@ page on our wiki!
39
39
 
40
40
  ## Requirements
41
41
 
42
- * Ruby >= 2.3
42
+ * Ruby >= 2.4
43
43
  * A webcam
44
44
  * [ImageMagick](http://www.imagemagick.org)
45
45
  * [ffmpeg](https://www.ffmpeg.org) (optional) for animated gif capturing
data/Rakefile CHANGED
@@ -5,8 +5,10 @@ require 'rake/clean'
5
5
 
6
6
  require 'rake/testtask'
7
7
 
8
+ ENV['CUCUMBER_PUBLISH_QUIET'] = 'true'
8
9
  require 'cucumber'
9
10
  require 'cucumber/rake/task'
11
+
10
12
  gem 'rdoc' # we need the installed RDoc gem, not the system one
11
13
  require 'rdoc/task'
12
14
 
@@ -66,7 +66,7 @@ Given(/^I am in a git repo with lolcommits enabled$/) do
66
66
  )
67
67
  end
68
68
 
69
- Given(/^a git post\-commit hook with "(.*?)"$/) do |file_content|
69
+ Given(/^a git post-commit hook with "(.*?)"$/) do |file_content|
70
70
  steps %(
71
71
  Given a file named "#{postcommit_hook_git}" with:
72
72
  """
@@ -75,13 +75,13 @@ Given(/^a git post\-commit hook with "(.*?)"$/) do |file_content|
75
75
  )
76
76
  end
77
77
 
78
- Then(/^the lolcommits git post\-commit hook should be properly installed$/) do
78
+ Then(/^the lolcommits git post-commit hook should be properly installed$/) do
79
79
  steps %(
80
80
  Then the git post-commit hook should contain "lolcommits --capture"
81
81
  )
82
82
  end
83
83
 
84
- Then(/^the git post\-commit hook (should|should not) contain "(.*?)"$/) do |should, content|
84
+ Then(/^the git post-commit hook (should|should not) contain "(.*?)"$/) do |should, content|
85
85
  steps %(
86
86
  Then the file "#{postcommit_hook_git}" #{should} contain "#{content}"
87
87
  )
@@ -119,7 +119,7 @@ Given(/^I am in a mercurial repo with lolcommits enabled$/) do
119
119
  )
120
120
  end
121
121
 
122
- Given(/^a mercurial post\-commit hook with "(.*?)"$/) do |file_content|
122
+ Given(/^a mercurial post-commit hook with "(.*?)"$/) do |file_content|
123
123
  steps %(
124
124
  Given a file named "#{postcommit_hook_mercurial}" with:
125
125
  """
@@ -128,13 +128,13 @@ Given(/^a mercurial post\-commit hook with "(.*?)"$/) do |file_content|
128
128
  )
129
129
  end
130
130
 
131
- Then(/^the lolcommits mercurial post\-commit hook should be properly installed$/) do
131
+ Then(/^the lolcommits mercurial post-commit hook should be properly installed$/) do
132
132
  steps %(
133
133
  Then the mercurial post-commit hook should contain "lolcommits --capture"
134
134
  )
135
135
  end
136
136
 
137
- Then(/^the mercurial post\-commit hook (should|should not) contain "(.*?)"$/) do |should, content|
137
+ Then(/^the mercurial post-commit hook (should|should not) contain "(.*?)"$/) do |should, content|
138
138
  steps %(
139
139
  Then the file "#{postcommit_hook_mercurial}" #{should} contain "#{content}"
140
140
  )
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mercurial
4
+ class ChangedFile
5
+ private
6
+
7
+ def enforce_unicode(str)
8
+ # String#encode patched to be Ruby 3.0+ compatible
9
+ str.encode('utf-8', invalid: :replace, undef: :replace, replace: '?')
10
+ end
11
+ end
12
+ end
@@ -9,7 +9,6 @@ require 'open3'
9
9
  require 'methadone'
10
10
  require 'date'
11
11
  require 'mercurial-ruby'
12
- require 'core_ext/mercurial-ruby/shell'
13
12
 
14
13
  require 'lolcommits/version'
15
14
  require 'lolcommits/configuration'
@@ -23,6 +22,10 @@ require 'lolcommits/plugin/base'
23
22
 
24
23
  # after lolcommits/platform, so that we can do platform-conditional override
25
24
  require 'core_ext/mercurial-ruby/command'
25
+ require 'core_ext/mercurial-ruby/shell'
26
+
27
+ # String#encode patched to be Ruby 3.0+ compatible
28
+ require 'core_ext/mercurial-ruby/changed_file'
26
29
 
27
30
  # backends
28
31
  require 'lolcommits/backends/installation_git'
@@ -49,7 +49,7 @@ module Lolcommits
49
49
 
50
50
  def video_fps(file)
51
51
  # inspect fps of the captured video file (default to 29.97)
52
- fps = system_call("ffmpeg -nostats -v quiet -i \"#{file}\" 2>&1 | sed -n \"s/.*, \\(.*\\) fp.*/\\1/p\"", true)
52
+ fps = system_call("ffmpeg -nostats -v quiet -i \"#{file}\" 2>&1 | sed -n \"s/.*, \\(.*\\) fp.*/\\1/p\"", capture_output: true)
53
53
  fps.to_i < 1 ? 29.97 : fps.to_f
54
54
  end
55
55
 
@@ -65,7 +65,7 @@ module Lolcommits
65
65
  end
66
66
  end
67
67
 
68
- def system_call(call_str, capture_output = false)
68
+ def system_call(call_str, capture_output: false)
69
69
  debug "making system call for \n #{call_str}"
70
70
  capture_output ? `#{call_str}` : system(call_str)
71
71
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Lolcommits
4
4
  class GitInfo
5
- GIT_URL_REGEX = %r{.*[:]([\/\w\-]*).git}.freeze
5
+ GIT_URL_REGEX = %r{.*:([/\w-]*).git}.freeze
6
6
 
7
7
  def self.repo_root?(path = '.')
8
8
  File.directory?(File.join(path, '.git'))
@@ -78,7 +78,7 @@ module Lolcommits
78
78
  end
79
79
 
80
80
  def remote_https_url(url)
81
- url.tr(':', '/').gsub(/^git@/, 'https://').gsub(/\.git$/, '') + '/commit/'
81
+ "#{url.tr(':', '/').gsub(/^git@/, 'https://').gsub(/\.git$/, '')}/commit/"
82
82
  end
83
83
 
84
84
  def repository(path = '.')
@@ -60,8 +60,8 @@ module Lolcommits
60
60
  end
61
61
 
62
62
  def self.hook_script(capture_args = '')
63
- ruby_path = Lolcommits::Platform.command_which('ruby', true)
64
- imagick_path = Lolcommits::Platform.command_which('identify', true)
63
+ ruby_path = Lolcommits::Platform.command_which('ruby', only_path: true)
64
+ imagick_path = Lolcommits::Platform.command_which('identify', only_path: true)
65
65
  capture_cmd = "if [ ! -d \"$GIT_DIR/rebase-merge\" ] && [ \"$LOLCOMMITS_CAPTURE_DISABLED\" != \"true\" ]; then lolcommits --capture #{capture_args}; fi"
66
66
  exports = "LANG=\"#{ENV['LANG']}\" && PATH=\"$PATH:#{ruby_path}:#{imagick_path}\""
67
67
 
@@ -90,7 +90,7 @@ module Lolcommits
90
90
 
91
91
  # does the git hook file have a good shebang?
92
92
  def self.good_shebang?
93
- File.read(HOOK_PATH).lines.first =~ %r{^\#\!.*\/bin\/.*sh}
93
+ File.read(HOOK_PATH).lines.first =~ %r{^\#!.*/bin/.*sh}
94
94
  end
95
95
 
96
96
  def self.remove_existing_hook!
@@ -40,8 +40,8 @@ module Lolcommits
40
40
  end
41
41
 
42
42
  def self.hook_script(capture_args = '')
43
- ruby_path = Lolcommits::Platform.command_which('ruby', true)
44
- imagick_path = Lolcommits::Platform.command_which('identify', true)
43
+ ruby_path = Lolcommits::Platform.command_which('ruby', only_path: true)
44
+ imagick_path = Lolcommits::Platform.command_which('identify', only_path: true)
45
45
  capture_cmd = "if [ \"$LOLCOMMITS_CAPTURE_DISABLED\" != \"true\" ]; then lolcommits --capture #{capture_args}; fi"
46
46
  exports = "LANG=\"#{ENV['LANG']}\" && PATH=\"$PATH:#{ruby_path}:#{imagick_path}\""
47
47
 
@@ -49,11 +49,7 @@ module Lolcommits
49
49
  exports = "set path=\"%PATH%;#{ruby_path};#{imagick_path}\""
50
50
  end
51
51
 
52
- <<-HOOK
53
- ### lolcommits hook (begin) ###
54
- #{exports} && #{capture_cmd}
55
- ### lolcommits hook (end) ###
56
- HOOK
52
+ "#{exports} && #{capture_cmd}"
57
53
  end
58
54
 
59
55
  def self.repository
@@ -11,7 +11,7 @@ module Lolcommits
11
11
  end
12
12
  end
13
13
 
14
- def system_call(call_str, capture_output = false)
14
+ def system_call(call_str, capture_output: false)
15
15
  debug "making system call for \n #{call_str}"
16
16
  capture_output ? `#{call_str}` : system(call_str)
17
17
  end
@@ -8,7 +8,7 @@ module Lolcommits
8
8
  tmpdir = Dir.mktmpdir
9
9
 
10
10
  # Default delay is 1s
11
- delay = capture_delay != 0 ? capture_delay : 1
11
+ delay = capture_delay.zero? ? 1 : capture_delay
12
12
 
13
13
  # There's no way to give a capture delay in mplayer, but a number of frame
14
14
  # mplayer's "delay" is actually a number of frames at 25 fps
@@ -25,7 +25,7 @@ module Lolcommits
25
25
  cmd_output = ''
26
26
  count = 0
27
27
  while cmd_output.empty? || !cmd_output.split('DirectShow')[2]
28
- cmd_output = system_call(ffpmeg_list_devices_cmd, true)
28
+ cmd_output = system_call(ffpmeg_list_devices_cmd, capture_output: true)
29
29
  count += 1
30
30
  raise 'failed to find a video capture device with ffmpeg -list_devices' if count == 5
31
31
 
@@ -15,9 +15,11 @@ module Lolcommits
15
15
 
16
16
  def yaml
17
17
  @yaml ||= begin
18
- return Hash.new({}) unless File.exist?(configuration_file)
19
-
20
- YAML.safe_load(File.open(configuration_file), [Symbol]) || Hash.new({})
18
+ if File.exist?(configuration_file)
19
+ YAML.safe_load(File.open(configuration_file), [Symbol]) || Hash.new({})
20
+ else
21
+ Hash.new({})
22
+ end
21
23
  end
22
24
  end
23
25
 
@@ -7,7 +7,7 @@ module Lolcommits
7
7
  class Platform
8
8
  # The capturer class constant to use
9
9
  # @return Class
10
- def self.capturer_class(animate = false)
10
+ def self.capturer_class(animate: false)
11
11
  if ENV['LOLCOMMITS_CAPTURER']
12
12
  const_get(ENV['LOLCOMMITS_CAPTURER'])
13
13
  elsif platform_mac?
@@ -90,7 +90,7 @@ module Lolcommits
90
90
  # command_which('ruby') #=> /usr/bin/ruby
91
91
  #
92
92
  # @return Boolean
93
- def self.command_which(cmd, only_path = false)
93
+ def self.command_which(cmd, only_path: false)
94
94
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
95
95
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
96
96
  exts.each do |ext|
@@ -52,7 +52,7 @@ module Lolcommits
52
52
  # @return [Hash] the configured plugin options
53
53
  def configure_options!
54
54
  configure_option_hash(
55
- Hash[options.map { |key, _value| [key, nil] }].merge(default_options)
55
+ (options.map { |option| [option, nil] }.to_h).merge(default_options)
56
56
  )
57
57
  end
58
58
 
@@ -95,7 +95,7 @@ module Lolcommits
95
95
 
96
96
  def run_capture
97
97
  puts '*** Preserving this moment in history.' unless capture_stealth
98
- capturer = Platform.capturer_class(!capture_image?).new(
98
+ capturer = Platform.capturer_class(animate: !capture_image?).new(
99
99
  capture_path: capture_path,
100
100
  capture_device: capture_device,
101
101
  capture_delay: capture_delay,
@@ -181,7 +181,7 @@ module Lolcommits
181
181
  @enabled_plugins ||= config.plugin_manager.enabled_plugins_for(self)
182
182
  end
183
183
 
184
- def system_call(call_str, capture_output = false)
184
+ def system_call(call_str, capture_output: false)
185
185
  debug "making system call for \n #{call_str}"
186
186
  capture_output ? `#{call_str}` : system(call_str)
187
187
  end
@@ -32,11 +32,11 @@ module Lolcommits
32
32
  `cd #{repo_path} && git commit -m "#{message}"`
33
33
  end
34
34
 
35
- def in_repo
35
+ def in_repo(&block)
36
36
  return unless repo_exists?
37
37
 
38
38
  Dir.chdir(File.expand_path(repo_path)) do
39
- yield
39
+ yield block
40
40
  end
41
41
  end
42
42
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lolcommits
4
- VERSION = '0.16.2'
5
- GEM_NAME = 'lolcommits'
4
+ VERSION = "0.16.3"
5
+ GEM_NAME = "lolcommits"
6
6
  end
@@ -40,10 +40,10 @@ Gem::Specification.new do |s|
40
40
  # core
41
41
  s.add_runtime_dependency('methadone', '~> 1.9.5')
42
42
  s.add_runtime_dependency('mercurial-ruby', '~> 0.7.12')
43
- s.add_runtime_dependency('mini_magick', '~> 4.10.1')
44
- s.add_runtime_dependency('launchy', '~> 2.4.3')
43
+ s.add_runtime_dependency('mini_magick', '~> 4.11.0')
44
+ s.add_runtime_dependency('launchy', '~> 2.5.0')
45
45
  s.add_runtime_dependency('open4', '~> 1.3.4')
46
- s.add_runtime_dependency('git', '~> 1.6.0')
46
+ s.add_runtime_dependency('git', '~> 1.8.1')
47
47
 
48
48
  # included plugins
49
49
  s.add_runtime_dependency('lolcommits-loltext', '~> 0.4.0')
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/test_helper')
3
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
4
4
 
5
5
  class PermissionsTest < Minitest::Test
6
6
  #
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolcommits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.2
4
+ version: 0.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Rothenberg
8
8
  - Matthew Hutchinson
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-08-24 00:00:00.000000000 Z
12
+ date: 2021-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: methadone
@@ -45,28 +45,28 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 4.10.1
48
+ version: 4.11.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 4.10.1
55
+ version: 4.11.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: launchy
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 2.4.3
62
+ version: 2.5.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 2.4.3
69
+ version: 2.5.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: open4
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 1.6.0
90
+ version: 1.8.1
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 1.6.0
97
+ version: 1.8.1
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: lolcommits-loltext
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -257,6 +257,7 @@ files:
257
257
  - features/step_definitions/lolcommits_steps.rb
258
258
  - features/support/env.rb
259
259
  - features/support/path_helpers.rb
260
+ - lib/core_ext/mercurial-ruby/changed_file.rb
260
261
  - lib/core_ext/mercurial-ruby/command.rb
261
262
  - lib/core_ext/mercurial-ruby/shell.rb
262
263
  - lib/lolcommits.rb
@@ -303,7 +304,7 @@ files:
303
304
  - vendor/ext/imagesnap/ReadMeOrDont.rtf
304
305
  - vendor/ext/imagesnap/imagesnap
305
306
  - vendor/ext/videosnap/videosnap
306
- homepage:
307
+ homepage:
307
308
  licenses:
308
309
  - LGPL-3.0
309
310
  metadata:
@@ -312,7 +313,7 @@ metadata:
312
313
  changelog_uri: https://github.com/lolcommits/lolcommits/blob/master/CHANGELOG.md
313
314
  bug_tracker_uri: https://github.com/lolcommits/lolcommits/issues
314
315
  allowed_push_host: https://rubygems.org
315
- post_install_message:
316
+ post_install_message:
316
317
  rdoc_options: []
317
318
  require_paths:
318
319
  - lib
@@ -329,8 +330,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
330
  requirements:
330
331
  - imagemagick
331
332
  - a webcam
332
- rubygems_version: 3.1.2
333
- signing_key:
333
+ rubygems_version: 3.2.3
334
+ signing_key:
334
335
  specification_version: 4
335
336
  summary: Capture webcam image on git commit for lulz.
336
337
  test_files: