Skip to content

Commit bac9732

Browse files
authored
Merge pull request #1 from couchbase-examples/AV-77025-ruby-couchbase-orm-quickstart
Code for Ruby Couchbase ORM Quickstart
2 parents f9fb256 + 12864a0 commit bac9732

File tree

103 files changed

+4319
-1
lines changed

Some content is hidden

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

103 files changed

+4319
-1
lines changed

.dockerignore

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

.gitattributes

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

.github/workflows/ci.yml

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

.gitignore

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

.rspec

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

.ruby-version

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

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Use the official Ruby 3.0.0 image as the base image
2+
FROM ruby:3.3.0
3+
4+
# Install essential Linux packages
5+
RUN apt-get update -qq && \
6+
apt-get install -y nodejs npm cmake && \
7+
npm install -g yarn && \
8+
apt-get clean && \
9+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
10+
11+
# Set the working directory in the container
12+
WORKDIR /app
13+
14+
# Install Rails gem with version 7.1
15+
RUN gem install rails -v '7.1'
16+
17+
# Copy the Gemfile and Gemfile.lock into the container
18+
COPY Gemfile Gemfile.lock ./
19+
20+
# Install project dependencies
21+
RUN bundle install
22+
23+
# Copy the rest of the application code into the container
24+
COPY . .
25+
26+
# Expose port 3000 to the Docker host
27+
EXPOSE 3000
28+
29+
# Start the Rails server
30+
CMD ["rails", "server", "-b", "0.0.0.0"]

Gemfile

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

0 commit comments

Comments
 (0)