Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 5bd765a

Browse files
committed
Ensure libv8 is required when rubygems is not installed
Do not break the build process if rubygems cannot be required. Instread try to require libv8 without selecting a version with gem and warn the user about it. This is necessary as ruby 1.8 does not ship with rubygems by default.
1 parent 1711364 commit 5bd765a

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

ext/v8/extconf.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,18 @@
1616
$CFLAGS += " -O0 -ggdb3"
1717
end
1818

19-
require 'rubygems'
20-
gem 'libv8', '~> 3.15.11'
21-
require 'libv8'
19+
LIBV8_COMPATIBILITY = '~> 3.15.11'
20+
21+
begin
22+
require 'rubygems'
23+
gem 'libv8', LIBV8_COMPATIBILITY
24+
rescue Gem::LoadError
25+
warn "Warning! Selecting libv8 #{LIBV8_COMPATIBILITY} failed. Has it been added to the gemspec?"
26+
rescue LoadError
27+
warn "Warning! Could not load rubygems. Please make sure you have libv8 #{LIBV8_COMPATIBILITY} installed."
28+
ensure
29+
require 'libv8'
30+
end
2231

2332
Libv8.configure_makefile
2433

0 commit comments

Comments
 (0)