diff --git a/.rubocop.yml b/.rubocop.yml index 104b0677c1..f1b05987d0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,5 +8,6 @@ # https://github.com/makersacademy/scaffolint # # Configure Rubocop to use the config file in the Scaffolint GitHub repo + inherit_from: - - https://raw.githubusercontent.com/makersacademy/scaffolint/v1.1.0/.rubocop.yml + - https://raw.githubusercontent.com/makersacademy/scaffolint/v2.2.0/.rubocop.yml diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 57cf282ebb..0000000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -2.6.5 diff --git a/Gemfile b/Gemfile index 41d90f2771..35de4a7f0e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,13 @@ source 'https://rubygems.org' +ruby '3.0.2' + group :test do gem 'rspec' - gem 'rubocop', '0.79.0' gem 'simplecov', require: false, group: :test gem 'simplecov-console', require: false, group: :test end + +group :development, :test do + gem 'rubocop', '1.20' +end diff --git a/Gemfile.lock b/Gemfile.lock index 702287c377..66064703c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,55 +2,65 @@ GEM remote: https://rubygems.org/ specs: ansi (1.5.0) - ast (2.4.0) - diff-lcs (1.3) - docile (1.3.2) - jaro_winkler (1.5.4) - parallel (1.19.1) - parser (2.7.0.3) - ast (~> 2.4.0) + ast (2.4.2) + diff-lcs (1.4.4) + docile (1.4.0) + parallel (1.20.1) + parser (3.0.2.0) + ast (~> 2.4.1) rainbow (3.0.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.1) - rspec-support (~> 3.9.1) - rspec-expectations (3.9.0) + regexp_parser (2.1.1) + rexml (3.2.5) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.1) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.1) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.2) - rubocop (0.79.0) - jaro_winkler (~> 1.5.1) + rspec-support (~> 3.10.0) + rspec-support (3.10.2) + rubocop (1.20.0) parallel (~> 1.10) - parser (>= 2.7.0.1) + parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.9.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - ruby-progressbar (1.10.1) - simplecov (0.18.0) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.11.0) + parser (>= 3.0.1.1) + ruby-progressbar (1.11.0) + simplecov (0.21.2) docile (~> 1.1) - simplecov-html (~> 0.11.0) - simplecov-console (0.6.0) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-console (0.9.1) ansi simplecov terminal-table - simplecov-html (0.11.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - unicode-display_width (1.6.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.3) + terminal-table (3.0.1) + unicode-display_width (>= 1.1.1, < 3) + unicode-display_width (2.0.0) PLATFORMS ruby DEPENDENCIES rspec - rubocop (= 0.79.0) + rubocop (= 1.20) simplecov simplecov-console +RUBY VERSION + ruby 3.0.2p107 + BUNDLED WITH - 2.1.4 + 2.2.26 diff --git a/check.sh b/check.sh new file mode 100755 index 0000000000..1469749226 --- /dev/null +++ b/check.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +# This script is used by Makers to ensure that the challenges stay up to date. +# If you're a student, you don't need to run it. But you can if you like! + +set -Eeuo pipefail +trap cleanup SIGINT SIGTERM ERR + +script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) + +setup_colors() { + if [[ -t 2 ]] && [[ -z "${NO_COLOR-}" ]] && [[ "${TERM-}" != "dumb" ]]; then + NOFORMAT='\033[0m' RED='\033[0;31m' GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' YELLOW='\033[1;33m' + else + NOFORMAT='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW='' + fi +} + +cleanup() { + trap - SIGINT SIGTERM ERR + die "${RED}Checks failed${NOFORMAT}" +} + +msg() { + echo >&2 -e "${1-}" +} + +die() { + local msg=$1 + local code=${2-1} # default exit status 1 + msg "$msg" + exit "$code" +} + +setup_colors + +msg "${BLUE}Integrity check using Ruby version ${ORANGE}$(ruby -v)${NOFORMAT}" +msg "${BLUE} • Installing bundler${NOFORMAT}" +gem install bundler +msg "${BLUE} • Running bundle install${NOFORMAT}" +bundle install +msg "${BLUE} • Running rspec${NOFORMAT}" +bundle exec rspec +msg "${BLUE} • Running rubocop${NOFORMAT}" +bundle exec rubocop +exit 0