checkoff 0.8.0 → 0.9.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 +117 -12
- data/.envrc +1 -1
- data/.git-hooks/pre-commit/circle_ci.rb +21 -0
- data/.gitignore +41 -1
- data/.overcommit.yml +24 -12
- data/.rubocop.yml +61 -167
- data/.yamllint.yml +8 -0
- data/CODE_OF_CONDUCT.md +6 -42
- data/Gemfile.lock +132 -0
- data/{LICENSE.txt → LICENSE} +7 -6
- data/Makefile +33 -18
- data/README.md +13 -2
- data/bin/bump +29 -0
- data/bin/rake +29 -0
- data/checkoff.gemspec +5 -2
- data/docs/cookiecutter_input.json +13 -0
- data/fix.sh +274 -0
- data/lib/checkoff/cli.rb +4 -0
- data/lib/checkoff/projects.rb +4 -4
- data/lib/checkoff/sections.rb +8 -3
- data/lib/checkoff/version.rb +1 -1
- data/requirements_dev.txt +1 -0
- metadata +63 -17
- data/.travis.yml +0 -22
- data/lib/tasks/clear_metrics.rake +0 -8
- data/lib/tasks/localtest.rake +0 -4
- data/lib/tasks/quality.rake +0 -9
data/.yamllint.yml
ADDED
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,49 +1,13 @@
|
|
1
1
|
# Contributor Code of Conduct
|
2
2
|
|
3
|
-
As contributors and maintainers of this project,
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
7
4
|
|
8
|
-
We are committed to making participation in this project a harassment-free
|
9
|
-
experience for everyone, regardless of level of experience, gender, gender
|
10
|
-
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
-
body size, race, ethnicity, age, religion, or nationality.
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
12
6
|
|
13
|
-
Examples of unacceptable behavior by participants include
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
14
8
|
|
15
|
-
|
16
|
-
* Personal attacks
|
17
|
-
* Trolling or insulting/derogatory comments
|
18
|
-
* Public or private harassment
|
19
|
-
* Publishing other's private information, such as physical or electronic
|
20
|
-
addresses, without explicit permission
|
21
|
-
* Other unethical or unprofessional conduct
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
22
10
|
|
23
|
-
|
24
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
-
threatening, offensive, or harmful.
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
28
12
|
|
29
|
-
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
33
|
-
|
34
|
-
This code of conduct applies both within project spaces and in public spaces
|
35
|
-
when an individual is representing the project or its community.
|
36
|
-
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting a project maintainer at vince@broz.cc. All
|
39
|
-
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
incident.
|
43
|
-
|
44
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
-
version 1.3.0, available at
|
46
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
-
|
48
|
-
[homepage]: http://contributor-covenant.org
|
49
|
-
[version]: http://contributor-covenant.org/version/1/3/0/
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
checkoff (0.9.0)
|
5
|
+
activesupport
|
6
|
+
asana (> 0.10.0)
|
7
|
+
cache_method
|
8
|
+
dalli
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activesupport (6.1.3)
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
minitest (>= 5.1)
|
17
|
+
tzinfo (~> 2.0)
|
18
|
+
zeitwerk (~> 2.3)
|
19
|
+
asana (0.10.3)
|
20
|
+
faraday (~> 1.0)
|
21
|
+
faraday_middleware (~> 1.0)
|
22
|
+
faraday_middleware-multi_json (~> 0.0)
|
23
|
+
oauth2 (~> 1.4)
|
24
|
+
ast (2.4.1)
|
25
|
+
bump (0.10.0)
|
26
|
+
cache (0.4.1)
|
27
|
+
cache_method (0.2.7)
|
28
|
+
cache (>= 0.2.1)
|
29
|
+
childprocess (4.0.0)
|
30
|
+
concurrent-ruby (1.1.8)
|
31
|
+
dalli (2.7.11)
|
32
|
+
diff-lcs (1.4.4)
|
33
|
+
docile (1.3.4)
|
34
|
+
faraday (1.3.0)
|
35
|
+
faraday-net_http (~> 1.0)
|
36
|
+
multipart-post (>= 1.2, < 3)
|
37
|
+
ruby2_keywords
|
38
|
+
faraday-net_http (1.0.1)
|
39
|
+
faraday_middleware (1.0.0)
|
40
|
+
faraday (~> 1.0)
|
41
|
+
faraday_middleware-multi_json (0.0.6)
|
42
|
+
faraday_middleware
|
43
|
+
multi_json
|
44
|
+
i18n (1.8.9)
|
45
|
+
concurrent-ruby (~> 1.0)
|
46
|
+
iniparse (1.5.0)
|
47
|
+
jwt (2.2.2)
|
48
|
+
minitest (5.14.4)
|
49
|
+
minitest-profile (0.0.2)
|
50
|
+
mocha (1.12.0)
|
51
|
+
multi_json (1.15.0)
|
52
|
+
multi_xml (0.6.0)
|
53
|
+
multipart-post (2.1.1)
|
54
|
+
oauth2 (1.4.4)
|
55
|
+
faraday (>= 0.8, < 2.0)
|
56
|
+
jwt (>= 1.0, < 3.0)
|
57
|
+
multi_json (~> 1.3)
|
58
|
+
multi_xml (~> 0.5)
|
59
|
+
rack (>= 1.2, < 3)
|
60
|
+
overcommit (0.57.0)
|
61
|
+
childprocess (>= 0.6.3, < 5)
|
62
|
+
iniparse (~> 1.4)
|
63
|
+
parallel (1.20.1)
|
64
|
+
parser (2.7.2.0)
|
65
|
+
ast (~> 2.4.1)
|
66
|
+
rack (2.2.3)
|
67
|
+
rainbow (3.0.0)
|
68
|
+
rake (13.0.3)
|
69
|
+
regexp_parser (2.0.3)
|
70
|
+
rexml (3.2.4)
|
71
|
+
rspec (3.10.0)
|
72
|
+
rspec-core (~> 3.10.0)
|
73
|
+
rspec-expectations (~> 3.10.0)
|
74
|
+
rspec-mocks (~> 3.10.0)
|
75
|
+
rspec-core (3.10.1)
|
76
|
+
rspec-support (~> 3.10.0)
|
77
|
+
rspec-expectations (3.10.1)
|
78
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
79
|
+
rspec-support (~> 3.10.0)
|
80
|
+
rspec-mocks (3.10.1)
|
81
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
+
rspec-support (~> 3.10.0)
|
83
|
+
rspec-support (3.10.1)
|
84
|
+
rubocop (0.92.0)
|
85
|
+
parallel (~> 1.10)
|
86
|
+
parser (>= 2.7.1.5)
|
87
|
+
rainbow (>= 2.2.2, < 4.0)
|
88
|
+
regexp_parser (>= 1.7)
|
89
|
+
rexml
|
90
|
+
rubocop-ast (>= 0.5.0)
|
91
|
+
ruby-progressbar (~> 1.7)
|
92
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
93
|
+
rubocop-ast (1.3.0)
|
94
|
+
parser (>= 2.7.1.5)
|
95
|
+
rubocop-minitest (0.10.3)
|
96
|
+
rubocop (>= 0.87, < 2.0)
|
97
|
+
rubocop-rake (0.5.1)
|
98
|
+
rubocop
|
99
|
+
ruby-progressbar (1.10.1)
|
100
|
+
ruby2_keywords (0.0.4)
|
101
|
+
simplecov (0.20.0)
|
102
|
+
docile (~> 1.1)
|
103
|
+
simplecov-html (~> 0.11)
|
104
|
+
simplecov_json_formatter (~> 0.1)
|
105
|
+
simplecov-html (0.12.3)
|
106
|
+
simplecov_json_formatter (0.1.2)
|
107
|
+
tzinfo (2.0.4)
|
108
|
+
concurrent-ruby (~> 1.0)
|
109
|
+
unicode-display_width (1.7.0)
|
110
|
+
zeitwerk (2.4.2)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
x86_64-darwin-19
|
114
|
+
x86_64-darwin-20
|
115
|
+
x86_64-linux
|
116
|
+
|
117
|
+
DEPENDENCIES
|
118
|
+
bump
|
119
|
+
bundler
|
120
|
+
checkoff!
|
121
|
+
minitest-profile
|
122
|
+
mocha
|
123
|
+
overcommit
|
124
|
+
rake (~> 13.0)
|
125
|
+
rspec (>= 3.4)
|
126
|
+
rubocop
|
127
|
+
rubocop-minitest
|
128
|
+
rubocop-rake
|
129
|
+
simplecov
|
130
|
+
|
131
|
+
BUNDLED WITH
|
132
|
+
2.2.11
|
data/{LICENSE.txt → LICENSE}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2021, Vince Broz
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +9,14 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/Makefile
CHANGED
@@ -1,27 +1,42 @@
|
|
1
|
-
.PHONY: spec feature
|
1
|
+
.PHONY: clean test help quality localtest spec feature
|
2
|
+
.DEFAULT_GOAL := default
|
2
3
|
|
3
|
-
|
4
|
+
define PRINT_HELP_PYSCRIPT
|
5
|
+
import re, sys
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
for line in sys.stdin:
|
8
|
+
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
|
9
|
+
if match:
|
10
|
+
target, help = match.groups()
|
11
|
+
print("%-20s %s" % (target, help))
|
12
|
+
endef
|
13
|
+
export PRINT_HELP_PYSCRIPT
|
7
14
|
|
8
|
-
|
9
|
-
@
|
15
|
+
help:
|
16
|
+
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
|
10
17
|
|
11
|
-
|
12
|
-
@bundle exec rake spec
|
18
|
+
default: localtest ## run default typechecking and tests
|
13
19
|
|
14
|
-
|
15
|
-
@bundle exec rake rubocop
|
20
|
+
clean: ## remove all built artifacts
|
16
21
|
|
17
|
-
|
18
|
-
@bundle exec rake punchlist
|
22
|
+
test: spec ## run tests quickly
|
19
23
|
|
20
|
-
|
21
|
-
@bundle exec
|
24
|
+
quality: ## run precommit quality checks
|
25
|
+
@bundle exec overcommit --run
|
22
26
|
|
23
|
-
|
24
|
-
@bundle exec rake
|
27
|
+
test: ## Run lower-level tests
|
28
|
+
@bundle exec rake test
|
25
29
|
|
26
|
-
quality
|
27
|
-
|
30
|
+
localtest: test quality feature ## run default local actions
|
31
|
+
|
32
|
+
update_from_cookiecutter: ## Bring in changes from template project used to create this repo
|
33
|
+
IN_COOKIECUTTER_PROJECT_UPGRADER=1 cookiecutter_project_upgrader || true
|
34
|
+
git checkout cookiecutter-template && git push && (git checkout main; bundle exec overcommit --sign)
|
35
|
+
git checkout main && bundle exec overcommit --sign && git pull && (git checkout -b update-from-cookiecutter-$$(date +%Y-%m-%d-%H%M); bundle exec overcommit --sign)
|
36
|
+
git merge cookiecutter-template || true
|
37
|
+
@echo
|
38
|
+
@echo "Please resolve any merge conflicts below and push up a PR with:"
|
39
|
+
@echo
|
40
|
+
@echo ' gh pr create --title "Update from cookiecutter" --body "Automated PR to update from cookiecutter boilerplate"'
|
41
|
+
@echo
|
42
|
+
@echo
|
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=
|
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/
|
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/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/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,7 +11,7 @@ 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 = '
|
14
|
+
spec.homepage = 'https://github.com/apiology/checkoff'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
spec.required_ruby_version = '>= 2.5'
|
17
17
|
|
@@ -27,12 +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
34
|
spec.add_development_dependency 'overcommit'
|
34
|
-
spec.add_development_dependency 'quality', '~> 38'
|
35
35
|
spec.add_development_dependency 'rake', '~> 13.0'
|
36
36
|
spec.add_development_dependency 'rspec', '>=3.4'
|
37
|
+
spec.add_development_dependency 'rubocop'
|
38
|
+
spec.add_development_dependency 'rubocop-minitest'
|
39
|
+
spec.add_development_dependency 'rubocop-rake'
|
37
40
|
spec.add_development_dependency 'simplecov'
|
38
41
|
end
|
@@ -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,274 @@
|
|
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
|
+
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
|
+
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
|
+
pip install 'pip>=20.3.1'
|
243
|
+
}
|
244
|
+
|
245
|
+
ensure_python_requirements() {
|
246
|
+
pip install -r requirements_dev.txt
|
247
|
+
}
|
248
|
+
|
249
|
+
ensure_shellcheck() {
|
250
|
+
if ! type shellcheck >/dev/null 2>&1
|
251
|
+
then
|
252
|
+
install_package shellcheck
|
253
|
+
fi
|
254
|
+
}
|
255
|
+
|
256
|
+
ensure_rbenv
|
257
|
+
|
258
|
+
ensure_ruby_versions
|
259
|
+
|
260
|
+
set_ruby_local_version
|
261
|
+
|
262
|
+
ensure_bundle
|
263
|
+
|
264
|
+
ensure_pyenv
|
265
|
+
|
266
|
+
ensure_python_versions
|
267
|
+
|
268
|
+
ensure_pyenv_virtualenvs
|
269
|
+
|
270
|
+
ensure_pip
|
271
|
+
|
272
|
+
ensure_python_requirements
|
273
|
+
|
274
|
+
ensure_shellcheck
|