Skip to content

Commit 0519d63

Browse files
committed
Added GHA.
1 parent d2fcf69 commit 0519d63

File tree

8 files changed

+42
-24
lines changed

8 files changed

+42
-24
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [dblock]

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: test
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v3
8+
- uses: harmon758/postgresql-action@v1
9+
with:
10+
postgresql version: '17'
11+
postgresql db: acme_test
12+
postgresql user: test
13+
postgresql password: password
14+
- uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: '3.4'
17+
bundler-cache: true
18+
- env:
19+
RACK_ENV: test
20+
DATABASE_URL: postgres://test:password@localhost/acme_test
21+
run: |
22+
bundle exec rake db:create db:migrate
23+
bundle exec rake

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-09-25 14:32:18 UTC using RuboCop version 1.81.0.
3+
# on 2025-09-25 14:53:06 UTC using RuboCop version 1.81.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new

.travis.yml

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

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
Grape API with Roar
22
===================
33

4-
[![Build Status](http://img.shields.io/travis/ruby-grape/grape-with-roar.svg?branch=with_activerecord)](https://travis-ci.org/ruby-grape/grape-with-roar?branch=with_activerecord)
5-
[![Dependency Status](https://gemnasium.com/ruby-grape/grape-with-roar.svg?branch=with_activerecord)](https://gemnasium.com/ruby-grape/grape-with-roar?branch=with_activerecord)
6-
[![Code Climate](https://codeclimate.com/github/ruby-grape/grape-with-roar.svg?branch=with_activerecord)](https://codeclimate.com/github/ruby-grape/grape-with-roar?branch=with_activerecord)
4+
[![test](https://github.com/ruby-grape/grape-with-roar/actions/workflows/test.yml/badge.svg?branch=with-activerecord)](https://github.com/ruby-grape/grape-with-roar/actions/workflows/test.yml)
75

86
A [Grape](http://github.com/intridea/grape) API that uses [Roar](https://github.com/apotonick/roar) and ActiveRecord with a PostgreSQL database.
97

Rakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ include ActiveRecord::Tasks
3333
db_dir = File.expand_path('db', __dir__)
3434

3535
DatabaseTasks.env = ENV['RACK_ENV'] || 'development'
36-
DatabaseTasks.database_configuration = YAML.load_file('./config/database.yml')
36+
yml = ERB.new(File.read(File.expand_path('config/database.yml', __dir__))).result
37+
DatabaseTasks.database_configuration = YAML.safe_load(yml, aliases: true)[ENV.fetch('RACK_ENV', nil)]
3738
DatabaseTasks.db_dir = db_dir
3839
DatabaseTasks.migrations_paths = File.join(db_dir, 'migrate')
3940

config/database.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
development:
2-
database: acme_development
1+
default: &default
32
adapter: postgresql
4-
encoding: unicode
53
pool: 10
4+
timeout: 5000
5+
encoding: unicode
6+
7+
development:
8+
<<: *default
9+
database: acme_development
610

711
test:
12+
<<: *default
13+
url: <%= ENV["DATABASE_URL"] %>
814
database: acme_test
9-
adapter: postgresql
10-
encoding: unicode
11-
pool: 10
12-
1315

16+
production:
17+
<<: *default
18+
url: <%= ENV["DATABASE_URL"] %>

config/environment.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
require File.expand_path('application', __dir__)
44

5-
db_config = YAML.load_file('config/database.yml')[ENV.fetch('RACK_ENV', nil)]
5+
yml = ERB.new(File.read(File.expand_path('database.yml', __dir__))).result
6+
db_config = YAML.safe_load(yml, aliases: true)[ENV.fetch('RACK_ENV', nil)]
67
ActiveRecord::Base.establish_connection(db_config)

0 commit comments

Comments
 (0)