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/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: gemfiles/rubocop.gemfile
steps:
- uses: actions/checkout@v7
- name: Set up Ruby
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ jobs:
- "4.0"
- "jruby-9.4"
- "jruby-10"
gemfile:
- Gemfile
include:
# See https://github.com/dblock/strava-ruby-client/issues/113: json
# 2.x is the version this gem currently supports. json_3 is
# commented out until Faraday's :json middleware supports json >=
# 3.0, since it currently fails (Faraday::ParsingError).
- ruby-version: "3.4"
gemfile: gemfiles/json_2.gemfile
# - ruby-version: "3.4"
# gemfile: gemfiles/json_3.gemfile
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v7
- name: Set up Ruby
Expand All @@ -31,7 +44,7 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
flag-name: ${{ matrix.ruby-version }}
flag-name: ${{ matrix.gemfile == 'Gemfile' && matrix.ruby-version || format('{0}-{1}', matrix.ruby-version, matrix.gemfile) }}
parallel: true
integration:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
.tool-versions
.vscode
Gemfile.lock
gemfiles/*.gemfile.lock
pkg
coverage
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AllCops:
NewCops: enable
Exclude:
- vendor/**/*
- gemfiles/**/*

Naming/MethodName:
Enabled: false
Expand Down
14 changes: 14 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

# Tests the gem against the two major json releases that are relevant to
# https://github.com/dblock/strava-ruby-client/issues/113: json < 3.0, where
# JSON.parse accepts a positional options hash (the form Faraday's :json
# response middleware uses), and json >= 3.0, where JSON.parse only accepts
# keyword arguments and Faraday's call raises an ArgumentError.
appraise 'json-2' do
gem 'json', '~> 2.3'
end

appraise 'json-3' do
gem 'json', '~> 3.0'
end
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 3.1.1 (Next)

* [#113](https://github.com/dblock/strava-ruby-client/issues/113): Adds Appraisals (`json-2`, `json-3`) - [@dblock](https://github.com/dblock).
* Your contribution here.

### 3.1.0 (2026/08/29)
Expand Down
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ bundle install
bundle exec rake
```

Rubocop uses its own `gemfiles/rubocop.gemfile`, kept separate so its pinned version doesn't constrain the main Gemfile's dependency resolution.

```
BUNDLE_GEMFILE=gemfiles/rubocop.gemfile bundle install
BUNDLE_GEMFILE=gemfiles/rubocop.gemfile bundle exec rubocop
```

This gem is tested against multiple `json` gem versions using [Appraisal](https://github.com/thoughtbot/appraisal), defined in `Appraisals`. To run the test suite against a specific `json` version, e.g. to reproduce [#113](https://github.com/dblock/strava-ruby-client/issues/113):

```
BUNDLE_GEMFILE=gemfiles/json_3.gemfile bundle install
BUNDLE_GEMFILE=gemfiles/json_3.gemfile bundle exec rake spec
```

If you add or change a runtime/test dependency in the main `Gemfile`, regenerate the appraisal gemfiles.

```
bundle exec appraisal generate
```

## Contribute Code

### Obtain a Strava Token
Expand Down
10 changes: 7 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ source 'http://rubygems.org'

gemspec

# Faraday's :json response middleware is incompatible with json >= 3.0 (see
# https://github.com/dblock/strava-ruby-client/issues/113), so pin json here
# rather than relying on rubocop's own transitive constraint. The `json-3`
# appraisal (see Appraisals) is used to track when this can be removed.
gem 'json', '~> 2.3'

group :development, :test do
gem 'appraisal'
gem 'csv'
gem 'danger-changelog', '~> 0.8.0'
gem 'danger-pr-comment'
Expand All @@ -17,9 +24,6 @@ group :development, :test do
gem 'pry'
gem 'rake'
gem 'rspec'
gem 'rubocop', '1.68.0'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'tcx'
gem 'vcr'
gem 'webmock'
Expand Down
8 changes: 5 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ RSpec::Core::RakeTask.new(:'spec:integration') do |spec|
spec.pattern = FileList['spec/integration/**/*_spec.rb']
end

require 'rubocop/rake_task'
RuboCop::RakeTask.new
# Rubocop lives in its own Gemfile (gemfiles/rubocop.gemfile), not the main
# Gemfile, so it doesn't constrain dependency resolution there (see
# https://github.com/dblock/strava-ruby-client/issues/113). Run it with
# `BUNDLE_GEMFILE=gemfiles/rubocop.gemfile bundle exec rubocop`.

task default: %i[rubocop spec]
task default: %i[spec]
32 changes: 32 additions & 0 deletions gemfiles/json_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "json", "~> 2.3"

group :development, :test do
gem "appraisal"
gem "csv"
gem "danger-changelog", "~> 0.8.0"
gem "danger-pr-comment"
gem "danger-toc", "~> 0.2.0"
gem "dotenv"
gem "faraday-retry"
gem "gpx"
gem "multi_xml"
gem "polylines"
gem "pry"
gem "rake"
gem "rspec"
gem "tcx"
gem "vcr"
gem "webmock"
gem "webrick", "~> 1.9"
end

group :test do
gem "simplecov"
gem "simplecov-lcov", require: false
end

gemspec path: "../"
32 changes: 32 additions & 0 deletions gemfiles/json_3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "json", "~> 3.0"

group :development, :test do
gem "appraisal"
gem "csv"
gem "danger-changelog", "~> 0.8.0"
gem "danger-pr-comment"
gem "danger-toc", "~> 0.2.0"
gem "dotenv"
gem "faraday-retry"
gem "gpx"
gem "multi_xml"
gem "polylines"
gem "pry"
gem "rake"
gem "rspec"
gem "tcx"
gem "vcr"
gem "webmock"
gem "webrick", "~> 1.9"
end

group :test do
gem "simplecov"
gem "simplecov-lcov", require: false
end

gemspec path: "../"
13 changes: 13 additions & 0 deletions gemfiles/rubocop.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# Rubocop is kept in its own Gemfile, separate from the main Gemfile, so that
# its exact pinned version (and its own transitive dependency constraints,
# e.g. on json) don't participate in dependency resolution for the gem's
# runtime/test Gemfile or its Appraisals. See
# https://github.com/dblock/strava-ruby-client/issues/113.

source 'http://rubygems.org'

gem 'rubocop', '1.68.0'
gem 'rubocop-rake'
gem 'rubocop-rspec'
Loading