From 52d660d0af84142eff611a7bfb9d3bd46e421609 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Fri, 23 Oct 2020 17:10:32 +0200 Subject: [PATCH] Adjust namespace --- Rakefile | 2 +- ext/libv8-node/.location.yml | 2 +- ext/libv8-node/extconf.rb | 2 +- ext/libv8-node/location.rb | 16 +++++++++------- ext/libv8-node/paths.rb | 4 +++- lib/libv8-node.rb | 2 +- lib/{libv8_node.rb => libv8/node.rb} | 7 ++++--- lib/{libv8_node => libv8/node}/version.rb | 4 +++- libv8-node.gemspec | 4 ++-- 9 files changed, 25 insertions(+), 18 deletions(-) rename lib/{libv8_node.rb => libv8/node.rb} (65%) rename lib/{libv8_node => libv8/node}/version.rb (75%) diff --git a/Rakefile b/Rakefile index cb2da26..bc3a8bf 100644 --- a/Rakefile +++ b/Rakefile @@ -26,7 +26,7 @@ task :binary => :compile do # We don't need most things for the binary gemspec.files = [] - gemspec.files += ['lib/libv8-node.rb', 'lib/libv8_node.rb', 'lib/libv8_node/version.rb'] + gemspec.files += ['lib/libv8-node.rb', 'lib/libv8/node.rb', 'lib/libv8/node/version.rb'] gemspec.files += ['ext/libv8-node/location.rb', 'ext/libv8-node/paths.rb'] gemspec.files += ['ext/libv8-node/.location.yml'] diff --git a/ext/libv8-node/.location.yml b/ext/libv8-node/.location.yml index 8ab0837..7e25414 100644 --- a/ext/libv8-node/.location.yml +++ b/ext/libv8-node/.location.yml @@ -1,2 +1,2 @@ ---- !ruby/object:Libv8Node::Location::Vendor {} +--- !ruby/object:Libv8::Node::Location::Vendor {} diff --git a/ext/libv8-node/extconf.rb b/ext/libv8-node/extconf.rb index 684abe4..c3d862c 100644 --- a/ext/libv8-node/extconf.rb +++ b/ext/libv8-node/extconf.rb @@ -2,7 +2,7 @@ create_makefile('libv8-node') #require File.expand_path('../location', __FILE__) -#location = Libv8Node::Location::Vendor.new +#location = Libv8::Node::Location::Vendor.new #exit location.install! exit 0 diff --git a/ext/libv8-node/location.rb b/ext/libv8-node/location.rb index e50fb4d..563e6e6 100644 --- a/ext/libv8-node/location.rb +++ b/ext/libv8-node/location.rb @@ -2,7 +2,9 @@ require 'pathname' require File.expand_path '../paths', __FILE__ -module Libv8Node +module Libv8; end + +module Libv8::Node class Location def install! File.open(Pathname(__FILE__).dirname.join('.location.yml'), "w") do |f| @@ -20,7 +22,7 @@ def self.load! class Vendor < Location def install! require File.expand_path '../builder', __FILE__ - builder = Libv8Node::Builder.new + builder = Libv8::Node::Builder.new exit_status = builder.build_libv8! super if exit_status == 0 verify_installation! @@ -28,16 +30,16 @@ def install! end def configure(context = MkmfContext.new) - context.incflags.insert 0, Libv8Node::Paths.include_paths.map{ |p| "-I#{p}" }.join(" ") + " " - context.ldflags.insert 0, Libv8Node::Paths.object_paths.join(" ") + " " + context.incflags.insert 0, Libv8::Node::Paths.include_paths.map{ |p| "-I#{p}" }.join(" ") + " " + context.ldflags.insert 0, Libv8::Node::Paths.object_paths.join(" ") + " " end def verify_installation! - include_paths = Libv8Node::Paths.include_paths + include_paths = Libv8::Node::Paths.include_paths unless include_paths.detect { |p| Pathname(p).join('v8.h').exist? } fail HeaderNotFound, "Unable to locate 'v8.h' in the libv8 header paths: #{include_paths.inspect}" end - Libv8Node::Paths.object_paths.each do |p| + Libv8::Node::Paths.object_paths.each do |p| fail ArchiveNotFound, p unless File.exist? p end end @@ -69,7 +71,7 @@ def initialize(*args) However, your system version of v8 could not be located. Please make sure your system version of v8 that is compatible -with #{Libv8Node::VERSION} installed. You may need to use the +with #{Libv8::Node::VERSION} installed. You may need to use the --with-v8-dir option if it is installed in a non-standard location EOS end diff --git a/ext/libv8-node/paths.rb b/ext/libv8-node/paths.rb index 57dd46a..ef30b86 100644 --- a/ext/libv8-node/paths.rb +++ b/ext/libv8-node/paths.rb @@ -1,7 +1,9 @@ require 'rbconfig' require 'shellwords' -module Libv8Node +module Libv8; end + +module Libv8::Node module Paths module_function diff --git a/lib/libv8-node.rb b/lib/libv8-node.rb index c4aaf78..632153f 100644 --- a/lib/libv8-node.rb +++ b/lib/libv8-node.rb @@ -1 +1 @@ -require 'libv8_node' +require 'libv8/node' diff --git a/lib/libv8_node.rb b/lib/libv8/node.rb similarity index 65% rename from lib/libv8_node.rb rename to lib/libv8/node.rb index 5945ca1..1d53519 100644 --- a/lib/libv8_node.rb +++ b/lib/libv8/node.rb @@ -1,10 +1,11 @@ -require 'libv8_node/version' +require 'libv8/node/version' require 'libv8-node/location' -module Libv8Node +module Libv8; end + +module Libv8::Node def self.configure_makefile location = Location.load! location.configure end end - diff --git a/lib/libv8_node/version.rb b/lib/libv8/node/version.rb similarity index 75% rename from lib/libv8_node/version.rb rename to lib/libv8/node/version.rb index 79dc880..75a419c 100644 --- a/lib/libv8_node/version.rb +++ b/lib/libv8/node/version.rb @@ -1,4 +1,6 @@ -module Libv8Node +module Libv8; end + +module Libv8::Node VERSION = "12.18.4.0.beta1" NODE_VERSION = "12.18.4" LIBV8_VERSION = "7.8.279.23" # v8/include/v8-version.h diff --git a/libv8-node.gemspec b/libv8-node.gemspec index 2badf00..ace2686 100644 --- a/libv8-node.gemspec +++ b/libv8-node.gemspec @@ -1,9 +1,9 @@ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__) -require 'libv8_node/version' +require 'libv8/node/version' Gem::Specification.new do |s| s.name = 'libv8-node' - s.version = Libv8Node::VERSION + s.version = Libv8::Node::VERSION s.platform = Gem::Platform::RUBY s.authors = [''] s.email = ['']