Skip to content

Commit 6b49f03

Browse files
committed
Merge branch 'AV-74851-ruby-on-rails-quickstart'
2 parents 27e3b71 + 788f426 commit 6b49f03

File tree

101 files changed

+4342
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+4342
-0
lines changed

.dockerignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2+
3+
# Ignore git directory.
4+
/.git/
5+
6+
# Ignore bundler config.
7+
/.bundle
8+
9+
# Ignore all environment files (except templates).
10+
/.env*
11+
!/.env*.erb
12+
13+
# Ignore all default key files.
14+
/config/master.key
15+
/config/credentials/*.key
16+
17+
# Ignore all logfiles and tempfiles.
18+
/log/*
19+
/tmp/*
20+
!/log/.keep
21+
!/tmp/.keep
22+
23+
# Ignore pidfiles, but keep the directory.
24+
/tmp/pids/*
25+
!/tmp/pids/.keep
26+
27+
# Ignore storage (uploaded files in development and any SQLite databases).
28+
/storage/*
29+
!/storage/.keep
30+
/tmp/storage/*
31+
!/tmp/storage/.keep
32+
33+
# Ignore assets.
34+
/node_modules/
35+
/app/assets/builds/*
36+
!/app/assets/builds/.keep
37+
/public/assets

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2+
3+
# Mark the database schema as having been generated.
4+
db/schema.rb linguist-generated
5+
6+
# Mark any vendored files as having been vendored.
7+
vendor/* linguist-vendored
8+
config/credentials/*.yml.enc diff=rails_credentials
9+
config/credentials.yml.enc diff=rails_credentials

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: "40 9 * * *"
10+
11+
jobs:
12+
run_tests:
13+
name: Run Tests
14+
runs-on: ubuntu-latest
15+
env:
16+
DB_CONN_STR: ${{ vars.DB_CONN_STR }}
17+
DB_USERNAME: ${{ vars.DB_USERNAME }}
18+
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
- name: Set up Ruby
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
ruby-version: 3.3.0
27+
- name: Install dependencies
28+
run: bundle install
29+
30+
- name: Run tests
31+
run: bundle exec rspec test/integration
32+
33+
- name: Report Status
34+
if: always()
35+
uses: ravsamhq/notify-slack-action@v1
36+
with:
37+
status: ${{ job.status }}
38+
notify_when: "failure,warnings"
39+
notification_title: "Repo: *{repo}*"
40+
message_format: "{emoji} *{status_message}* in <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>"
41+
footer: "<{run_url}|View Full Run on GitHub>"
42+
env:
43+
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Environment Variables
8+
dev.env
9+
10+
# Lockfile
11+
Gemfile.lock
12+
13+
# Logs
14+
log/
15+
16+
# Ignore bundler config.
17+
/.bundle
18+
19+
# Ignore all environment files (except templates).
20+
/.env*
21+
!/.env*.erb
22+
23+
# Ignore all logfiles and tempfiles.
24+
/log/*
25+
/tmp/*
26+
!/log/.keep
27+
!/tmp/.keep
28+
29+
# Ignore pidfiles, but keep the directory.
30+
/tmp/pids/*
31+
!/tmp/pids/
32+
!/tmp/pids/.keep
33+
34+
# Ignore storage (uploaded files in development and any SQLite databases).
35+
/storage/*
36+
!/storage/.keep
37+
/tmp/storage/*
38+
!/tmp/storage/
39+
!/tmp/storage/.keep
40+
41+
/public/assets
42+
43+
# Ignore master key for decrypting credentials and more.
44+
/config/master.key

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--require spec_helper

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.3.0

.vscode/launch.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
// Run all tests in a file using Minitest
5+
{
6+
"type": "rdbg",
7+
"name": "Minitest - current file",
8+
"request": "launch",
9+
"script": "-Itest ${file}",
10+
"askParameters": false
11+
},
12+
// If your test runner supports line numbers, such as in Rails,
13+
// you can add a task like this one to run only the test under the cursor
14+
{
15+
"name": "Minitest - current line",
16+
"type": "rdbg",
17+
"request": "launch",
18+
"command": "${workspaceRoot}/bin/rails",
19+
"script": "test",
20+
"args": ["${file}:${lineNumber}"],
21+
"askParameters": false
22+
},
23+
// Attach the debugger to an active process (for example, Rails server)
24+
{
25+
"type": "rdbg",
26+
"name": "Attach with rdbg",
27+
"request": "attach"
28+
}
29+
]
30+
}

Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4+
ARG RUBY_VERSION=3.3.0
5+
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
6+
7+
# Rails app lives here
8+
WORKDIR /rails
9+
10+
# Set production environment
11+
ENV RAILS_ENV="production" \
12+
BUNDLE_DEPLOYMENT="1" \
13+
BUNDLE_PATH="/usr/local/bundle" \
14+
BUNDLE_WITHOUT="development"
15+
16+
# Throw-away build stage to reduce size of final image
17+
FROM base as build
18+
19+
# Install packages needed to build gems
20+
RUN apt-get update -qq && \
21+
apt-get install --no-install-recommends -y build-essential git libvips pkg-config cmake
22+
23+
# Install application gems
24+
COPY Gemfile Gemfile.lock ./
25+
RUN bundle install
26+
27+
# Copy application code
28+
COPY . .
29+
30+
# Precompile bootsnap code for faster boot times
31+
RUN bundle exec bootsnap precompile app/ lib/
32+
33+
# Final stage for app image
34+
FROM base
35+
36+
# Install packages needed for deployment
37+
RUN apt-get update -qq && \
38+
apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
39+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
40+
41+
# Copy built artifacts: gems, application
42+
COPY --from=build /usr/local/bundle /usr/local/bundle
43+
COPY --from=build /rails /rails
44+
45+
# Run and own only the runtime files as a non-root user for security
46+
RUN useradd rails --create-home --shell /bin/bash && \
47+
chown -R rails:rails db log storage tmp
48+
USER rails:rails
49+
50+
# Entrypoint prepares the database.
51+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
52+
53+
# Start the server by default, this can be overwritten at runtime
54+
EXPOSE 3000
55+
CMD ["./bin/rails", "server"]

Gemfile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
source 'https://rubygems.org'
2+
3+
ruby '3.3.0'
4+
5+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
6+
gem 'rails', '~> 7.1.3', '>= 7.1.3.2'
7+
8+
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
9+
gem 'sprockets-rails'
10+
11+
# Use sqlite3 as the database for Active Record
12+
gem 'sqlite3', '~> 1.4'
13+
14+
# Use the Puma web server [https://github.com/puma/puma]
15+
gem 'puma', '>= 5.0'
16+
17+
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
18+
gem 'importmap-rails'
19+
20+
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
21+
gem 'turbo-rails'
22+
23+
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
24+
gem 'stimulus-rails'
25+
26+
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
27+
gem 'jbuilder'
28+
29+
# Couchbase
30+
gem 'couchbase'
31+
32+
# Rswag
33+
gem 'rswag'
34+
35+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
36+
gem 'tzinfo-data', platforms: %i[mswin mswin64 mingw x64_mingw jruby]
37+
38+
# Reduces boot times through caching; required in config/boot.rb
39+
gem 'bootsnap', require: false
40+
41+
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
42+
# gem "image_processing", "~> 1.2"
43+
44+
group :development, :test do
45+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
46+
gem 'debug', platforms: %i[mri mswin mswin64 mingw x64_mingw]
47+
gem 'dotenv'
48+
49+
gem 'rspec-rails'
50+
gem 'rubocop', require: false
51+
end
52+
53+
group :development do
54+
# Use console on exceptions pages [https://github.com/rails/web-console]
55+
gem 'web-console'
56+
57+
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
58+
# gem "rack-mini-profiler"
59+
60+
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
61+
# gem "spring"
62+
end
63+
64+
group :test do
65+
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
66+
gem 'capybara'
67+
gem 'selenium-webdriver'
68+
end

Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative 'config/application'
5+
6+
Rails.application.load_tasks

0 commit comments

Comments
 (0)