lolcommits 0.16.2 → 0.16.4

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: 164b3de849954edf608d49789f55504eb4b64a5e9a75eaa543536e22cf7ee354
4
- data.tar.gz: 566c9199274b5fb28501daa75ffccf0366ec58079ebb8f7b544b0d605a4991c4
3
+ metadata.gz: 127f7270f2ceb68501f4f2f158092290638eb45fc7fa9cb354a73bd5f7141016
4
+ data.tar.gz: 1a059a885d1acbaa0d988365495802ee9bab2bc78e8c95751cee495ee40bdfc2
5
5
  SHA512:
6
- metadata.gz: 213a07bd6e7e6072de06247805da3f390d465d873dd4174e70337cf324a3c6b697209ebb4c42de7c7cbab065fd9cd3f7417bf9a830ac58d50209f96bcec24fe5
7
- data.tar.gz: 12acf1920f4901338887f8363a8500a92444d7072650c420683b27021f621bcbfd06d47c882088b603bb31bdf18f3afbf0c7f9326b9bc99626286401579dcf9f
6
+ metadata.gz: 0be060d8b449e66f875997ec02e5ad745ad75d320087a5d19f27f506829dcac7796c997cf7e14bb021950222a57e416fdf8ad1724c45dbd3bb92f4d788dec045
7
+ data.tar.gz: fbb14bf9cc8f82662efb190707f254880509484ab9f4e4a2f4f5c09cf47ad6c552358c864347c30a55ea04f77f1a54c2259f49302e70196a4d1d4d587168e32b
data/.rubocop.yml CHANGED
@@ -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
data/.rubocop_todo.yml CHANGED
@@ -1,83 +1,68 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-01-20 22:28:11 +0000 using RuboCop version 0.79.0.
3
+ # on 2023-05-14 21:38:57 UTC using RuboCop version 1.50.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 6
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
12
- # Include: **/*.gemspec
13
- Gemspec/OrderedDependencies:
14
- Exclude:
15
- - 'lolcommits.gemspec'
16
-
17
- # Offense count: 19
18
- # Cop supports --auto-correct.
19
- # Configuration parameters: EnforcedStyle, IndentationWidth.
20
- # SupportedStyles: with_first_argument, with_fixed_indentation
21
- Layout/ArgumentAlignment:
22
- Enabled: false
23
-
24
- # Offense count: 6
25
- # Cop supports --auto-correct.
26
- Layout/EmptyLineAfterGuardClause:
27
- Exclude:
28
- - 'bin/bundle'
29
-
30
9
  # Offense count: 1
31
- # Cop supports --auto-correct.
32
- # Configuration parameters: EnforcedStyle.
33
- # SupportedStyles: squiggly, active_support, powerpack, unindent
10
+ # This cop supports safe autocorrection (--autocorrect).
34
11
  Layout/HeredocIndentation:
35
12
  Exclude:
36
13
  - 'lib/lolcommits/backends/installation_git.rb'
37
14
 
38
15
  # Offense count: 1
39
- # Cop supports --auto-correct.
40
- # Configuration parameters: EnforcedStyle, IndentationWidth.
41
- # SupportedStyles: aligned, indented
42
- Layout/MultilineOperationIndentation:
43
- Exclude:
44
- - 'bin/bundle'
45
-
46
- # Offense count: 1
16
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
47
17
  Lint/AmbiguousBlockAssociation:
48
18
  Exclude:
49
19
  - 'lib/lolcommits/cli/process_runner.rb'
50
20
 
51
- # Offense count: 18
21
+ # Offense count: 15
22
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
52
23
  Metrics/AbcSize:
53
- Max: 35
24
+ Max: 33
54
25
 
55
26
  # Offense count: 2
56
- # Configuration parameters: CountComments.
27
+ # Configuration parameters: CountComments, CountAsOne.
57
28
  Metrics/ClassLength:
58
29
  Max: 144
59
30
 
60
31
  # Offense count: 5
32
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
61
33
  Metrics/CyclomaticComplexity:
62
34
  Max: 10
63
35
 
64
- # Offense count: 21
65
- # Configuration parameters: CountComments, ExcludedMethods.
36
+ # Offense count: 20
37
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
66
38
  Metrics/MethodLength:
67
39
  Max: 24
68
40
 
69
41
  # Offense count: 5
42
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
70
43
  Metrics/PerceivedComplexity:
71
44
  Max: 10
72
45
 
73
- # Offense count: 25
46
+ # Offense count: 26
47
+ # Configuration parameters: AllowedConstants.
74
48
  Style/Documentation:
75
49
  Enabled: false
76
50
 
77
- # Offense count: 20
78
- # Cop supports --auto-correct.
79
- Style/ExpandPathArguments:
80
- Enabled: false
51
+ # Offense count: 6
52
+ # This cop supports safe autocorrection (--autocorrect).
53
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
54
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
55
+ # SupportedShorthandSyntax: always, never, either, consistent
56
+ Style/HashSyntax:
57
+ Exclude:
58
+ - 'lib/lolcommits/gem_plugin.rb'
59
+ - 'lib/lolcommits/runner.rb'
60
+
61
+ # Offense count: 1
62
+ # This cop supports unsafe autocorrection (--autocorrect-all).
63
+ Style/MapToHash:
64
+ Exclude:
65
+ - 'lib/lolcommits/plugin/base.rb'
81
66
 
82
67
  # Offense count: 2
83
68
  Style/MixinUsage:
@@ -86,7 +71,7 @@ Style/MixinUsage:
86
71
  - 'features/support/env.rb'
87
72
 
88
73
  # Offense count: 5
89
- # Cop supports --auto-correct.
74
+ # This cop supports safe autocorrection (--autocorrect).
90
75
  # Configuration parameters: PreferredDelimiters.
91
76
  Style/PercentLiteralDelimiters:
92
77
  Exclude:
@@ -96,30 +81,17 @@ Style/PercentLiteralDelimiters:
96
81
  - 'lib/lolcommits/cli/fatals.rb'
97
82
  - 'lib/lolcommits/installation.rb'
98
83
 
99
- # Offense count: 1
100
- # Cop supports --auto-correct.
101
- Style/PerlBackrefs:
102
- Exclude:
103
- - 'bin/bundle'
104
-
105
- # Offense count: 1
106
- # Cop supports --auto-correct.
107
- # Configuration parameters: EnforcedStyle.
108
- # SupportedStyles: use_perl_names, use_english_names
109
- Style/SpecialGlobalVars:
110
- Exclude:
111
- - 'bin/bundle'
112
-
113
- # Offense count: 166
114
- # Cop supports --auto-correct.
84
+ # Offense count: 2
85
+ # This cop supports safe autocorrection (--autocorrect).
115
86
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
116
87
  # SupportedStyles: single_quotes, double_quotes
117
88
  Style/StringLiterals:
118
- Enabled: false
89
+ Exclude:
90
+ - 'lib/lolcommits/version.rb'
119
91
 
120
- # Offense count: 120
121
- # Cop supports --auto-correct.
122
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
92
+ # Offense count: 16
93
+ # This cop supports safe autocorrection (--autocorrect).
94
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
123
95
  # URISchemes: http, https
124
96
  Layout/LineLength:
125
- Max: 198
97
+ Max: 192
data/.travis.yml CHANGED
@@ -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.9
7
+ - 2.6.7
8
+ - 2.7.3
9
+ - 3.0.1
9
10
  - ruby-head
10
11
 
11
12
  matrix:
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ This project adheres to [Semantic Versioning][Semver].
7
7
 
8
8
  * Your contribution here!
9
9
 
10
+ ## [0.16.4][] (05 Sep 2023)
11
+ * Fixing for Git 1.18+, it no longer sets a `$GIT_DIR` in post-commit hooks [#417][]
12
+
13
+ ## [0.16.3][] (28 Jan 2021)
14
+ * Upgrade gem dependencies (for Ruby 3.0 compatibility)
15
+ * Patched `mercurial-ruby` to work with Ruby 3.0 [#411][]
16
+ * Fixed up the formatting of generated hooks in `.hg/hgrc` [#411][]
17
+ * Fix failing RuboCops and update config
18
+ * Update Travis CI rubies
19
+
10
20
  ## [0.16.2][] (24 Aug 2020)
11
21
  * Support delays w/ Linux animated GIFs (@theY4Kman [#405][])
12
22
  * Upgrade git gem to version 1.6.0 (@depfu [#402][])
@@ -378,7 +388,9 @@ This project adheres to [Semantic Versioning][Semver].
378
388
  reliable to not glitch.)
379
389
 
380
390
  [Semver]: http://semver.org
381
- [Unreleased]: https://github.com/lolcommits/lolcommits/compare/v0.16.2...HEAD
391
+ [Unreleased]: https://github.com/lolcommits/lolcommits/compare/v0.16.4...HEAD
392
+ [0.16.4]: https://github.com/lolcommits/lolcommits/compare/v0.16.3...v0.16.4
393
+ [0.16.3]: https://github.com/lolcommits/lolcommits/compare/v0.16.2...v0.16.3
382
394
  [0.16.2]: https://github.com/lolcommits/lolcommits/compare/v0.16.1...v0.16.2
383
395
  [0.16.1]: https://github.com/lolcommits/lolcommits/compare/v0.16.0...v0.16.1
384
396
  [0.16.0]: https://github.com/lolcommits/lolcommits/compare/v0.15.1...v0.16.0
@@ -590,3 +602,5 @@ This project adheres to [Semantic Versioning][Semver].
590
602
  [#401]: https://github.com/lolcommits/lolcommits/pull/401
591
603
  [#402]: https://github.com/lolcommits/lolcommits/pull/402
592
604
  [#405]: https://github.com/lolcommits/lolcommits/pull/405
605
+ [#411]: https://github.com/lolcommits/lolcommits/pull/411
606
+ [#417]: https://github.com/lolcommits/lolcommits/pull/417
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # lolcommits
2
2
 
3
3
  [![Gem](https://img.shields.io/gem/v/lolcommits.svg?style=flat)](http://rubygems.org/gems/lolcommits)
4
- [![Travis](https://img.shields.io/travis/com/lolcommits/lolcommits/master.svg?style=flat)](https://travis-ci.com/lolcommits/lolcommits)
5
4
  [![Depfu](https://img.shields.io/depfu/lolcommits/lolcommits.svg?style=flat)](https://depfu.com/github/lolcommits/lolcommits)
6
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/c13fa50206e122e416c2/maintainability)](https://codeclimate.com/github/lolcommits/lolcommits/maintainability)
7
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/c13fa50206e122e416c2/test_coverage)](https://codeclimate.com/github/lolcommits/lolcommits/test_coverage)
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
 
@@ -53,9 +55,9 @@ RuboCop::RakeTask.new
53
55
 
54
56
  desc 'Migrate an existing local .lolcommits directory to Dropbox'
55
57
  task :dropboxify do
56
- dropbox_loldir = "#{ENV['HOME']}/Dropbox/lolcommits"
57
- loldir = "#{ENV['HOME']}/.lolcommits"
58
- backup_loldir = "#{ENV['HOME']}/.lolcommits.old"
58
+ dropbox_loldir = "#{Dir.home}/Dropbox/lolcommits"
59
+ loldir = "#{Dir.home}/.lolcommits"
60
+ backup_loldir = "#{Dir.home}/.lolcommits.old"
59
61
 
60
62
  # check whether we've done this already
61
63
  abort 'already dropboxified!' if File.symlink? loldir
@@ -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
@@ -5,7 +5,7 @@ module Mercurial
5
5
  # windows command line doesn't like single quotes
6
6
  def self.interpolate_arguments(cmd_with_args)
7
7
  cmd_with_args.shift.tap do |cmd|
8
- cmd.gsub!(/\?/) do
8
+ cmd.gsub!('?') do
9
9
  if Lolcommits::Platform.platform_windows?
10
10
  "\"#{cmd_with_args.shift}\""
11
11
  else
@@ -44,12 +44,12 @@ module Lolcommits
44
44
  def frame_delay(fps, skip)
45
45
  # calculate frame delay
46
46
  delay = ((100.0 * skip) / fps.to_f).to_i
47
- delay < 6 ? 6 : delay # hard limit for IE browsers
47
+ [delay, 6].max # hard limit for IE browsers
48
48
  end
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}
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,10 +60,10 @@ 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
- exports = "LANG=\"#{ENV['LANG']}\" && PATH=\"$PATH:#{ruby_path}:#{imagick_path}\""
66
+ exports = "GIT_DIR=${GIT_DIR-`git rev-parse --git-dir`} && LANG=\"#{ENV.fetch('LANG', nil)}\" && PATH=\"$PATH:#{ruby_path}:#{imagick_path}\""
67
67
 
68
68
  if Lolcommits::Platform.platform_windows?
69
69
  exports = "set path=\"%PATH%;#{ruby_path};#{imagick_path}\""
@@ -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,20 +40,16 @@ 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
- exports = "LANG=\"#{ENV['LANG']}\" && PATH=\"$PATH:#{ruby_path}:#{imagick_path}\""
46
+ exports = "LANG=\"#{ENV.fetch('LANG', nil)}\" && PATH=\"$PATH:#{ruby_path}:#{imagick_path}\""
47
47
 
48
48
  if Lolcommits::Platform.platform_windows?
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
@@ -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
 
@@ -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
@@ -19,7 +19,7 @@ module Lolcommits
19
19
  %w(imagesnap videosnap).each do |executable|
20
20
  next if File.executable? File.join(Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', executable, executable)
21
21
 
22
- fatal "Couldn't properly execute #{executable} for some reason, "\
22
+ fatal "Couldn't properly execute #{executable} for some reason, " \
23
23
  'please file a bug?!'
24
24
  exit 1
25
25
  end
@@ -32,7 +32,7 @@ module Lolcommits
32
32
 
33
33
  # make sure imagemagick is around and good to go
34
34
  unless Platform.valid_imagemagick_installed?
35
- fatal 'FATAL: ImageMagick does not appear to be properly installed!'\
35
+ fatal 'FATAL: ImageMagick does not appear to be properly installed!' \
36
36
  '(or version is too old)'
37
37
  exit 1
38
38
  end
@@ -40,8 +40,8 @@ module Lolcommits
40
40
  # check for a error condition with git config affecting ruby-git
41
41
  return unless Platform.git_config_color_always?
42
42
 
43
- fatal 'Due to a bug in the ruby-git library, git config for color.ui'\
44
- " cannot be set to 'always'."
43
+ fatal 'Due to a bug in the ruby-git library, git config for color.ui ' \
44
+ "cannot be set to 'always'."
45
45
  fatal "Try setting it to 'auto' instead!"
46
46
  exit 1
47
47
  end
@@ -33,11 +33,11 @@ module Lolcommits
33
33
  private
34
34
 
35
35
  def write_pid(pid)
36
- File.open(pid_file, 'w') { |f| f.write(pid) }
36
+ File.write(pid_file, pid)
37
37
  end
38
38
 
39
39
  def delete_pid
40
- File.delete(pid_file) if File.exist?(pid_file)
40
+ File.rm_f(pid_file)
41
41
  end
42
42
 
43
43
  def pid_file
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Lolcommits
4
4
  class Configuration
5
- LOLCOMMITS_BASE = ENV['LOLCOMMITS_DIR'] || File.join(ENV['HOME'], '.lolcommits')
5
+ LOLCOMMITS_BASE = ENV['LOLCOMMITS_DIR'] || File.join(Dir.home, '.lolcommits')
6
6
  LOLCOMMITS_ROOT = File.join(File.dirname(__FILE__), '../..')
7
7
 
8
8
  attr_accessor :plugin_manager
@@ -14,11 +14,11 @@ module Lolcommits
14
14
  end
15
15
 
16
16
  def yaml
17
- @yaml ||= begin
18
- return Hash.new({}) unless File.exist?(configuration_file)
19
-
20
- YAML.safe_load(File.open(configuration_file), [Symbol]) || Hash.new({})
21
- end
17
+ @yaml ||= if File.exist?(configuration_file)
18
+ YAML.safe_load(File.open(configuration_file), permitted_classes: [Symbol]) || Hash.new({})
19
+ else
20
+ Hash.new({})
21
+ end
22
22
  end
23
23
 
24
24
  def configuration_file
@@ -101,16 +101,14 @@ module Lolcommits
101
101
  # print config if plugin was enabled
102
102
  if plugin_config[:enabled]
103
103
  puts "\nSuccessfully configured plugin: #{plugin.name} - at path '#{configuration_file}'"
104
- puts plugin_config.to_yaml.to_s
104
+ puts plugin_config.to_yaml
105
105
  end
106
106
  end
107
107
  end
108
108
 
109
109
  def save(plugin_name, plugin_config)
110
110
  config_file_contents = yaml.merge(plugin_name => plugin_config).to_yaml
111
- File.open(configuration_file, 'w') do |f|
112
- f.write(config_file_contents)
113
- end
111
+ File.write(configuration_file, config_file_contents)
114
112
  end
115
113
 
116
114
  def to_s
@@ -128,7 +126,7 @@ module Lolcommits
128
126
  File.chmod(0o755, loldir)
129
127
  rescue Errno::EPERM
130
128
  # abort if permissions cannot be met
131
- puts "FATAL: directory '#{loldir}' should be present and writeable by user '#{ENV['USER']}'"
129
+ puts "FATAL: directory '#{loldir}' should be present and writeable by user '#{ENV.fetch('USER', nil)}'"
132
130
  puts 'Try changing the directory permissions to 755'
133
131
  exit 1
134
132
  end
@@ -15,7 +15,7 @@ module Lolcommits
15
15
  require gem_path unless required?
16
16
  rescue LoadError => e
17
17
  warn "Found plugin #{name}, but could not require gem '#{gem_name}'"
18
- warn e.to_s
18
+ warn e
19
19
  rescue StandardError => e
20
20
  warn "require gem '#{gem_name}' failed with: #{e}"
21
21
  end
@@ -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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Lolcommits
4
4
  class PluginManager
5
- GEM_NAME_PREFIX = /^#{Lolcommits::GEM_NAME}-/.freeze
5
+ GEM_NAME_PREFIX = /^#{Lolcommits::GEM_NAME}-/
6
6
 
7
7
  def self.init
8
8
  pm = new
@@ -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.4"
5
+ GEM_NAME = "lolcommits"
6
6
  end
data/lib/lolcommits.rb CHANGED
@@ -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'
data/lolcommits.gemspec CHANGED
@@ -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.12.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.18.0')
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.4
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: 2023-09-05 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.12.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.12.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.18.0
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.18.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: lolcommits-loltext
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -251,12 +251,12 @@ files:
251
251
  - appveyor.yml
252
252
  - bin/console
253
253
  - bin/lolcommits
254
- - config/cucumber.yml
255
254
  - features/bugs.feature
256
255
  - features/lolcommits.feature
257
256
  - features/step_definitions/lolcommits_steps.rb
258
257
  - features/support/env.rb
259
258
  - features/support/path_helpers.rb
259
+ - lib/core_ext/mercurial-ruby/changed_file.rb
260
260
  - lib/core_ext/mercurial-ruby/command.rb
261
261
  - lib/core_ext/mercurial-ruby/shell.rb
262
262
  - lib/lolcommits.rb
@@ -303,7 +303,7 @@ files:
303
303
  - vendor/ext/imagesnap/ReadMeOrDont.rtf
304
304
  - vendor/ext/imagesnap/imagesnap
305
305
  - vendor/ext/videosnap/videosnap
306
- homepage:
306
+ homepage:
307
307
  licenses:
308
308
  - LGPL-3.0
309
309
  metadata:
@@ -312,7 +312,7 @@ metadata:
312
312
  changelog_uri: https://github.com/lolcommits/lolcommits/blob/master/CHANGELOG.md
313
313
  bug_tracker_uri: https://github.com/lolcommits/lolcommits/issues
314
314
  allowed_push_host: https://rubygems.org
315
- post_install_message:
315
+ post_install_message:
316
316
  rdoc_options: []
317
317
  require_paths:
318
318
  - lib
@@ -329,8 +329,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
329
  requirements:
330
330
  - imagemagick
331
331
  - a webcam
332
- rubygems_version: 3.1.2
333
- signing_key:
332
+ rubygems_version: 3.4.17
333
+ signing_key:
334
334
  specification_version: 4
335
335
  summary: Capture webcam image on git commit for lulz.
336
336
  test_files:
data/config/cucumber.yml DELETED
@@ -1,2 +0,0 @@
1
- ---
2
- default: <%= ENV['TRAVIS'] == "true" ? "features --tags \"not @requires_ffmpeg\"" : "features" %>