Skip to content

Commit 0c7eb5e

Browse files
authored
chore: Remove SQLite and streamline dependencies (#13)
* chore: Remove SQLite and streamline dependencies Removed unnecessary dependencies for API-only application using Couchbase: **Removed gems:** - sqlite3 (not needed - using Couchbase directly) - capybara (no system testing for API) - selenium-webdriver (no browser automation needed) - sprockets-rails (no asset pipeline for API) - importmap-rails (no JavaScript imports needed) - turbo-rails (no Hotwire features needed) - stimulus-rails (no Stimulus controllers needed) **Configuration changes:** - Updated config/application.rb to load only required Rails components - Excluded activerecord/railtie (using Couchbase SDK directly) - Excluded active_storage/engine and action_cable/railtie (not needed) - Updated config/database.yml with clear note that it's not used - Commented out ActiveRecord configurations in spec/rails_helper.rb - Removed active_storage configuration from config/environments/test.rb **Removed directories/files:** - app/javascript/ (unused Stimulus controllers) - db/ (no migrations with Couchbase) - config/importmap.rb (not needed) - config/initializers/assets.rb (no asset pipeline) **Impact:** - Reduced gem count and bundle size - Faster boot time and bundle install - Clearer developer onboarding (no SQLite confusion) - All 27 tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: Comment out active_storage config in all environments Missed active_storage configuration in development.rb and production.rb which caused CI failures when the application tried to boot. Changes: - Commented out config.active_storage.service in development.rb - Commented out config.active_storage.service in production.rb This completes the removal of ActiveStorage dependency. * fix: Remove app/channels directory The app/channels directory contains ActionCable boilerplate that references ActionCable::Channel::Base, but we excluded ActionCable from loading in config/application.rb. Since we're not using WebSockets/ActionCable for this JSON API, removing the entire directory resolves the initialization errors. Changes: - Removed app/channels/ directory This completes the ActionCable removal. * fix: Comment out asset pipeline config in all environments Commented out config.assets.* references in development.rb and production.rb since the asset pipeline was removed. This fixes NoMethodError for undefined method 'assets' on Rails::Application::Configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: Remove unused application_record.rb file Removed app/models/application_record.rb since it references ActiveRecord::Base which is not loaded in this application. This application uses Couchbase SDK directly with the CouchbaseConnection module, not ActiveRecord. This fixes the CI error: NameError: uninitialized constant ActiveRecord 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: Remove unused application_record.rb and streamline CI - Removed app/models/application_record.rb which referenced ActiveRecord::Base. This application uses Couchbase SDK directly with CouchbaseConnection module, not ActiveRecord. - Updated CI workflow to set DB_* environment variables at job level so they apply to all steps automatically (cleaner configuration). - Removed redundant env sections from individual CI steps. This fixes the CI error: NameError: uninitialized constant ActiveRecord All 27 tests pass successfully. * chore: Trigger CI ---------
1 parent 6504da8 commit 0c7eb5e

File tree

12 files changed

+50
-89
lines changed

12 files changed

+50
-89
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
DB_CONN_STR: ${{ vars.DB_CONN_STR }}
1919
DB_USERNAME: ${{ vars.DB_USERNAME }}
2020
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
21+
CI: true
2122

2223
steps:
2324
- name: Checkout code
@@ -48,10 +49,6 @@ jobs:
4849
fi
4950
5051
echo "✓ All Couchbase environment variables are configured"
51-
env:
52-
DB_CONN_STR: ${{ vars.DB_CONN_STR }}
53-
DB_USERNAME: ${{ vars.DB_USERNAME }}
54-
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
5552
5653
- name: Test Couchbase Connection
5754
run: |
@@ -70,22 +67,12 @@ jobs:
7067
exit 1
7168
end
7269
'
73-
env:
74-
DB_CONN_STR: ${{ vars.DB_CONN_STR }}
75-
DB_USERNAME: ${{ vars.DB_USERNAME }}
76-
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
77-
CI: true
7870
7971
- name: Run integration tests
8072
run: bundle exec rspec spec/requests/api/v1
8173

8274
- name: Verify Swagger documentation generates
8375
run: bundle exec rake rswag:specs:swaggerize
84-
env:
85-
DB_CONN_STR: ${{ vars.DB_CONN_STR }}
86-
DB_USERNAME: ${{ vars.DB_USERNAME }}
87-
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
88-
CI: true
8976

9077
- name: Report Status
9178
if: always()
@@ -97,4 +84,4 @@ jobs:
9784
message_format: "{emoji} *{status_message}* in <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>"
9885
footer: "<{run_url}|View Full Run on GitHub>"
9986
env:
100-
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
87+
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}

Gemfile

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,9 @@ ruby '3.4.1'
55
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
66
gem 'rails', '~> 7.1.3', '>= 7.1.3.2'
77

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-
148
# Use the Puma web server [https://github.com/puma/puma]
159
gem 'puma', '>= 5.0'
1610

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-
2611
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
2712
gem 'jbuilder'
2813

@@ -62,7 +47,5 @@ group :development do
6247
end
6348

6449
group :test do
65-
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
66-
gem 'capybara'
67-
gem 'selenium-webdriver'
50+
# API-only testing with RSpec (no system/browser testing needed)
6851
end

app/channels/application_cable/channel.rb

Lines changed: 0 additions & 4 deletions
This file was deleted.

app/channels/application_cable/connection.rb

Lines changed: 0 additions & 4 deletions
This file was deleted.

app/models/application_record.rb

Lines changed: 0 additions & 3 deletions
This file was deleted.

config/application.rb

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
require_relative 'boot'
22

3-
require 'rails/all'
3+
# Load Rails components individually (excluding activerecord since we use Couchbase directly)
4+
require 'rails'
5+
%w(
6+
action_controller
7+
action_view
8+
action_mailer
9+
active_job
10+
).each do |framework|
11+
begin
12+
require "#{framework}/railtie"
13+
rescue LoadError
14+
end
15+
end
16+
17+
# Excluded components (using Couchbase directly via SDK):
18+
# - active_record/railtie - Using Couchbase SDK directly
19+
# - active_storage/engine - Not needed for API-only app
20+
# - action_cable/railtie - Not using WebSockets
421

522
# Require the gems listed in Gemfile, including any gems
623
# you've limited to :test, :development, or :production.

config/database.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
# SQLite. Versions 3.8.0 and up are supported.
2-
# gem install sqlite3
3-
#
4-
# Ensure the SQLite 3 gem is defined in your Gemfile
5-
# gem "sqlite3"
1+
# NOTE: This file is not used by the application.
2+
# This application uses Couchbase as its database through the Couchbase Ruby SDK.
3+
# Database connections are configured in config/initializers/couchbase.rb
64
#
5+
# The configuration below is kept for Rails compatibility but is not actively used.
6+
# No SQL database (SQLite, PostgreSQL, MySQL) is required for this application.
7+
8+
# Minimal configuration to prevent Rails from attempting database connections
79
default: &default
8-
adapter: sqlite3
9-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10-
timeout: 5000
10+
adapter: nulldb
1111

1212
development:
1313
<<: *default
14-
database: storage/development.sqlite3
1514

16-
# Warning: The database defined as "test" will be erased and
17-
# re-generated from your development database when you run "rake".
18-
# Do not set this db to the same as development or production.
1915
test:
2016
<<: *default
21-
database: storage/test.sqlite3
2217

2318
production:
2419
<<: *default
25-
database: storage/production.sqlite3

config/environments/development.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
end
3535

3636
# Store uploaded files on the local file system (see config/storage.yml for options).
37-
config.active_storage.service = :local
37+
# config.active_storage.service = :local # Commented out - not using ActiveStorage
3838

3939
# Don't care if the mailer can't send.
4040
config.action_mailer.raise_delivery_errors = false
@@ -51,16 +51,16 @@
5151
config.active_support.disallowed_deprecation_warnings = []
5252

5353
# Raise an error on page load if there are pending migrations.
54-
config.active_record.migration_error = :page_load
54+
# config.active_record.migration_error = :page_load # Commented out - not using ActiveRecord
5555

5656
# Highlight code that triggered database queries in logs.
57-
config.active_record.verbose_query_logs = true
57+
# config.active_record.verbose_query_logs = true # Commented out - not using ActiveRecord
5858

5959
# Highlight code that enqueued background job in logs.
6060
config.active_job.verbose_enqueue_logs = true
6161

6262
# Suppress logger output for asset requests.
63-
config.assets.quiet = true
63+
# config.assets.quiet = true # Commented out - not using asset pipeline
6464

6565
# Raises error for missing translations.
6666
# config.i18n.raise_on_missing_translations = true

config/environments/production.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# config.assets.css_compressor = :sass
2828

2929
# Do not fall back to assets pipeline if a precompiled asset is missed.
30-
config.assets.compile = false
30+
# config.assets.compile = false # Commented out - not using asset pipeline
3131

3232
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
3333
# config.asset_host = "http://assets.example.com"
@@ -37,7 +37,7 @@
3737
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
3838

3939
# Store uploaded files on the local file system (see config/storage.yml for options).
40-
config.active_storage.service = :local
40+
# config.active_storage.service = :local # Commented out - not using ActiveStorage
4141

4242
# Mount Action Cable outside main process or domain.
4343
# config.action_cable.mount_path = nil
@@ -85,7 +85,7 @@
8585
config.active_support.report_deprecations = false
8686

8787
# Do not dump schema after migrations.
88-
config.active_record.dump_schema_after_migration = false
88+
# config.active_record.dump_schema_after_migration = false # Commented out - not using ActiveRecord
8989

9090
# Enable DNS rebinding protection and other `Host` header attacks.
9191
# config.hosts = [

config/environments/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
config.action_controller.allow_forgery_protection = false
3636

3737
# Store uploaded files on the local file system in a temporary directory.
38-
config.active_storage.service = :test
38+
# config.active_storage.service = :test # Commented out - not using ActiveStorage
3939

4040
config.action_mailer.perform_caching = false
4141

0 commit comments

Comments
 (0)