diff --git a/Makefile b/Makefile index 75b991fd..2493c2c8 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ $(BUILD_DIR)/package/vendor: mkdir -p $(dir $@); cp -R vendor $@ -$(BUILD_DIR)/.package-ready: $(BUILD_DIR)/package/metanorma $(BUILD_DIR)/package/Gemfile $(BUILD_DIR)/package/Gemfile.lock $(BUILD_DIR)/package/cacert.pem.mozilla $(BUILD_DIR)/package/vendor +$(BUILD_DIR)/.package-ready: $(BUILD_DIR)/package/metanorma $(BUILD_DIR)/package/cacert.pem.mozilla $(BUILD_DIR)/package/vendor touch $@ $(BUILD_DIR)/bin/metanorma-darwin-x86_64: .archive/tebako/bin/tebako $(BUILD_DIR)/.package-ready diff --git a/bin/metanorma b/bin/metanorma index 00b22f39..4cc1c1cc 100644 --- a/bin/metanorma +++ b/bin/metanorma @@ -1,14 +1,39 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require 'rubygems' -require 'bundler/setup' -require 'openssl' -require 'open-uri' -require 'net/https' +require 'pathname' require 'tempfile' +require 'fileutils' COMPILER_MEMFS = '/__tebako_memfs__' +COMPILER_MEMFS_LIB_CACHE = Pathname.new(Dir.mktmpdir("packed-mn-")) +at_exit { + FileUtils.remove_dir(COMPILER_MEMFS_LIB_CACHE.to_path, true) +} +ENV['BUNDLE_PATH'] = COMPILER_MEMFS_LIB_CACHE.to_s + +require 'bundler/inline' + +gemfile do + source 'https://rubygems.org' + + if Gem.win_platform? + gem "fontist" + gem "net-ssh" + gem "zlib" + end + + gem "ffi" + gem "rake" + gem "sassc" + gem "seven_zip_ruby" + + gem "metanorma-cli", "= 1.5.9" +end + +require 'openssl' +require 'open-uri' +require 'net/https' # Limit Relaton to concurrent fetches of 1 ENV["RELATON_FETCH_PARALLEL"] = "1" @@ -33,12 +58,6 @@ def full_gem_path(gem) end unless Gem.win_platform? # because on windows we use ocra - # https://github.com/pmq20/ruby-packer/blob/master/lib/compiler/constants.rb#L10 - COMPILER_MEMFS_LIB_CACHE = Pathname.new(Dir.mktmpdir("packed-mn-")) - at_exit { - FileUtils.remove_dir(COMPILER_MEMFS_LIB_CACHE.to_path, true) - } - class String def is_quoted self.start_with?('"') && self.end_with?('"')