Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rwz committed Oct 14, 2019
1 parent bf4b472 commit e1f6584
Show file tree
Hide file tree
Showing 21 changed files with 167 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ log
*.gem
.bundle
pkg
Gemfile.lock
gemfiles/*.lock

## RBENV
.ruby-version
Expand Down
79 changes: 52 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,54 @@
bundler_args: --without development
cache: bundler
language: ruby
rvm:
- jruby-18mode
- jruby-19mode
- jruby-9000
- 1.8.7
- 1.9.2
- 1.9.3
- 2.0.0
- 2.1.10
- 2.2.9
- 2.3.6
- 2.4.3
- 2.5.0
- jruby-head
- rbx-2
- ruby-head

matrix:
allow_failures:
- rvm: jruby-head
- rvm: rbx-2
- rvm: ruby-head
fast_finish: true
sudo: false
before_install:
- gem update --system
- gem update --remote bundler
include:
- rvm: 1.8
gemfile: gemfiles/gemfile-1-8
os: linux
dist: trusty
env: SKIP_ADAPTERS=yajl,gson,jr_jackson,nsjsonserialization
- rvm: jruby-18mode
gemfile: gemfiles/gemfile-1-8-jruby
os: linux
dist: trusty
env: SKIP_ADAPTERS=oj,yajl,nsjsonserialization
- rvm: 1.9
gemfile: gemfiles/gemfile-1-9
os: linux
dist: trusty
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: jruby-19mode
gemfile: gemfiles/gemfile-1-9-jruby
os: linux
dist: trusty
env: SKIP_ADAPTERS=oj,yajl,nsjsonserialization
- rvm: 2.0
gemfile: gemfiles/gemfile-2
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: 2.1
gemfile: gemfiles/gemfile-2
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: 2.2
gemfile: gemfiles/gemfile-2
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: 2.3
gemfile: gemfiles/gemfile-2
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: 2.4
gemfile: gemfiles/gemfile-2
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: 2.5
gemfile: gemfiles/gemfile-2
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: 2.6
gemfile: gemfiles/gemfile-2
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: ruby-head
gemfile: gemfiles/gemfile-2
env: SKIP_ADAPTERS=gson,jr_jackson,nsjsonserialization
- rvm: jruby-9000
gemfile: gemfiles/gemfile-2-jruby
env: SKIP_ADAPTERS=oj,yajl,jr_jackson,nsjsonserialization
- rvm: jruby-head
gemfile: gemfiles/gemfile-2-jruby
env: SKIP_ADAPTERS=oj,yajl,jr_jackson,nsjsonserialization
34 changes: 0 additions & 34 deletions Gemfile

This file was deleted.

20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,15 @@ MultiJSON falls back to [OkJson][], a simple, vendorable JSON parser.
This library aims to support and is [tested against][travis] the following Ruby
implementations:

* Ruby 1.8.7
* Ruby 1.9.2
* Ruby 1.9.3
* Ruby 2.0.0
* Ruby 2.1.10
* Ruby 2.2.9
* Ruby 2.4.3
* Ruby 2.5.0
* Ruby 1.8
* Ruby 1.9
* Ruby 2.0
* Ruby 2.1
* Ruby 2.2
* Ruby 2.4
* Ruby 2.5
* Ruby 2.6
* [JRuby][]
* [Rubinius][]
* [MacRuby][] (not tested on Travis CI)

If something doesn't work in one of these implementations, it's a bug.

Expand Down Expand Up @@ -106,7 +104,6 @@ and Pavel Pravosud. See [LICENSE][] for details.

[codeclimate]: https://codeclimate.com/github/intridea/multi_json
[gem]: https://rubygems.org/gems/multi_json
[gemnasium]: https://gemnasium.com/intridea/multi_json
[gson]: https://github.com/avsej/gson.rb
[jrjackson]: https://github.com/guyboertje/jrjackson
[jruby]: http://www.jruby.org/
Expand All @@ -118,7 +115,6 @@ and Pavel Pravosud. See [LICENSE][] for details.
[oj]: https://github.com/ohler55/oj
[okjson]: https://github.com/kr/okjson
[pvc]: http://docs.rubygems.org/read/chapter/16#page74
[rubinius]: http://rubini.us/
[semver]: http://semver.org/
[travis]: http://travis-ci.org/intridea/multi_json
[yajl]: https://github.com/brianmario/yajl-ruby
17 changes: 12 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundler::GemHelper.install_tasks

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:base_spec) do |task|
task.pattern = 'spec/multi_json_spec.rb,spec/options_cache_spec.rb'
task.pattern = 'spec/{multi_json,options_cache}_spec.rb'
end

namespace :adapters do
Expand All @@ -16,10 +16,17 @@ namespace :adapters do
end
end

task :spec => %w(base_spec adapters:oj adapters:yajl adapters:json_gem adapters:json_pure adapters:ok_json adapters:gson adapters:jr_jackson adapters:nsjsonserialization)
task :spec => %w[
base_spec
adapters:oj
adapters:yajl
adapters:json_gem
adapters:json_pure
adapters:ok_json
adapters:gson
adapters:jr_jackson
adapters:nsjsonserialization
]

task :default => :spec
task :test => :spec

require 'yard'
YARD::Rake::YardocTask.new
7 changes: 7 additions & 0 deletions gemfiles/gemfile-1-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source "https://rubygems.org"

gem "json", "~> 1.8", :require => false
gem "json_pure", "~> 1.8", :require => false
gem "oj", "~> 2.18", :require => false

gemspec :path => ".."
8 changes: 8 additions & 0 deletions gemfiles/gemfile-1-8-jruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "json", "~> 1.8", :require => false
gem "json_pure", "~> 1.8", :require => false
gem "gson", ">= 0.6", :require => false
gem "jrjackson", "~> 0.3.4", :require => false

gemspec :path => ".."
8 changes: 8 additions & 0 deletions gemfiles/gemfile-1-9
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "json", "~> 1.8", require: false
gem "json_pure", "~> 1.8", require: false
gem "oj", "~> 2.18", require: false
gem "yajl-ruby", "~> 1.3", require: false

gemspec :path => ".."
8 changes: 8 additions & 0 deletions gemfiles/gemfile-1-9-jruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "json", "~> 1.8", require: false
gem "json_pure", "~> 1.8", require: false
gem "gson", ">= 0.6", require: false
gem "jrjackson", "~> 0.3.4", require: false

gemspec :path => ".."
8 changes: 8 additions & 0 deletions gemfiles/gemfile-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "json", "~> 2.0", require: false
gem "json_pure", "~> 2.0", require: false
gem "oj", "~> 2.18", require: false
gem "yajl-ruby", "~> 1.3", require: false

gemspec path: ".."
7 changes: 7 additions & 0 deletions gemfiles/gemfile-2-jruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source "https://rubygems.org"

gem "json", "~> 2.0", require: false
gem "json_pure", "~> 2.0", require: false
gem "gson", ">= 0.6", require: false

gemspec path: ".."
3 changes: 3 additions & 0 deletions lib/multi_json/adapters/nsjsonserialization.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This adapter is here for legacy reasons. We can't really test it, so it's hard
# to tell if it's even working properly. If you're still using it, please
# consider migrating to any other adapter out there.
framework 'Foundation'
require 'multi_json/adapters/ok_json'

Expand Down
5 changes: 3 additions & 2 deletions multi_json.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ Gem::Specification.new do |spec|
spec.version = MultiJson::Version

spec.required_rubygems_version = ">= 1.3.5"
spec.add_development_dependency "bundler", "~> 1.0"
end
spec.add_development_dependency "rake", "~> 10.5"
spec.add_development_dependency "rspec", "~> 3.9"
end
2 changes: 1 addition & 1 deletion spec/gson_adapter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

exit true unless jruby?
exit 0 if skip_adapter?('gson')

require 'shared/adapter'
require 'multi_json/adapters/gson'
Expand Down
2 changes: 1 addition & 1 deletion spec/jr_jackson_adapter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

exit true unless jruby?
exit 0 if skip_adapter?('jr_jackson')

require 'shared/adapter'
require 'multi_json/adapters/jr_jackson'
Expand Down
37 changes: 6 additions & 31 deletions spec/multi_json_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@
# Clear cache variable already set by previous tests
MultiJson.send(:remove_instance_variable, :@adapter) if MultiJson.instance_variable_defined?(:@adapter)

if jruby?
if jruby? && !skip_adapter?('jr_jackson')
expect(MultiJson.adapter.to_s).to eq('MultiJson::Adapters::JrJackson')
elsif jruby?
expect(MultiJson.adapter.to_s).to eq('MultiJson::Adapters::JsonGem')
else
expect(MultiJson.adapter.to_s).to eq('MultiJson::Adapters::Oj')
end
Expand Down Expand Up @@ -126,6 +128,8 @@
end

it 'JSON gem does not create symbols on parse' do
skip 'breaks in JRuby' if jruby?

MultiJson.with_engine(:json_gem) do
MultiJson.load('{"json_class":"ZOMG"}')

Expand All @@ -135,35 +139,6 @@
end
end

unless jruby?
it 'Oj does not create symbols on parse' do
MultiJson.with_engine(:oj) do
MultiJson.load('{"json_class":"ZOMG"}')

expect do
MultiJson.load('{"json_class":"OMG"}')
end.to_not change { Symbol.all_symbols.count }
end
end

context 'with Oj.default_settings' do
around do |example|
options = Oj.default_options
Oj.default_options = {:symbol_keys => true}
MultiJson.with_engine(:oj) { example.call }
Oj.default_options = options
end

it 'ignores global settings' do
MultiJson.with_engine(:oj) do
example = '{"a": 1, "b": 2}'
expected = {'a' => 1, 'b' => 2}
expect(MultiJson.load(example)).to eq(expected)
end
end
end
end

describe 'default options' do
after(:all) { MultiJson.load_options = MultiJson.dump_options = nil }

Expand All @@ -182,7 +157,7 @@
it_behaves_like 'has options', MultiJson

describe 'aliases' do
if jruby?
unless skip_adapter?('jr_jackson')
describe 'jrjackson' do
after { expect(MultiJson.adapter).to eq(MultiJson::Adapters::JrJackson) }

Expand Down
2 changes: 1 addition & 1 deletion spec/nsjsonserialization_adapter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

exit true unless macruby?
exit 0 if skip_adapter?("nsjsonserialization")

require 'shared/adapter'
require 'multi_json/adapters/nsjsonserialization'
Expand Down
Loading

0 comments on commit e1f6584

Please sign in to comment.