Skip to content

Commit

Permalink
Rails 4.2 -> Rails 7.1, Ruby 2.5.9 -> Ruby 3.2.3
Browse files Browse the repository at this point in the history
Work in progress.

This PR was produced by generating a new Rails 7.1 app with the new
Turbo/Stimulus/Hotwire stack and asset pipeline, adding bootstrap,
and then moving over the .git folder and all other files from the
main branch of the TicketBooth App.

Fixes Issue #58.
  • Loading branch information
kigster committed Apr 13, 2024
1 parent 182b308 commit 4fc5f05
Show file tree
Hide file tree
Showing 300 changed files with 61,944 additions and 4,127 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.2.2
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION

# Install packages needed to build gems
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
libpq-dev libvips \
# For video thumbnails
ffmpeg \
# For pdf thumbnails. If you want to use mupdf instead of poppler,
# you can install the following packages instead:
# mupdf mupdf-tools
poppler-utils
50 changes: 50 additions & 0 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
services:
rails-app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile

volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

networks:
- default

# Uncomment the next line to use a non-root user for all processes.
# user: vscode

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
ports:
- 45678:45678
depends_on:
- redis
- postgres


redis:
image: redis:7.2
restart: unless-stopped
networks:
- default
volumes:
- redis-data:/data

postgres:
image: postgres:16.1
restart: unless-stopped
networks:
- default
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres


volumes:
redis-data:
postgres-data:
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "ticket_booth",
"dockerComposeFile": "compose.yaml",
"service": "rails-app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},

"containerEnv": {
"REDIS_URL": "redis://redis:6379/1",
"DB_HOST": "postgres"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root",

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bin/setup"
}
10 changes: 0 additions & 10 deletions .env

This file was deleted.

19 changes: 19 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# vim: ft=bash

PATH_add bin
PATH_add /opt/homebrew/bin

export brew_prefix="$(brew --prefix)"

pg_pkg="postgresql@$(cat .postgresql-version)"
pg_dir="${brew_prefix}/bin/${pg_pkg}"

[[ -d ${pg_dir} ]] && PATH_add "${pg_dir}"

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

export V8HOME=$(brew --prefix [email protected])

export CFLAGS="-Wno-error=implicit-function-declaration -Wno-error=no-compound-token-split-by-macro"
export CPPFLAGS="$CPPFLAGS -I ${brew_prefix}/include -I ${V8HOME}/include"
export LDFLAGS="$LDFLAGS -L ${brew_prefix}/lib -L ${V8HOME}/lib"

export RUBY_CPPFLAGS="$CPPFLAGS"
export RUBY_CFLAGS="$CFLAGS"

[[ -f .envrc.local ]] && source .envrc.local
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/schema.rb linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
config/credentials/*.yml.enc diff=rails_credentials
config/credentials.yml.enc diff=rails_credentials
35 changes: 0 additions & 35 deletions .github/CODEOWNERS

This file was deleted.

12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
17 changes: 17 additions & 0 deletions .github/workflows/bash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: BASH ShellCheck
on:
push:
branches:
- main
pull_request:
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
run: bin/shchk
permissions:
checks: read
contents: read
statuses: read
41 changes: 0 additions & 41 deletions .github/workflows/build.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .github/workflows/main.yaml
name: "TicketBooth CI: Lint"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
main:
name: RuboCop
runs-on: ubuntu-latest
steps:
- run: sudo apt-get update -yqq
- run: sudo apt-get install -yqq netcat libpq-dev

- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.3'
bundler-cache: true

- name: RuboCop
run: bin/rubocop --parallel
68 changes: 68 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# .github/workflows/main.yaml
name: "TicketBooth CI: RSpec"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
main:
name: RSpec
runs-on: ubuntu-latest

# If you need DB like MySQL then define service below.
# Example for PostgreSQL and Redis can be found here:
# https://github.com/actions/example-services/tree/master/.github/workflows
services:
postgresql:
image: postgres
env:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: "trust"
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: niden/actions-memcached@v7

- run: sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- run: wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
- run: sudo apt-get update -yqq
- run: sudo apt-get install -yqq netcat libpq-dev postgresql-client-16

- name: "Verify Memcached is running"
run: echo -e "stats\nquit" | nc localhost 11211 | grep -e "accepting_conns 1" -q

- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.3'
bundler-cache: true

- name: "Create and migrate the DB"
run: |
bin/rails db:create
bin/rails db:migrate
bin/rails db:test:prepare
- name: "Run Rspec"
run: bundle exec rspec
25 changes: 0 additions & 25 deletions .github/workflows/rubocop.yml

This file was deleted.

Loading

0 comments on commit 4fc5f05

Please sign in to comment.