checkoff 0.5.5 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +119 -12
  3. data/.envrc +2 -0
  4. data/.git-hooks/pre_commit/circle_ci.rb +21 -0
  5. data/.gitignore +50 -1
  6. data/.overcommit.yml +53 -0
  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 +130 -0
  12. data/{LICENSE.txt → LICENSE} +7 -6
  13. data/Makefile +48 -18
  14. data/README.md +15 -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 +9 -5
  21. data/coverage/.last_run.json +2 -1
  22. data/docs/cookiecutter_input.json +13 -0
  23. data/fix.sh +299 -0
  24. data/lib/checkoff/cli.rb +9 -1
  25. data/lib/checkoff/config_loader.rb +43 -3
  26. data/lib/checkoff/projects.rb +5 -5
  27. data/lib/checkoff/sections.rb +48 -11
  28. data/lib/checkoff/tasks.rb +1 -1
  29. data/lib/checkoff/version.rb +1 -1
  30. data/lib/checkoff/workspaces.rb +4 -3
  31. data/metrics/bigfiles_high_water_mark +1 -1
  32. data/metrics/rubocop_high_water_mark +1 -1
  33. data/{lib/tasks → rakelib}/ci.rake +0 -0
  34. data/{lib/tasks → rakelib}/clear_metrics.rake +1 -1
  35. data/{lib/tasks → rakelib}/default.rake +0 -0
  36. data/rakelib/gem_tasks.rake +3 -0
  37. data/{lib/tasks → rakelib}/localtest.rake +1 -1
  38. data/rakelib/overcommit.rake +6 -0
  39. data/rakelib/quality.rake +4 -0
  40. data/{lib/tasks → rakelib}/test.rake +0 -0
  41. data/rakelib/undercover.rake +8 -0
  42. data/requirements_dev.txt +2 -0
  43. metadata +93 -25
  44. data/.ruby-version +0 -1
  45. data/.travis.yml +0 -22
  46. data/lib/tasks/feature.rake +0 -9
  47. data/lib/tasks/quality.rake +0 -9
  48. data/lib/tasks/spec.rake +0 -9
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)/})
@@ -27,11 +27,15 @@ Gem::Specification.new do |spec|
27
27
  spec.add_runtime_dependency 'cache_method'
28
28
  spec.add_runtime_dependency 'dalli'
29
29
 
30
+ spec.add_development_dependency 'bump'
30
31
  spec.add_development_dependency 'bundler'
31
32
  spec.add_development_dependency 'minitest-profile'
32
33
  spec.add_development_dependency 'mocha'
33
- spec.add_development_dependency 'quality', '~> 38'
34
+ spec.add_development_dependency 'overcommit'
34
35
  spec.add_development_dependency 'rake', '~> 13.0'
35
- spec.add_development_dependency 'rspec', '>=3.4'
36
+ spec.add_development_dependency 'rubocop'
37
+ spec.add_development_dependency 'rubocop-minitest'
38
+ spec.add_development_dependency 'rubocop-rake'
36
39
  spec.add_development_dependency 'simplecov'
40
+ spec.add_development_dependency 'undercover'
37
41
  end
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 83.74
3
+ "line": 93.15,
4
+ "branch": 61.66
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/fix.sh ADDED
@@ -0,0 +1,299 @@
1
+ #!/bin/bash -eu
2
+
3
+ set -o pipefail
4
+
5
+ install_rbenv() {
6
+ if [ "$(uname)" == "Darwin" ]
7
+ then
8
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install rbenv || true
9
+ if ! type rbenv 2>/dev/null
10
+ then
11
+ # https://github.com/pyenv/pyenv-installer/blob/master/bin/pyenv-installer
12
+ >&2 cat <<EOF
13
+ WARNING: seems you still have not added 'rbenv' to the load path.
14
+
15
+ # Load rbenv automatically by adding
16
+ # the following to ~/.bashrc:
17
+
18
+ export PATH="$HOME/.rbenv/bin:$PATH"
19
+ eval "$(rbenv init -)"
20
+ EOF
21
+ fi
22
+ else
23
+ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
24
+ fi
25
+ }
26
+
27
+ set_rbenv_env_variables() {
28
+ export PATH="${HOME}/.rbenv/bin:$PATH"
29
+ eval "$(rbenv init -)"
30
+ }
31
+
32
+ install_ruby_build() {
33
+ if [ "$(uname)" == "Darwin" ]
34
+ then
35
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install ruby-build || true
36
+ else
37
+ mkdir -p "$(rbenv root)"/plugins
38
+ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
39
+ fi
40
+ }
41
+
42
+ ensure_ruby_build() {
43
+ if ! type ruby-build >/dev/null 2>&1 && ! [ -d "${HOME}/.rbenv/plugins/ruby-build" ]
44
+ then
45
+ install_ruby_build
46
+ fi
47
+ }
48
+
49
+ ensure_rbenv() {
50
+ if ! type rbenv >/dev/null 2>&1 && ! [ -f "${HOME}/.rbenv/bin/rbenv" ]
51
+ then
52
+ install_rbenv
53
+ fi
54
+
55
+ set_rbenv_env_variables
56
+
57
+ ensure_ruby_build
58
+ }
59
+
60
+ latest_ruby_version() {
61
+ major_minor=${1}
62
+ rbenv install --list 2>/dev/null | grep "^${major_minor}."
63
+ }
64
+
65
+ ensure_dev_library() {
66
+ header_file_name=${1:?header file name}
67
+ homebrew_package=${2:?homebrew package}
68
+ apt_package=${3:-${homebrew_package}}
69
+ if ! [ -f /usr/include/"${header_file_name}" ] && \
70
+ ! [ -f /usr/include/x86_64-linux-gnu/"${header_file_name}" ] && \
71
+ ! [ -f /usr/local/include/"${header_file_name}" ] && \
72
+ ! [ -f /usr/local/opt/"${homebrew_package}"/include/"${header_file_name}" ]
73
+ then
74
+ install_package "${homebrew_package}" "${apt_package}"
75
+ fi
76
+ }
77
+
78
+ ensure_ruby_build_requirements() {
79
+ ensure_dev_library readline/readline.h readline libreadline-dev
80
+ }
81
+
82
+ # You can find out which feature versions are still supported / have
83
+ # been release here: https://www.ruby-lang.org/en/downloads/
84
+ ensure_ruby_versions() {
85
+ # You can find out which feature versions are still supported / have
86
+ # been release here: https://www.python.org/downloads/
87
+ ruby_versions="$(latest_ruby_version 2.6)"
88
+
89
+ echo "Latest Ruby versions: ${ruby_versions}"
90
+
91
+ ensure_ruby_build_requirements
92
+
93
+ for ver in $ruby_versions
94
+ do
95
+ rbenv install -s "${ver}"
96
+ done
97
+ }
98
+
99
+ ensure_bundle() {
100
+ # Not sure why this is needed a second time, but it seems to be?
101
+ #
102
+ # https://app.circleci.com/pipelines/github/apiology/source_finder/21/workflows/88db659f-a4f4-4751-abc0-46f5929d8e58/jobs/107
103
+ set_rbenv_env_variables
104
+ bundle --version >/dev/null 2>&1 || gem install bundler
105
+ make bundle_install
106
+ # https://bundler.io/v2.0/bundle_lock.html#SUPPORTING-OTHER-PLATFORMS
107
+ #
108
+ # "If you want your bundle to support platforms other than the one
109
+ # you're running locally, you can run bundle lock --add-platform
110
+ # PLATFORM to add PLATFORM to the lockfile, force bundler to
111
+ # re-resolve and consider the new platform when picking gems, all
112
+ # without needing to have a machine that matches PLATFORM handy to
113
+ # install those platform-specific gems on.'
114
+ grep x86_64-darwin-20 Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform x86_64-darwin-20 x86_64-linux
115
+ }
116
+
117
+ set_ruby_local_version() {
118
+ latest_ruby_version="$(cut -d' ' -f1 <<< "${ruby_versions}")"
119
+ echo "${latest_ruby_version}" > .ruby-version
120
+ }
121
+
122
+ latest_python_version() {
123
+ major_minor=${1}
124
+ # https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable
125
+ pyenv install --list | grep "^ ${major_minor}." | grep -v -- -dev | tail -1 | xargs
126
+ }
127
+
128
+ install_pyenv() {
129
+ if [ "$(uname)" == "Darwin" ]
130
+ then
131
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv || true
132
+ if ! type pyenv 2>/dev/null
133
+ then
134
+ # https://github.com/pyenv/pyenv-installer/blob/master/bin/pyenv-installer
135
+ >&2 cat <<EOF
136
+ WARNING: seems you still have not added 'pyenv' to the load path.
137
+
138
+ # Load pyenv automatically by adding
139
+ # the following to ~/.bashrc:
140
+
141
+ export PATH="$HOME/.pyenv/bin:$PATH"
142
+ eval "$(pyenv init -)"
143
+ eval "$(pyenv virtualenv-init -)"
144
+ EOF
145
+ fi
146
+ else
147
+ curl https://pyenv.run | bash
148
+ fi
149
+ }
150
+
151
+ set_pyenv_env_variables() {
152
+ # looks like pyenv scripts aren't -u clean:
153
+ #
154
+ # https://app.circleci.com/pipelines/github/apiology/cookiecutter-pypackage/15/workflows/10506069-7662-46bd-b915-2992db3f795b/jobs/15
155
+ set +u
156
+ export PATH="${HOME}/.pyenv/bin:$PATH"
157
+ eval "$(pyenv init -)"
158
+ eval "$(pyenv virtualenv-init -)"
159
+ set -u
160
+ }
161
+
162
+ ensure_pyenv() {
163
+ if ! type pyenv >/dev/null 2>&1 && ! [ -f "${HOME}/.pyenv/bin/pyenv" ]
164
+ then
165
+ install_pyenv
166
+ fi
167
+
168
+ if ! type pyenv >/dev/null 2>&1
169
+ then
170
+ set_pyenv_env_variables
171
+ fi
172
+ }
173
+
174
+ install_package() {
175
+ homebrew_package=${1:?homebrew package}
176
+ apt_package=${2:-${homebrew_package}}
177
+ if [ "$(uname)" == "Darwin" ]
178
+ then
179
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install "${homebrew_package}"
180
+ elif type apt-get >/dev/null 2>&1
181
+ then
182
+ sudo apt-get update -y
183
+ sudo apt-get install -y "${apt_package}"
184
+ else
185
+ >&2 echo "Teach me how to install packages on this plaform"
186
+ exit 1
187
+ fi
188
+ }
189
+
190
+ ensure_python_build_requirements() {
191
+ ensure_dev_library zlib.h zlib zlib1g-dev
192
+ ensure_dev_library bzlib.h bzip2 libbz2-dev
193
+ ensure_dev_library openssl/ssl.h openssl libssl-dev
194
+ ensure_dev_library ffi.h libffi libffi-dev
195
+ }
196
+
197
+ # You can find out which feature versions are still supported / have
198
+ # been release here: https://www.python.org/downloads/
199
+ ensure_python_versions() {
200
+ # You can find out which feature versions are still supported / have
201
+ # been release here: https://www.python.org/downloads/
202
+ python_versions="$(latest_python_version 3.9)"
203
+
204
+ echo "Latest Python versions: ${python_versions}"
205
+
206
+ ensure_python_build_requirements
207
+
208
+ for ver in $python_versions
209
+ do
210
+ if [ "$(uname)" == Darwin ]
211
+ then
212
+ pyenv_install() {
213
+ 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 "$@"
214
+ }
215
+
216
+ major_minor="$(cut -d. -f1-2 <<<"${ver}")"
217
+ if [ "${major_minor}" == 3.6 ]
218
+ then
219
+ pyenv_install --patch "${ver}" < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index=1)
220
+ else
221
+ pyenv_install "${ver}"
222
+ fi
223
+ else
224
+ pyenv install -s "${ver}"
225
+ fi
226
+ done
227
+ }
228
+
229
+ ensure_pyenv_virtualenvs() {
230
+ latest_python_version="$(cut -d' ' -f1 <<< "${python_versions}")"
231
+ virtualenv_name="checkoff-${latest_python_version}"
232
+ pyenv virtualenv "${latest_python_version}" "${virtualenv_name}" || true
233
+ # You can use this for your global stuff!
234
+ pyenv virtualenv "${latest_python_version}" mylibs || true
235
+ # shellcheck disable=SC2086
236
+ pyenv local "${virtualenv_name}" ${python_versions} mylibs
237
+ }
238
+
239
+ ensure_pip() {
240
+ # Make sure we have a pip with the 20.3 resolver, and after the
241
+ # initial bugfix release
242
+ major_pip_version=$(pip --version | cut -d' ' -f2 | cut -d '.' -f 1)
243
+ if [[ major_pip_version -lt 21 ]]
244
+ then
245
+ pip install 'pip>=20.3.1'
246
+ fi
247
+ }
248
+
249
+ ensure_python_requirements() {
250
+ make pip_install
251
+ }
252
+
253
+ ensure_shellcheck() {
254
+ if ! type shellcheck >/dev/null 2>&1
255
+ then
256
+ install_package shellcheck
257
+ fi
258
+ }
259
+
260
+ ensure_overcommit() {
261
+ # don't run if we're in the middle of a cookiecutter child project
262
+ # test, or otherwise don't have a Git repo to install hooks into...
263
+ if [ -d .git ]
264
+ then
265
+ bundle exec overcommit --install
266
+ else
267
+ >&2 echo 'Not in a git repo; not installing git hooks'
268
+ fi
269
+ }
270
+
271
+ ensure_rugged_packages_installed() {
272
+ install_package icu4c libicu-dev # needed by rugged, needed by undercover
273
+ install_package pkg-config # needed by rugged, needed by undercover
274
+ install_package cmake # needed by rugged, needed by undercover
275
+ }
276
+
277
+ ensure_rbenv
278
+
279
+ ensure_ruby_versions
280
+
281
+ set_ruby_local_version
282
+
283
+ ensure_rugged_packages_installed
284
+
285
+ ensure_bundle
286
+
287
+ ensure_pyenv
288
+
289
+ ensure_python_versions
290
+
291
+ ensure_pyenv_virtualenvs
292
+
293
+ ensure_pip
294
+
295
+ ensure_python_requirements
296
+
297
+ ensure_shellcheck
298
+
299
+ ensure_overcommit