Skip to content

Commit

Permalink
Merge pull request #18 from aifoundry-org/vadim/remove-unused-components
Browse files Browse the repository at this point in the history
Remove unused components, improve styles and docker compose
  • Loading branch information
Vadser authored Jul 16, 2024
2 parents 7be989c + 95fd033 commit 4c5f86c
Show file tree
Hide file tree
Showing 190 changed files with 1,723 additions and 1,779 deletions.
Binary file removed .DS_Store
Binary file not shown.
77 changes: 77 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Ruby with PostgreSQL

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

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.3.0']

services:
db:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v4
- name: Set up Ruby and PostgreSQL
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
mirror: 'bd' # Use the Brazilian mirror for faster downloads

- name: Install PostgreSQL client
run: |
sudo apt-get install postgresql-client
- name: Wait for PostgreSQL to be ready
run: |
until pg_isready -h localhost -p 5432 -U postgres; do
echo "Waiting for PostgreSQL to start..."
sleep 1
done
- name: Generate creds file
run: |
EDITOR="mate --wait" ./bin/rails credentials:edit
- name: Install Node.js and Yarn
run: |
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install -g yarn
- name: Yarn install
run: |
yarn install
- name: Precompile assets
run: |
SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
- name: Setup database schema
run: |
# Replace with your database setup commands (e.g., migrations)
bundle exec rake db:create db:schema:load
- name: Run tests
run: bundle exec rspec

- name: Run rubocop
run: bundle exec rubocop -DES
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@

/app/assets/builds/*
!/app/assets/builds/.keep
.DS_Store
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--require spec_helper
--format documentation
59 changes: 59 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-07-15 13:37:11 UTC using RuboCop version 1.65.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
Bundler/OrderedGems:
Exclude:
- 'Gemfile'

# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 66

# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 155

# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 9

# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 74

# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 9

# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'spec/controllers/*'
- 'spec/controllers/*'

# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false

# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'bin/bundle'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 198
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ WORKDIR /rails
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development" \
SECRET_KEY_BASE="a20aff0f4264e4896b81c5377418b46f104fdb209ded3d58b521abf871853adcabd0d904c569def108a35345e29b5e1affad36cb6619f0b51738f7de5d59b528"
BUNDLE_WITHOUT="development"

# Throw-away build stage to reduce size of final image
FROM base as build
Expand All @@ -38,6 +37,10 @@ COPY . .
# Install JavaScript dependencies
RUN yarn install

RUN gem install rails

RUN gem install foreman

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

Expand All @@ -56,6 +59,8 @@ RUN apt-get update -qq && \
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails

# Generate Rails master key and encrypt database credentials

# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp
Expand Down
57 changes: 34 additions & 23 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
source "https://rubygems.org"
# frozen_string_literal: true

ruby "3.3.0"
source 'https://rubygems.org'

ruby '3.3.0'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.1.3", ">= 7.1.3.4"
gem 'rails', '~> 7.1.3', '>= 7.1.3.4'

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
gem 'sprockets-rails'

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"
gem 'sqlite3', '~> 1.4'

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
gem 'puma', '>= 5.0'

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
gem 'importmap-rails'

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
gem 'turbo-rails'

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
gem 'stimulus-rails'

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
gem 'jbuilder'

# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"
Expand All @@ -36,24 +38,31 @@ gem "jbuilder"
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]
gem 'tzinfo-data', platforms: %i[windows jruby]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
gem 'bootsnap', require: false

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i[mri windows]
gem 'dotenv', '~> 3.1'
gem 'factory_bot_rails'
gem 'pry'
gem "debug", platforms: %i[ mri windows ]
gem "dotenv", "~> 3.1"
gem 'rails-controller-testing'
gem 'rspec-rails', '~> 5.0.0'
gem 'rubocop', require: false
gem 'rubocop-rails', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rspec', require: false
end

group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
gem 'web-console'

# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
# gem "rack-mini-profiler"
Expand All @@ -64,17 +73,19 @@ end

group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
gem 'capybara'
gem 'database_cleaner'
gem 'selenium-webdriver'
gem 'webmock', '~> 3.14'
end

gem "ruby-openai", "~> 7.0"
gem 'ruby-openai', '~> 7.0'

gem "devise", "~> 4.9"
gem "devise-jwt", "~> 0.12.0"
gem 'devise', '~> 4.9'
gem 'devise-jwt', '~> 0.12.0'

gem "solid_queue", "~> 0.3.3"
gem 'solid_queue', '~> 0.3.3'

gem "tailwindcss-rails", "~> 2.6"
gem 'tailwindcss-rails', '~> 2.6'

gem "pg", "~> 1.5"
gem 'pg', '~> 1.5'
Loading

0 comments on commit 4c5f86c

Please sign in to comment.