Skip to content

Commit

Permalink
Initial Rails setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cilim committed Aug 6, 2024
0 parents commit 8ad447c
Show file tree
Hide file tree
Showing 93 changed files with 3,463 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .git-hooks/pre_push/zeitwerk_check.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module Overcommit
module Hook
module PrePush
class ZeitwerkCheck < Base
def run
result = execute(command)
return :pass if result.success?

extract_messages result.stderr.split("\n"),
/^expected file (?<file>[[:alnum:]].*.rb)/
end
end
end
end
end
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
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# For more info about the file read https://help.github.com/en/articles/about-code-owners

# Set default PR reviewers. For example:
# * @github_username1 @github_username2
* @cilim @nika
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Task: [#__TASK_NUMBER__](__ADD_URL_TO_PRODUCTIVE_TASK__)

#### Aim


#### Solution


28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
versioning-strategy: "lockfile-only"
schedule:
interval: "monthly"
day: "monday"
time: "05:00"
timezone: "Europe/Zagreb"
rebase-strategy: "disabled"
ignore:
- dependency-name: "rails"
groups:
all-non-major-dependency-updates:
patterns:
- "*"
dependency-type: "production"
update-types:
- "minor"
- "patch"
development-dependencies:
dependency-type: "development"
exclude-patterns:
- "rubocop*"
rubocop-dependencies:
patterns:
- "rubocop*"
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build

on:
workflow_dispatch:
pull_request:
push:
branches: [ master ]

jobs:
build:
name: Build
uses: infinum/default_rails_template/.github/workflows/build.yml@v1
with:
postgres_image: '13.2'
ci_steps: 'bin/audit bin/lint bin/test'
# slack_notification_channel: 'slack-channel-name-without-hash-symbol' # UNCOMMENT THIS IF YOU WANT SLACK NOTIFICATIONS, DELETE OTHERWISE
# notify_on: 'all' # Possible values: 'success', 'failure', or 'all'
secrets:
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
VAULT_AUTH_METHOD: ${{ secrets.VAULT_AUTH_METHOD }}
VAULT_AUTH_ROLE_ID: ${{ secrets.VAULT_AUTH_ROLE_ID }}
VAULT_AUTH_SECRET_ID: ${{ secrets.VAULT_AUTH_SECRET_ID }}
# SLACK_BOT_TOKEN: ${{ secrets.RAILS_TEAM_SLACK_BOT_TOKEN }} # UNCOMMENT THIS IF YOU WANT SLACK NOTIFICATIONS, DELETE OTHERWISE
11 changes: 11 additions & 0 deletions .github/workflows/delete-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Delete Cache

on:
workflow_dispatch:
pull_request:
types:
- closed

jobs:
cleanup:
uses: infinum/default_rails_template/.github/workflows/delete-cache.yml@v1
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle/*
!/.bundle/ci-build
!/.bundle/ci-deploy

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

/public/assets

# Ignore master key for decrypting credentials and more.
/config/master.key
.sass-cache
powder
public/system
dump.rdb
logfile
.DS_Store
config/application.yml
node_modules
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.18.2
46 changes: 46 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
gemfile: Gemfile

CommitMsg:
HardTabs:
enabled: true

PreCommit:
BundleAudit:
enabled: true
flags: ['--update']
on_warn: fail
command: ['bundle', 'exec', 'bundle-audit']

BundleCheck:
enabled: true

RuboCop:
enabled: true
on_warn: fail
command: ['bundle', 'exec', 'rubocop']

SlimLint:
enabled: true
on_warn: fail
command: ['bundle', 'exec', 'slim-lint']

RailsSchemaUpToDate:
enabled: true

TrailingWhitespace:
enabled: true
exclude:
- '**/db/structure.sql'

HardTabs:
enabled: true

PrePush:
Brakeman:
enabled: true
command: ['bundle', 'exec', 'brakeman']

ZeitwerkCheck:
enabled: true
description: 'Checks project structure for Zeitwerk compatibility'
command: ['bundle', 'exec', 'rails zeitwerk:check']
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
inherit_gem:
rubocop-infinum: rubocop.yml

require: rubocop-infinum
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.2
3 changes: 3 additions & 0 deletions .slim-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
LineLength:
max: 120
3 changes: 3 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.*
!app/assets/**/*.css
!app/assets/**/*.scss
48 changes: 48 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

source 'https://rubygems.org'

ruby '3.2.2'
gem 'rails', '~> 7.1.3', '>= 7.1.3.2'

gem 'bootsnap', require: false
gem 'bugsnag'
gem 'figaro'
gem 'importmap-rails'
gem 'pg', '~> 1.1'
gem 'pry-byebug'
gem 'pry-rails'
gem 'puma', '>= 5.0'
gem 'slim'
gem 'sprockets-rails'
gem 'stimulus-rails'
gem 'strong_migrations'
gem 'turbo-rails'

group :development, :test do
end

group :development do
gem 'annotate'
gem 'better_errors'
gem 'binding_of_caller'
gem 'bullet'
gem 'overcommit', require: false

gem 'error_highlight', '>= 0.4.0', platforms: [:ruby]
end

group :test do
gem 'rspec-rails'
end

group :ci do
gem 'brakeman', require: false
gem 'bundler-audit', require: false
gem 'rubocop-infinum', require: false
gem 'slim_lint', require: false
end

group :deploy do
gem 'mina-infinum', require: false
end
Loading

0 comments on commit 8ad447c

Please sign in to comment.