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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:

jobs:
rubocop:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04 # no ubuntu-26.04 builds of Ruby 3.0/3.1 yet; revisit when ubuntu-latest moves
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
Expand All @@ -24,11 +24,11 @@ jobs:
run: bundle exec rubocop --parallel --format progress

rspec:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04 # no ubuntu-26.04 builds of Ruby 3.0/3.1 yet; revisit when ubuntu-latest moves
needs: ['rubocop']
strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4']
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
steps:
- name: Check out branch
uses: actions/checkout@v7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/danger-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ on:

jobs:
comment:
uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.0
uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.1
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
danger:
uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.0
uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.1
secrets: inherit
with:
ruby-version: '3.4'
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
### Next release
### 1.1.1 (Next)

#### Fixes

* [#411](https://github.com/ruby-grape/grape-entity/pull/411): Fix CI on Ruby 3.0 (pin `json` below 3.0, `git` below 6, newer RuboCop directives), add Ruby 4.0 to the test matrix - [@numbata](https://github.com/numbata).
* Your contribution here.

#### Features
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Document any external behavior in the [README](README.md).

#### Update Changelog

Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
Add a line to [CHANGELOG](CHANGELOG.md) under the unreleased `(Next)` section. Make it look like every other line, including your name and link to your Github account.

#### Commit Changes

Expand Down
7 changes: 6 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ gemspec

group :development, :test do
gem 'bundler'
# activesupport 7.1 (the newest on Ruby 3.0) passes `quirks_mode:` to JSON.generate, which json 3.0 removed
gem 'json', '< 3.0' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
gem 'maruku'
gem 'ostruct' # no longer a default gem in Ruby 4.0
gem 'pry' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx')
gem 'pry-byebug' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx')
gem 'rack-test'
gem 'rake'
gem 'rspec', '~> 3.9'
gem 'rubocop', '~> 1.0'
gem 'rubocop', '~> 1.90' # the disable-next directive needs 1.90
gem 'yard'
end

Expand All @@ -21,6 +24,8 @@ group :test do
gem 'danger', require: false
gem 'danger-changelog', require: false
gem 'danger-pr-comment', require: false
# danger 9.6 references Git::Base, which git 6 no longer loads eagerly; drop once danger supports git 6
gem 'git', '< 6'
gem 'growl'
gem 'guard'
gem 'guard-bundler'
Expand Down
11 changes: 8 additions & 3 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Increment the version, modify [lib/grape-entity/version.rb](lib/grape-entity/ver
* Increment the third number if the release has bug fixes and/or very minor features, only (eg. change `0.5.1` to `0.5.2`).
* Increment the second number if the release contains major features or breaking API changes (eg. change `0.5.1` to `0.4.0`).

Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version.
Change the "(Next)" heading in [CHANGELOG.md](CHANGELOG.md) to the new version and release date.

```
0.4.0 (2014-01-27)
Expand Down Expand Up @@ -52,8 +52,13 @@ Pushed grape-entity 0.4.0 to rubygems.org.
Add the next release to [CHANGELOG.md](CHANGELOG.md).

```
Next Release
============
### X.Y.Z (Next)

#### Fixes

* Your contribution here.

#### Features

* Your contribution here.
```
Expand Down
3 changes: 1 addition & 2 deletions lib/grape_entity/entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def self.inherited(subclass)
# field, typically the value is a hash with two fields, type and desc.
# @option options :merge This option allows you to merge an exposed field to the root
#
# rubocop:disable Layout/LineLength
# rubocop:disable-next Layout/LineLength
Comment thread
numbata marked this conversation as resolved.
Resolved
def self.expose(*args, &block)
options = merge_options(args.last.is_a?(Hash) ? args.pop : {})

Expand All @@ -217,7 +217,6 @@ def self.expose(*args, &block)
@nesting_stack ||= []
args.each { |attribute| build_exposure_for_attribute(attribute, @nesting_stack, options, block) }
end
# rubocop:enable Layout/LineLength

def self.build_exposure_for_attribute(attribute, nesting_stack, options, block)
exposure_list = nesting_stack.empty? ? root_exposures : nesting_stack.last.nested_exposures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def clear
@exposures.clear
end

# rubocop:disable Style/DocumentDynamicEvalDefinition
# rubocop:disable-next Style/DocumentDynamicEvalDefinition
Comment thread
numbata marked this conversation as resolved.
Resolved
%i[
each
to_ary to_a
Expand All @@ -56,7 +56,6 @@ def #{name}(*args, &block)
end
RUBY
end
# rubocop:enable Style/DocumentDynamicEvalDefinition

# Determine if we have any nesting exposures with the same name.
def deep_complex_nesting?(entity)
Expand Down
6 changes: 2 additions & 4 deletions spec/grape_entity/entity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
end

it 'makes sure that :format_with as a proc cannot be used with a block' do
# rubocop:disable Style/BlockDelimiters
# rubocop:disable-next Style/BlockDelimiters
expect {
subject.expose :name, format_with: proc {} do
p 'hi'
end
}.to raise_error ArgumentError
# rubocop:enable Style/BlockDelimiters
end

it 'makes sure unknown options are not silently ignored' do
Expand Down Expand Up @@ -2294,12 +2293,11 @@ class FriendEntity < Grape::Entity
end
end

# rubocop:disable Lint/EmptyBlock
# rubocop:disable-next Lint/EmptyBlock
fresh_class.class_eval do
expose :first_friend, using: EntitySpec::FriendEntity do |_user, _opts|
Comment thread
numbata marked this conversation as resolved.
Resolved
end
end
# rubocop:enable Lint/EmptyBlock

rep = subject.value_for(:first_friend)
expect(rep).to be_kind_of EntitySpec::FriendEntity
Expand Down
Loading