-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force Oj install and use for platforms != JRuby
- Add a Ruby extension that will install Oj when the platform is not JRuby - Rollbar::JSON will force to use Oj if it's defined. If not it'll use the MultiJson.current_adapter In summary. We'll use Oj for platforms != JRuby and any other one for JRuby.
- Loading branch information
1 parent
63db163
commit e33f10e
Showing
12 changed files
with
96 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'rubygems' | ||
require 'rubygems/command.rb' | ||
require 'rubygems/dependency_installer.rb' | ||
|
||
OJ_VERSION = '~> 2.12.14' | ||
|
||
def jruby? | ||
defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE) | ||
end | ||
|
||
def install_oj | ||
begin | ||
Gem::Command.build_args = ARGV | ||
|
||
unless jruby? | ||
$stdout.write "Installing oj because platform is not JRuby\n" | ||
|
||
di = Gem::DependencyInstaller.new | ||
di.install 'oj', OJ_VERSION | ||
end | ||
rescue => e | ||
warn "#{$0}: #{e}" | ||
|
||
exit! | ||
end | ||
end | ||
|
||
def write_rakefile | ||
$stdout.write "Writing fake Rakefile\n" | ||
|
||
# Write fake Rakefile for rake since Makefile isn't used | ||
File.open(File.join(File.dirname(__FILE__), 'Rakefile'), 'w') do |f| | ||
f.write('task :default' + $/) | ||
end | ||
end | ||
|
||
install_oj | ||
write_rakefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters