tebako-runtime 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f6c57128c83b5982c59977938d7773bc7f0e2041fbdfa134428d804eb8eb85f
4
- data.tar.gz: 84f0480d45a7ccbef56ca5fd7ed7e9de55d5097590b8b9a19caf942a9ac3d592
3
+ metadata.gz: fc9473e24e5664578ca501587c6a55dfcdc8852c3872f2e26d310201f738fa2c
4
+ data.tar.gz: 95e8bfc075a6e97461e495675a268b8fdc877f0ef7643c2a4fda00b97a41517c
5
5
  SHA512:
6
- metadata.gz: 8b9cadb0c12107454922d62e2c0748f25c7aab396d548e4b14fed27e9d3814ef62cfb60087285bfdb21eb5085ddda2843bc3d9bf78662924754b793108230af2
7
- data.tar.gz: ad15b544ecaea6f5853f1de6913bdf4fc45dd2deec2a74b42fe826b9d1610959e649119a0e7892aab455c4c6f4fe6104359cd296bb63c703ee2f8482a404cbea
6
+ metadata.gz: d1c0fdd8a3c0c08cbad7d4acf833ecaf7bb7e05672eb153efe3750c495c7edfbd57959119ba5fffe66a25521dd7332e796d37494f2115bc2ecd4a3b10c23b826
7
+ data.tar.gz: 610f4432bcf2a0c1f292cf9e833598217a4c9e1ce51d72b7de8092e6558eec0e4e57cf5fc5e68855d444ce9eb647ed37beffa712904d1b68e5bf04b88e2683d2
data/README.adoc CHANGED
@@ -3,6 +3,7 @@
3
3
  == A helper Gem for tebako image packager
4
4
 
5
5
  image:https://github.com/maxirmx/tebako-runtime/actions/workflows/test-and-release.yml/badge.svg["Test and release", link="https://github.com/maxirmx/tebako-runtime/actions/workflows/test-and-release.yml"]
6
+ image:https://codecov.io/gh/tamatebako/tebako-runtime/graph/badge.svg?token=CXNsUymRsM["Test coverage", link="https://codecov.io/gh/tamatebako/tebako-runtime"]
6
7
 
7
8
  Tebako is an executable packager. It packages a set of files into a DwarFS file system for read-only purposes.
8
9
 
@@ -22,9 +23,17 @@ tebako-runtime (this Gem) provides support for known Gems that use system calls
22
23
 
23
24
  == Supported Gems
24
25
 
26
+ * https://rubygems.org/gems/excavate/[excavate]
25
27
  * https://rubygems.org/gems/ffi[ffi]
28
+ * https://rubygems.org/gems/jing[jing]
26
29
  * https://rubygems.org/gems/mn2pdf[mn2pdf]
27
30
  * https://rubygems.org/gems/mnconvert[mnconvert]
28
31
  * https://rubygems.org/gems/ruby-jing[ruby-jing]
29
32
  * https://rubygems.org/gems/sassc[sassc]
30
33
  * https://rubygems.org/gems/seven-zip[seven-zip]
34
+
35
+ == Additional features
36
+ In addition to gem support tebako-runtime provides a set of utilities to help with tebako image creation:
37
+
38
+ * Embedded root SSL certificates's bundle
39
+ * https://rubygems.org/gems/ffi-compiler[ffi-compiler], https://rubygems.org/gems/ffi-compiler2[ffi-compiler2] support
@@ -28,7 +28,7 @@
28
28
  # Unpack jing.jar
29
29
  class Jing
30
30
  tmp = DEFAULT_JAR
31
- remove_const("DEFAULT_JAR")
31
+ remove_const("DEFAULT_JAR") if const_defined?("DEFAULT_JAR")
32
32
  DEFAULT_JAR = TebakoRuntime.extract_memfs(tmp)
33
33
 
34
34
  alias original_initialize initialize
@@ -26,10 +26,27 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  # Unpack mn2pdf.jar
29
- module Mn2pdf
30
- remove_const("MN2PDF_JAR_PATH")
31
- MN2PDF_JAR_PATH = TebakoRuntime.extract_memfs(File.join(TebakoRuntime.full_gem_path("mn2pdf"), "bin", "mn2pdf.jar"))
32
29
 
30
+ module TebakoRuntime
31
+ MN2PDF_J_PATH = TebakoRuntime.extract_memfs(File.join(TebakoRuntime.full_gem_path("mn2pdf"), "bin",
32
+ "mn2pdf.jar"))
33
+ end
34
+
35
+ if Mn2pdf.const_defined?("MN2PDF_JAR_PATH")
36
+ module Mn2pdf
37
+ remove_const("MN2PDF_JAR_PATH")
38
+ MN2PDF_JAR_PATH = TebakoRuntime::MN2PDF_J_PATH
39
+ end
40
+ end
41
+
42
+ if Jvm.const_defined?("MN2PDF_JAR_PATH")
43
+ module Jvm
44
+ remove_const("MN2PDF_JAR_PATH")
45
+ MN2PDF_JAR_PATH = TebakoRuntime::MN2PDF_J_PATH
46
+ end
47
+ end
48
+
49
+ module Mn2pdf
33
50
  singleton_class.send(:alias_method, :convert_orig, :convert)
34
51
  singleton_class.send(:remove_method, :convert)
35
52
 
@@ -27,7 +27,7 @@
27
27
 
28
28
  # Unpack mn2pdf.jar
29
29
  module MnConvert
30
- remove_const("MNCONVERT_JAR_PATH")
30
+ remove_const("MNCONVERT_JAR_PATH") if const_defined?("MNCONVERT_JAR_PATH")
31
31
  MNCONVERT_JAR_PATH = TebakoRuntime.extract_memfs(File.join(TebakoRuntime.full_gem_path("mnconvert"), "bin",
32
32
  "mnconvert.jar"))
33
33
 
@@ -35,33 +35,46 @@ require_relative "string"
35
35
  # Module TebakoRuntime
36
36
  # Methods to extract files from memfs to temporary folder
37
37
  module TebakoRuntime
38
- COMPILER_MEMFS = RUBY_PLATFORM =~ /mswin|mingw/ ? "A:/__tebako_memfs__" : "/__tebako_memfs__"
39
- COMPILER_MEMFS_LIB_CACHE = Pathname.new(Dir.mktmpdir("tebako-runtime-"))
38
+ def self.initialize_compiler_memfs_lib_cache
39
+ Pathname.new(Dir.mktmpdir("tebako-runtime-"))
40
+ rescue StandardError
41
+ return nil unless defined?($tebako_original_pwd) && !$tebako_original_pwd.nil? # rubocop:disable Style/GlobalVars
40
42
 
41
- class << self
42
- def extract(file, wild, extract_path)
43
- files = if wild
44
- Dir.glob("#{File.dirname(file)}/*#{File.extname(file)}")
45
- else
46
- [file]
47
- end
48
- FileUtils.cp_r files, extract_path
43
+ begin
44
+ Pathname.new(Dir.mktmpdir("tebako-runtime-", $tebako_original_pwd)) # rubocop:disable Style/GlobalVars
45
+ rescue StandardError
46
+ nil
49
47
  end
48
+ end
49
+
50
+ COMPILER_MEMFS = RUBY_PLATFORM =~ /mswin|mingw/ ? "A:/__tebako_memfs__" : "/__tebako_memfs__"
51
+ COMPILER_MEMFS_LIB_CACHE = initialize_compiler_memfs_lib_cache
52
+ exit if COMPILER_MEMFS_LIB_CACHE.nil?
50
53
 
51
- # wild == true means "also extract other files with the same extension"
52
- def extract_memfs(file, wild: false, cache_path: COMPILER_MEMFS_LIB_CACHE)
53
- is_quoted = file.quoted?
54
- file = file.unquote if is_quoted
55
- return is_quoted ? file.quote : file unless File.exist?(file) && file.start_with?(COMPILER_MEMFS)
54
+ def self.extract(file, wild, extract_path)
55
+ files = if wild
56
+ Dir.glob("#{File.dirname(file)}/*#{File.extname(file)}")
57
+ else
58
+ [file]
59
+ end
60
+ FileUtils.cp_r files, extract_path
61
+ end
56
62
 
57
- memfs_extracted_file = cache_path + File.basename(file)
58
- extract(file, wild, cache_path) unless memfs_extracted_file.exist?
63
+ # wild == true means "also extract other files with the same extension"
64
+ def self.extract_memfs(file, wild: false, cache_path: COMPILER_MEMFS_LIB_CACHE)
65
+ is_quoted = file.quoted?
66
+ file = file.unquote if is_quoted
67
+ return is_quoted ? file.quote : file unless File.exist?(file) && file.start_with?(COMPILER_MEMFS)
59
68
 
60
- is_quoted ? memfs_extracted_file.to_path.quote : memfs_extracted_file.to_path
61
- end
69
+ memfs_extracted_file = cache_path + File.basename(file)
70
+ extract(file, wild, cache_path) unless memfs_extracted_file.exist?
71
+
72
+ is_quoted ? memfs_extracted_file.to_path.quote : memfs_extracted_file.to_path
62
73
  end
63
74
  end
64
75
 
65
76
  at_exit do
77
+ return if TebakoRuntime::COMPILER_MEMFS_LIB_CACHE.nil?
78
+
66
79
  FileUtils.remove_dir(TebakoRuntime::COMPILER_MEMFS_LIB_CACHE.to_path, true)
67
80
  end
@@ -26,5 +26,5 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  module TebakoRuntime
29
- VERSION = "0.5.2"
29
+ VERSION = "0.5.4"
30
30
  end
@@ -65,5 +65,7 @@ Gem::Specification.new do |spec|
65
65
  spec.add_development_dependency "mnconvert", "~> 1.54"
66
66
  spec.add_development_dependency "ruby-jing", "~> 0.0.3"
67
67
  spec.add_development_dependency "sassc", "~> 2.4"
68
+ spec.add_development_dependency "simplecov"
69
+ spec.add_development_dependency "simplecov-cobertura"
68
70
  spec.add_development_dependency "sinatra", "~> 4.0"
69
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tebako-runtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-26 00:00:00.000000000 Z
11
+ date: 2024-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -136,6 +136,34 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '2.4'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov-cobertura
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: sinatra
141
169
  requirement: !ruby/object:Gem::Requirement