Skip to content

Commit 6ca5a7c

Browse files
authored
Merge pull request #98 from samsonjs/ci-github-actions
Switch to GitHub Actions for CI and update dependencies
2 parents eb20081 + b609ebc commit 6ca5a7c

22 files changed

+122
-98
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
on: [push, pull_request]
3+
4+
jobs:
5+
danger:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: ruby/setup-ruby@v1
10+
with:
11+
ruby-version: 3.4.4
12+
- name: Install dependencies
13+
run: bundle install --jobs 4 --retry 3
14+
- name: Run Danger
15+
run: |
16+
# the token is public, has public_repo scope and belongs to the grape-bot user owned by @dblock, this is ok
17+
TOKEN=$(echo -n Z2hwX2lYb0dPNXNyejYzOFJyaTV3QUxUdkNiS1dtblFwZTFuRXpmMwo= | base64 --decode)
18+
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
19+
20+
test:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
ruby-version: [3.4.4, 3.3.8, 3.2.8, 3.1.7]
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: ${{ matrix.ruby-version }}
30+
- name: Install dependencies
31+
run: bundle install --jobs 4 --retry 3
32+
- name: Run tests
33+
run: bundle exec rake

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ AllCops:
44
Exclude:
55
- Guardfile
66
- grape-active_model_serializers.gemspec
7+
NewCops: enable
78

89
Style/BlockDelimiters:
910
Enabled: false
11+
12+
Style/FrozenStringLiteralComment:
13+
Enabled: false

.rubocop_todo.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Bundler/DuplicatedGem:
1515

1616
# Offense count: 1
1717
Metrics/AbcSize:
18-
Max: 17
18+
Max: 18
1919

2020
# Offense count: 23
2121
# Configuration parameters: CountComments, ExcludedMethods.
@@ -63,5 +63,9 @@ Style/GuardClause:
6363
# Offense count: 2
6464
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
6565
# URISchemes: http, https
66-
Metrics/LineLength:
66+
Layout/LineLength:
6767
Max: 87
68+
69+
Lint/ConstantDefinitionInBlock:
70+
Exclude:
71+
- spec/integration/sequel_spec.rb

.travis.yml

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

CHANGELOG.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
11
## Changelog
22

3-
### 1.5.3 (Next)
3+
### 2.0.0 (Next)
44

5+
* [#96](https://github.com/ruby-grape/grape-active_model_serializers/pull/96): Add compatibility for Grape 2.3 - [@samsonjs](https://github.com/samsonjs).
6+
* [#98](https://github.com/ruby-grape/grape-active_model_serializers/pull/98): Out with Travis CI, in with GitHub Actions - [@samsonjs](https://github.com/samsonjs).
57
* Your contribution here.
68

7-
### 1.5.2 (March 14, 2018)
9+
### 1.5.2 (2018/03/14)
810

911
* [#76](https://github.com/ruby-grape/grape-active_model_serializers/pull/76): Add custom error formatter - [@xn](https://github.com/xn).
1012

11-
### 1.5.1 (April 25, 2017)
13+
### 1.5.1 (2017/04/25)
1214

1315
* [#74](https://github.com/ruby-grape/grape-active_model_serializers/pull/74): Add support for Sequel - [@drn](https://github.com/drn).
1416
* [#73](https://github.com/ruby-grape/grape-active_model_serializers/pull/73): Ensure all AMS options are passed through - [@drn](https://github.com/drn).
1517
* [#65](https://github.com/ruby-grape/grape-active_model_serializers/pull/65): Added Danger, PR linter - [@dblock](https://github.com/dblock).
1618
* [#63](https://github.com/ruby-grape/grape-active_model_serializers/pull/63): Pass adapter options through render - [@drn](https://github.com/drn).
1719

18-
### 1.5.0 (August 24, 2016)
20+
### 1.5.0 (2016/08/24)
1921

2022
* [#61](https://github.com/ruby-grape/grape-active_model_serializers/pull/61): Adds support for collection serializers - [@drn](https://github.com/drn).
2123
* [#60](https://github.com/ruby-grape/grape-active_model_serializers/pull/60): Namespace serializer inference - [@drn](https://github.com/drn).
2224
* [#59](https://github.com/ruby-grape/grape-active_model_serializers/pull/59): Refactor option and serializer resolution - [@drn](https://github.com/drn).
2325
* [#57](https://github.com/ruby-grape/grape-active_model_serializers/pull/57): Solve line length linter issues - [@drn](https://github.com/drn).
2426
* [#54](https://github.com/ruby-grape/grape-active_model_serializers/pull/54): Adding support for ASM v0.10. Drops support for ASM v0.9 - [@drn](https://github.com/drn).
2527

26-
### 1.4.0 (July 14, 2016)
28+
### 1.4.0 (2016/07/14)
2729

2830
* [#49](https://github.com/ruby-grape/grape-active_model_serializers/pull/49): Adds support for active model serializer namespace - [@syntaxTerr0r](https://github.com/syntaxTerr0r).
2931
* [#36](https://github.com/ruby-grape/grape-active_model_serializers/pull/36), [#50](https://github.com/jrhe/grape-active_model_serializers/pull/50): Added support through Grape 0.16.x - [@dblock](https://github.com/dblock).
3032

31-
### v1.3.2 (February 27, 2015)
33+
### 1.3.2 (2015/02/27)
3234

3335
* [#40](https://github.com/ruby-grape/grape-active_model_serializers/pull/40): Use env to pass AMS meta around - [@dblock](https://github.com/dblock).
3436
* [#39](https://github.com/ruby-grape/grape-active_model_serializers/pull/39): Look for namespace and other options to configure serializers - [@jwkoelewijn](https://github.com/jwkoelewijn).
3537

36-
### v1.3.1 (November 20, 2014)
38+
### 1.3.1 (2014/11/20)
3739

3840
* [#30](https://github.com/ruby-grape/grape-active_model_serializers/pull/30): Read options from default_serializer_options - [@siong1987](https://github.com/siong1987).
3941
* [#24](https://github.com/ruby-grape/grape-active_model_serializers/pull/24): Makes it possible to use `current_user` within serializers - [@sonxurxo](https://github.com/sonxurxo).
4042

41-
### v1.2.1 (July 23, 2014)
43+
### 1.2.1 (2014/07/23)
4244

4345
* [#21](https://github.com/ruby-grape/grape-active_model_serializers/pull/21): Correctly fetch serialization scope - [@radanskoric](https://github.com/radanskoric).
4446
* [#18](https://github.com/ruby-grape/grape-active_model_serializers/pull/18): Added support for active model serializer 0.9.x - [@sbounmy](https://github.com/sbounmy).
@@ -48,12 +50,12 @@
4850
* [#12](https://github.com/ruby-grape/grape-active_model_serializers/pull/12): Added support for `current_user` - [@kpassapk](https://github.com/kpassapk).
4951
* [#11](https://github.com/ruby-grape/grape-active_model_serializers/pull/11): Fixed require path - [@schickling](https://github.com/schickling).
5052

51-
### v1.0.1 (September 9, 2013)
53+
### 1.0.1 (2013/09/09)
5254

5355
* [#6](https://github.com/ruby-grape/grape-active_model_serializers/pull/6): Conform to ActiveModel::Serializers way of determining array-ness - [@tfe](https://github.com/tfe).
5456
* [#4](https://github.com/ruby-grape/grape-active_model_serializers/pull/4): Support for namespace options and rely more on active_model_serializers - [@johnallen3d](https://github.com/johnallen3d).
5557
* [#1](https://github.com/ruby-grape/grape-active_model_serializers/pull/1): Fix: Grape::ActiveModelSerializers for models with compound names - [@george](https://github.com/george).
5658

57-
### v1.0.0
59+
### 1.0.0 (2013/09/09)
5860

5961
* Initial public release - [@jrhe](https://github.com/jrhe).

Gemfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
22

33
gemspec
44

5-
case version = ENV['GRAPE_VERSION'] || '~> 1.0.0'
5+
case version = ENV['GRAPE_VERSION'] || '~> 2.3.0'
66
when 'HEAD'
77
gem 'grape', github: 'intridea/grape'
88
else
@@ -11,15 +11,15 @@ end
1111

1212
group :test do
1313
gem 'rack-test'
14-
gem 'ruby-grape-danger', '~> 0.1.0', require: false
15-
gem 'sequel', '~> 4.37', require: false
14+
gem 'ruby-grape-danger', '~> 0.2.0', require: false
15+
gem 'sequel', '~> 5.91', require: false
1616
gem 'sqlite3'
1717
end
1818

1919
group :development, :test do
2020
gem 'guard-rspec'
21-
gem 'listen', '~> 3.0.7'
21+
gem 'listen', '~> 3.9.0'
2222
gem 'rake'
2323
gem 'rspec'
24-
gem 'rubocop', '0.53.0'
24+
gem 'rubocop', '1.75.7'
2525
end

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
1+
# Table of Contents
2+
3+
- [Grape::ActiveModelSerializers](#grapeactivemodelserializers)
4+
- [Installation](#installation)
5+
- [Dependencies](#dependencies)
6+
- [Usage](#usage)
7+
- [Require grape-active_model_serializers](#require-grape-active_model_serializers)
8+
- [Tell your API to use Grape::Formatter::ActiveModelSerializers](#tell-your-api-to-use-grapeformatteractivemodelserializers)
9+
- [Writing Serializers](#writing-serializers)
10+
- [Serializers are inferred by active_record model names](#serializers-are-inferred-by-active_record-model-names)
11+
- [Array Roots](#array-roots)
12+
- [API Versioning](#api-versioning)
13+
- [Manually specifying serializer / adapter options](#manually-specifying-serializer--adapter-options)
14+
- [Custom Metadata](#custom-metadata)
15+
- [Default Serializer Options](#default-serializer-options)
16+
- [Current User](#current-user)
17+
- [Full Example](#full-example)
18+
- [Contributing](#contributing)
19+
- [History](#history)
20+
121
# Grape::ActiveModelSerializers
222

323
Use [active_model_serializers](https://github.com/rails-api/active_model_serializers) with [Grape](https://github.com/intridea/grape)!
424

525
[![Gem Version](https://badge.fury.io/rb/grape-active_model_serializers.svg)](https://badge.fury.io/rb/grape-active_model_serializers)
6-
[![Build Status](https://api.travis-ci.org/ruby-grape/grape-active_model_serializers.svg)](http://travis-ci.org/ruby-grape/grape-active_model_serializers) [![Code Climate](https://codeclimate.com/github/ruby-grape/grape-active_model_serializers.svg)](https://codeclimate.com/github/ruby-grape/grape-active_model_serializers)
26+
[![Build Status](https://github.com/ruby-grape/grape-active_model_serializers/actions/workflows/ci.yml/badge.svg)](https://github.com/ruby-grape/grape-active_model_serializers/actions/workflows/ci.yml) [![Code Climate](https://codeclimate.com/github/ruby-grape/grape-active_model_serializers.svg)](https://codeclimate.com/github/ruby-grape/grape-active_model_serializers)
727

828
## Installation
929

@@ -17,8 +37,8 @@ See [UPGRADING](UPGRADING.md) if you're upgrading from a previous version.
1737

1838
## Dependencies
1939

20-
* >= Ruby v2.2
21-
* >= [grape](https://github.com/ruby-grape/grape) v0.8.0
40+
* >= Ruby v3.1
41+
* >= [grape](https://github.com/ruby-grape/grape) v2.3.0
2242
* >= [active_model_serializers](https://github.com/rails-api/active_model_serializers) v0.10.0
2343

2444
## Usage

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env rake
2+
23
require 'bundler/gem_tasks'
34

45
require 'rspec/core'

grape-active_model_serializers.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
1616
gem.version = Grape::ActiveModelSerializers::VERSION
1717
gem.licenses = ['MIT']
1818

19-
gem.add_dependency 'grape', '>= 0.8.0'
19+
gem.add_dependency 'grape', '>= 2.3.0'
2020
gem.add_dependency 'active_model_serializers', '>= 0.10.0'
2121
end

lib/grape-active_model_serializers/endpoint_extension.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def self.included(base)
3232
def serialization_scope
3333
return unless _serialization_scope
3434
return unless respond_to?(_serialization_scope, true)
35+
3536
send(_serialization_scope)
3637
end
3738
end
@@ -55,5 +56,5 @@ def default_serializer_options; end
5556
def url_options; end
5657
end
5758

58-
Endpoint.send(:include, EndpointExtension)
59+
Endpoint.include EndpointExtension
5960
end

0 commit comments

Comments
 (0)