tebako-runtime 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f6c57128c83b5982c59977938d7773bc7f0e2041fbdfa134428d804eb8eb85f
4
- data.tar.gz: 84f0480d45a7ccbef56ca5fd7ed7e9de55d5097590b8b9a19caf942a9ac3d592
3
+ metadata.gz: 55d42da9bcdd1ffbcf8102951cd270c07ed0408e9c135b4fb6d1c06bc3e9f601
4
+ data.tar.gz: ff544cf2dad24760b3ff71672c91fc74aec415f912bfce948acb22abc137b7eb
5
5
  SHA512:
6
- metadata.gz: 8b9cadb0c12107454922d62e2c0748f25c7aab396d548e4b14fed27e9d3814ef62cfb60087285bfdb21eb5085ddda2843bc3d9bf78662924754b793108230af2
7
- data.tar.gz: ad15b544ecaea6f5853f1de6913bdf4fc45dd2deec2a74b42fe826b9d1610959e649119a0e7892aab455c4c6f4fe6104359cd296bb63c703ee2f8482a404cbea
6
+ metadata.gz: 52c8b58193ec9bf05a003079c184149c270582fae74b4df87bf05dde8bb837d3311e6e2ebf5908211a499f3fdd3ab23c0a97da9091d9efaade384308d1fcd8dd
7
+ data.tar.gz: '082b88d3712b7bfbfa451939e0cc881b5a20835f4856fc854cb72a39b31787d26df8d50bdc754360a556974a61f67f4ab719eb86ef187f4cb25986f1730e47d5'
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
@@ -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.3"
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.3
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-10 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