diff --git a/.travis.yml b/.travis.yml index 8bcfc97..1cf4b3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ rvm: - 2.2 - rbx-2 - ruby-head + - jruby-head env: - RAILS_ENV=test COVERAGE=true @@ -22,3 +23,4 @@ matrix: allow_failures: - rvm: rbx-2 - rvm: ruby-head + - rvm: jruby-head diff --git a/Gemfile b/Gemfile index 9ca9943..e9ca6b5 100644 --- a/Gemfile +++ b/Gemfile @@ -55,7 +55,8 @@ gem 'flowdock' gem 'omniauth-github' gem 'ri_cal' -gem 'yajl-ruby', :require => "yajl" +gem 'yajl-ruby', platform: 'ruby' +gem 'json', platform: 'jruby' group :development, :test do gem 'airbrake', :require => false @@ -72,7 +73,7 @@ group :development do # better errors gem 'better_errors' - gem 'binding_of_caller' + gem 'binding_of_caller', platform: 'ruby' gem 'meta_request' gem 'foreman', :require => false end @@ -96,7 +97,7 @@ end group :heroku, :production do gem 'rails_12factor', require: !!ENV["HEROKU"] - gem 'unicorn', :require => false + gem 'unicorn', require: false, platform: 'ruby' end gem 'sass-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 2f13207..63a0011 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,12 +51,14 @@ GEM json arel (5.0.1.20140414130214) bcrypt (3.1.9) + bcrypt (3.1.9-java) better_errors (1.0.1) coderay (>= 1.0.0) erubis (>= 2.6.6) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) bson (2.3.0) + bson (2.3.0-java) builder (3.2.2) byebug (2.7.0) columnize (~> 0.3) @@ -132,6 +134,7 @@ GEM fabrication (2.9.0) faraday (0.8.9) multipart-post (~> 1.2.0) + ffi (1.9.6-java) flowdock (0.3.1) httparty (~> 0.7) multi_json @@ -160,6 +163,7 @@ GEM railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.2) + json (1.8.2-java) jwt (0.1.8) multi_json (>= 1.5) kaminari (0.14.1) @@ -168,6 +172,9 @@ GEM kgio (2.9.2) launchy (2.4.3) addressable (~> 2.3) + launchy (2.4.3-java) + addressable (~> 2.3) + spoon (~> 0.0.1) mail (2.6.3) mime-types (>= 1.16, < 3) meta_request (0.2.8) @@ -204,6 +211,7 @@ GEM net-ssh (2.9.1) nokogiri (1.6.5) mini_portile (~> 0.6.0) + nokogiri (1.6.5-java) oauth2 (0.8.1) faraday (~> 0.8) httpauth (~> 0.1) @@ -239,6 +247,11 @@ GEM coderay (~> 1.0.5) method_source (~> 0.8) slop (~> 3.4) + pry (0.9.12.2-java) + coderay (~> 1.0.5) + method_source (~> 0.8) + slop (~> 3.4) + spoon (~> 0.0) pry-byebug (1.3.2) byebug (~> 2.7) pry (~> 0.9.12) @@ -332,6 +345,8 @@ GEM simplecov-html (~> 0.7.1) simplecov-html (0.7.1) slop (3.4.6) + spoon (0.0.4) + ffi sprockets (2.12.3) hike (~> 1.2) multi_json (~> 1.0) @@ -351,6 +366,7 @@ GEM power_assert thor (0.19.1) thread_safe (0.3.4) + thread_safe (0.3.4-java) tilt (1.4.1) timecop (0.6.3) tins (0.12.0) @@ -369,6 +385,8 @@ GEM rack (>= 1.0) websocket-driver (0.5.1) websocket-extensions (>= 0.1.0) + websocket-driver (0.5.1-java) + websocket-extensions (>= 0.1.0) websocket-extensions (0.1.1) xmpp4r (0.5.5) xpath (2.0.0) @@ -376,6 +394,7 @@ GEM yajl-ruby (1.1.0) PLATFORMS + java ruby DEPENDENCIES @@ -411,6 +430,7 @@ DEPENDENCIES htmlentities httparty jquery-rails (~> 2.1.4) + json kaminari (>= 0.14.1) launchy meta_request diff --git a/app/controllers/api/v1/notices_controller.rb b/app/controllers/api/v1/notices_controller.rb index 3b36b6d..f16710f 100644 --- a/app/controllers/api/v1/notices_controller.rb +++ b/app/controllers/api/v1/notices_controller.rb @@ -16,7 +16,7 @@ class Api::V1::NoticesController < ApplicationController end respond_to do |format| - format.any(:html, :json) { render :json => Yajl.dump(results) } # render JSON if no extension specified on path + format.any(:html, :json) { render :json => JSON.dump(results) } # render JSON if no extension specified on path format.xml { render :xml => results } end end diff --git a/app/controllers/api/v1/problems_controller.rb b/app/controllers/api/v1/problems_controller.rb index 8225a03..76f6282 100644 --- a/app/controllers/api/v1/problems_controller.rb +++ b/app/controllers/api/v1/problems_controller.rb @@ -32,7 +32,7 @@ class Api::V1::ProblemsController < ApplicationController end respond_to do |format| - format.any(:html, :json) { render :json => Yajl.dump(results) } # render JSON if no extension specified on path + format.any(:html, :json) { render :json => JSON.dump(results) } # render JSON if no extension specified on path format.xml { render :xml => results } end end diff --git a/app/controllers/api/v1/stats_controller.rb b/app/controllers/api/v1/stats_controller.rb index fcd646f..67f7a92 100644 --- a/app/controllers/api/v1/stats_controller.rb +++ b/app/controllers/api/v1/stats_controller.rb @@ -18,7 +18,7 @@ class Api::V1::StatsController < ApplicationController } respond_to do |format| - format.any(:html, :json) { render :json => Yajl.dump(stats) } # render JSON if no extension specified on path + format.any(:html, :json) { render :json => JSON.dump(stats) } # render JSON if no extension specified on path format.xml { render :xml => stats } end end diff --git a/config/boot.rb b/config/boot.rb index 5e5f0c1..36b1587 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -2,3 +2,11 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'json' + +begin + # try to use Yajl, the json_gem compatibility layer must be loaded after json + require 'yajl/json_gem' +rescue LoadError + # fail silently because json gem is fine +end -- libgit2 0.21.2