summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-12-29 16:16:08 -0800
committerGitHub <noreply@github.com>2019-12-29 16:16:08 -0800
commita9afab8e2175276bc7ccaf5ac5d2af07a250fbff (patch)
tree265ac83193e9a63d65d3698d620d226fb6c7f67b
parentdd0232bf6107e64321a36da3348ab8cc8e5046dd (diff)
parent63be9508b745b094aa0226bb57062547e9cf8fb9 (diff)
downloadffi-yajl-a9afab8e2175276bc7ccaf5ac5d2af07a250fbff.tar.gz
Merge pull request #105 from chef/relative
Substitute require for require_relative
-rw-r--r--lib/ffi_yajl.rb10
-rw-r--r--lib/ffi_yajl/benchmark/encode.rb2
-rw-r--r--lib/ffi_yajl/benchmark/encode_profile.rb2
-rw-r--r--lib/ffi_yajl/benchmark/parse.rb2
-rw-r--r--lib/ffi_yajl/benchmark/parse_profile.rb2
-rw-r--r--lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb2
-rw-r--r--lib/ffi_yajl/ext.rb6
-rw-r--r--lib/ffi_yajl/ffi.rb10
8 files changed, 18 insertions, 18 deletions
diff --git a/lib/ffi_yajl.rb b/lib/ffi_yajl.rb
index 1111775..20979a1 100644
--- a/lib/ffi_yajl.rb
+++ b/lib/ffi_yajl.rb
@@ -35,16 +35,16 @@
# - Then we try the c-ext and rescue into ffi that fails
#
if ENV["FORCE_FFI_YAJL"] == "ext"
- require "ffi_yajl/ext"
+ require_relative "ffi_yajl/ext"
elsif ENV["FORCE_FFI_YAJL"] == "ffi"
- require "ffi_yajl/ffi"
+ require_relative "ffi_yajl/ffi"
elsif RUBY_PLATFORM == "java"
- require "ffi_yajl/ffi"
+ require_relative "ffi_yajl/ffi"
else
begin
- require "ffi_yajl/ext"
+ require_relative "ffi_yajl/ext"
rescue LoadError
warn "failed to load the ffi-yajl c-extension, falling back to ffi interface"
- require "ffi_yajl/ffi"
+ require_relative "ffi_yajl/ffi"
end
end
diff --git a/lib/ffi_yajl/benchmark/encode.rb b/lib/ffi_yajl/benchmark/encode.rb
index 17e12cc..81c1d26 100644
--- a/lib/ffi_yajl/benchmark/encode.rb
+++ b/lib/ffi_yajl/benchmark/encode.rb
@@ -13,7 +13,7 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
else
puts "INFO: skipping yajl-ruby on jruby"
end
-require "ffi_yajl"
+require_relative "../../ffi_yajl"
begin
require "json"
rescue LoadError
diff --git a/lib/ffi_yajl/benchmark/encode_profile.rb b/lib/ffi_yajl/benchmark/encode_profile.rb
index 468f88b..153912e 100644
--- a/lib/ffi_yajl/benchmark/encode_profile.rb
+++ b/lib/ffi_yajl/benchmark/encode_profile.rb
@@ -2,7 +2,7 @@
# See MIT-LICENSE
require "rubygems"
-require "ffi_yajl"
+require_relative "../../ffi_yajl"
begin
require "perftools"
rescue LoadError
diff --git a/lib/ffi_yajl/benchmark/parse.rb b/lib/ffi_yajl/benchmark/parse.rb
index ad0091c..431f0a9 100644
--- a/lib/ffi_yajl/benchmark/parse.rb
+++ b/lib/ffi_yajl/benchmark/parse.rb
@@ -1,7 +1,7 @@
require "rubygems"
require "benchmark"
require "yajl"
-require "ffi_yajl"
+require_relative "../../ffi_yajl"
if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
begin
require "yajl"
diff --git a/lib/ffi_yajl/benchmark/parse_profile.rb b/lib/ffi_yajl/benchmark/parse_profile.rb
index 4b396b4..cccb6db 100644
--- a/lib/ffi_yajl/benchmark/parse_profile.rb
+++ b/lib/ffi_yajl/benchmark/parse_profile.rb
@@ -2,7 +2,7 @@
# See MIT-LICENSE
require "rubygems"
-require "ffi_yajl"
+require_relative "../../ffi_yajl"
begin
require "perftools"
rescue LoadError
diff --git a/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb b/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
index 2c4021a..bdfee7c 100644
--- a/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
+++ b/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
@@ -2,7 +2,7 @@
# See MIT-LICENSE
require "rubygems"
-require "ffi_yajl"
+require_relative "../../ffi_yajl"
module FFI_Yajl
class Benchmark
diff --git a/lib/ffi_yajl/ext.rb b/lib/ffi_yajl/ext.rb
index f7bbcfd..e6a7e6d 100644
--- a/lib/ffi_yajl/ext.rb
+++ b/lib/ffi_yajl/ext.rb
@@ -22,10 +22,10 @@
require "rubygems"
-require "ffi_yajl/encoder"
-require "ffi_yajl/parser"
+require_relative "encoder"
+require_relative "parser"
require "ffi_yajl/ext/dlopen"
-require "ffi_yajl/map_library_name"
+require_relative "map_library_name"
# needed so the encoder c-code can find these symbols
require "stringio"
diff --git a/lib/ffi_yajl/ffi.rb b/lib/ffi_yajl/ffi.rb
index 25bb852..c6601f0 100644
--- a/lib/ffi_yajl/ffi.rb
+++ b/lib/ffi_yajl/ffi.rb
@@ -31,7 +31,7 @@ rescue LoadError
exit 1
end
-require "ffi_yajl/map_library_name"
+require_relative "map_library_name"
module FFI_Yajl
extend ::FFI::Library
@@ -137,17 +137,17 @@ module FFI_Yajl
attach_function :yajl_gen_clear, [:yajl_gen], :void
end
-require "ffi_yajl/encoder"
-require "ffi_yajl/parser"
+require_relative "encoder"
+require_relative "parser"
module FFI_Yajl
class Parser
- require "ffi_yajl/ffi/parser"
+ require_relative "ffi/parser"
include FFI_Yajl::FFI::Parser
end
class Encoder
- require "ffi_yajl/ffi/encoder"
+ require_relative "ffi/encoder"
include FFI_Yajl::FFI::Encoder
end
end