tebako 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CMakeLists.txt +21 -29
  3. data/README.adoc +53 -28
  4. data/Rakefile +1 -1
  5. data/common.env +1 -1
  6. data/lib/tebako/cli.rb +23 -0
  7. data/lib/tebako/cli_helpers.rb +3 -3
  8. data/lib/tebako/packager/pass1.rb +3 -1
  9. data/lib/tebako/packager/pass2.rb +64 -274
  10. data/{tests-2/fixtures/gems-expressir/gems-expressir.rb → lib/tebako/packager/patch_helpers.rb} +30 -5
  11. data/lib/tebako/packager/patch_literals.rb +255 -0
  12. data/lib/tebako/version.rb +1 -1
  13. data/tebako.gemspec +1 -1
  14. data/version.txt +1 -1
  15. metadata +4 -62
  16. data/tests/scripts/cross-tests.sh +0 -34
  17. data/tests/scripts/functional-tests.sh +0 -335
  18. data/tests/test-00/test.rb +0 -4
  19. data/tests/test-01/tebako-test-run.rb +0 -5
  20. data/tests/test-09/tebako-test-0.0.1.gem +0 -0
  21. data/tests/test-11/bin/tebako-test-run.rb +0 -10
  22. data/tests/test-11/lib/tebako-test.rb +0 -20
  23. data/tests/test-11/tebako-test.gemspec +0 -15
  24. data/tests/test-12/tebako-test-a.gemspec +0 -15
  25. data/tests/test-12/tebako-test-b.gemspec +0 -15
  26. data/tests/test-13/bin/tebako-test-run.rb +0 -10
  27. data/tests/test-13/lib/tebako-test.rb +0 -20
  28. data/tests/test-13/tebako-test.gemspec +0 -15
  29. data/tests/test-15/Gemfile +0 -8
  30. data/tests/test-15/Rakefile +0 -4
  31. data/tests/test-15/bin/tebako-test-run.rb +0 -10
  32. data/tests/test-15/lib/tebako/bundle/test/version.rb +0 -9
  33. data/tests/test-15/lib/tebako/bundle/test.rb +0 -29
  34. data/tests/test-15/tebako-bundle-test.gemspec +0 -30
  35. data/tests/test-16/Gemfile +0 -8
  36. data/tests/test-16/Rakefile +0 -4
  37. data/tests/test-16/bin/tebako-test-run.rb +0 -10
  38. data/tests/test-16/lib/tebako/bundle/test/version.rb +0 -9
  39. data/tests/test-16/lib/tebako/bundle/test.rb +0 -29
  40. data/tests/test-16/tebako-bundle-test.gemspec +0 -24
  41. data/tests/test-18/Gemfile +0 -5
  42. data/tests/test-18/tebako-test-run.rb +0 -12
  43. data/tests/test-19/Gemfile +0 -6
  44. data/tests/test-19/tebako-test-run.rb +0 -11
  45. data/tests-2/fixtures/gems-bundler/Gemfile +0 -4
  46. data/tests-2/fixtures/gems-bundler/gems-bundler.rb +0 -34
  47. data/tests-2/fixtures/gems-byebug/Gemfile +0 -5
  48. data/tests-2/fixtures/gems-byebug/gems-byebug.rb +0 -31
  49. data/tests-2/fixtures/gems-expressir/Gemfile +0 -7
  50. data/tests-2/fixtures/gems-libmspack/Gemfile +0 -5
  51. data/tests-2/fixtures/gems-libmspack/gems-libmspack.rb +0 -91
  52. data/tests-2/fixtures/gems-sassc/Gemfile +0 -6
  53. data/tests-2/fixtures/gems-sassc/base_style/all.scss +0 -1
  54. data/tests-2/fixtures/gems-sassc/base_style/reset.scss +0 -100
  55. data/tests-2/fixtures/gems-sassc/gems-sassc.rb +0 -129
  56. data/tests-2/fixtures/gems-seven-zip/Gemfile +0 -7
  57. data/tests-2/fixtures/gems-seven-zip/gems-seven-zip.rb +0 -53
  58. data/tests-2/fixtures/launcher-coreincl/launcher-coreincl.rb +0 -29
  59. data/tests-2/fixtures/launcher-package/launcher-package.rb +0 -29
  60. data/tests-2/fixtures/launcher-pwd/launcher-pwd.rb +0 -28
  61. data/tests-2/fixtures/launcher-stdinredir/input.txt +0 -1
  62. data/tests-2/fixtures/launcher-stdinredir/launcher-stdinredir.rb +0 -31
  63. data/tests-2/fixtures/launcher-stdoutredir/launcher-stdoutredir.rb +0 -28
  64. data/tests-2/fixtures/patches-dir/level-1/level-2/file-1.txt +0 -1
  65. data/tests-2/fixtures/patches-dir/level-1/level-2/file-2.txt +0 -1
  66. data/tests-2/fixtures/patches-dir/level-1/level-2/file-3.txt +0 -1
  67. data/tests-2/fixtures/patches-dir/patches-dir.rb +0 -154
  68. data/tests-2/fixtures/patches-io-and-file/level-1/level-2/file-1.txt +0 -1
  69. data/tests-2/fixtures/patches-io-and-file/level-1/level-2/file-2.txt +0 -2
  70. data/tests-2/fixtures/patches-io-and-file/level-1/level-2/file-3.txt +0 -1
  71. data/tests-2/fixtures/patches-io-and-file/level-1/link-3 +0 -1
  72. data/tests-2/fixtures/patches-io-and-file/patches-io-and-file.rb +0 -87
  73. data/tests-2/fixtures/patches-main/patches-main.rb +0 -6
  74. data/tests-2/tebako-test.rb +0 -313
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/tebako/bundle/test/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "tebako-bundle-test"
7
- spec.version = Tebako::Bundle::Test::VERSION
8
- spec.authors = ["Ribose"]
9
- spec.email = open.source @ribose.com
10
-
11
- spec.summary = "A simple gem for tebako testing"
12
- spec.homepage = "https://github.com/tamitebako"
13
- spec.license = "Unlicense"
14
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
15
- spec.metadata["homepage_uri"] = spec.homepage
16
-
17
- spec.files = Dir["bin/**/*.rb"] + Dir["lib/**/*.rb"]
18
-
19
- spec.bindir = "bin"
20
- spec.executables << "tebako-test-run.rb"
21
- spec.require_paths = %w[bin lib]
22
-
23
- spec.add_dependency "text-table", "~> 1.2.4"
24
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "text-table", "~> 1.2.4"
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "text-table"
4
-
5
- table = Text::Table.new
6
- table.head = %w[A B]
7
- table.rows = [%w[a1 b1]]
8
- table.rows << %w[a2 b2]
9
-
10
- puts "Hello! This is test-18 talking from inside DwarFS"
11
- puts "You will now see a nice table that will be drawn for you by text-table gem."
12
- puts table
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "byebug"
6
- gem "ffi"
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "ffi"
4
-
5
- # Tebako test module
6
- module TebakoTest
7
- extend FFI::Library
8
- ffi_lib FFI::Library::LIBC
9
- attach_function("cputs", "puts", [:string], :int)
10
- end
11
- TebakoTest.cputs("Hello, World via libc puts using FFI on tebako package")
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
- gem "rake"
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2021-2023, [Ribose Inc](https://www.ribose.com).
4
- # All rights reserved.
5
- # This file is a part of tebako
6
- #
7
- # Redistribution and use in source and binary forms, with or without
8
- # modification, are permitted provided that the following conditions
9
- # are met:
10
- # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
12
- # 2. Redistributions in binary form must reproduce the above copyright
13
- # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
15
- #
16
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
- # POSSIBILITY OF SUCH DAMAGE.
27
-
28
- require "rubygems"
29
- require "bundler"
30
- # requires 'bundler/setup'
31
- require "rake"
32
-
33
- # Just make sure the constant exists
34
- puts "Hello! Bundler welcomes you to the magic world of ruby gems."
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
- gem "byebug"
5
- gem "rake"
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2023, [Ribose Inc](https://www.ribose.com).
4
- # All rights reserved.
5
- # This file is a part of tebako
6
- #
7
- # Redistribution and use in source and binary forms, with or without
8
- # modification, are permitted provided that the following conditions
9
- # are met:
10
- # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
12
- # 2. Redistributions in binary form must reproduce the above copyright
13
- # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
15
- #
16
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
- # POSSIBILITY OF SUCH DAMAGE.
27
-
28
- require "byebug"
29
-
30
- # Just make sure the constant exists
31
- puts "Hello! Byebug welcomes you to the magic world of ruby gems."
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "bundler"
6
- gem "expressir"
7
- gem "ffi"
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "libmspack"
@@ -1,91 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2022-2023, [Ribose Inc](https://www.ribose.com).
4
- # All rights reserved.
5
- # This file is a part of tebako
6
- #
7
- # Redistribution and use in source and binary forms, with or without
8
- # modification, are permitted provided that the following conditions
9
- # are met:
10
- # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
12
- # 2. Redistributions in binary form must reproduce the above copyright
13
- # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
15
- #
16
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
- # POSSIBILITY OF SUCH DAMAGE.
27
-
28
- require "rubygems"
29
- require "bundler/setup"
30
- require "tempfile"
31
-
32
- COMPILER_MEMFS = "/__tebako_memfs__"
33
-
34
- # https://github.com/pmq20/ruby-packer/blob/master/lib/compiler/constants.rb#L10
35
- COMPILER_MEMFS_LIB_CACHE = Pathname.new(Dir.mktmpdir("tebako-tests-"))
36
- at_exit do
37
- FileUtils.remove_dir(COMPILER_MEMFS_LIB_CACHE.to_path, true)
38
- end
39
-
40
- # Extension for String class
41
- # Operations with quotes
42
- class String
43
- def quoted?
44
- start_with?('"') && end_with?('"')
45
- end
46
-
47
- def unquote
48
- chomp('"').reverse.chomp('"').reverse
49
- end
50
-
51
- def quote
52
- "\"#{self}\""
53
- end
54
- end
55
-
56
- def extract_memfs(file, wild: false, extract_path: COMPILER_MEMFS_LIB_CACHE)
57
- is_quoted = file.quoted?
58
- file = file.unquote if is_quoted
59
-
60
- return file unless File.exist?(file) && file.start_with?(COMPILER_MEMFS)
61
-
62
- memfs_extracted_file = extract_path + File.basename(file)
63
- unless memfs_extracted_file.exist?
64
- files = wild ? Dir.glob("#{File.dirname(file)}/*#{File.extname(file)}") : [file]
65
- FileUtils.cp_r files, extract_path
66
- end
67
-
68
- is_quoted ? memfs_extracted_file.to_path.quote : memfs_extracted_file.to_path
69
- end
70
-
71
- require "ffi"
72
-
73
- # HACK: extract temp libraries to use with ffi
74
- # Wrapper for FFI.map_library_name method
75
- module FFI
76
- # https://stackoverflow.com/questions/29907157/how-to-alias-a-class-method-in-rails-model/29907207
77
- singleton_class.send(:alias_method, :map_library_name_orig, :map_library_name)
78
-
79
- # http://tech.tulentsev.com/2012/02/ruby-how-to-override-class-method-with-a-module/
80
- def self.map_library_name(lib)
81
- l = extract_memfs(lib)
82
- puts "#{lib} ==> #{l}"
83
- ll = map_library_name_orig(l)
84
- puts "#{lib} ==> #{l} ==> #{ll}"
85
- ll
86
- end
87
- end
88
- # END of HACK
89
-
90
- require "libmspack"
91
- puts "Hello! libmspack welcomes you to the magic world of ruby gems."
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "bundler"
6
- gem "sassc"
@@ -1 +0,0 @@
1
- @import 'base_style/reset';
@@ -1,100 +0,0 @@
1
- html, body, div, span, applet, object, iframe,
2
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3
- a, abbr, acronym, address, big, cite, code,
4
- del, dfn, em, img, ins, kbd, q, s, samp,
5
- small, strike, strong, sub, sup, tt, var,
6
- b, u, i, center,
7
- ol, ul, li,
8
- fieldset, form, label, legend,
9
- table, caption, tbody, tfoot, thead, tr, th, td,
10
- article, aside, canvas, details, embed,
11
- figure, figcaption, footer, header, hgroup,
12
- menu, output, ruby, section, summary,
13
- time, mark, audio, video {
14
- margin: 0;
15
- padding: 0;
16
- }
17
-
18
- html, body, div, span, applet, object, iframe,
19
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
20
- a, abbr, acronym, address, big, cite, code,
21
- del, dfn, em, img, ins, kbd, q, s, samp,
22
- small, strike, strong, sub, sup, tt, var,
23
- b, u, i, center,
24
- dl, dt, dd, ol, ul, li,
25
- fieldset, form, label, legend,
26
- table, caption, tbody, tfoot, thead, tr, th, td,
27
- article, aside, canvas, details, embed,
28
- figure, figcaption, footer, header, hgroup,
29
- menu, nav, output, ruby, section, summary,
30
- time, mark, audio, video {
31
- border: 0;
32
- font-size: 100%;
33
- }
34
-
35
- html, body, div, span, applet, object, iframe,
36
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
37
- a, abbr, acronym, address, big, cite, code,
38
- del, dfn, em, img, ins, kbd, q, s, samp,
39
- small, strike, strong, tt, var,
40
- b, u, i, center,
41
- dl, dd, ol, ul, li,
42
- fieldset, form, label, legend,
43
- table, caption, tbody, tfoot, thead, tr, th, td,
44
- article, aside, canvas, details, embed,
45
- figure, figcaption, footer, header, hgroup,
46
- menu, nav, output, ruby, section, summary,
47
- time, mark, audio, video {
48
- vertical-align: baseline;
49
- }
50
-
51
- article, aside, details, figcaption, figure,
52
- footer, header, hgroup, menu, nav, section {
53
- display: block;
54
- }
55
-
56
- table {
57
- border-collapse: collapse;
58
- border-spacing: 0;
59
- }
60
-
61
- dl {
62
- display: grid;
63
- grid-template-columns: max-content auto;
64
-
65
- dt, dd {
66
- p {
67
- margin-top: 0;
68
- }
69
- }
70
-
71
- dt {
72
- grid-column-start: 1;
73
- }
74
-
75
- dd {
76
- grid-column-start: 2;
77
- }
78
- }
79
-
80
- b, strong {
81
- font-weight: bold;
82
- }
83
-
84
- div.document-stage-band, div.document-type-band {
85
- background-color: #333333;
86
- }
87
-
88
- a.FootnoteRef + a.FootnoteRef:before {
89
- content: ", ";
90
- vertical-align: super;
91
- }
92
-
93
- .addition {
94
- color: blue;
95
- }
96
-
97
- .deletion {
98
- color: red;
99
- text-decoration: line-through;
100
- }
@@ -1,129 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2021-2023, [Ribose Inc](https://www.ribose.com).
4
- # All rights reserved.
5
- # This file is a part of tebako
6
- #
7
- # Redistribution and use in source and binary forms, with or without
8
- # modification, are permitted provided that the following conditions
9
- # are met:
10
- # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
12
- # 2. Redistributions in binary form must reproduce the above copyright
13
- # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
15
- #
16
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
- # POSSIBILITY OF SUCH DAMAGE.
27
-
28
- # This test is inspired packed-mn
29
- # https://github.com/metanorma/packed-mn
30
-
31
- require "rubygems"
32
- require "bundler/setup"
33
- require "tempfile"
34
-
35
- COMPILER_MEMFS = "/__tebako_memfs__"
36
-
37
- # https://github.com/pmq20/ruby-packer/blob/master/lib/compiler/constants.rb#L10
38
- COMPILER_MEMFS_LIB_CACHE = Pathname.new(Dir.mktmpdir("tebako-tests-"))
39
- at_exit do
40
- FileUtils.remove_dir(COMPILER_MEMFS_LIB_CACHE.to_path, true)
41
- end
42
-
43
- # Extension for String class
44
- # Operations with quotes
45
- class String
46
- def quoted?
47
- start_with?('"') && end_with?('"')
48
- end
49
-
50
- def unquote
51
- chomp('"').reverse.chomp('"').reverse
52
- end
53
-
54
- def quote
55
- "\"#{self}\""
56
- end
57
- end
58
-
59
- def extract_memfs(file, wild: false, extract_path: COMPILER_MEMFS_LIB_CACHE)
60
- is_quoted = file.quoted?
61
- file = file.unquote if is_quoted
62
-
63
- return file unless File.exist?(file) && file.start_with?(COMPILER_MEMFS)
64
-
65
- memfs_extracted_file = extract_path + File.basename(file)
66
- unless memfs_extracted_file.exist?
67
- files = wild ? Dir.glob("#{File.dirname(file)}/*#{File.extname(file)}") : [file]
68
- FileUtils.cp_r files, extract_path
69
- end
70
-
71
- is_quoted ? memfs_extracted_file.to_path.quote : memfs_extracted_file.to_path
72
- end
73
-
74
- require "ffi"
75
-
76
- # HACK: extract temp libraries to use with ffi
77
- # Wrapper for FFI.map_library_name method
78
- module FFI
79
- # https://stackoverflow.com/questions/29907157/how-to-alias-a-class-method-in-rails-model/29907207
80
- singleton_class.send(:alias_method, :map_library_name_orig, :map_library_name)
81
-
82
- # http://tech.tulentsev.com/2012/02/ruby-how-to-override-class-method-with-a-module/
83
- def self.map_library_name(lib)
84
- l = extract_memfs(lib)
85
- ll = map_library_name_orig(l)
86
- puts "#{lib} ==> #{ll}"
87
- ll
88
- end
89
- end
90
- # END of HACK
91
-
92
- require "sassc"
93
-
94
- module SassC
95
- # SassC engine patch
96
- # Scan through load paths; copy files from tebako memfs to
97
- # tmp folders; add tmp folders to load paths
98
- class Engine
99
- alias load_paths_orig load_paths
100
-
101
- def process_path(path)
102
- if path.start_with?(COMPILER_MEMFS)
103
- m = path.sub(COMPILER_MEMFS, COMPILER_MEMFS_LIB_CACHE.to_s)
104
- FileUtils.cp_r(File.join(path, "."), m) if File.exist?(path)
105
- m
106
- else
107
- path
108
- end
109
- end
110
-
111
- def load_paths
112
- paths = (@options[:load_paths] || []) + SassC.load_paths
113
- np = []
114
- paths.each { |p| np << process_path(p) }
115
- pp = np.join(File::PATH_SEPARATOR) unless np.empty?
116
- puts "Using load_path @ '#{pp}'"
117
- pp
118
- end
119
- end
120
- end
121
-
122
- name = File.join(File.dirname(__FILE__), "styles")
123
- SassC.load_paths << File.dirname(__FILE__)
124
- SassC.load_paths << name
125
- SassC.load_paths << "/usr/local/fun"
126
-
127
- SassC::Engine.new("@import 'base_style/all.scss'", style: :compressed).render
128
-
129
- puts "Hello! SassC gem welcomes you to the magic world of ruby gems."
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "bundler"
6
- gem "ffi"
7
- gem "seven-zip", "~>1.4"
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2021-2023, [Ribose Inc](https://www.ribose.com).
4
- # All rights reserved.
5
- # This file is a part of tebako
6
- #
7
- # Redistribution and use in source and binary forms, with or without
8
- # modification, are permitted provided that the following conditions
9
- # are met:
10
- # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
12
- # 2. Redistributions in binary form must reproduce the above copyright
13
- # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
15
- #
16
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
- # POSSIBILITY OF SUCH DAMAGE.
27
-
28
- # This test is inspired packed-mn
29
- # https://github.com/metanorma/packed-mn
30
-
31
- require "rubygems"
32
- require "bundler/setup"
33
- require "tempfile"
34
-
35
- COMPILER_MEMFS = "/__tebako_memfs__"
36
-
37
- # https://github.com/pmq20/ruby-packer/blob/master/lib/compiler/constants.rb#L10
38
- COMPILER_MEMFS_LIB_CACHE = Pathname.new(Dir.mktmpdir("tebako-tests-"))
39
- at_exit do
40
- FileUtils.remove_dir(COMPILER_MEMFS_LIB_CACHE.to_path, true)
41
- end
42
-
43
- # HACK: fix path for 7zip load
44
- sevenz_lib = RUBY_PLATFORM.downcase.match(/mswin|mingw/) ? "7z*.dll" : "7z.so"
45
- sevenz_path = File.join(Gem::Specification.find_by_name("seven-zip").full_gem_path, "lib", "seven_zip_ruby", sevenz_lib)
46
- FileUtils.mkdir_p(COMPILER_MEMFS_LIB_CACHE / "seven_zip_ruby")
47
- FileUtils.cp(sevenz_path, COMPILER_MEMFS_LIB_CACHE / "seven_zip_ruby")
48
- $LOAD_PATH.unshift(COMPILER_MEMFS_LIB_CACHE)
49
- # END of HACK
50
-
51
- # Just make sure the constant exists
52
- require "seven_zip_ruby"
53
- puts "Hello! SevenZipRuby welcomes you to the magic world of ruby gems."
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2022-2023, [Ribose Inc](https://www.ribose.com).
4
- # All rights reserved.
5
- # This file is a part of tebako
6
- #
7
- # Redistribution and use in source and binary forms, with or without
8
- # modification, are permitted provided that the following conditions
9
- # are met:
10
- # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
12
- # 2. Redistributions in binary form must reproduce the above copyright
13
- # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
15
- #
16
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
- # POSSIBILITY OF SUCH DAMAGE.
27
-
28
- require "cgi"
29
- File.write("output.txt", CGI.escapeHTML("3 < 5"))
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2022-2023, [Ribose Inc](https://www.ribose.com).
4
- # All rights reserved.
5
- # This file is a part of tebako
6
- #
7
- # Redistribution and use in source and binary forms, with or without
8
- # modification, are permitted provided that the following conditions
9
- # are met:
10
- # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
12
- # 2. Redistributions in binary form must reproduce the above copyright
13
- # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
15
- #
16
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
- # POSSIBILITY OF SUCH DAMAGE.
27
-
28
- hello_world = "Hello, World!"
29
- puts hello_world
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2021-2023, [Ribose Inc](https://www.ribose.com).
4
- # All rights reserved.
5
- # This file is a part of tebako
6
- #
7
- # Redistribution and use in source and binary forms, with or without
8
- # modification, are permitted provided that the following conditions
9
- # are met:
10
- # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
12
- # 2. Redistributions in binary form must reproduce the above copyright
13
- # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
15
- #
16
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
- # POSSIBILITY OF SUCH DAMAGE.
27
-
28
- File.write("output.txt", "output")
@@ -1 +0,0 @@
1
- Hello, World!