lolcommits 0.17.2 → 0.18.0

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +309 -9
  3. data/README.md +14 -26
  4. data/bin/lolcommits +2 -12
  5. data/lib/core_ext/mercurial-ruby/changed_file.rb +1 -3
  6. data/lib/core_ext/mercurial-ruby/command.rb +2 -4
  7. data/lib/core_ext/mercurial-ruby/config_file.rb +0 -2
  8. data/lib/core_ext/mercurial-ruby/repository.rb +0 -2
  9. data/lib/core_ext/mercurial-ruby/shell.rb +1 -3
  10. data/lib/lolcommits/animated_gif.rb +12 -7
  11. data/lib/lolcommits/backends/git_info.rb +6 -8
  12. data/lib/lolcommits/backends/installation_git.rb +8 -10
  13. data/lib/lolcommits/backends/installation_mercurial.rb +8 -10
  14. data/lib/lolcommits/backends/mercurial_info.rb +9 -11
  15. data/lib/lolcommits/capturer/capture_cygwin.rb +0 -2
  16. data/lib/lolcommits/capturer/capture_fake.rb +2 -4
  17. data/lib/lolcommits/capturer/capture_linux.rb +4 -6
  18. data/lib/lolcommits/capturer/capture_linux_video.rb +1 -3
  19. data/lib/lolcommits/capturer/capture_mac.rb +2 -4
  20. data/lib/lolcommits/capturer/capture_mac_video.rb +1 -3
  21. data/lib/lolcommits/capturer/capture_windows.rb +2 -4
  22. data/lib/lolcommits/capturer/capture_windows_video.rb +5 -7
  23. data/lib/lolcommits/capturer.rb +9 -12
  24. data/lib/lolcommits/cli/fatals.rb +11 -16
  25. data/lib/lolcommits/cli/launcher.rb +1 -3
  26. data/lib/lolcommits/cli/process_runner.rb +2 -4
  27. data/lib/lolcommits/cli/timelapse_gif.rb +11 -11
  28. data/lib/lolcommits/cli.rb +6 -6
  29. data/lib/lolcommits/configuration.rb +32 -36
  30. data/lib/lolcommits/gem_plugin.rb +5 -7
  31. data/lib/lolcommits/installation.rb +5 -7
  32. data/lib/lolcommits/platform.rb +14 -18
  33. data/lib/lolcommits/plugin/base.rb +4 -8
  34. data/lib/lolcommits/plugin/configuration_helper.rb +4 -6
  35. data/lib/lolcommits/plugin_manager.rb +1 -3
  36. data/lib/lolcommits/runner.rb +21 -24
  37. data/lib/lolcommits/test_helpers/fake_io.rb +0 -2
  38. data/lib/lolcommits/test_helpers/git_repo.rb +3 -5
  39. data/lib/lolcommits/vcs_info.rb +2 -4
  40. data/lib/lolcommits/version.rb +1 -3
  41. data/lib/lolcommits.rb +26 -30
  42. metadata +42 -83
  43. data/.gitattributes +0 -1
  44. data/.github/workflows/build.yml +0 -64
  45. data/.github/workflows/push_gem.yml +0 -25
  46. data/.gitignore +0 -15
  47. data/.rubocop_todo.yml +0 -97
  48. data/.travis.yml +0 -45
  49. data/CHANGELOG.md +0 -637
  50. data/CODE_OF_CONDUCT.md +0 -73
  51. data/CONTRIBUTING.md +0 -44
  52. data/Gemfile +0 -4
  53. data/PULL_REQUEST_TEMPLATE.md +0 -16
  54. data/Rakefile +0 -53
  55. data/bin/console +0 -12
  56. data/features/bugs.feature +0 -52
  57. data/features/lolcommits.feature +0 -376
  58. data/features/step_definitions/lolcommits_steps.rb +0 -238
  59. data/features/support/env.rb +0 -56
  60. data/features/support/path_helpers.rb +0 -38
  61. data/lolcommits.gemspec +0 -62
  62. data/test/assets/test_image.jpg +0 -0
  63. data/test/assets/test_video.mp4 +0 -0
  64. data/test/images/test_image.jpg +0 -0
  65. data/test/permissions_test.rb +0 -19
  66. data/test/test_helper.rb +0 -4
@@ -1,238 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'fileutils'
4
- require 'aruba/api'
5
-
6
- def postcommit_hook_git
7
- '.git/hooks/post-commit'
8
- end
9
-
10
- def postcommit_hook_mercurial
11
- '.hg/hgrc'
12
- end
13
-
14
- def default_repo
15
- 'myrepo'
16
- end
17
-
18
- def default_loldir
19
- "~/.lolcommits/#{default_repo}"
20
- end
21
-
22
- Given(/^I am in a directory named "(.*?)"$/) do |dir_name|
23
- steps %(
24
- Given a directory named "#{dir_name}"
25
- And I cd to "#{dir_name}"
26
- )
27
- end
28
-
29
- Given(/^a git repo named "(.*?)"$/) do |repo_name|
30
- steps %(
31
- Given I run `git init --quiet "#{repo_name}"`
32
- )
33
- end
34
-
35
- Given(/^I am in a git repo named "(.*?)"$/) do |repo|
36
- steps %(
37
- Given a git repo named "#{repo}"
38
- And I cd to "#{repo}"
39
- )
40
- end
41
-
42
- Given(/^I am in a git repo$/) do
43
- steps %(
44
- Given I am in a git repo named "#{default_repo}"
45
- )
46
- end
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
-
56
- Given(/^I am in a git repo named "(.*?)" with lolcommits enabled$/) do |repo|
57
- steps %(
58
- Given I am in a git repo named "#{repo}"
59
- And I run `lolcommits --enable`
60
- )
61
- end
62
-
63
- Given(/^I am in a git repo with lolcommits enabled$/) do
64
- steps %(
65
- Given I am in a git repo named "#{default_repo}" with lolcommits enabled
66
- )
67
- end
68
-
69
- Given(/^a git post-commit hook with "(.*?)"$/) do |file_content|
70
- steps %(
71
- Given a file named "#{postcommit_hook_git}" with:
72
- """
73
- #{file_content}
74
- """
75
- )
76
- end
77
-
78
- Then(/^the lolcommits git post-commit hook should be properly installed$/) do
79
- steps %(
80
- Then the git post-commit hook should contain "lolcommits --capture"
81
- )
82
- end
83
-
84
- Then(/^the git post-commit hook (should|should not) contain "(.*?)"$/) do |should, content|
85
- steps %(
86
- Then the file "#{postcommit_hook_git}" #{should} contain "#{content}"
87
- )
88
- end
89
-
90
- Given(/^a mercurial repo named "(.*?)"$/) do |repo_name|
91
- steps %(
92
- Given I run `hg init "#{repo_name}"`
93
- )
94
- end
95
-
96
- Given(/^I am in a mercurial repo named "(.*?)"$/) do |repo|
97
- steps %(
98
- Given a mercurial repo named "#{repo}"
99
- And I cd to "#{repo}"
100
- )
101
- end
102
-
103
- Given(/^I am in a mercurial repo$/) do
104
- steps %(
105
- Given I am in a mercurial repo named "#{default_repo}"
106
- )
107
- end
108
-
109
- Given(/^I am in a mercurial repo named "(.*?)" with lolcommits enabled$/) do |repo|
110
- steps %(
111
- Given I am in a mercurial repo named "#{repo}"
112
- And I run `lolcommits --enable`
113
- )
114
- end
115
-
116
- Given(/^I am in a mercurial repo with lolcommits enabled$/) do
117
- steps %(
118
- Given I am in a mercurial repo named "#{default_repo}" with lolcommits enabled
119
- )
120
- end
121
-
122
- Given(/^a mercurial post-commit hook with "(.*?)"$/) do |file_content|
123
- steps %(
124
- Given a file named "#{postcommit_hook_mercurial}" with:
125
- """
126
- #{file_content}
127
- """
128
- )
129
- end
130
-
131
- Then(/^the lolcommits mercurial post-commit hook should be properly installed$/) do
132
- steps %(
133
- Then the mercurial post-commit hook should contain "lolcommits --capture"
134
- )
135
- end
136
-
137
- Then(/^the mercurial post-commit hook (should|should not) contain "(.*?)"$/) do |should, content|
138
- steps %(
139
- Then the file "#{postcommit_hook_mercurial}" #{should} contain "#{content}"
140
- )
141
- end
142
-
143
- Given(/^I have environment variable (.*?) set to (.*?)$/) do |var, value|
144
- set_environment_variable var, value
145
- end
146
-
147
- Given(/^its loldir has (\d+) lolimages$/) do |num_images|
148
- steps %(
149
- Given a loldir named "#{default_repo}" with #{num_images} lolimages
150
- )
151
- end
152
-
153
- Given(/^a loldir named "(.*?)" with (\d+) lolimages$/) do |repo, num_images|
154
- loldir = expand_path("~/.lolcommits/#{repo}")
155
- FileUtils.mkdir_p loldir
156
- num_images.to_i.times do
157
- sha = format('%<hex>x', hex: (rand * 0xfffffffffff))
158
- FileUtils.cp 'test/assets/test_image.jpg', File.join(loldir, "#{sha}.jpg")
159
- end
160
- end
161
-
162
- Then(/^there should be exactly (.*?) (mp4|jpg|gif|pid)s? in its loldir$/) do |n, type|
163
- steps %(
164
- Then there should be exactly #{n} #{type} in "#{default_loldir}"
165
- )
166
- end
167
-
168
- Then(/^there should be exactly (.*?) (mp4|jpg|gif|pid)s? in "(.*?)"$/) do |n, type, folder|
169
- expect(Dir[expand_path("#{folder}/*.#{type}")].count).to eq(n.to_i)
170
- end
171
-
172
- Then(/^the output should contain a list of plugins$/) do
173
- step %(the output should contain "Installed plugins: (* enabled)")
174
- step %(the output should contain "[*] loltext")
175
- end
176
-
177
- Then(/^the output should show the version number$/) do
178
- step %(the output should match /^#{Lolcommits::VERSION}$/)
179
- end
180
-
181
- When(/^I do a git commit with commit message "(.*?)"$/) do |commit_msg|
182
- filename = FFaker::Lorem.words(1).first
183
- steps %(
184
- Given a 98 byte file named "#{filename}"
185
- And I run `git add #{filename}`
186
- And I run `git commit -m "#{commit_msg}"`
187
- )
188
- end
189
-
190
- When(/^I do a git commit$/) do
191
- step %(I do a git commit with commit message "#{FFaker::Lorem.sentence}")
192
- end
193
-
194
- When(/^I do (\d+) git commits$/) do |n|
195
- n.to_i.times do
196
- step %(I do a git commit)
197
- sleep 0.2
198
- end
199
- end
200
-
201
- Then(/^there should be (\d+) commit entries in the git log$/) do |n|
202
- sleep 1 # let the file writing catch up
203
- expect(n.to_i).to eq `git shortlog | grep -E '^[ ]+\w+' | wc -l`.chomp.to_i
204
- end
205
-
206
- When(/^I do a mercurial commit with commit message "(.*?)"$/) do |commit_msg|
207
- filename = FFaker::Lorem.words(1).first
208
- steps %(
209
- Given a 98 byte file named "#{filename}"
210
- And I run `hg add #{filename}`
211
- And I run `hg commit -m "#{commit_msg}"`
212
- )
213
- end
214
-
215
- When(/^I do a mercurial commit$/) do
216
- step %(I do a mercurial commit with commit message "#{FFaker::Lorem.sentence}")
217
- end
218
-
219
- When(/^I do (\d+) mercurial commits$/) do |n|
220
- n.to_i.times do
221
- step %(I do a mercurial commit)
222
- sleep 0.1
223
- end
224
- end
225
-
226
- Then(/^there should be (\d+) commit entries in the mercurial log$/) do |n|
227
- sleep 1 # let the file writing catch up
228
- expect(n.to_i).to eq `hg log | grep '^changeset:' | wc -l`.chomp.to_i
229
- end
230
-
231
- Given(/^I am using a "(.*?)" platform$/) do |host_os_name|
232
- set_environment_variable 'LOLCOMMITS_FAKE_HOST_OS', host_os_name
233
- end
234
-
235
- When(/^I wait for the child process to exit in "(.*?)"$/) do |repo_name|
236
- pid_loc = expand_path("~/.lolcommits/#{repo_name}/lolcommits.pid")
237
- sleep 0.1 while File.exist?(pid_loc)
238
- end
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'aruba/cucumber'
4
- require 'optparse_plus/cucumber'
5
- require 'open3'
6
- require 'ffaker'
7
- require 'fileutils'
8
-
9
- require File.join(__dir__, 'path_helpers')
10
- include Lolcommits
11
-
12
- World(PathHelpers)
13
-
14
- Aruba.configure do |config|
15
- config.exit_timeout = 20
16
- # allow absolute paths for tests involving no repo
17
- config.allow_absolute_paths = true
18
- end
19
-
20
- Before do
21
- # prevent launchy from opening gifs in tests
22
- set_environment_variable 'LAUNCHY_DRY_RUN', 'true'
23
- set_environment_variable 'LOLCOMMITS_CAPTURER', 'Lolcommits::CaptureFake'
24
-
25
- author_name = 'Testy McTesterson'
26
- author_email = 'testy@tester.com'
27
-
28
- set_environment_variable 'GIT_AUTHOR_NAME', author_name
29
- set_environment_variable 'GIT_COMMITTER_NAME', author_name
30
- set_environment_variable 'GIT_AUTHOR_EMAIL', author_email
31
- set_environment_variable 'GIT_COMMITTER_EMAIL', author_email
32
- end
33
-
34
- # for tasks that may take an incredibly long time (e.g. network related)
35
- # we should strive to not have any of these in our scenarios, naturally.
36
- Before('@slow_process') do
37
- Aruba.configure do |config|
38
- config.exit_timeout = 60
39
- end
40
- end
41
-
42
- # in order to fake an interactive rebase, we replace the editor with a script
43
- # to simply squash a few random commits. in this case, using lines 3-5.
44
- Before('@fake-interactive-rebase') do
45
- set_environment_variable 'GIT_EDITOR', "sed -i -e '3,5 s/pick/squash/g'"
46
- end
47
-
48
- # adjust the path so tests dont see a global imagemagick install
49
- Before('@fake-no-imagemagick') do
50
- reject_paths_with_cmd('mogrify')
51
- end
52
-
53
- # adjust the path so tests dont see a global ffmpeg install
54
- Before('@fake-no-ffmpeg') do
55
- reject_paths_with_cmd('ffmpeg')
56
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'fileutils'
4
- require 'aruba/api'
5
- require 'lolcommits/platform'
6
-
7
- module PathHelpers
8
- def reject_paths_with_cmd(cmd)
9
- # make a new subdir that still contains cmds
10
- tmpbindir = expand_path('./bin')
11
- FileUtils.mkdir_p tmpbindir
12
-
13
- preseve_cmds_in_path(%w(git mplayer), tmpbindir)
14
-
15
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
16
- newpaths = ENV['PATH'].split(File::PATH_SEPARATOR).reject do |path|
17
- found_cmd = false
18
- exts.each do |ext|
19
- exe = "#{path}/#{cmd}#{ext}"
20
- found_cmd = true if File.executable? exe
21
- end
22
- found_cmd
23
- end
24
-
25
- # add the temporary directory with git in it back into the path
26
- newpaths << tmpbindir
27
-
28
- # use aruba/api set_environment_variable to set PATH, which will be automaticaly restored
29
- set_environment_variable 'PATH', newpaths.join(File::PATH_SEPARATOR)
30
- end
31
-
32
- def preseve_cmds_in_path(cmds, tmpbindir)
33
- cmds.each do |cmd|
34
- whichcmd = Lolcommits::Platform.command_which(cmd)
35
- FileUtils.ln_s whichcmd, File.join(tmpbindir, File.basename(whichcmd)) unless whichcmd.nil?
36
- end
37
- end
38
- end
data/lolcommits.gemspec DELETED
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'lolcommits/version'
6
-
7
- Gem::Specification.new do |s|
8
- s.name = Lolcommits::GEM_NAME.dup
9
- s.version = Lolcommits::VERSION.dup
10
-
11
- s.authors = ['Matthew Rothenberg', 'Matthew Hutchinson']
12
- s.email = ['mrothenberg@gmail.com', 'matt@hiddenloop.com']
13
- s.license = 'LGPL-3.0'
14
- s.summary = 'Capture webcam image on git commit for lulz.'
15
-
16
- s.description = <<-DESC
17
- lolcommits takes a snapshot with your webcam every time you git commit code,
18
- and archives a lolcat style image with it. It's selfies for software
19
- developers. `git blame` has never been so much fun.
20
- DESC
21
-
22
- s.metadata = {
23
- 'homepage_uri' => 'https://lolcommits.github.io',
24
- 'source_code_uri' => 'https://github.com/lolcommits/lolcommits',
25
- 'changelog_uri' => 'https://github.com/lolcommits/lolcommits/blob/master/CHANGELOG.md',
26
- 'bug_tracker_uri' => 'https://github.com/lolcommits/lolcommits/issues',
27
- 'allowed_push_host' => 'https://rubygems.org'
28
- }
29
-
30
- s.files = `git ls-files`.split("\n")
31
- s.test_files = `git ls-files -- {test,features}/*`.split("\n")
32
- s.executables = 'lolcommits'
33
- s.require_paths = ['lib']
34
-
35
- # non-gem dependencies
36
- s.required_ruby_version = '>= 3.1'
37
- s.requirements << 'imagemagick'
38
- s.requirements << 'a webcam'
39
-
40
- # core
41
- s.add_runtime_dependency('optparse-plus', '~> 3.0.1')
42
- s.add_runtime_dependency('mercurial-ruby', '~> 0.7.12')
43
- s.add_runtime_dependency('mini_magick', '~> 5.0.1')
44
- s.add_runtime_dependency('launchy', '~> 3.0.1')
45
- s.add_runtime_dependency('open4', '~> 1.3.4')
46
- s.add_runtime_dependency('git', '~> 2.3.0')
47
- s.add_runtime_dependency('logger')
48
- s.add_runtime_dependency('ostruct')
49
- s.add_runtime_dependency('base64')
50
-
51
- # included plugins
52
- s.add_runtime_dependency('lolcommits-loltext', '~> 0.5.0')
53
-
54
- # development & test gems
55
- s.add_development_dependency('aruba')
56
- s.add_development_dependency('rake')
57
- s.add_development_dependency('rdoc')
58
- s.add_development_dependency('debug')
59
- s.add_development_dependency('rubocop')
60
- s.add_development_dependency('minitest')
61
- s.add_development_dependency('ffaker')
62
- end
Binary file
Binary file
Binary file
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
4
-
5
- class PermissionsTest < Minitest::Test
6
- #
7
- # issue #53, https://github.com/lolcommits/lolcommits/issues/53
8
- # this will test the permissions but only locally, important before building a gem package!
9
- #
10
- def test_permissions
11
- imagesnap_perms = File.lstat(File.join(Lolcommits::Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'imagesnap', 'imagesnap')).mode & 0o777
12
- videosnap_perms = File.lstat(File.join(Lolcommits::Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'videosnap', 'videosnap')).mode & 0o777
13
- commandcam_perms = File.lstat(File.join(Lolcommits::Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'CommandCam', 'CommandCam.exe')).mode & 0o777
14
-
15
- assert [0o755, 0o775].include?(imagesnap_perms), "expected perms of 755/775 but instead got #{format '%<perms>o', perms: imagesnap_perms}"
16
- assert [0o755, 0o775].include?(videosnap_perms), "expected perms of 755/775 but instead got #{format '%<perms>o', perms: videosnap_perms}"
17
- assert [0o755, 0o775].include?(commandcam_perms), "expected perms of 755/775 but instead got #{format '%<perms>o', perms: commandcam_perms}"
18
- end
19
- end
data/test/test_helper.rb DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lolcommits'
4
- require 'minitest/autorun'