Skip to content

Commit 8810104

Browse files
headiusnobu
authored andcommitted
Move FFI console under lib
Having the separate dir makes testing difficult and doesn't reflect the structure the gem will eventually have. We can filter these files out if necessary when building the CRuby gem.
1 parent a51b74b commit 8810104

File tree

10 files changed

+18
-14
lines changed

10 files changed

+18
-14
lines changed

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ helper = Bundler::GemHelper.instance
77
Rake::TestTask.new(:test) do |t|
88
t.libs << "test" << "test/lib"
99
t.libs << "lib"
10-
t.libs << "jruby" if RUBY_ENGINE == 'jruby'
1110
t.ruby_opts << "-rhelper"
1211
t.test_files = FileList["test/**/test_*.rb"]
1312
end

io-console.gemspec

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ Gem::Specification.new do |s|
2525
if Gem::Platform === s.platform and s.platform =~ 'java'
2626
s.files.delete_if {|f| f.start_with?("ext/")}
2727
s.extensions.clear
28-
s.require_paths.unshift("jruby")
2928
s.files.concat(%w[
30-
jruby/io/console.rb
31-
jruby/io/console/bsd_console.rb
32-
jruby/io/console/common.rb
33-
jruby/io/console/linux_console.rb
34-
jruby/io/console/native_console.rb
35-
jruby/io/console/stty_console.rb
36-
jruby/io/console/stub_console.rb
29+
lib/io/console.rb
30+
lib/io/console/ffi/bsd_console.rb
31+
lib/io/console/ffi/common.rb
32+
lib/io/console/ffi/console.rb
33+
lib/io/console/ffi/linux_console.rb
34+
lib/io/console/ffi/native_console.rb
35+
lib/io/console/ffi/stty_console.rb
36+
lib/io/console/ffi/stub_console.rb
3737
])
3838
end
3939

lib/io/console.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if RUBY_ENGINE == 'ruby'
2+
require_relative 'console.so'
3+
else
4+
require_relative 'console/ffi/console'
5+
end
File renamed without changes.
File renamed without changes.

jruby/io/console.rb renamed to lib/io/console/ffi/console.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@
2121

2222
require 'rbconfig'
2323

24-
require_relative 'console/common'
24+
require_relative 'common'
2525

2626
# If Windows, always use the stub version
2727
if RbConfig::CONFIG['host_os'] =~ /(mswin)|(win32)|(ming)/
28-
require_relative 'console/stub_console'
28+
require_relative 'stub_console'
2929
else
3030

3131
# If Linux or BSD, try to load the native version
3232
if RbConfig::CONFIG['host_os'].downcase =~ /darwin|openbsd|freebsd|netbsd|linux/
3333
begin
3434

3535
# Attempt to load the native Linux and BSD console logic
36-
require_relative 'console/native_console'
36+
require_relative 'native_console'
3737
ready = true
3838

3939
rescue Exception => ex
@@ -48,7 +48,7 @@
4848
if !ready
4949
begin
5050

51-
require_relative 'console/stty_console'
51+
require_relative 'stty_console'
5252
ready = true
5353

5454
rescue Exception
@@ -61,7 +61,7 @@
6161

6262
# If still not ready, just use stubbed version
6363
if !ready
64-
require_relative 'console/stub_console'
64+
require_relative 'stub_console'
6565
end
6666

6767
end
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)