Skip to content

Commit

Permalink
Merge branch 'cookiecutter-template' into update-from-cookiecutter-20…
Browse files Browse the repository at this point in the history
…21-10-13-0919
  • Loading branch information
apiology committed Oct 13, 2021
2 parents dcd7570 + cbbadb3 commit f70a95e
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 40 deletions.
15 changes: 11 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ commands:
sed -E -e 's/bigfiles \([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\)/bigfiles (0.1.0)/g' \
Gemfile.lock > Gemfile.lock.deversioned
- restore_cache:
key: gems-v4-{{ checksum "Gemfile.lock.deversioned" }}
key: gems-v1-{{ checksum "Gemfile.lock.deversioned" }}
- restore_cache:
key: wheels-v1-{{ checksum "requirements_dev.txt" }}
- run:
name: Initialize packages
command: |
Expand All @@ -52,9 +54,13 @@ commands:
exit 1
fi
- save_cache:
key: gems-v4-{{ checksum "Gemfile.lock.deversioned" }}
key: gems-v1-{{ checksum "Gemfile.lock.deversioned" }}
paths:
- "vendor/bundle"
- save_cache:
key: wheels-v1-{{ checksum "requirements_dev.txt" }}
paths:
- "/home/circleci/.cache/pip/wheels"
- run:
name: Download new circleci tool
command: |
Expand All @@ -78,7 +84,7 @@ commands:
jobs:
overcommit:
docker:
- image: apiology/circleci:latest
- image: apiology/circleci-ruby:latest
steps:
- when:
condition:
Expand All @@ -93,7 +99,7 @@ jobs:
build:
working_directory: ~/bigfiles
docker:
- image: apiology/circleci:latest
- image: apiology/circleci-ruby:latest
steps:
- set_up_environment
- run_with_languages:
Expand All @@ -117,6 +123,7 @@ workflows:
- main
jobs:
- build
- overcommit
overcommit:
jobs:
- overcommit
Expand Down
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ Naming/MethodParameterName:
- x # cartesian coordinates
- y # cartesian coordinates

# by default (EnforcedStyle=NormalCase) this rule doesn't like
# things like check_1, check_2, etc and wants check1, check2, etc. I
# like the former.
#
# https://docs.rubocop.org/rubocop/cops_naming.html#namingvariablenumber
Naming/VariableNumber:
Enabled: true
EnforcedStyle: snake_case

# http://www.betterspecs.org/#single
#
# > in tests that are not isolated (e.g. ones that integrate with a
Expand Down
2 changes: 2 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ development. See the `.envrc` file for detail.
To publish new version as a maintainer:

```sh
git checkout main && git pull
git log "v$(bump current)..."
# Set type_of_bump to patch, minor, or major
bump --tag --tag-prefix=v ${type_of_bump:?}
rake release
git push
```
40 changes: 21 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ GEM
specs:
ast (2.4.2)
bump (0.10.0)
childprocess (4.0.0)
childprocess (4.1.0)
coderay (1.1.3)
diff-lcs (1.4.4)
docile (1.4.0)
high_water_mark (0.1.0)
imagen (0.1.8)
parser (>= 2.5, != 2.5.1.1)
iniparse (1.5.0)
minitest-profile (0.0.2)
mocha (1.12.0)
method_source (1.0.0)
overcommit (0.58.0)
childprocess (>= 0.6.3, < 5)
iniparse (~> 1.4)
rexml (~> 3.2)
parallel (1.20.1)
parser (3.0.1.1)
parallel (1.21.0)
parser (3.0.2.0)
ast (~> 2.4.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rainbow (3.0.0)
rake (13.0.3)
rake (13.0.6)
regexp_parser (2.1.1)
rexml (3.2.5)
rspec (3.10.0)
Expand All @@ -43,24 +46,23 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.16.0)
rubocop (1.22.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.7.0, < 2.0)
rubocop-ast (>= 1.12.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.7.0)
rubocop-ast (1.12.0)
parser (>= 3.0.1.1)
rubocop-rake (0.5.1)
rubocop
rubocop-rspec (2.3.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
rubocop-rspec (2.5.0)
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
rugged (1.1.0)
rugged (1.1.1)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -73,29 +75,29 @@ GEM
imagen (>= 0.1.8)
rainbow (>= 2.1, < 4.0)
rugged (>= 0.27, < 1.2)
unicode-display_width (2.0.0)
unicode-display_width (2.1.0)

PLATFORMS
java
ruby
x86_64-darwin-19
x86_64-darwin-20
x86_64-linux

DEPENDENCIES
bigfiles!
bump
bundler
minitest-profile
mocha
overcommit (>= 0.58.0)
pry
rake (~> 13.0)
rspec (>= 3.4)
rubocop
rubocop-rake
rubocop-rspec
simplecov
simplecov (>= 0.18.0)
simplecov-lcov
undercover

BUNDLED WITH
2.2.19
2.2.25
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ requirements_dev.txt.installed: requirements_dev.txt

pip_install: requirements_dev.txt.installed ## Install Python dependencies

Gemfile.lock:
bundle install
# bundle install doesn't get run here so that we can catch it below in
# fresh-checkout and fresh-rbenv cases
Gemfile.lock: Gemfile

# Ensure any Gemfile.lock changes ensure a bundle is installed.
Gemfile.lock.installed: Gemfile.lock
bundle install
touch Gemfile.lock.installed
Expand All @@ -39,11 +41,13 @@ clean: clear_metrics ## remove all built artifacts

test: spec ## run tests quickly

quality: ## run precommit quality checks
overcommit: ## run precommit quality checks
bundle exec overcommit --run

quality: overcommit ## run precommit quality checks

spec: ## Run lower-level tests
# @bundle exec rake spec
@bundle exec rake spec

feature: ## Run higher-level tests
@bundle exec rake feature
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# BigFiles

[![Build Status](https://travis-ci.org/apiology/bigfiles.svg?branch=main)](https://travis-ci.org/apiology/bigfiles)
[![CircleCI](https://circleci.com/gh/apiology/bigfiles.svg?style=svg)](https://circleci.com/gh/apiology/bigfiles)


Simple tool to find the largest source files in your project - maybe
to target for refactoring!
Expand Down
12 changes: 7 additions & 5 deletions bigfiles.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ Gem::Specification.new do |spec|
spec.license = 'MIT license'
spec.required_ruby_version = '>= 2.6'

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
end
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
Expand All @@ -27,18 +29,18 @@ Gem::Specification.new do |spec|

spec.add_development_dependency 'bump'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'minitest-profile'
spec.add_development_dependency 'mocha'
# 0.58.0 and 0.57.0 don't seem super compatible with signatures, and
# magit doesn't seem to want to use the bundled version at the moment,
# so let's favor the more recent version...
spec.add_development_dependency 'overcommit', ['>=0.58.0']
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '>=3.4'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop-rake'
spec.add_development_dependency 'rubocop-rspec'
spec.add_development_dependency 'simplecov'
# ensure version with branch coverage
spec.add_development_dependency 'simplecov', ['>=0.18.0']
spec.add_development_dependency 'simplecov-lcov'
spec.add_development_dependency 'undercover'
end
2 changes: 1 addition & 1 deletion feature/feature_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Add the bin directory, to allow testing of gem executables as if the gem is
# already installed.
root_dir = RSpec::Core::RubyProject.root
exec_dir = "#{root_dir}/bin"
exec_dir = File.join(File::SEPARATOR, root_dir, 'bin')
ENV['PATH'] = [exec_dir, ENV['PATH']].join(File::PATH_SEPARATOR)

# Courtesy of:
Expand Down
45 changes: 39 additions & 6 deletions fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ensure_ruby_build_requirements() {
# been release here: https://www.ruby-lang.org/en/downloads/
ensure_ruby_versions() {
# You can find out which feature versions are still supported / have
# been release here: https://www.python.org/downloads/
# been release here: https://www.ruby-lang.org/en/downloads/
ruby_versions="$(latest_ruby_version 2.6)"

echo "Latest Ruby versions: ${ruby_versions}"
Expand Down Expand Up @@ -127,10 +127,33 @@ ensure_bundle() {
bundler_version=$(bundle --version | cut -d ' ' -f3)
bundler_version_major=$(cut -d. -f1 <<< "${bundler_version}")
bundler_version_minor=$(cut -d. -f2 <<< "${bundler_version}")
bundler_version_patch=$(cut -d. -f3 <<< "${bundler_version}")
# Version 2.1 of bundler seems to have some issues with nokogiri:
#
# https://app.asana.com/0/1107901397356088/1199504270687298
if [ "${bundler_version_major}" == 2 ] && [ "${bundler_version_minor}" -lt 2 ]

# Version 2.2.22 of bundler comes with a fix to ensure the 'bundle
# update --conservative' flag works as expected - important when
# doing a 'bundle update' on a about-to-be-published gem after
# bumping a gem version.
need_better_bundler=false
if [ "${bundler_version_major}" -lt 2 ]
then
need_better_bundler=true
elif [ "${bundler_version_major}" -eq 2 ]
then
if [ "${bundler_version_minor}" -lt 2 ]
then
need_better_bundler=true
elif [ "${bundler_version_minor}" -eq 2 ]
then
if [ "${bundler_version_patch}" -lt 22 ]
then
need_better_bundler=true
fi
fi
fi
if [ "${need_better_bundler}" = true ]
then
gem install --no-document bundler
fi
Expand All @@ -143,7 +166,13 @@ ensure_bundle() {
# re-resolve and consider the new platform when picking gems, all
# without needing to have a machine that matches PLATFORM handy to
# install those platform-specific gems on.'
grep x86_64-darwin-20 Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform x86_64-darwin-20 x86_64-linux
#
# This affects nokogiri, which will try to reinstall itself in
# Docker builds where it's already installed if this is not run.
for platform in x86_64-darwin-20 x86_64-linux
do
grep "${platform:?}" Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform "${platform:?}"
done
}

set_ruby_local_version() {
Expand Down Expand Up @@ -227,14 +256,16 @@ ensure_python_build_requirements() {
ensure_dev_library openssl/ssl.h openssl libssl-dev
ensure_dev_library ffi.h libffi libffi-dev
ensure_dev_library sqlite3.h sqlite3 libsqlite3-dev
ensure_dev_library lzma.h xz liblzma-dev
ensure_dev_library readline.h readline libreadline-dev
}

# You can find out which feature versions are still supported / have
# been release here: https://www.python.org/downloads/
ensure_python_versions() {
# You can find out which feature versions are still supported / have
# been release here: https://www.python.org/downloads/
python_versions="$(latest_python_version 3.9)"
python_versions="$(latest_python_version 3.10)"

echo "Latest Python versions: ${python_versions}"

Expand Down Expand Up @@ -271,14 +302,16 @@ ensure_pyenv_virtualenvs() {
pyenv local "${virtualenv_name}" ${python_versions} mylibs
}

ensure_pip() {
ensure_pip_and_wheel() {
# Make sure we have a pip with the 20.3 resolver, and after the
# initial bugfix release
major_pip_version=$(pip --version | cut -d' ' -f2 | cut -d '.' -f 1)
if [[ major_pip_version -lt 21 ]]
then
pip install 'pip>=20.3.1'
fi
# wheel is helpful for being able to cache long package builds
pip show wheel >/dev/null 2>&1 || pip install wheel
}

ensure_python_requirements() {
Expand Down Expand Up @@ -325,7 +358,7 @@ ensure_python_versions

ensure_pyenv_virtualenvs

ensure_pip
ensure_pip_and_wheel

ensure_python_requirements

Expand Down
6 changes: 6 additions & 0 deletions rakelib/console.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

desc 'Load up bigfiles in pry'
task :console do |_t|
exec 'pry -I lib -r bigfiles'
end
1 change: 1 addition & 0 deletions rakelib/default.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

desc 'Standard build'
task default: :localtest
4 changes: 4 additions & 0 deletions rakelib/repl.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

desc 'Load up bigfiles in pry'
task repl: [:console]

0 comments on commit f70a95e

Please sign in to comment.