Skip to content

Commit

Permalink
Adjust namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
lloeki committed Oct 23, 2020
1 parent b7e5613 commit 52d660d
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
2 changes: 1 addition & 1 deletion ext/libv8-node/.location.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--- !ruby/object:Libv8Node::Location::Vendor {}
--- !ruby/object:Libv8::Node::Location::Vendor {}

2 changes: 1 addition & 1 deletion ext/libv8-node/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 9 additions & 7 deletions ext/libv8-node/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -20,24 +22,24 @@ 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!
return exit_status
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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion ext/libv8-node/paths.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rbconfig'
require 'shellwords'

module Libv8Node
module Libv8; end

module Libv8::Node
module Paths
module_function

Expand Down
2 changes: 1 addition & 1 deletion lib/libv8-node.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
require 'libv8_node'
require 'libv8/node'
7 changes: 4 additions & 3 deletions lib/libv8_node.rb → lib/libv8/node.rb
Original file line number Diff line number Diff line change
@@ -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

4 changes: 3 additions & 1 deletion lib/libv8_node/version.rb → lib/libv8/node/version.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions libv8-node.gemspec
Original file line number Diff line number Diff line change
@@ -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 = ['']
Expand Down

0 comments on commit 52d660d

Please sign in to comment.