Skip to content

Commit

Permalink
feat: support rubinius
Browse files Browse the repository at this point in the history
  • Loading branch information
tonytonyjan committed Sep 30, 2017
1 parent 330e368 commit 27090ff
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rvm:
- 2.0.0
- 1.9.3
- jruby-19mode
- rbx-3.86
matrix:
include:
# https://github.com/travis-ci/travis-ci/issues/7848
Expand Down
10 changes: 5 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ task compare: :compile do
table.each{|row| puts row.join(' | ')}
end

if RUBY_PLATFORM == 'java'
task :compile do
puts 'Can not compile C extension, fallback to pure Ruby version.'
end
else
if RUBY_ENGINE == 'ruby'
Rake::ExtensionTask.new 'jaro_winkler_ext' do |ext|
ext.lib_dir = 'lib/jaro_winkler'
ext.ext_dir = 'ext/jaro_winkler'
end
else
task :compile do
puts 'Can not compile C extension, fallback to pure Ruby version.'
end
end

Rake::TestTask.new do |t|
Expand Down
6 changes: 1 addition & 5 deletions jaro_winkler.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ Gem::Specification.new do |spec|
spec.version = JaroWinkler::VERSION
spec.authors = ['Jian Weihang']
spec.email = 'tonytonyjan@gmail.com'
if RUBY_PLATFORM == 'java'
spec.platform = 'java'
else
spec.extensions = ['ext/jaro_winkler/extconf.rb']
end
spec.extensions = ['ext/jaro_winkler/extconf.rb'] if RUBY_ENGINE == 'ruby'
spec.summary = 'Ruby & C implementation of Jaro-Winkler distance algorithm which both support UTF-8 string.'
spec.description = %q{It's a implementation of Jaro-Winkler distance algorithm, it uses C extension and will fallback to pure Ruby version in JRuby. Both implementation supports UTF-8 string.}
spec.homepage = 'https://github.com/tonytonyjan/jaro_winkler'
Expand Down
7 changes: 3 additions & 4 deletions lib/jaro_winkler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

require 'jaro_winkler/version'

case RUBY_PLATFORM
when 'java'
require 'jaro_winkler/jaro_winkler_pure'
else
if RUBY_ENGINE == 'ruby'
require 'jaro_winkler/jaro_winkler_ext'
else
require 'jaro_winkler/jaro_winkler_pure'
end

0 comments on commit 27090ff

Please sign in to comment.