Skip to content

Commit

Permalink
metanorma/eccma-iso-scor-vocab#1 embed Gemfile into metanroma script
Browse files Browse the repository at this point in the history
  • Loading branch information
CAMOBAP committed Feb 16, 2022
1 parent 9459372 commit 3647b57
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 31 additions & 11 deletions bin/metanorma
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
#!/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
FileUtils.mkdir_p(COMPILER_MEMFS_LIB_CACHE / 'ruby/2.7.0')
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"
Expand All @@ -33,12 +59,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?('"')
Expand Down

0 comments on commit 3647b57

Please sign in to comment.