Skip to content

Commit bf5222a

Browse files
authored
Merge pull request #115 from github/ruby-updates
2 parents 226326f + fca04db commit bf5222a

File tree

11 files changed

+100
-119
lines changed

11 files changed

+100
-119
lines changed

.bundle/config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
BUNDLE_BIN: "bin"
3+
BUNDLE_PATH: "vendor/gems"
4+
BUNDLE_CACHE_PATH: "vendor/cache"
5+
BUNDLE_CACHE_ALL: "true"
6+
BUNDLE_SPECIFIC_PLATFORM: "true"
7+
BUNDLE_NO_INSTALL: "true"

.github/workflows/lint.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ jobs:
2222
with:
2323
bundler-cache: true
2424

25+
- name: bootstrap
26+
run: script/bootstrap
27+
2528
- name: lint
26-
run: bundle exec rubocop -c .rubocop.yml lib/ spec/
29+
run: script/lint

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: script/bootstrap
2929

3030
- name: lint
31-
run: bundle exec rubocop -c .rubocop.yml lib/ spec/
31+
run: script/lint
3232

3333
- name: test
3434
run: script/test

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
ruby: [ '3.1.2', '3.1.4', '3.2.2', '3.2.3', '3.3.0', '3.3.1' ]
18+
ruby: [ '3.1.2', '3.1.4', '3.2.2', '3.2.3', '3.3.0', '3.3.1', '3.4.0', '3.4.2' ]
1919

2020
steps:
2121
- name: checkout
@@ -26,5 +26,8 @@ jobs:
2626
bundler-cache: true
2727
ruby-version: ${{ matrix.ruby }}
2828

29+
- name: bootstrap
30+
run: script/bootstrap
31+
2932
- name: test
30-
run: script/test -k
33+
run: script/test

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.bundle
21
bin
32
coverage
43
logs

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.2
1+
3.4.2

lib/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module RedactingLogger
44
module Version
5-
VERSION = "1.4.0"
5+
VERSION = "1.4.1"
66
end
77
end

script/bootstrap

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,16 @@
11
#! /usr/bin/env bash
22

3-
# COLORS
4-
OFF='\033[0m'
5-
RED='\033[0;31m'
6-
GREEN='\033[0;32m'
7-
BLUE='\033[0;34m'
8-
PURPLE='\033[0;35m'
3+
set -e # prevent any kind of script failures
94

10-
set -e # Prevent any kind of script failures
5+
source script/env "$@"
116

12-
# if any of the following env vars are set, use them for the APP_ENV value
13-
if [ -n "$APP_ENV" ]; then
14-
export APP_ENV="$APP_ENV"
15-
elif [ -n "$ENV" ]; then
16-
export APP_ENV="$ENV"
17-
elif [ -n "$ENVIRONMENT" ]; then
18-
export APP_ENV="$ENVIRONMENT"
19-
elif [ -n "$RAILS_ENV" ]; then
20-
export APP_ENV="$RAILS_ENV"
21-
elif [ -n "$RACK_ENV" ]; then
22-
export APP_ENV="$RACK_ENV"
23-
fi
24-
25-
# set the working directory to the root of the project
26-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
27-
28-
# set the ruby version to the one specified in the .ruby-version file
29-
[ -z "$RBENV_VERSION" ] && export RBENV_VERSION=$(cat "$DIR/.ruby-version")
30-
31-
# set the app environment to development if it's not set
32-
[ -z "$APP_ENV" ] && export APP_ENV="development"
33-
34-
# set the path to include the rbenv shims if they exist
35-
[ -d "/usr/share/rbenv/shims" ] && export PATH=/usr/share/rbenv/shims:$PATH
36-
37-
TRASHDIR=$(mktemp -d /tmp/bootstrap.XXXXXXXXXXXXXXXXX)
38-
cleanup() {
39-
rm -rf "$TRASHDIR"
40-
# Remove empty directory
41-
rmdir "$DIR/vendor/cache" 2>/dev/null || true
42-
}
43-
trap cleanup EXIT
44-
45-
# Bootstrap gem dependencies.
46-
if [ "$APP_ENV" == "production" ]; then
47-
echo -e "💎 ${BLUE}Installing Gems for ${GREEN}production${BLUE}...${OFF}"
48-
BUNDLE_WITHOUT=development bundle install --local
49-
BUNDLE_WITHOUT=development bundle binstubs --all
7+
# bootstrap gem dependencies
8+
if [ "$BUNDLE_WITHOUT" == "" ]; then
9+
echo -e "${BLUE}Installing Gems for ${PURPLE}development${BLUE}...${OFF}"
5010
else
51-
echo -e "💎 ${BLUE}Installing Gems for ${PURPLE}development${BLUE}...${OFF}"
52-
bundle install --local
53-
bundle binstubs --all
11+
echo -e "${BLUE}Installing Gems for ${GREEN}production${BLUE}...${OFF}"
5412
fi
13+
14+
# what gets installed is set via the BUNDLE_WITHOUT env var in the script/env file
15+
bundle install --local
16+
bundle binstubs --all

script/env

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#! /usr/bin/env bash
2+
3+
set -e # prevent any kind of script failures
4+
5+
# COLORS
6+
export OFF='\033[0m'
7+
export RED='\033[0;31m'
8+
export GREEN='\033[0;32m'
9+
export BLUE='\033[0;34m'
10+
export PURPLE='\033[0;35m'
11+
12+
# set RUBY_ENV to development (as a default) if not set
13+
: "${RUBY_ENV:=development}"
14+
15+
export RUBY_ENV
16+
17+
# set the working directory to the root of the project
18+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
19+
export DIR
20+
21+
# The name of the repository is the name of the directory (usually)
22+
REPO_NAME=$(basename "$PWD")
23+
export REPO_NAME
24+
25+
# set the ruby version to the one specified in the .ruby-version file
26+
[ -z "$RBENV_VERSION" ] && RBENV_VERSION=$(cat "$DIR/.ruby-version")
27+
export RBENV_VERSION
28+
29+
# set the path to include the rbenv shims if they exist
30+
[ -d "/usr/share/rbenv/shims" ] && export PATH=/usr/share/rbenv/shims:$PATH
31+
32+
# detect OS version and architecture
33+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
34+
PLATFORM="linux"
35+
VERSION=$(grep '^VERSION_CODENAME=' /etc/os-release | cut -d '=' -f2 || echo "unknown")
36+
elif [[ "$OSTYPE" == "darwin"* ]]; then
37+
PLATFORM="macos"
38+
VERSION=$(sw_vers -productVersion || echo "unknown")
39+
else
40+
PLATFORM="unknown"
41+
VERSION="unknown"
42+
fi
43+
44+
ARCH=$(uname -m || echo "unknown")
45+
46+
export PLATFORM
47+
export VERSION
48+
export ARCH
49+
50+
shopt -s nocasematch # enable case-insensitive matching
51+
if [[ "$RUBY_ENV" == "production" ]]; then
52+
export BUNDLE_WITHOUT="development"
53+
fi
54+
shopt -u nocasematch # disable case-insensitive matching
55+
56+
# make the vendor/cache directory if it doesn't exist
57+
mkdir -p "$DIR/vendor/cache"

script/lint

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#! /usr/bin/env bash
2+
3+
set -e
4+
5+
source script/env "$@"
6+
7+
# run linter
8+
echo -e "\n🤖 ${BLUE}Running Rubocop: $(date "+%H:%M:%S")${OFF}\n"
9+
10+
bundle exec rubocop -c .rubocop.yml lib/ spec/ "$@"

0 commit comments

Comments
 (0)