Sha256: db358350b8a43d8fe48e3298679aa227a040e6f8c60a20f34a0f7e970c62eaf0

Contents?: true

Size: 1.53 KB

Versions: 16

Compression:

Stored size: 1.53 KB

Contents

unless $LOAD_PATH.include?(File.expand_path('../../lib', __dir__)) # rubocop:disable Style/IfUnlessModifier
  $LOAD_PATH.unshift(File.expand_path('../../lib', __dir__))
end
require 'libv8/node/version'

module Libv8::Node
  class BuilderError < StandardError; end

  class Builder
    def build_libv8!
      version = Libv8::Node::NODE_VERSION
      download_node(version)  || raise(BuilderError, "failed to download node #{NODE_VERSION}")
      extract_node(version)   || raise(BuilderError, "failed to extract node #{NODE_VERSION}")
      build_libv8(version)    || raise(BuilderError, "failed to build libv8 #{NODE_VERSION}")
      build_monolith(version) || raise(BuilderError, "failed to build monolith #{NODE_VERSION}")
      inject_libv8(version)   || raise(BuilderError, "failed to inject libv8 #{NODE_VERSION}")

      0
    end

    def remove_intermediates!
      FileUtils.rm_rf(File.expand_path('../../src', __dir__))
    end

    private

    def download_node(version)
      system(script('download-node'), version)
    end

    def extract_node(version)
      system(script('extract-node'), version)
    end

    def build_libv8(version)
      system(script('build-libv8'), version)
    end

    def build_monolith(version)
      system(script('build-monolith'), version)
    end

    def inject_libv8(version)
      system(script('inject-libv8'), version)
    end

    def script(name)
      File.expand_path("../../libexec/#{name}", __dir__).tap do |v|
        puts "==== in #{Dir.pwd}"
        puts "==== running #{v}"
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
libv8-node-22.7.0.4 ext/libv8-node/builder.rb
libv8-node-22.7.0.3 ext/libv8-node/builder.rb
libv8-node-22.7.0.2 ext/libv8-node/builder.rb
libv8-node-22.7.0.1 ext/libv8-node/builder.rb
libv8-node-22.5.1.0 ext/libv8-node/builder.rb
libv8-node-21.7.2.0 ext/libv8-node/builder.rb
libv8-node-20.12.1.0 ext/libv8-node/builder.rb
libv8-node-18.19.1.0 ext/libv8-node/builder.rb
libv8-node-18.19.0.0 ext/libv8-node/builder.rb
libv8-node-18.16.0.0 ext/libv8-node/builder.rb
libv8-node-16.20.0.0 ext/libv8-node/builder.rb
libv8-node-20.2.0.0 ext/libv8-node/builder.rb
libv8-node-19.9.0.0 ext/libv8-node/builder.rb
libv8-node-18.13.0.1 ext/libv8-node/builder.rb
libv8-node-17.9.1.1 ext/libv8-node/builder.rb
libv8-node-16.19.0.1 ext/libv8-node/builder.rb