checkoff 0.207.0 → 0.208.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +19 -7
- data/.git-hooks/pre_commit/solargraph_typecheck.rb +12 -1
- data/Gemfile +36 -25
- data/Gemfile.lock +25 -11
- data/Makefile +6 -1
- data/bin/overcommit_branch +54 -57
- data/config/annotations_misc.rb +1 -0
- data/fix.sh +68 -10
- data/lib/checkoff/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7942023f02e281c392a83c840d17c775b34feeccf295822faae41b90fd1c866e
|
4
|
+
data.tar.gz: 563a27004a03f007de1a379ff2a612c0ee8e1c66a2edec2a23ed0ba9a3ec6f46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f3c0dddcaedb88b032b36635b726c53b9b4f7966d06d93a8bb9a84da425cf4611be202064deadc2a00338579d616f16d99f31e922ac7c7cfd712355eee82745
|
7
|
+
data.tar.gz: '087d1c0f801fc7864a6d4abb93ad7609f21b1c4a10bda4932c506aece41f8420df741c5b5e2bc5a4ac511dacaab4824e61fb4318f54a64535bff2d9cf32ee73c'
|
data/.circleci/config.yml
CHANGED
@@ -22,7 +22,8 @@ commands:
|
|
22
22
|
eval "$(pyenv init --path)"
|
23
23
|
eval "$(pyenv virtualenv-init -)"
|
24
24
|
eval "$(rbenv init -)"
|
25
|
-
|
25
|
+
# keep this in a single place for both main and child builds for cachability
|
26
|
+
export BUNDLE_PATH="$(pwd)/vendor/bundle"
|
26
27
|
|
27
28
|
<<parameters.command>>
|
28
29
|
environment:
|
@@ -35,8 +36,8 @@ commands:
|
|
35
36
|
- checkout
|
36
37
|
- restore_cache:
|
37
38
|
keys:
|
38
|
-
- gems-
|
39
|
-
- gems-
|
39
|
+
- gems-v3-{{ checksum "Gemfile.lock" }}-
|
40
|
+
- gems-v3-
|
40
41
|
- gems-
|
41
42
|
- restore_cache:
|
42
43
|
keys:
|
@@ -53,8 +54,15 @@ commands:
|
|
53
54
|
- run:
|
54
55
|
name: Initialize packages
|
55
56
|
command: |
|
56
|
-
|
57
|
+
# measuring slows down the script - only enable when you
|
58
|
+
# want to debug where this is spending time
|
59
|
+
|
60
|
+
# export FIX_SH_TIMING_LOG=/tmp/fix_sh_timing.log
|
61
|
+
|
62
|
+
export BUNDLE_PATH="$(pwd)/vendor/bundle"
|
57
63
|
'./fix.sh'
|
64
|
+
- store_artifacts:
|
65
|
+
path: /tmp/fix_sh_timing.log
|
58
66
|
- run:
|
59
67
|
name: Verify Gemfile.lock
|
60
68
|
command: |
|
@@ -64,9 +72,10 @@ commands:
|
|
64
72
|
exit 1
|
65
73
|
fi
|
66
74
|
- save_cache:
|
67
|
-
key: gems-
|
75
|
+
key: gems-v3-{{ checksum "Gemfile.lock" }}-{{ checksum ".ruby-version" }}
|
68
76
|
paths:
|
69
77
|
- "vendor/bundle"
|
78
|
+
- ".yardoc"
|
70
79
|
- save_cache:
|
71
80
|
key: wheels-v1-3.12.1-{{ checksum "requirements_dev.txt" }}
|
72
81
|
paths:
|
@@ -101,9 +110,14 @@ commands:
|
|
101
110
|
label: Run brakeman
|
102
111
|
command: |
|
103
112
|
bundle exec brakeman --no-pager --force
|
113
|
+
- run_with_languages:
|
114
|
+
label: Run Rubocop
|
115
|
+
command: |
|
116
|
+
bundle exec rubocop
|
104
117
|
- run_with_languages:
|
105
118
|
label: Ratchet rubocop quality
|
106
119
|
command: |
|
120
|
+
set -x
|
107
121
|
bundle exec rubocop --regenerate-todo --no-exclude-limit --auto-gen-only-exclude --no-auto-gen-timestamp
|
108
122
|
if [ -f .rubocop_todo.yml ]
|
109
123
|
then
|
@@ -216,8 +230,6 @@ jobs:
|
|
216
230
|
- image: apiology/circleci-ruby:latest
|
217
231
|
steps:
|
218
232
|
- set_up_environment
|
219
|
-
- run: git config user.email 'vince@broz.cc'
|
220
|
-
- run: git config user.name 'Vince Broz'
|
221
233
|
- run_with_languages:
|
222
234
|
label: Make RubyGems release
|
223
235
|
command: |
|
@@ -23,6 +23,17 @@ module Overcommit
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
+
# @param stderr [String]
|
27
|
+
#
|
28
|
+
# @return [Array<String>]
|
29
|
+
def remove_harmless_glitches(stderr)
|
30
|
+
stderr.split("\n").reject do |line|
|
31
|
+
line.include?('[WARN]') ||
|
32
|
+
line.include?('warning: parser/current is loading') ||
|
33
|
+
line.include?('Please see https://github.com/whitequark')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
26
37
|
# @param errors [Array<String>]
|
27
38
|
# @param file [String]
|
28
39
|
# @return [void]
|
@@ -30,7 +41,7 @@ module Overcommit
|
|
30
41
|
result = execute(['bundle', 'exec', 'solargraph', 'typecheck', '--level', 'strong', *files])
|
31
42
|
return if result.success?
|
32
43
|
|
33
|
-
stderr = result.stderr
|
44
|
+
stderr = remove_harmless_glitches(result.stderr)
|
34
45
|
raise result.stderr unless stderr.empty?
|
35
46
|
|
36
47
|
# @type [String]
|
data/Gemfile
CHANGED
@@ -5,11 +5,43 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in checkoff.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
|
9
|
-
gem 'bundler'
|
8
|
+
group :development, :test do
|
9
|
+
gem 'bundler'
|
10
|
+
gem 'mdl'
|
11
|
+
gem 'minitest'
|
12
|
+
gem 'minitest-profile'
|
13
|
+
gem 'minitest-reporters'
|
14
|
+
gem 'mocha', ['>= 2']
|
15
|
+
# ensure recent definitions
|
16
|
+
gem 'rbs'
|
17
|
+
# ensure version with branch coverage
|
18
|
+
gem 'simplecov', ['>=0.18.0']
|
19
|
+
gem 'simplecov-lcov'
|
20
|
+
gem 'undercover'
|
21
|
+
gem 'webmock'
|
22
|
+
end
|
10
23
|
|
11
|
-
|
12
|
-
gem '
|
24
|
+
group :development do
|
25
|
+
gem 'brakeman'
|
26
|
+
gem 'bump'
|
27
|
+
gem 'overcommit', ['>=0.64.1', '<0.65.0']
|
28
|
+
gem 'punchlist', ['>=1.3.1']
|
29
|
+
gem 'rubocop', ['~> 1.52']
|
30
|
+
gem 'rubocop-minitest'
|
31
|
+
gem 'rubocop-performance'
|
32
|
+
gem 'rubocop-rake'
|
33
|
+
# ensure version with RSpec/VerifiedDoubleReference
|
34
|
+
gem 'rubocop-rspec', ['>=2.10.0']
|
35
|
+
# https://github.com/castwide/solargraph/pull/727
|
36
|
+
# gem "solargraph", [">=0.50.0"]
|
37
|
+
gem 'solargraph',
|
38
|
+
git: 'https://github.com/apiology/solargraph',
|
39
|
+
branch: 'master'
|
40
|
+
gem 'solargraph-rails',
|
41
|
+
git: 'https://github.com/apiology/solargraph-rails',
|
42
|
+
branch: 'main'
|
43
|
+
gem 'yard'
|
44
|
+
end
|
13
45
|
|
14
46
|
# not a direct dependency - but updates a lot and confuses
|
15
47
|
# bump+overcommit+bundler when it unexpectedly updates during the
|
@@ -17,29 +49,8 @@ gem 'mdl'
|
|
17
49
|
#
|
18
50
|
# https://app.circleci.com/pipelines/github/apiology/checkoff/1209/workflows/863fa0ce-097e-4a6b-a49f-f6ed62b29908/jobs/2320
|
19
51
|
gem 'mime-types', ['=3.5.1']
|
20
|
-
gem 'minitest-profile'
|
21
|
-
gem 'minitest-reporters'
|
22
|
-
gem 'mocha', ['>= 2']
|
23
|
-
gem 'ostruct'
|
24
|
-
gem 'overcommit', ['>=0.64.0', '<0.65.0']
|
25
52
|
gem 'pry'
|
26
|
-
gem 'punchlist', ['>=1.3.1']
|
27
53
|
gem 'rake'
|
28
|
-
gem 'rbs'
|
29
|
-
gem 'rubocop', ['~> 1.52']
|
30
|
-
gem 'rubocop-minitest'
|
31
|
-
gem 'rubocop-performance'
|
32
|
-
gem 'rubocop-rake'
|
33
|
-
# ensure version with branch coverage
|
34
|
-
gem 'simplecov', ['>=0.18.0']
|
35
|
-
gem 'simplecov-lcov'
|
36
|
-
gem 'solargraph',
|
37
|
-
git: 'https://github.com/apiology/solargraph',
|
38
|
-
branch: 'master'
|
39
|
-
gem 'undercover'
|
40
|
-
gem 'webmock'
|
41
|
-
gem 'yard'
|
42
|
-
|
43
54
|
# ruby-asana gem is pending key bugfixes for checkoff as of
|
44
55
|
# 2021-07-29:
|
45
56
|
#
|
data/Gemfile.lock
CHANGED
@@ -31,10 +31,19 @@ GIT
|
|
31
31
|
tilt (~> 2.0)
|
32
32
|
yard (~> 0.9, >= 0.9.24)
|
33
33
|
|
34
|
+
GIT
|
35
|
+
remote: https://github.com/apiology/solargraph-rails
|
36
|
+
revision: 9dc37915bd4f3b169046e34db6fb32193ab347d8
|
37
|
+
branch: main
|
38
|
+
specs:
|
39
|
+
solargraph-rails (1.1.0)
|
40
|
+
activesupport
|
41
|
+
solargraph
|
42
|
+
|
34
43
|
PATH
|
35
44
|
remote: .
|
36
45
|
specs:
|
37
|
-
checkoff (0.
|
46
|
+
checkoff (0.208.0)
|
38
47
|
activesupport
|
39
48
|
asana (> 0.10.0)
|
40
49
|
cache_method
|
@@ -128,7 +137,7 @@ GEM
|
|
128
137
|
kramdown-parser-gfm (1.1.0)
|
129
138
|
kramdown (~> 2.0)
|
130
139
|
language_server-protocol (3.17.0.3)
|
131
|
-
logger (1.6.
|
140
|
+
logger (1.6.2)
|
132
141
|
mdl (0.13.0)
|
133
142
|
kramdown (~> 2.3)
|
134
143
|
kramdown-parser-gfm (~> 1.1)
|
@@ -139,6 +148,7 @@ GEM
|
|
139
148
|
mime-types (3.5.1)
|
140
149
|
mime-types-data (~> 3.2015)
|
141
150
|
mime-types-data (3.2023.1205)
|
151
|
+
mini_portile2 (2.8.8)
|
142
152
|
minitest (5.21.1)
|
143
153
|
minitest-profile (0.0.2)
|
144
154
|
minitest-reporters (1.6.1)
|
@@ -157,9 +167,10 @@ GEM
|
|
157
167
|
multi_xml (0.6.0)
|
158
168
|
multipart-post (2.3.0)
|
159
169
|
mutex_m (0.3.0)
|
160
|
-
nokogiri (1.16.7
|
170
|
+
nokogiri (1.16.7)
|
171
|
+
mini_portile2 (~> 2.8.2)
|
161
172
|
racc (~> 1.4)
|
162
|
-
nokogiri (1.16.7-
|
173
|
+
nokogiri (1.16.7-aarch64-linux)
|
163
174
|
racc (~> 1.4)
|
164
175
|
nokogiri (1.16.7-arm64-darwin)
|
165
176
|
racc (~> 1.4)
|
@@ -173,11 +184,10 @@ GEM
|
|
173
184
|
multi_json (~> 1.3)
|
174
185
|
multi_xml (~> 0.5)
|
175
186
|
rack (>= 1.2, < 4)
|
176
|
-
|
177
|
-
overcommit (0.64.0)
|
187
|
+
overcommit (0.64.1)
|
178
188
|
childprocess (>= 0.6.3, < 6)
|
179
189
|
iniparse (~> 1.4)
|
180
|
-
rexml (
|
190
|
+
rexml (>= 3.3.9)
|
181
191
|
parallel (1.23.0)
|
182
192
|
parser (3.2.2.4)
|
183
193
|
ast (~> 2.4.1)
|
@@ -196,7 +206,7 @@ GEM
|
|
196
206
|
regexp_parser (2.8.3)
|
197
207
|
reverse_markdown (2.1.1)
|
198
208
|
nokogiri
|
199
|
-
rexml (3.
|
209
|
+
rexml (3.3.9)
|
200
210
|
rubocop (1.59.0)
|
201
211
|
json (~> 2.3)
|
202
212
|
language_server-protocol (>= 3.17.0)
|
@@ -218,6 +228,8 @@ GEM
|
|
218
228
|
rubocop-ast (>= 1.30.0, < 2.0)
|
219
229
|
rubocop-rake (0.6.0)
|
220
230
|
rubocop (~> 1.0)
|
231
|
+
rubocop-rspec (3.0.0)
|
232
|
+
rubocop (~> 1.40)
|
221
233
|
ruby-progressbar (1.13.0)
|
222
234
|
ruby2_keywords (0.0.5)
|
223
235
|
rugged (1.6.3)
|
@@ -263,11 +275,11 @@ DEPENDENCIES
|
|
263
275
|
checkoff!
|
264
276
|
mdl
|
265
277
|
mime-types (= 3.5.1)
|
278
|
+
minitest
|
266
279
|
minitest-profile
|
267
280
|
minitest-reporters
|
268
281
|
mocha (>= 2)
|
269
|
-
|
270
|
-
overcommit (>= 0.64.0, < 0.65.0)
|
282
|
+
overcommit (>= 0.64.1, < 0.65.0)
|
271
283
|
pry
|
272
284
|
punchlist (>= 1.3.1)
|
273
285
|
rake
|
@@ -276,12 +288,14 @@ DEPENDENCIES
|
|
276
288
|
rubocop-minitest
|
277
289
|
rubocop-performance
|
278
290
|
rubocop-rake
|
291
|
+
rubocop-rspec (>= 2.10.0)
|
279
292
|
simplecov (>= 0.18.0)
|
280
293
|
simplecov-lcov
|
281
294
|
solargraph!
|
295
|
+
solargraph-rails!
|
282
296
|
undercover
|
283
297
|
webmock
|
284
298
|
yard
|
285
299
|
|
286
300
|
BUNDLED WITH
|
287
|
-
2.
|
301
|
+
2.5.23
|
data/Makefile
CHANGED
@@ -45,7 +45,7 @@ pip_install: requirements_dev.txt.installed ## Install Python dependencies
|
|
45
45
|
|
46
46
|
# bundle install doesn't get run here so that we can catch it below in
|
47
47
|
# fresh-checkout and fresh-rbenv cases
|
48
|
-
Gemfile.lock: Gemfile
|
48
|
+
Gemfile.lock: Gemfile checkoff.gemspec
|
49
49
|
|
50
50
|
# Ensure any Gemfile.lock changes ensure a bundle is installed.
|
51
51
|
Gemfile.lock.installed: Gemfile.lock
|
@@ -98,6 +98,11 @@ update_from_cookiecutter: ## Bring in changes from template project used to crea
|
|
98
98
|
git checkout cookiecutter-template && git push --no-verify
|
99
99
|
git checkout main; overcommit --sign && overcommit --sign pre-commit && git checkout main && git pull && git checkout -b update-from-cookiecutter-$$(date +%Y-%m-%d-%H%M)
|
100
100
|
git merge cookiecutter-template || true
|
101
|
+
git checkout --ours Gemfile.lock || true
|
102
|
+
# update frequently security-flagged gems while we're here
|
103
|
+
bundle update --conservative rexml || true
|
104
|
+
git add Gemfile.lock || true
|
105
|
+
bundle install || true
|
101
106
|
bundle exec overcommit --install || true
|
102
107
|
@echo
|
103
108
|
@echo "Please resolve any merge conflicts below and push up a PR with:"
|
data/bin/overcommit_branch
CHANGED
@@ -4,86 +4,83 @@
|
|
4
4
|
|
5
5
|
require 'overcommit'
|
6
6
|
require 'optparse'
|
7
|
+
require 'set'
|
7
8
|
|
8
9
|
# frozen_string_literal: true
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
# use git cli to get the list of files changed on this feature branch
|
20
|
-
# @sg-ignore
|
21
|
-
# @type [Array<String>]
|
22
|
-
@modified_files ||= begin
|
11
|
+
module Overcommit
|
12
|
+
module HookContext
|
13
|
+
# Simulates a pre-commit context representing all commits on the
|
14
|
+
# current feature branch, useful for automated CI scripts in large
|
15
|
+
# projects where not all unchanged files are assumed to pass.
|
16
|
+
class FeatureBranch < Base
|
17
|
+
# @return [Array<String>]
|
18
|
+
def modified_files
|
19
|
+
# use git cli to get the list of files changed on this feature branch
|
23
20
|
# @sg-ignore
|
24
21
|
# @type [Array<String>]
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
@modified_files ||= begin
|
23
|
+
# @sg-ignore
|
24
|
+
# @type [Array<String>]
|
25
|
+
relative_filenames = `git diff --name-only origin/main...HEAD`.split("\n")
|
26
|
+
absolute_filenames = relative_filenames.map { |f| File.expand_path(f) }
|
27
|
+
absolute_filenames.select { |f| File.exist?(f) }
|
28
|
+
end
|
28
29
|
end
|
29
|
-
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
# @param file [String]
|
32
|
+
#
|
33
|
+
# @return [Set]
|
34
|
+
def modified_lines_in_file(file)
|
35
|
+
# use git cli to get the list of lines changed in this file on this feature branch
|
36
|
+
# @sg-ignore
|
37
|
+
# @type [Array<String>]
|
38
|
+
lines = `git diff -U0 origin/main...HEAD -- #{file}`.split("\n")
|
39
|
+
|
40
|
+
modified_lines = Set.new
|
36
41
|
|
37
|
-
|
38
|
-
|
39
|
-
# @type [Array<String>]
|
40
|
-
lines = `git diff -U0 origin/main...HEAD -- #{file}`.split("\n")
|
42
|
+
lines.each do |line|
|
43
|
+
next unless line =~ /^@@ -\d+,\d+ \+(\d+),(\d+)/
|
41
44
|
|
42
|
-
lines.each do |line|
|
43
|
-
if line =~ /^@@ -\d+,\d+ \+(\d+),(\d+)/
|
44
45
|
first_line = Regexp.last_match(1).to_i
|
45
46
|
last_line = first_line + Regexp.last_match(2).to_i - 1
|
46
|
-
|
47
|
-
(
|
48
|
-
modified_lines << line_number
|
49
|
-
end
|
47
|
+
this_file_lines = (first_line..last_line)
|
48
|
+
modified_lines.merge(this_file_lines)
|
50
49
|
end
|
51
|
-
end
|
52
50
|
|
53
|
-
|
54
|
-
|
51
|
+
modified_lines.to_set
|
52
|
+
end
|
55
53
|
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
def hook_class_name
|
55
|
+
'PreCommit'
|
56
|
+
end
|
59
57
|
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
def hook_type_name
|
59
|
+
'pre_commit'
|
60
|
+
end
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
def hook_script_name
|
63
|
+
'pre-commit'
|
64
|
+
end
|
67
65
|
|
68
|
-
|
69
|
-
|
66
|
+
def initial_commit?
|
67
|
+
return @initial_commit unless @initial_commit.nil?
|
70
68
|
|
71
|
-
|
72
|
-
|
69
|
+
@initial_commit = Overcommit::GitRepo.initial_commit?
|
70
|
+
end
|
73
71
|
|
74
|
-
|
72
|
+
private
|
75
73
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
# @param file [IO]
|
75
|
+
#
|
76
|
+
# @return [Integer]
|
77
|
+
def count_lines(file)
|
78
|
+
File.foreach(file).count
|
79
|
+
end
|
81
80
|
end
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
85
|
-
# Returns the configuration for this repository.
|
86
|
-
|
87
84
|
# Used for ease of stubbing in tests
|
88
85
|
# @param status [Integer] The exit status to return
|
89
86
|
# @return [void]
|
@@ -94,7 +91,7 @@ end
|
|
94
91
|
# @return [Overcommit::Logger]
|
95
92
|
def log
|
96
93
|
# @sg-ignore
|
97
|
-
@log ||= Overcommit::Logger.new(
|
94
|
+
@log ||= Overcommit::Logger.new($stdout)
|
98
95
|
end
|
99
96
|
|
100
97
|
# @param options [Hash]
|
data/config/annotations_misc.rb
CHANGED
data/fix.sh
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
#!/bin/bash -eu
|
2
2
|
|
3
|
+
if [ -n "${FIX_SH_TIMING_LOG+x}" ]; then
|
4
|
+
rm -f "${FIX_SH_TIMING_LOG}"
|
5
|
+
fi
|
6
|
+
|
7
|
+
debug_timing() {
|
8
|
+
if [ -n "${FIX_SH_TIMING_LOG+x}" ]; then
|
9
|
+
# shellcheck disable=SC2034
|
10
|
+
_lastcmd=$(ruby -e "puts (Time.now.to_f * 1000).to_i")
|
11
|
+
last_command='start'
|
12
|
+
# shellcheck disable=SC2154
|
13
|
+
trap '_now=$(ruby -e "puts (Time.now.to_f * 1000).to_i"); duration=$((_now - _lastcmd)); echo ${duration} ms: $last_command >> '"${FIX_SH_TIMING_LOG}"'; last_command="$BASH_COMMAND" >> '"${FIX_SH_TIMING_LOG}"'; _lastcmd=$_now' DEBUG
|
14
|
+
fi
|
15
|
+
}
|
16
|
+
|
17
|
+
# copy this into any function you want to debug further
|
18
|
+
debug_timing
|
19
|
+
|
3
20
|
set -o pipefail
|
4
21
|
|
5
22
|
apt_upgraded=0
|
@@ -98,6 +115,24 @@ ensure_dev_library() {
|
|
98
115
|
fi
|
99
116
|
}
|
100
117
|
|
118
|
+
ensure_binary_library() {
|
119
|
+
library_base_name=${1:?library base name - like libfoo}
|
120
|
+
homebrew_package=${2:?homebrew package}
|
121
|
+
apt_package=${3:-${homebrew_package}}
|
122
|
+
if ! [ -f /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/"${library_base_name}*.dylib" ] && \
|
123
|
+
! [ -f /opt/homebrew/lib/"${library_base_name}*.dylib" ] && \
|
124
|
+
! [ -f /usr/lib/"${library_base_name}.so" ] && \
|
125
|
+
! [ -f /usr/lib/x86_64-linux-gnu/"${library_base_name}.so" ] && \
|
126
|
+
! [ -f /usr/local/lib/"${library_base_name}.so" ] && \
|
127
|
+
! [ -f /usr/local/opt/"${homebrew_package}/lib/${library_base_name}*.dylib" ]
|
128
|
+
then
|
129
|
+
if ! compgen -G "/opt/homebrew/Cellar/${homebrew_package}"*/*/"lib/${library_base_name}"*.dylib
|
130
|
+
then
|
131
|
+
install_package "${homebrew_package}" "${apt_package}"
|
132
|
+
fi
|
133
|
+
fi
|
134
|
+
}
|
135
|
+
|
101
136
|
ensure_ruby_build_requirements() {
|
102
137
|
ensure_dev_library readline/readline.h readline libreadline-dev
|
103
138
|
ensure_dev_library zlib.h zlib zlib1g-dev
|
@@ -108,7 +143,12 @@ ensure_ruby_build_requirements() {
|
|
108
143
|
ensure_latest_ruby_build_definitions() {
|
109
144
|
ensure_rbenv
|
110
145
|
|
111
|
-
|
146
|
+
# last_pulled_unix_epoch="$(stat -f '%m' "$(rbenv root)"/plugins/ruby-build/.git/FETCH_HEAD)"
|
147
|
+
# # if not pulled in last 24 hours
|
148
|
+
# if [ $(( $(date +%s) - last_pulled_unix_epoch )) -gt $(( 24 * 60 * 60 )) ]
|
149
|
+
# then
|
150
|
+
git -C "$(rbenv root)"/plugins/ruby-build pull
|
151
|
+
# fi
|
112
152
|
}
|
113
153
|
|
114
154
|
# You can find out which feature versions are still supported / have
|
@@ -193,10 +233,7 @@ ensure_bundle() {
|
|
193
233
|
#
|
194
234
|
# This affects nokogiri, which will try to reinstall itself in
|
195
235
|
# Docker builds where it's already installed if this is not run.
|
196
|
-
|
197
|
-
do
|
198
|
-
grep "${platform:?}" Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform "${platform:?}"
|
199
|
-
done
|
236
|
+
bundle lock --add-platform arm64-darwin-23 x86_64-darwin-23 x86_64-linux x86_64-linux-musl aarch64-linux arm64-linux
|
200
237
|
}
|
201
238
|
|
202
239
|
set_ruby_local_version() {
|
@@ -258,6 +295,20 @@ ensure_pyenv() {
|
|
258
295
|
fi
|
259
296
|
}
|
260
297
|
|
298
|
+
ensure_package() {
|
299
|
+
homebrew_package=${1:?homebrew package}
|
300
|
+
apt_package=${2:-${homebrew_package}}
|
301
|
+
binary=${3:-${homebrew_package}}
|
302
|
+
if ! [ -f /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/bin/"${binary}" ] && \
|
303
|
+
! [ -f /opt/homebrew/bin/"${binary}" ] && \
|
304
|
+
! [ -f /usr/bin/"${binary}" ] && \
|
305
|
+
! [ -f /usr/local/bin/"${binary}" ] && \
|
306
|
+
! [ -f /usr/local/opt/"${homebrew_package}"/bin/"${binary}" ]
|
307
|
+
then
|
308
|
+
install_package "${homebrew_package}" "${apt_package}"
|
309
|
+
fi
|
310
|
+
}
|
311
|
+
|
261
312
|
install_package() {
|
262
313
|
homebrew_package=${1:?homebrew package}
|
263
314
|
apt_package=${2:-${homebrew_package}}
|
@@ -337,9 +388,15 @@ ensure_python_versions() {
|
|
337
388
|
ensure_pyenv_virtualenvs() {
|
338
389
|
latest_python_version="$(cut -d' ' -f1 <<< "${python_versions}")"
|
339
390
|
virtualenv_name="checkoff-${latest_python_version}"
|
340
|
-
|
391
|
+
if ! [ -d ~/".pyenv/versions/${virtualenv_name}" ]
|
392
|
+
then
|
393
|
+
pyenv virtualenv "${latest_python_version}" "${virtualenv_name}" || true
|
394
|
+
fi
|
341
395
|
# You can use this for your global stuff!
|
342
|
-
|
396
|
+
if ! [ -d ~/".pyenv/versions/mylibs" ]
|
397
|
+
then
|
398
|
+
pyenv virtualenv "${latest_python_version}" mylibs || true
|
399
|
+
fi
|
343
400
|
# shellcheck disable=SC2086
|
344
401
|
pyenv local "${virtualenv_name}" ${python_versions} mylibs
|
345
402
|
}
|
@@ -376,6 +433,7 @@ ensure_overcommit() {
|
|
376
433
|
if [ -d .git ]
|
377
434
|
then
|
378
435
|
bundle exec overcommit --install
|
436
|
+
bundle exec overcommit --sign
|
379
437
|
bundle exec overcommit --sign pre-commit
|
380
438
|
else
|
381
439
|
>&2 echo 'Not in a git repo; not installing git hooks'
|
@@ -383,9 +441,9 @@ ensure_overcommit() {
|
|
383
441
|
}
|
384
442
|
|
385
443
|
ensure_rugged_packages_installed() {
|
386
|
-
|
387
|
-
|
388
|
-
|
444
|
+
ensure_binary_library libicuio icu4c libicu-dev # needed by rugged, needed by undercover
|
445
|
+
ensure_package pkg-config # needed by rugged, needed by undercover
|
446
|
+
ensure_package cmake # needed by rugged, needed by undercover
|
389
447
|
}
|
390
448
|
|
391
449
|
ensure_rbenv
|
data/lib/checkoff/version.rb
CHANGED