lolcommits 0.15.1 → 0.16.3

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: e82514359cfc87aedfb9c139d4f2dcb380b2d5fd86081e012b2fe3feb27a04a7
4
- data.tar.gz: d3f10669c8723cba11309df12c0ce1aeafd8dfb8ef80f98abe975ad4ad4d4531
3
+ metadata.gz: 3b77f42634dc21e58f7c16311a6da2ddd82b957d97e3433b66622fdd5a4fac71
4
+ data.tar.gz: 19b7b1eb0f9a8f33712e0dd74fe4f99c1d2e83f444a292b0f75099e1545fb509
5
5
  SHA512:
6
- metadata.gz: c90be17ef828f988227cb40bbf5cba1f3660216fd850ba0b08a9d48ac67b1f8d659b9eb3ba3f238b37b6143e3a30782421698b2765684de8678e51156e30d593
7
- data.tar.gz: e663c70ac161697c01bb02673415cc9883d2c3165811821d56e888147d72b67708cbdb1abdbbb2a4918781c580b3a5493042ab2e9dcd85a7b5a6a4a4acebdea0
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
@@ -1,52 +1,68 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-12-13 17:09:06 +0000 using RuboCop version 0.52.0.
3
+ # on 2020-01-20 22:28:11 +0000 using RuboCop version 0.79.0.
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: 7
9
+ # Offense count: 6
10
10
  # Cop supports --auto-correct.
11
- # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
12
12
  # Include: **/*.gemspec
13
13
  Gemspec/OrderedDependencies:
14
14
  Exclude:
15
15
  - 'lolcommits.gemspec'
16
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
+
17
30
  # Offense count: 1
18
31
  # Cop supports --auto-correct.
19
32
  # Configuration parameters: EnforcedStyle.
20
- # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
21
- Layout/IndentHeredoc:
33
+ # SupportedStyles: squiggly, active_support, powerpack, unindent
34
+ Layout/HeredocIndentation:
22
35
  Exclude:
23
36
  - 'lib/lolcommits/backends/installation_git.rb'
24
37
 
38
+ # 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
+
25
46
  # Offense count: 1
26
47
  Lint/AmbiguousBlockAssociation:
27
48
  Exclude:
28
49
  - 'lib/lolcommits/cli/process_runner.rb'
29
50
 
30
- # Offense count: 19
51
+ # Offense count: 18
31
52
  Metrics/AbcSize:
32
53
  Max: 35
33
54
 
34
- # Offense count: 1
35
- # Configuration parameters: CountComments, ExcludedMethods.
36
- Metrics/BlockLength:
37
- Max: 40
38
-
39
55
  # Offense count: 2
40
56
  # Configuration parameters: CountComments.
41
57
  Metrics/ClassLength:
42
- Max: 150
58
+ Max: 144
43
59
 
44
60
  # Offense count: 5
45
61
  Metrics/CyclomaticComplexity:
46
62
  Max: 10
47
63
 
48
- # Offense count: 23
49
- # Configuration parameters: CountComments.
64
+ # Offense count: 21
65
+ # Configuration parameters: CountComments, ExcludedMethods.
50
66
  Metrics/MethodLength:
51
67
  Max: 24
52
68
 
@@ -54,23 +70,20 @@ Metrics/MethodLength:
54
70
  Metrics/PerceivedComplexity:
55
71
  Max: 10
56
72
 
57
- # Offense count: 1
58
- # Cop supports --auto-correct.
59
- Security/YAMLLoad:
60
- Exclude:
61
- - 'lib/lolcommits/configuration.rb'
62
-
63
73
  # Offense count: 25
64
74
  Style/Documentation:
65
75
  Enabled: false
66
76
 
67
- # Offense count: 5
77
+ # Offense count: 20
78
+ # Cop supports --auto-correct.
79
+ Style/ExpandPathArguments:
80
+ Enabled: false
81
+
82
+ # Offense count: 2
68
83
  Style/MixinUsage:
69
84
  Exclude:
70
85
  - 'Rakefile'
71
- - 'bin/lolcommits'
72
86
  - 'features/support/env.rb'
73
- - 'test/lolcommits_test.rb'
74
87
 
75
88
  # Offense count: 5
76
89
  # Cop supports --auto-correct.
@@ -85,13 +98,28 @@ Style/PercentLiteralDelimiters:
85
98
 
86
99
  # Offense count: 1
87
100
  # Cop supports --auto-correct.
88
- # Configuration parameters: MinSize.
89
- # SupportedStyles: percent, brackets
90
- Style/SymbolArray:
91
- EnforcedStyle: brackets
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'
92
112
 
93
- # Offense count: 90
94
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
113
+ # Offense count: 166
114
+ # Cop supports --auto-correct.
115
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
116
+ # SupportedStyles: single_quotes, double_quotes
117
+ Style/StringLiterals:
118
+ Enabled: false
119
+
120
+ # Offense count: 120
121
+ # Cop supports --auto-correct.
122
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
95
123
  # URISchemes: http, https
96
- Metrics/LineLength:
97
- Max: 168
124
+ Layout/LineLength:
125
+ Max: 198
@@ -2,10 +2,11 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.3.8
6
- - 2.4.6
7
- - 2.5.5
8
- - 2.6.3
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,25 @@ 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
+
17
+ ## [0.16.2][] (24 Aug 2020)
18
+ * Support delays w/ Linux animated GIFs (@theY4Kman [#405][])
19
+ * Upgrade git gem to version 1.6.0 (@depfu [#402][])
20
+ * Upgrade lolcommits-loltext to version 0.4.0 (@depfu [#401][])
21
+
22
+ ## [0.16.1][] (21 Jan 2020)
23
+ * Upgrade mini_magick to version 4.10.1 (@depfu [#399][])
24
+ * Fix rubocop config (@Salzig [#400][])
25
+
26
+ ## [0.16.0][] (21 Oct 2019)
27
+ * update macOS binaries for Catalina support (@matthutchinson, @samwize [#398][])
28
+
10
29
  ## [0.15.1][] (6 Jun 2019)
11
30
  * fix device list command (@matthutchinson [#394][])
12
31
 
@@ -35,7 +54,7 @@ This project adheres to [Semantic Versioning][Semver].
35
54
  * Update all links and badges (in gemspec, README etc.) to lolcommits
36
55
  organisation (@matthutchinson)
37
56
  * remove gem `post_install` message (@matthutchinson)
38
- * use `lolcommits-loltext ~> 0.1.0' (@matthutchinson)
57
+ * use `lolcommits-loltext ~> 0.1.0` (@matthutchinson)
39
58
 
40
59
  ## [0.13.0][] (23 April 2019)
41
60
  * Require at least Ruby 2.3
@@ -49,7 +68,7 @@ This project adheres to [Semantic Versioning][Semver].
49
68
 
50
69
  ## [0.12.1][] (27 March 2018)
51
70
  * Name passed to `Plugin::Base` initializer (@matthutchinson)
52
- * Removed dead method `configured? in `Plugin::Base`
71
+ * Removed dead method `configured?` in `Plugin::Base`
53
72
  * Using `YAML.safe_load` for configuration loading
54
73
 
55
74
  ## [0.12.0][] (15 March 2018)
@@ -366,8 +385,12 @@ This project adheres to [Semantic Versioning][Semver].
366
385
  reliable to not glitch.)
367
386
 
368
387
  [Semver]: http://semver.org
369
- [Unreleased]: https://github.com/lolcommits/lolcommits/compare/v0.15.1...HEAD
370
- [0.15.0]: https://github.com/lolcommits/lolcommits/compare/v0.15.0...v0.15.1
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
390
+ [0.16.2]: https://github.com/lolcommits/lolcommits/compare/v0.16.1...v0.16.2
391
+ [0.16.1]: https://github.com/lolcommits/lolcommits/compare/v0.16.0...v0.16.1
392
+ [0.16.0]: https://github.com/lolcommits/lolcommits/compare/v0.15.1...v0.16.0
393
+ [0.15.1]: https://github.com/lolcommits/lolcommits/compare/v0.15.0...v0.15.1
371
394
  [0.15.0]: https://github.com/lolcommits/lolcommits/compare/v0.14.1...v0.15.0
372
395
  [0.14.2]: https://github.com/lolcommits/lolcommits/compare/v0.14.1...v0.14.2
373
396
  [0.14.1]: https://github.com/lolcommits/lolcommits/compare/v0.14.0...v0.14.1
@@ -569,3 +592,10 @@ This project adheres to [Semantic Versioning][Semver].
569
592
  [#386]: https://github.com/lolcommits/lolcommits/pull/386
570
593
  [#392]: https://github.com/lolcommits/lolcommits/pull/392
571
594
  [#394]: https://github.com/lolcommits/lolcommits/pull/394
595
+ [#398]: https://github.com/lolcommits/lolcommits/pull/398
596
+ [#399]: https://github.com/lolcommits/lolcommits/pull/399
597
+ [#400]: https://github.com/lolcommits/lolcommits/pull/400
598
+ [#401]: https://github.com/lolcommits/lolcommits/pull/401
599
+ [#402]: https://github.com/lolcommits/lolcommits/pull/402
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
 
@@ -1,2 +1,2 @@
1
1
  ---
2
- default: <%= ENV['TRAVIS'] == 'true' ? '--tags ~@requires_ffmpeg' : 'features' %>
2
+ default: <%= ENV['TRAVIS'] == "true" ? "features --tags \"not @requires_ffmpeg\"" : "features" %>
@@ -63,15 +63,6 @@ Feature: Basic UI functionality
63
63
  And a file named ".git/hooks/post-commit" should exist
64
64
  And the exit status should be 0
65
65
 
66
- Scenario: Trying to enable while not in a git repo fails
67
- Given I am in a directory named "svnrulez"
68
- When I run `lolcommits --enable`
69
- Then the output should contain:
70
- """
71
- You don't appear to be in the base directory of a supported vcs project.
72
- """
73
- And the exit status should be 1
74
-
75
66
  # flakey test sometimes fails
76
67
  # Scenario: Capture doesnt break in forked mode
77
68
  # Given I am in a git repo named "forked"
@@ -160,8 +151,17 @@ Feature: Basic UI functionality
160
151
  """
161
152
  And the exit status should be 0
162
153
 
163
- @no-repo-dir
154
+ Scenario: Trying to enable while not in a git repo fails
155
+ Given I am not in a git repo
156
+ When I run `lolcommits --enable`
157
+ Then the output should contain:
158
+ """
159
+ You don't appear to be in the base directory of a supported vcs project.
160
+ """
161
+ And the exit status should be 1
162
+
164
163
  Scenario: last command should fail gracefully if not in a repo
164
+ Given I am not in a git repo
165
165
  When I run `lolcommits --last`
166
166
  Then the output should contain:
167
167
  """
@@ -169,8 +169,8 @@ Feature: Basic UI functionality
169
169
  """
170
170
  And the exit status should be 1
171
171
 
172
- @no-repo-dir
173
172
  Scenario: Configuring loltext plugin if not in a repo
173
+ Given I am not in a git repo
174
174
  When I run `lolcommits --config`
175
175
  Then the output should contain:
176
176
  """
@@ -178,8 +178,8 @@ Feature: Basic UI functionality
178
178
  """
179
179
  And the exit status should be 1
180
180
 
181
- @no-repo-dir
182
181
  Scenario: browse command should fail gracefully when not in a repo
182
+ Given I am not in a git repo
183
183
  When I run `lolcommits --browse`
184
184
  Then the output should contain:
185
185
  """
@@ -45,6 +45,14 @@ Given(/^I am in a git repo$/) do
45
45
  )
46
46
  end
47
47
 
48
+ Given(/^I am not in a git repo/) do
49
+ steps %(
50
+ Given I cd to "/tmp"
51
+ And a directory named "lolcommits_no_repo"
52
+ And I cd to "lolcommits_no_repo"
53
+ )
54
+ end
55
+
48
56
  Given(/^I am in a git repo named "(.*?)" with lolcommits enabled$/) do |repo|
49
57
  steps %(
50
58
  Given I am in a git repo named "#{repo}"
@@ -58,7 +66,7 @@ Given(/^I am in a git repo with lolcommits enabled$/) do
58
66
  )
59
67
  end
60
68
 
61
- Given(/^a git post\-commit hook with "(.*?)"$/) do |file_content|
69
+ Given(/^a git post-commit hook with "(.*?)"$/) do |file_content|
62
70
  steps %(
63
71
  Given a file named "#{postcommit_hook_git}" with:
64
72
  """
@@ -67,13 +75,13 @@ Given(/^a git post\-commit hook with "(.*?)"$/) do |file_content|
67
75
  )
68
76
  end
69
77
 
70
- 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
71
79
  steps %(
72
80
  Then the git post-commit hook should contain "lolcommits --capture"
73
81
  )
74
82
  end
75
83
 
76
- 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|
77
85
  steps %(
78
86
  Then the file "#{postcommit_hook_git}" #{should} contain "#{content}"
79
87
  )
@@ -111,7 +119,7 @@ Given(/^I am in a mercurial repo with lolcommits enabled$/) do
111
119
  )
112
120
  end
113
121
 
114
- Given(/^a mercurial post\-commit hook with "(.*?)"$/) do |file_content|
122
+ Given(/^a mercurial post-commit hook with "(.*?)"$/) do |file_content|
115
123
  steps %(
116
124
  Given a file named "#{postcommit_hook_mercurial}" with:
117
125
  """
@@ -120,13 +128,13 @@ Given(/^a mercurial post\-commit hook with "(.*?)"$/) do |file_content|
120
128
  )
121
129
  end
122
130
 
123
- 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
124
132
  steps %(
125
133
  Then the mercurial post-commit hook should contain "lolcommits --capture"
126
134
  )
127
135
  end
128
136
 
129
- 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|
130
138
  steps %(
131
139
  Then the file "#{postcommit_hook_mercurial}" #{should} contain "#{content}"
132
140
  )
@@ -146,8 +154,8 @@ Given(/^a loldir named "(.*?)" with (\d+) lolimages$/) do |repo, num_images|
146
154
  loldir = expand_path("~/.lolcommits/#{repo}")
147
155
  FileUtils.mkdir_p loldir
148
156
  num_images.to_i.times do
149
- hex = format('%011x', (rand * 0xfffffffffff)).to_s
150
- FileUtils.cp 'test/assets/test_image.jpg', File.join(loldir, "#{hex}.jpg")
157
+ sha = format('%<hex>x', hex: (rand * 0xfffffffffff))
158
+ FileUtils.cp 'test/assets/test_image.jpg', File.join(loldir, "#{sha}.jpg")
151
159
  end
152
160
  end
153
161
 
@@ -13,6 +13,8 @@ World(PathHelpers)
13
13
 
14
14
  Aruba.configure do |config|
15
15
  config.exit_timeout = 20
16
+ # allow absolute paths for tests involving no repo
17
+ config.allow_absolute_paths = true
16
18
  end
17
19
 
18
20
  Before do
@@ -52,21 +54,3 @@ end
52
54
  Before('@fake-no-ffmpeg') do
53
55
  reject_paths_with_cmd('ffmpeg')
54
56
  end
55
-
56
- # do test in a new temp directory (outside our own git repo-ness)
57
- # due to https://github.com/cucumber/aruba/issues/478 aruba no longer allows
58
- # wandering out of `tmp/aruba` so this pop/restore is necessary
59
- Before('@no-repo-dir') do
60
- @original_root = aruba.root_directory.pop
61
- @original_dir = aruba.current_directory.pop
62
- @working_dir = Dir.mktmpdir
63
- aruba.current_directory << @working_dir
64
- end
65
-
66
- After('@no-repo-dir') do
67
- aruba.current_directory.pop
68
- aruba.root_directory << @original_root
69
- aruba.current_directory << @original_dir
70
-
71
- FileUtils.rm_rf(@working_dir)
72
- end
@@ -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
@@ -3,7 +3,7 @@
3
3
  module Lolcommits
4
4
  class CaptureLinuxVideo < Capturer
5
5
  def capture
6
- system_call "ffmpeg -nostats -v quiet -y -f video4linux2 -video_size 640x480 -i #{capture_device_string} -t #{capture_duration} \"#{capture_path}\" > /dev/null"
6
+ system_call "ffmpeg -nostats -v quiet -y -f video4linux2 -video_size 640x480 -i #{capture_device_string} -t #{capture_duration} -ss #{capture_delay || 0} \"#{capture_path}\" > /dev/null"
7
7
  end
8
8
 
9
9
  private
@@ -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.15.1'
5
- GEM_NAME = 'lolcommits'
4
+ VERSION = "0.16.3"
5
+ GEM_NAME = "lolcommits"
6
6
  end
@@ -33,20 +33,20 @@ Gem::Specification.new do |s|
33
33
  s.require_paths = ['lib']
34
34
 
35
35
  # non-gem dependencies
36
- s.required_ruby_version = '>= 2.3'
36
+ s.required_ruby_version = '>= 2.4'
37
37
  s.requirements << 'imagemagick'
38
38
  s.requirements << 'a webcam'
39
39
 
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.9.3')
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.5.0')
46
+ s.add_runtime_dependency('git', '~> 1.8.1')
47
47
 
48
48
  # included plugins
49
- s.add_runtime_dependency('lolcommits-loltext', '~> 0.3.0')
49
+ s.add_runtime_dependency('lolcommits-loltext', '~> 0.4.0')
50
50
 
51
51
  # development & test gems
52
52
  s.add_development_dependency('aruba')
@@ -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.15.1
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: 2019-06-06 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.9.3
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.9.3
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,28 +87,28 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 1.5.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.5.0
97
+ version: 1.8.1
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: lolcommits-loltext
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 0.3.0
104
+ version: 0.4.0
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 0.3.0
111
+ version: 0.4.0
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: aruba
114
114
  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
@@ -320,7 +321,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
320
321
  requirements:
321
322
  - - ">="
322
323
  - !ruby/object:Gem::Version
323
- version: '2.3'
324
+ version: '2.4'
324
325
  required_rubygems_version: !ruby/object:Gem::Requirement
325
326
  requirements:
326
327
  - - ">="
@@ -329,9 +330,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
330
  requirements:
330
331
  - imagemagick
331
332
  - a webcam
332
- rubyforge_project:
333
- rubygems_version: 2.7.7
334
- signing_key:
333
+ rubygems_version: 3.2.3
334
+ signing_key:
335
335
  specification_version: 4
336
336
  summary: Capture webcam image on git commit for lulz.
337
- test_files: []
337
+ test_files:
338
+ - features/bugs.feature
339
+ - features/lolcommits.feature
340
+ - features/step_definitions/lolcommits_steps.rb
341
+ - features/support/env.rb
342
+ - features/support/path_helpers.rb
343
+ - test/assets/test_image.jpg
344
+ - test/assets/test_video.mp4
345
+ - test/images/test_image.jpg
346
+ - test/permissions_test.rb
347
+ - test/test_helper.rb