Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [dblock]
tidelift: rubygems/grape
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
22 changes: 22 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: danger
on: pull_request
jobs:
danger:
name: Dangerfile
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- run: |
# the token is public, has public_repo scope and belongs to the grape-bot user owned by @dblock, this is ok
TOKEN=$(echo -n Z2hwX2lYb0dPNXNyejYzOFJyaTV3QUxUdkNiS1dtblFwZTFuRXpmMwo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
15 changes: 15 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: lint
on: [push, pull_request]
jobs:
rubocop:
name: RuboCop
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- run: bundle exec rubocop
32 changes: 32 additions & 0 deletions .github/workflows/test-activerecord.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: test-activerecord
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
entry:
- { ruby: '3.4', postgresql: '17', activerecord: '~> 8.0.2', grape: '2.4.0' }
name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }}, activerecord=${{ matrix.entry.activerecord }}, grape=${{ matrix.entry.grape }})
env:
ACTIVERECORD_VERSION: ${{ matrix.entry.activerecord }}
GRAPE_VERSION: ${{ matrix.entry.grape }}
steps:
- uses: harmon758/postgresql-action@v1
with:
postgresql version: ${{ matrix.entry.postgresql }}
postgresql db: slack_ruby_bot_server_test
postgresql user: test
postgresql password: password
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler-cache: true
- name: Run ActiveRecord Tests
env:
SPEC_OPTS: --tag activerecord
run: bundle exec rake
- name: Run Tests
run: bundle exec rake
29 changes: 29 additions & 0 deletions .github/workflows/test-mongodb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: test-mongodb
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
entry:
- { ruby: '3.4', mongoid: '6.4.8', mongodb: '6.0', grape: '1.7.0' }
name: test (ruby=${{ matrix.entry.ruby }}, mongoid=${{ matrix.entry.mongoid }}, mongodb=${{ matrix.entry.mongodb }}, grape=${{ matrix.entry.grape }})
env:
MONGOID_VERSION: ${{ matrix.entry.mongoid }}
GRAPE_VERSION: ${{ matrix.entry.grape }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler-cache: true
- uses: supercharge/mongodb-github-action@1.7.0
with:
mongodb-version: ${{ matrix.entry.mongodb }}
- name: Run Tests
run: bundle exec rake
- name: Run Mongoid Tagged Tests
env:
SPEC_OPTS: --tag mongoid
run: bundle exec rake
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
entry:
- { ruby: 3.4 }
name: test (ruby=${{ matrix.entry.ruby }})
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler-cache: true
- name: Run Tests
run: bundle exec rake
10 changes: 7 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
AllCops:
TargetRubyVersion: 2.3
DisplayCopNames: true
TargetRubyVersion: 3.0
NewCops: enable
Exclude:
- bin/**/*
- gemfiles/**/*
- spec/**/*
- vendor/**/*

inherit_from: .rubocop_todo.yml
inherit_from: .rubocop_todo.yml

plugins:
- rubocop-rake
- rubocop-rspec
57 changes: 37 additions & 20 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-07-02 09:34:39 -0400 using RuboCop version 0.49.1.
# on 2025-09-24 16:57:49 UTC using RuboCop version 1.80.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 7
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 108
# Offense count: 1
# Configuration parameters: Severity.
Gemspec/RequiredRubyVersion:
Exclude:
- 'grape-roar.gemspec'

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 11

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'Rakefile.rb'
- 'lib/grape-roar.rb'

# Offense count: 6
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
# NamePrefix: is_, has_, have_, does_
# ForbiddenPrefixes: is_, has_, have_, does_
# AllowedMethods: is_a?
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicatePrefix:
Exclude:
- 'spec/**/*'
- 'lib/grape/roar/extensions/relations/validations/active_record.rb'
- 'lib/grape/roar/extensions/relations/validations/mongoid.rb'

# Offense count: 14
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
Expand All @@ -32,18 +59,8 @@ Style/Documentation:
- 'lib/grape/roar/representer.rb'

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Style/FileName:
Exclude:
- 'lib/grape-roar.rb'

# Offense count: 3
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
# NamePrefix: is_, has_, have_
# NamePrefixBlacklist: is_, has_, have_
# NameWhitelist: is_a?
Style/PredicateName:
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'spec/**/*'
- 'lib/grape/roar/extensions/relations/validations/active_record.rb'
- 'lib/grape/roar/extensions/relations/dsl_methods.rb'
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

9 changes: 0 additions & 9 deletions Appraisals

This file was deleted.

23 changes: 9 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
Next
----
### 0.5.0 (Next)

* [#23](https://github.com/ruby-grape/grape-roar/pull/23): Resolves pollution issue with invoking representers on singletons - [@mach-kernel](https://github.com/mach-kernel).
* [#28](https://github.com/ruby-grape/grape-roar/pull/28): Replaced Travis-CI with GHA - [@dblock](https://github.com/dblock).
* Your contribution here.
* [#23](https://github.com/ruby-grape/grape-roar/pull/23): Resolves pollution issue with invoking representers on singletons ([#16](https://github.com/ruby-grape/grape-roar/issues/16)) - [@mach-kernel](https://github.com/mach-kernel).


0.4.1 (07/14/2017)
----
### 0.4.1 (2017/07/14)

* [#22](https://github.com/ruby-grape/grape-roar/pull/22): Adds Grape::Roar::Extensions::Relations.
* [#22](https://github.com/ruby-grape/grape-roar/pull/22): Adds Grape::Roar::Extensions::Relations - [@mach-kernel](https://github.com/mach-kernel).


0.4.0 (02/18/2017)
------------------
### 0.4.0 (2017/02/18)

* [#21](https://github.com/ruby-grape/grape-roar/pull/21): Fixes serialization issue due to [representable](https://github.com/trailblazer/representable) API change, drop support for Ruby < `2.1.0` - [@mach-kernel](https://github.com/mach-kernel).


0.3.0 (12/31/2014)
------------------
### 0.3.0 (2014/12/31)

* Added support for Roar 1.0 - [@dblock](https://github.com/dblock).


0.2.0 (12/18/2014)
------------------
### 0.2.0 (2014/12/18)

* [#10](https://github.com/ruby-grape/grape-roar/pull/10): Support for Roar decorator - [@sdbondi](https://github.com/sdbondi).


0.1.0 (7/17/2014)
-----------------
### 0.1.0 (2014/7/17)

* Initial public release, with support for Grape `present` - [@dblock](https://github.com/dblock).
4 changes: 4 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

danger.import_dangerfile(gem: 'ruby-grape-danger')
toc.check!
18 changes: 13 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@ source 'https://rubygems.org'

gemspec

group :development do
gem 'appraisal', '~> 2.2.0'
end
gem 'activerecord', ENV['ACTIVERECORD_VERSION'], require: 'active_record' if ENV.key?('ACTIVERECORD_VERSION')
gem 'grape', ENV['GRAPE_VERSION'] if ENV.key?('GRAPE_VERSION')
gem 'mongoid', ENV['MONGOID_VERSION'], require: 'mongoid' if ENV.key?('MONGOID_VERSION')

group :test do
gem 'rack-test'
gem 'rspec', '~> 3.1'
gem 'rspec'
end

group :development, :test do
gem 'base64'
gem 'bigdecimal'
gem 'mutex_m'
gem 'nokogiri'
gem 'ostruct'
gem 'rack', '~> 2.2.17'
gem 'rake'
gem 'rubocop', '0.49.1'
gem 'rubocop', '1.80.2'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'sorted_set'
end
6 changes: 6 additions & 0 deletions Gemfile.danger
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

group :test do
gem 'danger-toc', '~> 0.2.0', require: false
gem 'ruby-grape-danger', '~> 0.2.1', require: false
end
Loading