diff --git a/.env.template b/.env.template index 1c995ecc..59891b2b 100644 --- a/.env.template +++ b/.env.template @@ -3,4 +3,9 @@ DATABASE_DEV_PASSWORD=postgres_password GITHUB_ID=github_client_id GITHUB_SECRET=github_client_secret GOOGLE_ID=google_client_id -GOOGLE_SECRET=google_secret_key \ No newline at end of file +GOOGLE_SECRET=google_secret_key +FACEBOOK_ID=facebook_app_id +FACEBOOK_SECRET=facebook_app_secret +TWITTER_ID=twitter_app_id +TWITTER_SECRET=twitter_app_secret +TZ=America/Sao_Paulo \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index ef538c28..4f5e6973 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.2 +3.4.5 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..27a8619d --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.4.5 diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..bc51ec86 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,166 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Development Environment + +### Ruby and Rails Versions +- Ruby: 3.4.5 (managed via asdf) +- Rails: 8.0.3 +- Node: 22.x +- Bundler: 2.7.2 + +### Essential Commands + +#### Development Server +```bash +bin/dev # Start Rails server with CSS watching (uses Procfile.dev) +rails server # Start Rails server only +yarn build:css --watch # Watch and compile CSS changes +``` + +#### Database +```bash +rails db:create # Create database +rails db:migrate # Run migrations +rails db:seed # Seed database with sample data +rails db:drop # Drop database (careful!) +rails db:reset # Drop, create, migrate, and seed +``` + +#### Testing +```bash +# Run all RSpec tests +bundle exec rspec + +# Run specific test categories +bundle exec rspec spec/features +bundle exec rspec spec/models +bundle exec rspec spec/requests +bundle exec rspec spec/integration + +# Run Rails tests +rails test test/models +rails test test/controllers +rails test test/integration +rails test test/system + +# Run a single test file +bundle exec rspec path/to/spec_file.rb +rails test path/to/test_file.rb + +# Run tests with specific line number +bundle exec rspec path/to/spec_file.rb:42 +``` + +#### Linting and Code Quality +```bash +bundle exec rubocop # Run Rubocop linter +bundle exec rubocop -a # Auto-fix Rubocop offenses +bundle exec rubocop path/to/file.rb # Check specific file +``` + +#### API Documentation +```bash +bundle exec rake rswag # Generate Swagger/OpenAPI documentation +# Access at: http://localhost:3000/api-docs/index.html +``` + +#### Background Jobs +```bash +bundle exec sidekiq # Start Sidekiq worker +redis-server # Start Redis (required for Sidekiq) +``` + +#### Asset Compilation +```bash +yarn build:css # Build CSS with Bulma +rails assets:precompile # Precompile all assets for production +rails assets:clobber # Remove compiled assets +``` + +## Architecture Overview + +### Core Models and Relationships + +The application centers around **Member** (User) with Devise authentication: +- **Member** → has many **Posts** (blog posts) +- **Post** → has many **Comments** and **Likes** +- Complex analytics system tracking visitors, browsers, and user interactions + +### Authentication & Authorization +- **Devise** handles authentication with OAuth support (GitHub, Google) +- **CanCanCan** manages authorization through `app/models/ability.rb` +- **JWT** tokens for API authentication (`app/models/json_web_token.rb`) +- API login endpoint: `POST /api/v1/auth/login` + +### API Structure +- Versioned API under `app/controllers/api/v1/` +- JWT-based authentication for API endpoints +- Swagger documentation auto-generated from tests +- API responses use Jbuilder templates in `app/views/api/v1/` + +### Real-time Features +- **Turbo Streams** for live updates without page refresh +- **Stimulus controllers** in `app/javascript/controllers/` +- **Action Cable** broadcasts analytics updates to dashboards +- Chart controller manages real-time analytics visualization + +### Background Processing +- **Sidekiq** jobs in `app/jobs/` process analytics asynchronously +- Jobs: AddCounterJob, AddBrowserJob, AddUniqueJob, AddLengthJob +- Redis required for job queue management + +### Frontend Stack +- **Turbo Rails** for SPA-like navigation +- **Stimulus** for JavaScript behavior +- **Bulma CSS** framework (compiled via cssbundling-rails) +- **Chartkick** for analytics charts +- **Pagy** for pagination + +### Testing Approach +- **RSpec** for API and integration tests (`spec/`) +- **Rails Test** for models and controllers (`test/`) +- **Factory Bot** for test data generation +- **Capybara** with Selenium for system tests +- Tests generate API documentation via Rswag + +### Key Technical Patterns + +1. **Counter Caches**: Automatic count maintenance + - `posts_count` on Member + - `comments_count` and `likes_count` on Post + +2. **FriendlyId**: SEO-friendly URLs for members + - Uses slug field on Member model + +3. **Active Storage**: Avatar uploads with validation + - Image processing for variants + +4. **Analytics System**: + - Visitor tracking with browser fingerprinting + - Multiple analytics models for different metrics + - MemberBrowser class implements visitor pattern + +5. **Broadcasting Pattern**: + - CounterAnalytic broadcasts updates to member-specific channels + - Real-time dashboard updates via Turbo Streams + +### Database Considerations +- PostgreSQL with multiple extensions enabled +- Counter caches maintain denormalized counts +- Indexes on foreign keys and frequently queried fields +- Bullet gem monitors N+1 queries in development + +### Environment Variables +Required in `.env` for development: +- `DATABASE_DEV_USERNAME` - PostgreSQL username +- `DATABASE_DEV_PASSWORD` - PostgreSQL password +- `GITHUB_ID` & `GITHUB_SECRET` - GitHub OAuth +- `GOOGLE_ID` & `GOOGLE_SECRET` - Google OAuth + +### Deployment +- Configured for Render.com deployment +- Dockerfile uses Ruby 3.4.5 and Node 22.x +- Production uses PostgreSQL and Redis +- Assets precompiled during Docker build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ead0afa0..612d559b 100755 --- a/Dockerfile +++ b/Dockerfile @@ -11,19 +11,13 @@ ####################################################################### -# Learn more about the chosen Ruby stack, Fullstaq Ruby, here: -# https://github.com/evilmartians/fullstaq-ruby-docker. -# -# We recommend using the highest patch level for better security and -# performance. - -ARG RUBY_VERSION=3.1.2 -ARG VARIANT=jemalloc-bullseye-slim -FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} as base +# Using official Ruby image for Ruby 3.4.5 support +ARG RUBY_VERSION=3.4.5 +FROM ruby:${RUBY_VERSION}-slim as base LABEL fly_launch_runtime="rails" -ARG BUNDLER_VERSION=2.3.22 +ARG BUNDLER_VERSION=2.7.2 ARG RAILS_ENV=production ENV RAILS_ENV=${RAILS_ENV} @@ -49,23 +43,30 @@ RUN gem update --system --no-document && \ FROM base as build_deps -ARG BUILD_PACKAGES="git build-essential libpq-dev wget vim curl gzip xz-utils libsqlite3-dev" +ARG BUILD_PACKAGES="git build-essential libpq-dev wget vim curl gzip xz-utils libsqlite3-dev nodejs npm" ENV BUILD_PACKAGES ${BUILD_PACKAGES} +# Install Node.js 22.x RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ apt-get update -qq && \ + apt-get install -y curl && \ + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ apt-get install --no-install-recommends -y ${BUILD_PACKAGES} \ && rm -rf /var/lib/apt/lists /var/cache/apt/archives ####################################################################### -# install gems +# install gems and node modules FROM build_deps as gems COPY Gemfile* ./ -RUN bundle install && rm -rf vendor/bundle/ruby/*/cache +RUN bundle install && rm -rf vendor/bundle/ruby/*/cache + +# Copy package.json and install node modules for asset compilation +COPY package.json ./ +RUN npm install ####################################################################### @@ -73,19 +74,21 @@ RUN bundle install && rm -rf vendor/bundle/ruby/*/cache FROM base -ARG DEPLOY_PACKAGES="postgresql-client file vim curl gzip libsqlite3-0" +ARG DEPLOY_PACKAGES="postgresql-client file vim curl gzip libsqlite3-0 nodejs" ENV DEPLOY_PACKAGES=${DEPLOY_PACKAGES} +# Install Node.js 22.x for runtime (needed for execjs) RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt \ --mount=type=cache,id=prod-apt-lib,sharing=locked,target=/var/lib/apt \ apt-get update -qq && \ + apt-get install -y curl && \ + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ apt-get install --no-install-recommends -y \ ${DEPLOY_PACKAGES} \ && rm -rf /var/lib/apt/lists /var/cache/apt/archives -# copy installed gems +# copy installed gems and node modules COPY --from=gems /app /app -COPY --from=gems /usr/lib/fullstaq-ruby/versions /usr/lib/fullstaq-ruby/versions COPY --from=gems /usr/local/bundle /usr/local/bundle ####################################################################### @@ -113,4 +116,4 @@ RUN ${BUILD_COMMAND} ENV PORT 8080 ARG SERVER_COMMAND="bin/rails fly:server" ENV SERVER_COMMAND ${SERVER_COMMAND} -CMD ${SERVER_COMMAND} +CMD ${SERVER_COMMAND} \ No newline at end of file diff --git a/Gemfile b/Gemfile index 790b8fbf..b167967a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,12 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.1.2' +ruby '3.4.5' -gem 'rubocop', '>= 1.0', '< 2.0' +gem 'rubocop', '>= 1.58', '< 2.0' # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" -gem 'rails', '~> 7.0.4' +gem 'rails', '~> 8.0.0' # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] gem 'sprockets-rails' @@ -27,7 +27,7 @@ gem 'rspec' gem 'jwt' # Use the Puma web server [https://github.com/puma/puma] -gem 'puma', '~> 5.0' +gem 'puma', '~> 6.0' # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] gem 'importmap-rails' @@ -42,7 +42,7 @@ gem 'stimulus-rails' gem 'jbuilder' # Use Redis adapter to run Action Cable in production -gem 'redis', '~> 4.0' +gem 'redis', '~> 5.0' # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] # gem "kredis" diff --git a/Gemfile.lock b/Gemfile.lock index 5e53e2a2..901ce6a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,79 +13,86 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) + actioncable (8.0.3) + actionpack (= 8.0.3) + activesupport (= 8.0.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.6) - actionpack (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activesupport (= 7.0.6) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.6) - actionview (= 7.0.6) - activesupport (= 7.0.6) - rack (~> 2.0, >= 2.2.4) + zeitwerk (~> 2.6) + actionmailbox (8.0.3) + actionpack (= 8.0.3) + activejob (= 8.0.3) + activerecord (= 8.0.3) + activestorage (= 8.0.3) + activesupport (= 8.0.3) + mail (>= 2.8.0) + actionmailer (8.0.3) + actionpack (= 8.0.3) + actionview (= 8.0.3) + activejob (= 8.0.3) + activesupport (= 8.0.3) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (8.0.3) + actionview (= 8.0.3) + activesupport (= 8.0.3) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.6) - actionpack (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (8.0.3) + actionpack (= 8.0.3) + activerecord (= 8.0.3) + activestorage (= 8.0.3) + activesupport (= 8.0.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.6) - activesupport (= 7.0.6) + actionview (8.0.3) + activesupport (= 8.0.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - active_storage_validations (1.0.4) - activejob (>= 5.2.0) - activemodel (>= 5.2.0) - activestorage (>= 5.2.0) - activesupport (>= 5.2.0) - activejob (7.0.6) - activesupport (= 7.0.6) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + active_storage_validations (3.0.2) + activejob (>= 6.1.4) + activemodel (>= 6.1.4) + activestorage (>= 6.1.4) + activesupport (>= 6.1.4) + marcel (>= 1.0.3) + activejob (8.0.3) + activesupport (= 8.0.3) globalid (>= 0.3.6) - activemodel (7.0.6) - activesupport (= 7.0.6) - activerecord (7.0.6) - activemodel (= 7.0.6) - activesupport (= 7.0.6) - activestorage (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activesupport (= 7.0.6) + activemodel (8.0.3) + activesupport (= 8.0.3) + activerecord (8.0.3) + activemodel (= 8.0.3) + activesupport (= 8.0.3) + timeout (>= 0.4.0) + activestorage (8.0.3) + actionpack (= 8.0.3) + activejob (= 8.0.3) + activerecord (= 8.0.3) + activesupport (= 8.0.3) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.6) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (8.0.3) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) - ast (2.4.2) + ast (2.4.3) aws-eventstream (1.2.0) aws-partitions (1.785.0) aws-sdk-core (3.177.0) @@ -102,52 +109,57 @@ GEM aws-sigv4 (~> 1.6) aws-sigv4 (1.6.0) aws-eventstream (~> 1, >= 1.0.2) + base64 (0.3.0) bcrypt (3.1.19) + benchmark (0.4.1) + bigdecimal (3.2.3) bindex (0.8.1) bootsnap (1.16.0) msgpack (~> 1.2) browser (5.3.1) - builder (3.2.4) - bullet (7.0.7) + builder (3.3.0) + bullet (8.0.8) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) cancancan (3.5.0) - capybara (3.39.2) + capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) chartkick (5.0.4) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.5) connection_pool (2.4.1) crass (1.0.6) cssbundling-rails (1.2.0) railties (>= 6.0.0) - database_cleaner (2.0.2) + database_cleaner (2.1.0) database_cleaner-active_record (>= 2, < 3) - database_cleaner-active_record (2.1.0) + database_cleaner-active_record (2.2.2) activerecord (>= 5.a) - database_cleaner-core (~> 2.0.0) + database_cleaner-core (~> 2.0) database_cleaner-core (2.0.1) - date (3.3.3) - debug (1.8.0) - irb (>= 1.5.0) - reline (>= 0.3.1) + date (3.4.1) + debug (1.11.0) + irb (~> 1.10) + reline (>= 0.3.8) diff-lcs (1.5.0) dotenv (2.8.1) dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) - erubi (1.12.0) - factory_bot (6.2.1) - activesupport (>= 5.0.0) - factory_bot_rails (6.2.0) - factory_bot (~> 6.2.0) - railties (>= 5.0.0) + drb (2.2.3) + erb (5.0.2) + erubi (1.13.1) + factory_bot (6.5.5) + activesupport (>= 6.1.0) + factory_bot_rails (6.5.1) + factory_bot (~> 6.5) + railties (>= 6.1.0) faker (3.2.0) i18n (>= 1.8.11, < 2) faraday (2.7.10) @@ -157,36 +169,41 @@ GEM ffi (1.15.5) friendly_id (5.4.2) activerecord (>= 4.0.0) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) hashie (5.0.0) - i18n (1.14.1) + i18n (1.14.7) concurrent-ruby (~> 1.0) image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - importmap-rails (1.2.1) + importmap-rails (2.2.2) actionpack (>= 6.0.0) + activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.6.0) - irb (1.7.1) - reline (>= 0.3.0) - jbuilder (2.11.5) - actionview (>= 5.0.0) - activesupport (>= 5.0.0) + irb (1.15.2) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jbuilder (2.14.1) + actionview (>= 7.0.0) + activesupport (>= 7.0.0) jmespath (1.6.2) - json (2.6.3) + json (2.15.0) json-schema (3.0.0) addressable (>= 2.8) jwt (2.7.1) kramdown (2.4.0) rexml - language_server-protocol (3.17.0.3) + language_server-protocol (3.17.0.5) launchy (2.5.2) addressable (~> 2.8) letter_opener (1.8.1) launchy (>= 2.2, < 3) - loofah (2.21.3) + lint_roller (1.1.0) + logger (1.7.0) + loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -194,31 +211,30 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.1.0) matrix (0.4.2) - method_source (1.0.0) mini_magick (4.12.0) - mini_mime (1.1.2) - mini_portile2 (2.8.5) - minitest (5.18.1) + mini_mime (1.1.5) + mini_portile2 (2.8.9) + minitest (5.25.5) msgpack (1.7.1) multi_xml (0.6.0) - net-imap (0.3.6) + net-imap (0.5.10) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout - net-smtp (0.3.3) + net-smtp (0.5.1) net-protocol - nio4r (2.5.9) - nokogiri (1.15.3) + nio4r (2.7.4) + nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.15.3-x86_64-darwin) + nokogiri (1.18.10-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.3-x86_64-linux) + nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -242,82 +258,100 @@ GEM omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) omniauth (~> 2.0) - omniauth-rails_csrf_protection (1.0.1) + omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) orm_adapter (0.5.0) pagy (6.0.4) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.27.0) + parser (3.3.9.0) ast (~> 2.4.1) racc pg (1.5.3) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + prism (1.5.1) + psych (5.2.6) + date + stringio public_suffix (5.0.1) - puma (5.6.6) + puma (6.6.1) nio4r (~> 2.0) - racc (1.7.1) - rack (2.2.7) + racc (1.8.1) + rack (3.2.1) rack-protection (3.0.6) rack - rack-test (2.1.0) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) rack (>= 1.3) - rails (7.0.6) - actioncable (= 7.0.6) - actionmailbox (= 7.0.6) - actionmailer (= 7.0.6) - actionpack (= 7.0.6) - actiontext (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activemodel (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + rackup (2.2.1) + rack (>= 3) + rails (8.0.3) + actioncable (= 8.0.3) + actionmailbox (= 8.0.3) + actionmailer (= 8.0.3) + actionpack (= 8.0.3) + actiontext (= 8.0.3) + actionview (= 8.0.3) + activejob (= 8.0.3) + activemodel (= 8.0.3) + activerecord (= 8.0.3) + activestorage (= 8.0.3) + activesupport (= 8.0.3) bundler (>= 1.15.0) - railties (= 7.0.6) + railties (= 8.0.3) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.1.1) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) - method_source + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.3) + actionpack (= 8.0.3) + activesupport (= 8.0.3) + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.0.6) - redis (4.8.1) - redis-client (0.18.0) + rake (13.3.0) + rdoc (6.14.2) + erb + psych (>= 4.0.0) + redis (5.4.1) + redis-client (>= 0.22.0) + redis-client (0.25.3) connection_pool - regexp_parser (2.8.1) - reline (0.3.6) + regexp_parser (2.11.3) + reline (0.6.2) io-console (~> 0.5) - responders (3.1.0) + responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.5) + rexml (3.4.4) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) rspec-mocks (~> 3.12.0) - rspec-core (3.12.2) + rspec-core (3.12.3) rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec-expectations (3.12.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (6.0.3) + rspec-rails (6.1.1) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) @@ -326,73 +360,82 @@ GEM rspec-mocks (~> 3.12) rspec-support (~> 3.12) rspec-support (3.12.1) - rswag (2.9.0) - rswag-api (= 2.9.0) - rswag-specs (= 2.9.0) - rswag-ui (= 2.9.0) - rswag-api (2.9.0) - railties (>= 3.1, < 7.1) - rswag-specs (2.9.0) - activesupport (>= 3.1, < 7.1) - json-schema (>= 2.2, < 4.0) - railties (>= 3.1, < 7.1) + rswag (2.16.0) + rswag-api (= 2.16.0) + rswag-specs (= 2.16.0) + rswag-ui (= 2.16.0) + rswag-api (2.16.0) + activesupport (>= 5.2, < 8.1) + railties (>= 5.2, < 8.1) + rswag-specs (2.16.0) + activesupport (>= 5.2, < 8.1) + json-schema (>= 2.2, < 6.0) + railties (>= 5.2, < 8.1) rspec-core (>= 2.14) - rswag-ui (2.9.0) - actionpack (>= 3.1, < 7.1) - railties (>= 3.1, < 7.1) - rubocop (1.54.1) + rswag-ui (2.16.0) + actionpack (>= 5.2, < 8.1) + railties (>= 5.2, < 8.1) + rubocop (1.80.2) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.46.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.47.1) + parser (>= 3.3.7.2) + prism (~> 1.4) ruby-progressbar (1.13.0) ruby-vips (2.1.4) ffi (~> 1.12) ruby2_keywords (0.0.5) rubyzip (2.3.2) + securerandom (0.4.1) selenium-webdriver (4.10.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sidekiq (7.2.0) - concurrent-ruby (< 2) + sidekiq (7.3.9) + base64 connection_pool (>= 2.3.0) + logger rack (>= 2.2.4) - redis-client (>= 0.14.0) + redis-client (>= 0.22.2) snaky_hash (2.0.1) hashie version_gem (~> 1.1, >= 1.1.1) sprockets (4.2.0) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) stimulus-rails (1.2.1) railties (>= 6.0.0) - thor (1.2.2) - timeout (0.4.0) - turbo-rails (1.4.0) - actionpack (>= 6.0.0) - activejob (>= 6.0.0) - railties (>= 6.0.0) + stringio (3.1.7) + thor (1.4.0) + timeout (0.4.3) + tsort (0.2.0) + turbo-rails (2.0.16) + actionpack (>= 7.1.0) + railties (>= 7.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) uniform_notifier (1.16.0) + uri (1.0.3) + useragent (0.16.11) version_gem (1.1.3) warden (1.2.9) rack (>= 2.0.9) - web-console (4.2.0) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) @@ -402,12 +445,13 @@ GEM rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0) websocket (1.2.9) - websocket-driver (0.7.5) + websocket-driver (0.8.0) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.8) + zeitwerk (2.7.3) PLATFORMS ruby @@ -442,15 +486,15 @@ DEPENDENCIES omniauth-rails_csrf_protection pagy (~> 6.0) pg (~> 1.1) - puma (~> 5.0) - rails (~> 7.0.4) + puma (~> 6.0) + rails (~> 8.0.0) rails-controller-testing rake - redis (~> 4.0) + redis (~> 5.0) rspec rspec-rails rswag - rubocop (>= 1.0, < 2.0) + rubocop (>= 1.58, < 2.0) selenium-webdriver sidekiq sprockets-rails @@ -461,7 +505,7 @@ DEPENDENCIES webdrivers RUBY VERSION - ruby 3.1.2p20 + ruby 3.4.5p51 BUNDLED WITH 2.3.25 diff --git a/Procfile.dev b/Procfile.dev index cb7c9aa8..0a6f1f08 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1,2 +1,3 @@ web: unset PORT && bin/rails server css: yarn build:css --watch +worker: bundle exec sidekiq diff --git a/app/controllers/analytics_controller.rb b/app/controllers/analytics_controller.rb index 660984f7..60cc600f 100644 --- a/app/controllers/analytics_controller.rb +++ b/app/controllers/analytics_controller.rb @@ -2,14 +2,19 @@ class AnalyticsController < ApplicationController before_action :authenticate_member! def index - @start_date = params[:start_date] || (Date.today - 6.days).to_s - @end_date = params[:end_date] || Date.today.to_s + # Use Time.current for timezone-aware dates + today = Time.current.to_date + @start_date = params[:start_date] || (today - 6.days).to_s + @end_date = params[:end_date] || today.to_s + + # Convert string dates to timezone-aware datetime objects + start_datetime = Time.zone.parse(@start_date).beginning_of_day + end_datetime = Time.zone.parse(@end_date).end_of_day + %w[counter_analytics length_analytics unique_analytics browser_analytics].each do |analytics| instance_variable_set("@#{analytics}", current_user .send(analytics) - .where('created_at BETWEEN ? AND ?', - "#{@start_date} 00:00:00", - "#{@end_date} 23:59:59") + .where(created_at: start_datetime..end_datetime) .order(created_at: :desc)) end end diff --git a/app/controllers/api/v1/comments_controller.rb b/app/controllers/api/v1/comments_controller.rb index ece4d5db..634cfda9 100644 --- a/app/controllers/api/v1/comments_controller.rb +++ b/app/controllers/api/v1/comments_controller.rb @@ -1,5 +1,6 @@ class Api::V1::CommentsController < ApplicationController include TrackEvent + before_action :authorize_request before_action :find_member_post after_action :track_event, only: %i[create] diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 82faf8e4..c03c60c5 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,5 +1,6 @@ class CommentsController < ApplicationController include TrackEvent + before_action :authenticate_member! before_action :set_post, only: %i[index new create] before_action :set_comment, only: %i[edit update destroy] diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index ce42b4bd..7fd604a3 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -13,6 +13,10 @@ def index end end + def show + # The @post and @member are already set by before_action callbacks + end + def new @post = Post.new end diff --git a/app/models/member.rb b/app/models/member.rb index 63a86055..b6bcf6b2 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -22,6 +22,7 @@ class Member < ApplicationRecord } extend FriendlyId + friendly_id :name, use: %i[slugged finders history] def is?(requested_role) @@ -41,7 +42,12 @@ def self.from_omniauth(access_token) member ||= Member.create(name: access_token.info.name, email: access_token.info.email, - password: Devise.friendly_token[0, 20]) + password: Devise.friendly_token[0, 20], + provider: access_token.provider, + uid: access_token.uid) + + # Update provider and uid if not set + member.update(provider: access_token.provider, uid: access_token.uid) if member.provider.blank? || member.uid.blank? if !member.avatar.attached? && !access_token.info.image.empty? filename = File.basename(URI.parse(access_token.info.image).path) @@ -51,4 +57,8 @@ def self.from_omniauth(access_token) end member end + + def oauth_user? + provider.present? && uid.present? + end end diff --git a/app/views/analytics/index.html.erb b/app/views/analytics/index.html.erb index 3e4ed272..c8a5c2d7 100644 --- a/app/views/analytics/index.html.erb +++ b/app/views/analytics/index.html.erb @@ -1,4 +1,14 @@ -

Comment analytics

+

Analytics for Your Posts

+

Track comments, visitors, and engagement on posts authored by <%= current_member.name %>

+
+

📊 What's shown here:

+ +
<%= form_with(url: analytics_url, method: :get, class: "is-flex is-justify-content-center my-4") do |form| %>
@@ -31,11 +41,11 @@ <%= render "broadcast", analytics: analytics %> <% end %> - <%= render "chart", title: "Comments", target: "counter" %> - <%= render "chart", title: "Average comment length", target: "length" %> - <%= render "chart", title: "Unique visitors", target: "unique" %> - <%= render "chart", title: "Browser device", target: "devices" %> - <%= render "chart", title: "Browser platform", target: "platforms" %> + <%= render "chart", title: "Comments on Your Posts", target: "counter" %> + <%= render "chart", title: "Average Comment Length on Your Posts", target: "length" %> + <%= render "chart", title: "Unique Visitors to Your Posts", target: "unique" %> + <%= render "chart", title: "Devices Used by Your Post Visitors", target: "devices" %> + <%= render "chart", title: "Platforms Used by Your Post Visitors", target: "platforms" %>
<%= link_to "Back", root_path, class: "button is-primary mt-5" %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 9134b1f8..5fa0e774 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,80 +1,99 @@

Edit profile

-<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= render 'devise/shared/error_messages', resource: resource %> +<% if resource.oauth_user? %> + +
+

You signed up using <%= resource.provider.humanize %>. You cannot change your password or email here.

+

To update your profile information, please do so through your <%= resource.provider.humanize %> account.

+
-
- <%= f.label :avatar, class: 'label' %> - <%= f.file_field :avatar, class: 'input' %> +
+ <%= link_to "Back", :back, class: "button is-primary" %>
-
- <%= f.label :name, class: 'label' %> -
- <%= f.text_field :name, class: 'input', autofocus: true, autocomplete: 'name' %> - - - -
+

+
+ + <%= link_to 'Cancel my account', registration_path(resource_name), data: { turbo_confirm: 'Are you sure?', turbo_method: :delete }, class:'button is-danger' %>
+<% else %> + + <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> + <%= render 'devise/shared/error_messages', resource: resource %> -
- <%= f.label :email, class: 'label' %> -
- <%= f.email_field :email, class: 'input', autocomplete: 'email' %> - - - +
+ <%= f.label :avatar, class: 'label' %> + <%= f.file_field :avatar, class: 'input' %>
-
- <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> -
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
- <% end %> +
+ <%= f.label :name, class: 'label' %> +
+ <%= f.text_field :name, class: 'input', autofocus: true, autocomplete: 'name' %> + + + +
+
-
- <%= f.label :password, class: 'label' %> -
- <%= f.password_field :password, class: 'input', autocomplete: 'new-password' %> - - - +
+ <%= f.label :email, class: 'label' %> +
+ <%= f.email_field :email, class: 'input', autocomplete: 'email' %> + + + +
- <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) leave blank if you don't want to change it - <% else %> - leave blank if you don't want to change it + + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
<% end %> -
-
- <%= f.label :password_confirmation, class: 'label' %> -
- <%= f.password_field :password_confirmation, class: 'input', autocomplete: 'new-password' %> - - - +
+ <%= f.label :password, class: 'label' %> +
+ <%= f.password_field :password, class: 'input', autocomplete: 'new-password' %> + + + +
+ <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum) leave blank if you don't want to change it + <% else %> + leave blank if you don't want to change it + <% end %>
-
-
- <%= f.label :current_password, class: 'label' %> -
- <%= f.password_field :current_password, class: 'input', autocomplete: 'current-password' %> - - - +
+ <%= f.label :password_confirmation, class: 'label' %> +
+ <%= f.password_field :password_confirmation, class: 'input', autocomplete: 'new-password' %> + + + +
- We need your current password to confirm your changes -
-
- <%= f.submit 'Update', class:'button is-primary' %> - <%= link_to "Back", :back, class: "button is-primary" %> +
+ <%= f.label :current_password, class: 'label' %> +
+ <%= f.password_field :current_password, class: 'input', autocomplete: 'current-password' %> + + + +
+ We need your current password to confirm your changes +
+ +
+ <%= f.submit 'Update', class:'button is-primary' %> + <%= link_to "Back", :back, class: "button is-primary" %> +
+ <% end %> +

+
+ + <%= link_to 'Cancel my account', registration_path(resource_name), data: { turbo_confirm: 'Are you sure?', turbo_method: :delete }, class:'button is-danger' %>
-<% end %> -

-
- - <%= link_to 'Cancel my account', registration_path(resource_name), data: { turbo_confirm: 'Are you sure?', turbo_method: :delete }, class:'button is-danger' %> -
+<% end %> \ No newline at end of file diff --git a/app/views/members/_thumb.html.erb b/app/views/members/_thumb.html.erb index 4df2ed1a..62e7cf5b 100644 --- a/app/views/members/_thumb.html.erb +++ b/app/views/members/_thumb.html.erb @@ -1,5 +1,5 @@ <% if member.avatar.attached? %> <%= image_tag member.avatar.variant(:thumb), class: "is-rounded" %> <% else %> - class="is-rounded" alt="member photo"> + <%= image_tag 'profile-picture.jpg', class: "is-rounded", alt: "member photo" %> <% end %> diff --git a/bin/dev b/bin/dev index 74ade166..5f91c205 100755 --- a/bin/dev +++ b/bin/dev @@ -1,8 +1,2 @@ -#!/usr/bin/env sh - -if ! gem list foreman -i --silent; then - echo "Installing foreman..." - gem install foreman -fi - -exec foreman start -f Procfile.dev "$@" +#!/usr/bin/env ruby +exec "./bin/rails", "server", *ARGV diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 00000000..40330c0f --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +# explicit rubocop config increases performance slightly while avoiding config confusion. +ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) + +load Gem.bin_path("rubocop", "rubocop") diff --git a/bin/setup b/bin/setup index ec47b79b..be3db3c0 100755 --- a/bin/setup +++ b/bin/setup @@ -1,11 +1,10 @@ #!/usr/bin/env ruby require "fileutils" -# path to your application root. APP_ROOT = File.expand_path("..", __dir__) def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") + system(*args, exception: true) end FileUtils.chdir APP_ROOT do @@ -14,7 +13,6 @@ FileUtils.chdir APP_ROOT do # Add necessary setup steps to this file. puts "== Installing dependencies ==" - system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" @@ -28,6 +26,9 @@ FileUtils.chdir APP_ROOT do puts "\n== Removing old logs and tempfiles ==" system! "bin/rails log:clear tmp:clear" - puts "\n== Restarting application server ==" - system! "bin/rails restart" + unless ARGV.include?("--skip-server") + puts "\n== Starting development server ==" + STDOUT.flush # flush the output before exec(2) so that it displays + exec "bin/dev" + end end diff --git a/config/application.rb b/config/application.rb index 66377e7b..52f7b6c1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,14 +9,24 @@ module Blogapp class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.0 + config.load_defaults 8.0 + + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w[assets tasks]) # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files # in config/environments, which are processed later. # - # config.time_zone = "Central Time (US & Canada)" + # Set the default timezone - adjust to your local timezone + config.time_zone = ENV.fetch('TZ', 'America/Sao_Paulo') # Change to your timezone # config.eager_load_paths << Rails.root.join("extras") + config.active_support.to_time_preserves_timezone = :zone + + # Use ImageMagick for Active Storage variants + config.active_storage.variant_processor = :mini_magick end end diff --git a/config/environments/development.rb b/config/environments/development.rb index a2e891ee..4cc21c4e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,21 +1,10 @@ require "active_support/core_ext/integer/time" Rails.application.configure do - config.after_initialize do - Bullet.enable = false - Bullet.alert = false - Bullet.bullet_logger = false - Bullet.console = false - Bullet.rails_logger = false - Bullet.add_footer = false - end - # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded any time - # it changes. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false + # Make code changes take effect immediately without server restart. + config.enable_reloading = true # Do not eager load code on boot. config.eager_load = false @@ -23,62 +12,61 @@ # Show full error reports. config.consider_all_requests_local = true - # Enable server timing + # Enable server timing. config.server_timing = true - # Enable/disable caching. By default caching is disabled. - # Run rails dev:cache to toggle caching. + # Enable/disable Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller caching. if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true - - config.cache_store = :memory_store - config.public_file_server.headers = { - "Cache-Control" => "public, max-age=#{2.days.to_i}" - } + config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false - - config.cache_store = :null_store end + # Change to :null_store to avoid any caching. + config.cache_store = :memory_store + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local - config.active_storage.variant_processor = :mini_magick # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false + # Make template changes take effect immediately. config.action_mailer.perform_caching = false + # Set localhost to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "localhost", port: 3000 } + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise exceptions for disallowed deprecations. - config.active_support.disallowed_deprecation = :raise - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] - # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Suppress logger output for asset requests. - config.assets.quiet = true + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true + + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. - # config.action_view.annotate_rendered_view_with_filenames = true + config.action_view.annotate_rendered_view_with_filenames = true # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true - config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } - config.action_mailer.delivery_method = :letter_opener - config.action_mailer.perform_deliveries = true + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true + + # Apply autocorrection by RuboCop to files generated by `bin/rails generate`. + # config.generators.apply_rubocop_autocorrect_after_generate! end diff --git a/config/environments/production.rb b/config/environments/production.rb index 1aec3325..17496077 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -4,90 +4,86 @@ # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. - config.cache_classes = true + config.enable_reloading = false - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). config.eager_load = true - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] - # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). - # config.require_master_key = true - - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? || ENV['RENDER'].present? + # Full error reports are disabled. + config.consider_all_requests_local = false - # Compress CSS using a preprocessor. - # config.assets.css_compressor = :sass + # Turn on fragment caching in view templates. + config.action_controller.perform_caching = true - # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + # Cache assets for far-future expiry since they are all digest stamped. + config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" } # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.asset_host = "http://assets.example.com" - # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache - # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :amazon + config.active_storage.service = :local - # Mount Action Cable outside main process or domain. - # config.action_cable.mount_path = nil - # config.action_cable.url = "wss://example.com/cable" - # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + config.assume_ssl = true # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = true - # Include generic and useful information about system operation, but avoid logging too much - # information to avoid inadvertent exposure of personally identifiable information (PII). - config.log_level = :info + # Skip http-to-https redirect for the default health check endpoint. + # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } - # Prepend all log lines with the following tags. + # Log to STDOUT with the current request id as a default log tag. config.log_tags = [ :request_id ] + config.logger = ActiveSupport::TaggedLogging.logger(STDOUT) - # Use a different cache store in production. - # config.cache_store = :mem_cache_store + # Change to "debug" to log everything (including potentially personally-identifiable information!) + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") + + # Prevent health checks from clogging up the logs. + config.silence_healthcheck_path = "/up" + + # Don't log any deprecations. + config.active_support.report_deprecations = false - # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "blogapp_production" + # Replace the default in-process memory cache store with a durable alternative. + # config.cache_store = :mem_cache_store - config.action_mailer.perform_caching = false + # Replace the default in-process and non-durable queuing backend for Active Job. + # config.active_job.queue_adapter = :resque # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false + # Set host to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "example.com" } + + # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. + # config.action_mailer.smtp_settings = { + # user_name: Rails.application.credentials.dig(:smtp, :user_name), + # password: Rails.application.credentials.dig(:smtp, :password), + # address: "smtp.example.com", + # port: 587, + # authentication: :plain + # } + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Don't log any deprecations. - config.active_support.report_deprecations = false - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Use a different logger for distributed setups. - # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") - - if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # Only use :id for inspections in production. + config.active_record.attributes_for_inspect = [ :id ] + + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/config/environments/test.rb b/config/environments/test.rb index 4d23c399..c2095b11 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,40 +1,29 @@ -require "active_support/core_ext/integer/time" - # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! Rails.application.configure do - config.after_initialize do - Bullet.enable = false - Bullet.bullet_logger = true - Bullet.raise = true # raise an error if n+1 query occurs - end - # Settings specified here will take precedence over those in config/application.rb. - # Turn false under Spring and add config.action_view.cache_template_loading = true. - config.cache_classes = true + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false - # Eager loading loads your whole application. When running a single test locally, - # this probably isn't necessary. It's a good idea to do in a continuous integration - # system, or in some way before deploying your code. + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. config.eager_load = ENV["CI"].present? - # Configure public file server for tests with Cache-Control for performance. - config.public_file_server.enabled = true - config.public_file_server.headers = { - "Cache-Control" => "public, max-age=#{1.hour.to_i}" - } + # Configure public file server for tests with cache-control for performance. + config.public_file_server.headers = { "cache-control" => "public, max-age=3600" } - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true config.cache_store = :null_store - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false @@ -42,25 +31,23 @@ # Store uploaded files on the local file system in a temporary directory. config.active_storage.service = :test - config.action_mailer.perform_caching = false - # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Print deprecation notices to the stderr. - config.active_support.deprecation = :log + # Set host to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "example.com" } - # Raise exceptions for disallowed deprecations. - config.active_support.disallowed_deprecation = :raise - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef966..48732442 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -5,8 +5,3 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in the app/assets -# folder are already added. -# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 54f47cf1..b3076b38 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -16,9 +16,9 @@ # # policy.report_uri "/csp-violation-report-endpoint" # end # -# # Generate session nonces for permitted importmap and inline scripts +# # Generate session nonces for permitted importmap, inline scripts, and inline styles. # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } -# config.content_security_policy_nonce_directives = %w(script-src) +# config.content_security_policy_nonce_directives = %w(script-src style-src) # # # Report violations without enforcing the policy. # # config.content_security_policy_report_only = true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index adc6568c..c0b717f7 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,8 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure parameters to be filtered from the log file. Use this to limit dissemination of -# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported -# notations and behaviors. +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. +# Use this to limit dissemination of sensitive information. +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += [ - :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn + :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc ] diff --git a/config/initializers/new_framework_defaults_8_0.rb b/config/initializers/new_framework_defaults_8_0.rb new file mode 100644 index 00000000..92efa951 --- /dev/null +++ b/config/initializers/new_framework_defaults_8_0.rb @@ -0,0 +1,30 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 8.0 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `8.0`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +### +# Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone. +# If set to `:zone`, `to_time` methods will use the timezone of their receivers. +# If set to `:offset`, `to_time` methods will use the UTC offset. +# If `false`, `to_time` methods will convert to the local system UTC offset instead. +#++ +# Rails.application.config.active_support.to_time_preserves_timezone = :zone + +### +# When both `If-Modified-Since` and `If-None-Match` are provided by the client +# only consider `If-None-Match` as specified by RFC 7232 Section 6. +# If set to `false` both conditions need to be satisfied. +#++ +# Rails.application.config.action_dispatch.strict_freshness = true + +### +# Set `Regexp.timeout` to `1`s by default to improve security over Regexp Denial-of-Service attacks. +#++ +# Regexp.timeout = 1 diff --git a/config/initializers/rswag_api.rb b/config/initializers/rswag_api.rb index 4d72f687..c4462b27 100644 --- a/config/initializers/rswag_api.rb +++ b/config/initializers/rswag_api.rb @@ -4,7 +4,7 @@ # This is used by the Swagger middleware to serve requests for API descriptions # NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure # that it's configured to generate files in the same folder - c.swagger_root = Rails.root.to_s + '/swagger' + c.openapi_root = Rails.root.to_s + '/swagger' # Inject a lambda function to alter the returned Swagger prior to serialization # The function will have access to the rack env for the current request diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index 0a768c17..f62d5c78 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -8,7 +8,7 @@ # (under swagger_root) as JSON or YAML endpoints, then the list below should # correspond to the relative paths for those endpoints. - c.swagger_endpoint '/api-docs/v1/swagger.yaml', 'API V1 Docs' + c.openapi_endpoint '/api-docs/v1/swagger.yaml', 'API V1 Docs' # Add Basic Auth in case your API is private # c.basic_auth_enabled = true diff --git a/config/puma.rb b/config/puma.rb index 81dae67c..a248513b 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,43 +1,41 @@ -# Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers: a minimum and maximum. -# Any libraries that use thread pools should be configured to match -# the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum; this matches the default thread size of Active Record. +# This configuration file will be evaluated by Puma. The top-level methods that +# are invoked here are part of Puma's configuration DSL. For more information +# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. # -max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } -threads min_threads_count, max_threads_count - -# Specifies the `worker_timeout` threshold that Puma will use to wait before -# terminating a worker in development environments. +# Puma starts a configurable number of processes (workers) and each process +# serves each request in a thread from an internal thread pool. # -worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" - -# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You +# should only set this value when you want to run 2 or more workers. The +# default is already 1. # -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. +# The ideal number of threads per worker depends both on how much time the +# application spends waiting for IO operations and on how much you wish to +# prioritize throughput over latency. # -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the `pidfile` that Puma will use. -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } - -# Specifies the number of `workers` to boot in clustered mode. -# Workers are forked web server processes. If using threads and workers together -# the concurrency of the application would be max `threads` * `workers`. -# Workers do not work on JRuby or Windows (both of which do not support -# processes). +# As a rule of thumb, increasing the number of threads will increase how much +# traffic a given process can handle (throughput), but due to CRuby's +# Global VM Lock (GVL) it has diminishing returns and will degrade the +# response time (latency) of the application. # -workers ENV.fetch("WEB_CONCURRENCY") { 4 } - -# Use the `preload_app!` method when specifying a `workers` number. -# This directive tells Puma to first boot the application and load code -# before forking the application. This takes advantage of Copy On Write -# process behavior so workers use less memory. +# The default is set to 3 threads as it's deemed a decent compromise between +# throughput and latency for the average Rails application. # -preload_app! +# Any libraries that use a connection pool or another resource pool should +# be configured to provide at least as many connections as the number of +# threads. This includes Active Record's `pool` parameter in `database.yml`. +threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +port ENV.fetch("PORT", 3000) # Allow puma to be restarted by `bin/rails restart` command. plugin :tmp_restart + +# Run the Solid Queue supervisor inside of Puma for single-server deployments +plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"] + +# Specify the PID file. Defaults to tmp/pids/server.pid in development. +# In other environments, only set the PID file if requested. +pidfile ENV["PIDFILE"] if ENV["PIDFILE"] diff --git a/db/migrate/20250923010528_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20250923010528_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 00000000..a15c6ce8 --- /dev/null +++ b/db/migrate/20250923010528_add_service_name_to_active_storage_blobs.active_storage.rb @@ -0,0 +1,22 @@ +# This migration comes from active_storage (originally 20190112182829) +class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] + def up + return unless table_exists?(:active_storage_blobs) + + unless column_exists?(:active_storage_blobs, :service_name) + add_column :active_storage_blobs, :service_name, :string + + if configured_service = ActiveStorage::Blob.service.name + ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) + end + + change_column :active_storage_blobs, :service_name, :string, null: false + end + end + + def down + return unless table_exists?(:active_storage_blobs) + + remove_column :active_storage_blobs, :service_name + end +end diff --git a/db/migrate/20250923010529_create_active_storage_variant_records.active_storage.rb b/db/migrate/20250923010529_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 00000000..94ac83af --- /dev/null +++ b/db/migrate/20250923010529_create_active_storage_variant_records.active_storage.rb @@ -0,0 +1,27 @@ +# This migration comes from active_storage (originally 20191206030411) +class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + # Use Active Record's configured type for primary key + create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| + t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type + t.string :variation_digest, null: false + + t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + + private + def primary_key_type + config = Rails.configuration.generators + config.options[config.orm][:primary_key_type] || :primary_key + end + + def blobs_primary_key_type + pkey_name = connection.primary_key(:active_storage_blobs) + pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name } + pkey_column.bigint? ? :bigint : pkey_column.type + end +end diff --git a/db/migrate/20250923010530_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20250923010530_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 00000000..93c8b85a --- /dev/null +++ b/db/migrate/20250923010530_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb @@ -0,0 +1,8 @@ +# This migration comes from active_storage (originally 20211119233751) +class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + change_column_null(:active_storage_blobs, :checksum, true) + end +end diff --git a/db/migrate/20250923014501_add_provider_to_members.rb b/db/migrate/20250923014501_add_provider_to_members.rb new file mode 100644 index 00000000..dba637c0 --- /dev/null +++ b/db/migrate/20250923014501_add_provider_to_members.rb @@ -0,0 +1,6 @@ +class AddProviderToMembers < ActiveRecord::Migration[8.0] + def change + add_column :members, :provider, :string + add_column :members, :uid, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 0cac7fa9..ee0f07de 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_12_01_001659) do +ActiveRecord::Schema[8.0].define(version: 2025_09_23_014501) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "btree_gist" @@ -24,12 +24,12 @@ enable_extension "hstore" enable_extension "intarray" enable_extension "ltree" + enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" enable_extension "pg_trgm" enable_extension "pgcrypto" enable_extension "pgrowlocks" enable_extension "pgstattuple" - enable_extension "plpgsql" enable_extension "tablefunc" enable_extension "unaccent" enable_extension "uuid-ossp" @@ -140,6 +140,8 @@ t.string "unconfirmed_email" t.string "role" t.string "slug" + t.string "provider" + t.string "uid" t.index ["confirmation_token"], name: "index_members_on_confirmation_token", unique: true t.index ["email"], name: "index_members_on_email", unique: true t.index ["reset_password_token"], name: "index_members_on_reset_password_token", unique: true diff --git a/public/400.html b/public/400.html new file mode 100644 index 00000000..282dbc8c --- /dev/null +++ b/public/400.html @@ -0,0 +1,114 @@ + + + + + + + The server cannot process the request due to a client error (400 Bad Request) + + + + + + + + + + + + + +
+
+ +
+
+

The server cannot process the request due to a client error. Please check the request and try again. If you’re the application owner check the logs for more information.

+
+
+ + + + diff --git a/public/404.html b/public/404.html index 2be3af26..c0670bc8 100644 --- a/public/404.html +++ b/public/404.html @@ -1,67 +1,114 @@ - - - - The page you were looking for doesn't exist (404) - - - - - - -
-
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
-

If you are the application owner check the logs for more information.

-
- + + + + + + + The page you were looking for doesn’t exist (404 Not found) + + + + + + + + + + + + + +
+
+ +
+
+

The page you were looking for doesn’t exist. You may have mistyped the address or the page may have moved. If you’re the application owner check the logs for more information.

+
+
+ + + diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html new file mode 100644 index 00000000..9532a9cc --- /dev/null +++ b/public/406-unsupported-browser.html @@ -0,0 +1,114 @@ + + + + + + + Your browser is not supported (406 Not Acceptable) + + + + + + + + + + + + + +
+
+ +
+
+

Your browser is not supported.
Please upgrade your browser to continue.

+
+
+ + + + diff --git a/public/422.html b/public/422.html index c08eac0d..8bcf0601 100644 --- a/public/422.html +++ b/public/422.html @@ -1,67 +1,114 @@ - - - - The change you wanted was rejected (422) - - - - - - -
-
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
-

If you are the application owner check the logs for more information.

-
- + + + + + + + The change you wanted was rejected (422 Unprocessable Entity) + + + + + + + + + + + + + +
+
+ +
+
+

The change you wanted was rejected. Maybe you tried to change something you didn’t have access to. If you’re the application owner check the logs for more information.

+
+
+ + + diff --git a/public/500.html b/public/500.html index 78a030af..d77718c3 100644 --- a/public/500.html +++ b/public/500.html @@ -1,66 +1,114 @@ - - - - We're sorry, but something went wrong (500) - - - - - - -
-
-

We're sorry, but something went wrong.

-
-

If you are the application owner check the logs for more information.

-
- + + + + + + + We’re sorry, but something went wrong (500 Internal Server Error) + + + + + + + + + + + + + +
+
+ +
+
+

We’re sorry, but something went wrong.
If you’re the application owner check the logs for more information.

+
+
+ + + diff --git a/public/icon.png b/public/icon.png new file mode 100644 index 00000000..c4c9dbfb Binary files /dev/null and b/public/icon.png differ diff --git a/public/icon.svg b/public/icon.svg new file mode 100644 index 00000000..04b34bf8 --- /dev/null +++ b/public/icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index a4195eb5..fbbe5477 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -40,7 +40,7 @@ Capybara.javascript_driver = :selenium_chrome RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{Rails.root}/spec/fixtures" + config.fixture_paths = ["#{Rails.root}/spec/fixtures"] # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false diff --git a/spec/sidekiq/create_browser_job_spec.rb b/spec/sidekiq/create_browser_job_spec.rb deleted file mode 100644 index 5e393456..00000000 --- a/spec/sidekiq/create_browser_job_spec.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'rails_helper' -RSpec.describe CreateBrowserJob, type: :job do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/sidekiq/create_counter_job_spec.rb b/spec/sidekiq/create_counter_job_spec.rb deleted file mode 100644 index 7779594f..00000000 --- a/spec/sidekiq/create_counter_job_spec.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'rails_helper' -RSpec.describe CreateCounterJob, type: :job do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/sidekiq/create_length_job_spec.rb b/spec/sidekiq/create_length_job_spec.rb deleted file mode 100644 index 741e03f3..00000000 --- a/spec/sidekiq/create_length_job_spec.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'rails_helper' -RSpec.describe CreateLengthJob, type: :job do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/sidekiq/create_unique_job_spec.rb b/spec/sidekiq/create_unique_job_spec.rb deleted file mode 100644 index ad134d3d..00000000 --- a/spec/sidekiq/create_unique_job_spec.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'rails_helper' -RSpec.describe CreateUniqueJob, type: :job do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index e1395d20..4bb87d43 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.configure do |config| - config.swagger_root = Rails.root.join('swagger').to_s - config.swagger_docs = { + config.openapi_root = Rails.root.join('swagger').to_s + config.openapi_specs = { 'v1/swagger.yaml' => { openapi: '3.0.1', info: { @@ -30,5 +30,5 @@ } } } - config.swagger_format = :yaml + config.openapi_format = :yaml end