tebako 0.8.1 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 [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 "fileutils"
29
+ require "find"
30
+
31
+ require_relative "build_helpers"
32
+
33
+ # Tebako - an executable packager
34
+ module Tebako
35
+ # Tebako packaging support (ruby builder)
36
+ class RubyBuilder
37
+ def initialize(ruby_ver, src_dir)
38
+ @ruby_ver = ruby_ver
39
+ @src_dir = src_dir
40
+ @ncores = BuildHelpers.ncores
41
+ end
42
+
43
+ # Final build of tebako package
44
+ def final_build
45
+ puts " ... building tebako package"
46
+ Dir.chdir(@src_dir) do
47
+ BuildHelpers.run_with_capture(["make", "ruby", "-j#{@ncores}"]) if @ruby_ver.ruby3x?
48
+ BuildHelpers.run_with_capture(["make", "-j#{@ncores}"])
49
+ end
50
+ end
51
+ end
52
+ end
@@ -26,5 +26,5 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  module Tebako
29
- VERSION = "0.8.1"
29
+ VERSION = "0.8.3"
30
30
  end
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  *
3
- * Copyright (c) 2021-2023 [Ribose Inc](https://www.ribose.com).
3
+ * Copyright (c) 2021-2024 [Ribose Inc](https://www.ribose.com).
4
4
  * All rights reserved.
5
5
  * This file is a part of tebako
6
6
  *
@@ -30,8 +30,11 @@
30
30
  #include <incbin/incbin.h>
31
31
 
32
32
  namespace tebako {
33
- const char * fs_log_level = "@LOG_LEVEL@";
34
- const char * fs_mount_point = "@FS_MOUNT_POINT@";
35
- const char * fs_entry_point = "@FS_ENTRY_POINT@";
33
+ const char * fs_log_level = "@LOG_LEVEL@";
34
+ const char * fs_mount_point = "@FS_MOUNT_POINT@";
35
+ const char * fs_entry_point = "@FS_ENTRY_POINT@";
36
+ bool needs_cwd = @NEEDS_CWD@;
37
+ const char * package_cwd = "@PACKAGE_CWD_FULL@";
38
+ char original_cwd[PATH_MAX];
36
39
  INCBIN(fs, "@DATA_BIN_FILE@");
37
40
  }
data/src/tebako-main.cpp CHANGED
@@ -27,6 +27,7 @@
27
27
  *
28
28
  */
29
29
 
30
+ #include <unistd.h>
30
31
  #include <stdlib.h>
31
32
  #include <stdio.h>
32
33
  #include <string.h>
@@ -34,6 +35,7 @@
34
35
  #include <sys/stat.h>
35
36
  #include <fcntl.h>
36
37
 
38
+
37
39
  #include <string>
38
40
  #include <cstdint>
39
41
 
@@ -132,6 +134,20 @@ extern "C" int tebako_main(int* argc, char*** argv) {
132
134
 
133
135
  }
134
136
 
137
+ if (!tebako_is_running_miniruby()) {
138
+ if (getcwd(tebako::original_cwd, sizeof(tebako::original_cwd)) == NULL) {
139
+ printf("Failed to get current directory: %s\n", strerror(errno));
140
+ return -1;
141
+ }
142
+
143
+ if (tebako::needs_cwd) {
144
+ if (tebako_chdir(tebako::package_cwd) != 0) {
145
+ printf("Failed to chdir to '%s' : %s\n", tebako::package_cwd, strerror(errno));
146
+ ret = -1;
147
+ }
148
+ }
149
+ }
150
+
135
151
  if (ret != 0) {
136
152
  try {
137
153
  printf("Tebako initialization failed\n");
@@ -153,6 +169,10 @@ extern "C" const char* tebako_mount_point(void) {
153
169
  return tebako::fs_mount_point;
154
170
  }
155
171
 
172
+ extern "C" const char* tebako_original_pwd(void) {
173
+ return tebako::original_cwd;
174
+ }
175
+
156
176
  extern "C" int tebako_is_running_miniruby(void) {
157
177
  return running_miniruby;
158
178
  }
data/tebako.gemspec CHANGED
@@ -51,7 +51,7 @@ Gem::Specification.new do |spec|
51
51
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
52
52
  `git ls-files --recurse-submodules -z`.split("\x0").reject do |f|
53
53
  (f == __FILE__) ||
54
- f.match(%r{\A(?:(?:tests|tests-2|features|deps|output|common\.env)/|\.(?:git|cirrus|tebako|rubocop))})
54
+ f.match(%r{\A(?:(?:tests|tests-2|spec|deps|output|common\.env)/|\.(?:git|rspec|cirrus|tebako|rubocop))})
55
55
  end
56
56
  end
57
57
 
@@ -63,4 +63,12 @@ Gem::Specification.new do |spec|
63
63
 
64
64
  spec.add_dependency "thor", "~> 1.2"
65
65
  spec.add_dependency "yaml", "~> 0.2.1"
66
+
67
+ spec.add_development_dependency "hoe"
68
+ spec.add_development_dependency "minitest"
69
+ spec.add_development_dependency "rspec", "~> 3.2"
70
+ spec.add_development_dependency "rubocop", "~> 1.52"
71
+ spec.add_development_dependency "rubocop-rubycw"
72
+ spec.add_development_dependency "simplecov"
73
+ spec.add_development_dependency "simplecov-cobertura"
66
74
  end
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tebako
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2024-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -38,6 +38,104 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.2.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: hoe
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.52'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.52'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rubycw
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov-cobertura
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
41
139
  description: |
42
140
  Tebako is an executable packager. It packages a set of files into a single
43
141
  executable binary that allows a user to run a selected file from the
@@ -63,6 +161,7 @@ files:
63
161
  - include/tebako/tebako-fs.h
64
162
  - include/tebako/tebako-main.h
65
163
  - lib/tebako.rb
164
+ - lib/tebako/build_helpers.rb
66
165
  - lib/tebako/cli.rb
67
166
  - lib/tebako/cli_helpers.rb
68
167
  - lib/tebako/cli_rubies.rb
@@ -76,6 +175,8 @@ files:
76
175
  - lib/tebako/packager/patch_helpers.rb
77
176
  - lib/tebako/packager/patch_libraries.rb
78
177
  - lib/tebako/packager/patch_literals.rb
178
+ - lib/tebako/packager/patch_main.rb
179
+ - lib/tebako/ruby_builder.rb
79
180
  - lib/tebako/stripper.rb
80
181
  - lib/tebako/version.rb
81
182
  - resources/tebako-fs.cpp.in
@@ -139,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
240
  - !ruby/object:Gem::Version
140
241
  version: '0'
141
242
  requirements: []
142
- rubygems_version: 3.3.27
243
+ rubygems_version: 3.4.19
143
244
  signing_key:
144
245
  specification_version: 4
145
246
  summary: Packager for Ruby executables