checkoff 0.7.0 → 0.11.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +120 -12
  3. data/.envrc +2 -0
  4. data/.git-hooks/pre_commit/circle_ci.rb +21 -0
  5. data/.gitignore +51 -1
  6. data/.overcommit.yml +32 -12
  7. data/.rubocop.yml +64 -168
  8. data/.yamllint.yml +8 -0
  9. data/CODE_OF_CONDUCT.md +120 -36
  10. data/DEVELOPMENT.md +28 -0
  11. data/Gemfile.lock +139 -0
  12. data/{LICENSE.txt → LICENSE} +7 -6
  13. data/Makefile +52 -18
  14. data/README.md +13 -2
  15. data/Rakefile +2 -9
  16. data/bin/bump +29 -0
  17. data/bin/checkoff +29 -0
  18. data/bin/overcommit +29 -0
  19. data/bin/rake +29 -0
  20. data/checkoff.gemspec +14 -6
  21. data/coverage/.last_run.json +2 -1
  22. data/docs/cookiecutter_input.json +13 -0
  23. data/exe/checkoff +1 -2
  24. data/fix.sh +334 -0
  25. data/lib/checkoff/cli.rb +97 -76
  26. data/lib/checkoff/config_loader.rb +22 -16
  27. data/lib/checkoff/projects.rb +35 -31
  28. data/lib/checkoff/sections.rb +98 -50
  29. data/lib/checkoff/subtasks.rb +14 -11
  30. data/lib/checkoff/tasks.rb +25 -16
  31. data/lib/checkoff/version.rb +2 -1
  32. data/lib/checkoff/workspaces.rb +10 -5
  33. data/metrics/bigfiles_high_water_mark +1 -1
  34. data/metrics/rubocop_high_water_mark +1 -1
  35. data/{lib/tasks/ci.rake → rakelib/citest.rake} +1 -1
  36. data/rakelib/clear_metrics.rake +17 -0
  37. data/{lib/tasks → rakelib}/default.rake +0 -0
  38. data/rakelib/gem_tasks.rake +3 -0
  39. data/{lib/tasks → rakelib}/localtest.rake +1 -1
  40. data/rakelib/overcommit.rake +6 -0
  41. data/rakelib/quality.rake +4 -0
  42. data/{lib/tasks → rakelib}/test.rake +0 -0
  43. data/rakelib/undercover.rake +8 -0
  44. data/requirements_dev.txt +2 -0
  45. metadata +110 -29
  46. data/.ruby-version +0 -1
  47. data/.travis.yml +0 -22
  48. data/lib/tasks/clear_metrics.rake +0 -8
  49. data/lib/tasks/feature.rake +0 -9
  50. data/lib/tasks/quality.rake +0 -9
  51. data/lib/tasks/spec.rake +0 -9
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  Command-line and gem client for Asana (unofficial)
2
2
 
3
3
  [![Circle CI](https://circleci.com/gh/apiology/checkoff.svg?style=svg)](https://circleci.com/gh/apiology/checkoff)
4
- [![Travis CI](https://travis-ci.org/apiology/checkoff.svg?branch=master)](https://travis-ci.org/apiology/checkoff)
4
+ [![Travis CI](https://travis-ci.org/apiology/checkoff.svg?branch=main)](https://travis-ci.org/apiology/checkoff)
5
+
6
+ Command-line and gem client for Asana (unofficial)
5
7
 
6
8
  ## Using
7
9
 
@@ -15,7 +17,7 @@ View tasks:
15
17
 
16
18
  Let's say we have a project like this:
17
19
 
18
- ![project screenshot from asana.com](https://github.com/apiology/checkoff/raw/master/docs/example_project.png "Example project")
20
+ ![project screenshot from asana.com](https://github.com/apiology/checkoff/raw/main/docs/example_project.png "Example project")
19
21
 
20
22
  Checkoff outputs things in JSON. 'jq' is a great tool to use in combination:
21
23
 
@@ -134,3 +136,12 @@ Alternately you can set environment variables to match - e.g., `ASANA__PERSONAL_
134
136
  bundle install
135
137
  bundle exec exe/checkoff --help
136
138
  ```
139
+
140
+ To publish new version as a maintainer:
141
+
142
+ ```sh
143
+ git log "v$(bump current)..."
144
+ # Set type_of_bump to patch, minor, or major
145
+ bump --tag --tag-prefix=v ${type_of_bump:?}
146
+ rake release
147
+ ```
data/Rakefile CHANGED
@@ -1,11 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- #
4
- # bundle exec rake release to release a new gem
5
- #
6
- require 'bundler/gem_tasks'
7
-
8
- Dir['lib/tasks/**/*.rake'].each { |t| load t }
9
-
10
- desc 'Default: Run specs and check quality.'
11
- task default: [:localtest]
3
+ # Add your own tasks in files placed in rakelib/ ending in .rake,
4
+ # for example rakelib/capistrano.rake, and they will automatically be available to Rake.
data/bin/bump ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bump' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("bump", "bump")
data/bin/checkoff ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'checkoff' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("checkoff", "checkoff")
data/bin/overcommit ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'overcommit' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("overcommit", "overcommit")
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/checkoff.gemspec CHANGED
@@ -11,9 +11,9 @@ Gem::Specification.new do |spec|
11
11
  spec.authors = ['Vince Broz']
12
12
  spec.email = ['vince@broz.cc']
13
13
  spec.summary = 'Command-line and gem client for Asana (unofficial)'
14
- spec.homepage = 'http://github.com/apiology/checkoff'
15
- spec.license = 'MIT'
16
- spec.required_ruby_version = '>= 2.5'
14
+ spec.homepage = 'https://github.com/apiology/checkoff'
15
+ spec.license = 'MIT license'
16
+ spec.required_ruby_version = '>= 2.6'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
19
  f.match(%r{^(test|spec|features)/})
@@ -26,13 +26,21 @@ Gem::Specification.new do |spec|
26
26
  spec.add_runtime_dependency 'asana', '>0.10.0'
27
27
  spec.add_runtime_dependency 'cache_method'
28
28
  spec.add_runtime_dependency 'dalli'
29
+ spec.add_runtime_dependency 'gli'
29
30
 
31
+ spec.add_development_dependency 'bump'
30
32
  spec.add_development_dependency 'bundler'
31
33
  spec.add_development_dependency 'minitest-profile'
32
34
  spec.add_development_dependency 'mocha'
33
- spec.add_development_dependency 'overcommit'
34
- spec.add_development_dependency 'quality', '~> 38'
35
+ # 0.58.0 and 0.57.0 don't seem super compatible with signatures, and
36
+ # magit doesn't seem to want to use the bundled version at the moment,
37
+ # so let's favor the more recent version...
38
+ spec.add_development_dependency 'overcommit', ['>=0.58.0']
35
39
  spec.add_development_dependency 'rake', '~> 13.0'
36
- spec.add_development_dependency 'rspec', '>=3.4'
40
+ spec.add_development_dependency 'rubocop'
41
+ spec.add_development_dependency 'rubocop-minitest'
42
+ spec.add_development_dependency 'rubocop-rake'
37
43
  spec.add_development_dependency 'simplecov'
44
+ spec.add_development_dependency 'simplecov-lcov'
45
+ spec.add_development_dependency 'undercover'
38
46
  end
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 85.38
3
+ "line": 94.61,
4
+ "branch": 71.42
4
5
  }
5
6
  }
@@ -0,0 +1,13 @@
1
+ {
2
+ "_template": "https://github.com/apiology/cookiecutter-gem",
3
+ "email": "vince@broz.cc",
4
+ "full_name": "Vince Broz",
5
+ "github_username": "apiology",
6
+ "module_name": "Checkoff",
7
+ "open_source_license": "MIT license",
8
+ "project_name": "Checkoff",
9
+ "project_short_description": "Command-line and gem client for Asana (unofficial)",
10
+ "project_slug": "checkoff",
11
+ "type_of_github_repo": "public",
12
+ "version": "0.8.0"
13
+ }
data/exe/checkoff CHANGED
@@ -4,5 +4,4 @@
4
4
  require 'checkoff/cli'
5
5
 
6
6
  CacheMethod.config.storage = Dalli::Client.new('memcached:11211')
7
- cli = Checkoff::CLI.new
8
- puts cli.run(ARGV)
7
+ exit(Checkoff::CheckoffGLIApp.run(ARGV))
data/fix.sh ADDED
@@ -0,0 +1,334 @@
1
+ #!/bin/bash -eu
2
+
3
+ set -o pipefail
4
+
5
+ apt_upgraded=0
6
+
7
+ update_apt() {
8
+ if [ "${apt_upgraded}" = 0 ]
9
+ then
10
+ sudo apt-get update -y
11
+ apt_upgraded=1
12
+ fi
13
+ }
14
+
15
+ install_rbenv() {
16
+ if [ "$(uname)" == "Darwin" ]
17
+ then
18
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install rbenv || true
19
+ if ! type rbenv 2>/dev/null
20
+ then
21
+ # https://github.com/pyenv/pyenv-installer/blob/master/bin/pyenv-installer
22
+ >&2 cat <<EOF
23
+ WARNING: seems you still have not added 'rbenv' to the load path.
24
+
25
+ # Load rbenv automatically by adding
26
+ # the following to ~/.bashrc:
27
+
28
+ export PATH="$HOME/.rbenv/bin:$PATH"
29
+ eval "$(rbenv init -)"
30
+ EOF
31
+ fi
32
+ else
33
+ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
34
+ fi
35
+ }
36
+
37
+ set_rbenv_env_variables() {
38
+ export PATH="${HOME}/.rbenv/bin:$PATH"
39
+ eval "$(rbenv init -)"
40
+ }
41
+
42
+ install_ruby_build() {
43
+ if [ "$(uname)" == "Darwin" ]
44
+ then
45
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install ruby-build || true
46
+ else
47
+ mkdir -p "$(rbenv root)"/plugins
48
+ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
49
+ fi
50
+ }
51
+
52
+ ensure_ruby_build() {
53
+ if ! type ruby-build >/dev/null 2>&1 && ! [ -d "${HOME}/.rbenv/plugins/ruby-build" ]
54
+ then
55
+ install_ruby_build
56
+ fi
57
+ }
58
+
59
+ ensure_rbenv() {
60
+ if ! type rbenv >/dev/null 2>&1 && ! [ -f "${HOME}/.rbenv/bin/rbenv" ]
61
+ then
62
+ install_rbenv
63
+ fi
64
+
65
+ set_rbenv_env_variables
66
+
67
+ ensure_ruby_build
68
+ }
69
+
70
+ latest_ruby_version() {
71
+ major_minor=${1}
72
+ rbenv install --list 2>/dev/null | grep "^${major_minor}."
73
+ }
74
+
75
+ ensure_dev_library() {
76
+ header_file_name=${1:?header file name}
77
+ homebrew_package=${2:?homebrew package}
78
+ apt_package=${3:-${homebrew_package}}
79
+ if ! [ -f /usr/include/"${header_file_name}" ] && \
80
+ ! [ -f /usr/include/x86_64-linux-gnu/"${header_file_name}" ] && \
81
+ ! [ -f /usr/local/include/"${header_file_name}" ] && \
82
+ ! [ -f /usr/local/opt/"${homebrew_package}"/include/"${header_file_name}" ]
83
+ then
84
+ install_package "${homebrew_package}" "${apt_package}"
85
+ fi
86
+ }
87
+
88
+ ensure_ruby_build_requirements() {
89
+ ensure_dev_library readline/readline.h readline libreadline-dev
90
+ ensure_dev_library zlib.h zlib zlib1g-dev
91
+ ensure_dev_library openssl/ssl.h openssl libssl-dev
92
+ }
93
+
94
+ # You can find out which feature versions are still supported / have
95
+ # been release here: https://www.ruby-lang.org/en/downloads/
96
+ ensure_ruby_versions() {
97
+ # You can find out which feature versions are still supported / have
98
+ # been release here: https://www.python.org/downloads/
99
+ ruby_versions="$(latest_ruby_version 2.6)"
100
+
101
+ echo "Latest Ruby versions: ${ruby_versions}"
102
+
103
+ ensure_ruby_build_requirements
104
+
105
+ for ver in $ruby_versions
106
+ do
107
+ # These CFLAGS can be retired once 2.6.7 is no longer needed :
108
+ #
109
+ # https://github.com/rbenv/ruby-build/issues/1747
110
+ # https://github.com/rbenv/ruby-build/issues/1489
111
+ # https://bugs.ruby-lang.org/issues/17777
112
+ if [ "${ver}" == 2.6.7 ]
113
+ then
114
+ CFLAGS="-Wno-error=implicit-function-declaration" rbenv install -s "${ver}"
115
+ else
116
+ rbenv install -s "${ver}"
117
+ fi
118
+ done
119
+ }
120
+
121
+ ensure_bundle() {
122
+ # Not sure why this is needed a second time, but it seems to be?
123
+ #
124
+ # https://app.circleci.com/pipelines/github/apiology/source_finder/21/workflows/88db659f-a4f4-4751-abc0-46f5929d8e58/jobs/107
125
+ set_rbenv_env_variables
126
+ bundle --version >/dev/null 2>&1 || gem install --no-document bundler
127
+ bundler_version=$(bundle --version | cut -d ' ' -f3)
128
+ bundler_version_major=$(cut -d. -f1 <<< "${bundler_version}")
129
+ bundler_version_minor=$(cut -d. -f2 <<< "${bundler_version}")
130
+ # Version 2.1 of bundler seems to have some issues with nokogiri:
131
+ #
132
+ # https://app.asana.com/0/1107901397356088/1199504270687298
133
+ if [ "${bundler_version_major}" == 2 ] && [ "${bundler_version_minor}" -lt 2 ]
134
+ then
135
+ gem install --no-document bundler
136
+ fi
137
+ make bundle_install
138
+ # https://bundler.io/v2.0/bundle_lock.html#SUPPORTING-OTHER-PLATFORMS
139
+ #
140
+ # "If you want your bundle to support platforms other than the one
141
+ # you're running locally, you can run bundle lock --add-platform
142
+ # PLATFORM to add PLATFORM to the lockfile, force bundler to
143
+ # re-resolve and consider the new platform when picking gems, all
144
+ # without needing to have a machine that matches PLATFORM handy to
145
+ # install those platform-specific gems on.'
146
+ grep x86_64-darwin-20 Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform x86_64-darwin-20 x86_64-linux
147
+ }
148
+
149
+ set_ruby_local_version() {
150
+ latest_ruby_version="$(cut -d' ' -f1 <<< "${ruby_versions}")"
151
+ echo "${latest_ruby_version}" > .ruby-version
152
+ }
153
+
154
+ latest_python_version() {
155
+ major_minor=${1}
156
+ # https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable
157
+ pyenv install --list | grep "^ ${major_minor}." | grep -v -- -dev | tail -1 | xargs
158
+ }
159
+
160
+ install_pyenv() {
161
+ if [ "$(uname)" == "Darwin" ]
162
+ then
163
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv || true
164
+ if ! type pyenv 2>/dev/null
165
+ then
166
+ # https://github.com/pyenv/pyenv-installer/blob/master/bin/pyenv-installer
167
+ >&2 cat <<EOF
168
+ WARNING: seems you still have not added 'pyenv' to the load path.
169
+
170
+ # Load pyenv automatically by adding
171
+ # the following to ~/.bashrc:
172
+
173
+ export PYENV_ROOT="${HOME}/.pyenv"
174
+ export PATH="${PYENV_ROOT}/bin:$PATH"
175
+ eval "$(pyenv init --path)"
176
+ eval "$(pyenv virtualenv-init -)"
177
+ EOF
178
+ fi
179
+ else
180
+ curl https://pyenv.run | bash
181
+ fi
182
+ }
183
+
184
+ set_pyenv_env_variables() {
185
+ # looks like pyenv scripts aren't -u clean:
186
+ #
187
+ # https://app.circleci.com/pipelines/github/apiology/cookiecutter-pypackage/15/workflows/10506069-7662-46bd-b915-2992db3f795b/jobs/15
188
+ set +u
189
+ export PYENV_ROOT="${HOME}/.pyenv"
190
+ export PATH="${PYENV_ROOT}/bin:$PATH"
191
+ eval "$(pyenv init --path)"
192
+ eval "$(pyenv virtualenv-init -)"
193
+ set -u
194
+ }
195
+
196
+ ensure_pyenv() {
197
+ if ! type pyenv >/dev/null 2>&1 && ! [ -f "${HOME}/.pyenv/bin/pyenv" ]
198
+ then
199
+ install_pyenv
200
+ fi
201
+
202
+ if ! type pyenv >/dev/null 2>&1
203
+ then
204
+ set_pyenv_env_variables
205
+ fi
206
+ }
207
+
208
+ install_package() {
209
+ homebrew_package=${1:?homebrew package}
210
+ apt_package=${2:-${homebrew_package}}
211
+ if [ "$(uname)" == "Darwin" ]
212
+ then
213
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install "${homebrew_package}"
214
+ elif type apt-get >/dev/null 2>&1
215
+ then
216
+ update_apt
217
+ sudo apt-get install -y "${apt_package}"
218
+ else
219
+ >&2 echo "Teach me how to install packages on this plaform"
220
+ exit 1
221
+ fi
222
+ }
223
+
224
+ ensure_python_build_requirements() {
225
+ ensure_dev_library zlib.h zlib zlib1g-dev
226
+ ensure_dev_library bzlib.h bzip2 libbz2-dev
227
+ ensure_dev_library openssl/ssl.h openssl libssl-dev
228
+ ensure_dev_library ffi.h libffi libffi-dev
229
+ ensure_dev_library sqlite3.h sqlite3 libsqlite3-dev
230
+ }
231
+
232
+ # You can find out which feature versions are still supported / have
233
+ # been release here: https://www.python.org/downloads/
234
+ ensure_python_versions() {
235
+ # You can find out which feature versions are still supported / have
236
+ # been release here: https://www.python.org/downloads/
237
+ python_versions="$(latest_python_version 3.9)"
238
+
239
+ echo "Latest Python versions: ${python_versions}"
240
+
241
+ ensure_python_build_requirements
242
+
243
+ for ver in $python_versions
244
+ do
245
+ if [ "$(uname)" == Darwin ]
246
+ then
247
+ pyenv_install() {
248
+ CFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include" LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib" pyenv install --skip-existing "$@"
249
+ }
250
+
251
+ major_minor="$(cut -d. -f1-2 <<<"${ver}")"
252
+ if [ "${major_minor}" == 3.6 ]
253
+ then
254
+ pyenv_install --patch "${ver}" < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index=1)
255
+ else
256
+ pyenv_install "${ver}"
257
+ fi
258
+ else
259
+ pyenv install -s "${ver}"
260
+ fi
261
+ done
262
+ }
263
+
264
+ ensure_pyenv_virtualenvs() {
265
+ latest_python_version="$(cut -d' ' -f1 <<< "${python_versions}")"
266
+ virtualenv_name="checkoff-${latest_python_version}"
267
+ pyenv virtualenv "${latest_python_version}" "${virtualenv_name}" || true
268
+ # You can use this for your global stuff!
269
+ pyenv virtualenv "${latest_python_version}" mylibs || true
270
+ # shellcheck disable=SC2086
271
+ pyenv local "${virtualenv_name}" ${python_versions} mylibs
272
+ }
273
+
274
+ ensure_pip() {
275
+ # Make sure we have a pip with the 20.3 resolver, and after the
276
+ # initial bugfix release
277
+ major_pip_version=$(pip --version | cut -d' ' -f2 | cut -d '.' -f 1)
278
+ if [[ major_pip_version -lt 21 ]]
279
+ then
280
+ pip install 'pip>=20.3.1'
281
+ fi
282
+ }
283
+
284
+ ensure_python_requirements() {
285
+ make pip_install
286
+ }
287
+
288
+ ensure_shellcheck() {
289
+ if ! type shellcheck >/dev/null 2>&1
290
+ then
291
+ install_package shellcheck
292
+ fi
293
+ }
294
+
295
+ ensure_overcommit() {
296
+ # don't run if we're in the middle of a cookiecutter child project
297
+ # test, or otherwise don't have a Git repo to install hooks into...
298
+ if [ -d .git ]
299
+ then
300
+ bundle exec overcommit --install
301
+ else
302
+ >&2 echo 'Not in a git repo; not installing git hooks'
303
+ fi
304
+ }
305
+
306
+ ensure_rugged_packages_installed() {
307
+ install_package icu4c libicu-dev # needed by rugged, needed by undercover
308
+ install_package pkg-config # needed by rugged, needed by undercover
309
+ install_package cmake # needed by rugged, needed by undercover
310
+ }
311
+
312
+ ensure_rbenv
313
+
314
+ ensure_ruby_versions
315
+
316
+ set_ruby_local_version
317
+
318
+ ensure_rugged_packages_installed
319
+
320
+ ensure_bundle
321
+
322
+ ensure_pyenv
323
+
324
+ ensure_python_versions
325
+
326
+ ensure_pyenv_virtualenvs
327
+
328
+ ensure_pip
329
+
330
+ ensure_python_requirements
331
+
332
+ ensure_shellcheck
333
+
334
+ ensure_overcommit