tebako 0.12.5 → 0.12.7
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 +4 -4
- data/CMakeLists.txt +1 -1
- data/README.adoc +34 -9
- data/lib/tebako/cli_helpers.rb +6 -1
- data/lib/tebako/deploy_helper.rb +1 -1
- data/lib/tebako/error.rb +5 -2
- data/lib/tebako/options_manager.rb +13 -0
- data/lib/tebako/ruby_version.rb +68 -12
- data/lib/tebako/scenario_manager.rb +8 -5
- data/lib/tebako/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5b1ebb29eeb477173ec41d8380aa728bbc79d3d2bc44a84e9c3f6b1090ca751
|
4
|
+
data.tar.gz: 8fa4fc2ad1e8de867d4a4929ed97c97cd69ad7b1ee1027b6b21e581d1e100bd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c1188f49ef1e8931b88e6e92fa80f363a24ee169d3b21f7be6f2fcb545913f0ccd5015304259f1da6b43af19a35c3b00e8b28da6758d1806130ef2da63964b
|
7
|
+
data.tar.gz: c7978b7655bd25d36f2d49231d7be1106a3e6a35b5e611d075d910252b2d1d0bb44fb23255471c8a52838581a50833e3c26887d676857d1d7028be4ed58d6cd0
|
data/CMakeLists.txt
CHANGED
@@ -229,7 +229,7 @@ message(STATUS "DATA_BIN_FILE: ${DATA_BIN_FILE}")
|
|
229
229
|
message(STATUS "Target binary directory: ${TBD}")
|
230
230
|
message(STATUS "Target library directory: ${TLIBD}")
|
231
231
|
message(STATUS "Target local directory: ${TLD}")
|
232
|
-
message(STATUS "Target Gem directory
|
232
|
+
message(STATUS "Target Gem directory: ${TGD}")
|
233
233
|
message(STATUS "FS_MOUNT_POINT: ${FS_MOUNT_POINT}")
|
234
234
|
message(STATUS "Building for Win32 Ruby (RB_W32): ${RB_W32}")
|
235
235
|
message(STATUS "Removing GLIBC_PRIVATE reference: ${WITH_PATCHELF}")
|
data/README.adoc
CHANGED
@@ -90,7 +90,7 @@ can opt to run `strip -S` manually, it most cases it works.
|
|
90
90
|
|
91
91
|
MacOS build caveats:
|
92
92
|
|
93
|
-
* We saw `clang` compiler segmentation fault when
|
93
|
+
* We saw `clang` compiler segmentation fault when packaging of very large
|
94
94
|
projects with XCode 14.3.1. This issue is not reproducible with XCode 15.0.1 or
|
95
95
|
higher.
|
96
96
|
====
|
@@ -905,7 +905,8 @@ Where:
|
|
905
905
|
|
906
906
|
`<tebako-root-folder>`:: the Tebako root folder (see details: <<root-folder-selection>>)
|
907
907
|
|
908
|
-
`Ruby`:: parameter defines Ruby version
|
908
|
+
`Ruby`:: parameter defines package Ruby version (optional). This version is used in conjuction with requirements
|
909
|
+
from the Gemfile as explained below in 'Package Ruby version selection rules' section.
|
909
910
|
|
910
911
|
`tebafile`::
|
911
912
|
the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
|
@@ -1056,13 +1057,37 @@ operation. The following table lists the possible exit codes and their meanings.
|
|
1056
1057
|
|
1057
1058
|
| 0 | No error
|
1058
1059
|
| 1 | Invalid command line
|
1059
|
-
| 101 |
|
1060
|
-
| 102 |
|
1061
|
-
| 103 |
|
1062
|
-
| 104 |
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1060
|
+
| 101 | 'tebako setup' configure step failed
|
1061
|
+
| 102 | 'tebako setup' build step failed
|
1062
|
+
| 103 | 'tebako press' configure step failed
|
1063
|
+
| 104 | 'tebako press' build step failed
|
1064
|
+
| 105 | Failed to map MSys path to Windows
|
1065
|
+
| 106 | Entry point does not exist or is not accessible
|
1066
|
+
| 107 | Project root does not exist or is not accessible
|
1067
|
+
| 108 | Package working directory does not exist
|
1068
|
+
| 109 | Invalid Ruby version format
|
1069
|
+
| 110 | Ruby version is not supported
|
1070
|
+
| 111 | Ruby version is not supported on Windows
|
1071
|
+
| 112 | OS is not supported
|
1072
|
+
| 113 | Path to root shall be absolute. Relative path is not allowed
|
1073
|
+
| 114 | Entry point is not within the project root
|
1074
|
+
| 115 | Failed to load Gemfile
|
1075
|
+
| 116 | Ruby version does not satify Gemfile requirements
|
1076
|
+
|===
|
1077
|
+
|
1078
|
+
== Package Ruby version selection rules
|
1079
|
+
|
1080
|
+
During packaging tebako creates its own Ruby execution environment that is independent from the host Ruby environment.
|
1081
|
+
The version of Ruby that is used in the package is defined by the combination of the `--Ruby` option and ruby requirement
|
1082
|
+
specified in Gemfile.
|
1083
|
+
|
1084
|
+
.Package Ruby version selection Rules
|
1085
|
+
[cols="3", options="header"]
|
1086
|
+
|===
|
1087
|
+
| Gemfile requirement\--Ruby option | Specified | Not specified
|
1088
|
+
|
1089
|
+
| Specified | The version specified by --Ruby option if it is supported and satisfies Gemfile requirement; error otherwise | The minimal supported Ruby option that satisfies Gemfile requirement; error otherwise
|
1090
|
+
| Not specified | The version specified by --Ruby option if it is supported; error otherwise | Default Tebako Ruby version (3.2.6).
|
1066
1091
|
|
1067
1092
|
|===
|
1068
1093
|
|
data/lib/tebako/cli_helpers.rb
CHANGED
@@ -48,12 +48,18 @@ module Tebako
|
|
48
48
|
* WARNING: You are packaging in-place, i.e.: tebako package will be placed inside application root. *
|
49
49
|
* It is not an error but we do not recommend it because it is a way to keep packaging old versions recrsively. *
|
50
50
|
* *
|
51
|
+
* For example, ensure that `--root=` differs from `--output=` as described in README.adoc: *
|
52
|
+
* tebako press --root='~/projects/myproject' --entry=start.rb --output=/temp/myproject.tebako *
|
53
|
+
* *
|
51
54
|
******************************************************************************************************************
|
52
55
|
|
53
56
|
WARN
|
54
57
|
|
55
58
|
def do_press(options_manager)
|
56
59
|
scenario_manager = Tebako::ScenarioManager.new(options_manager.root, options_manager.fs_entrance)
|
60
|
+
scenario_manager.configure_scenario
|
61
|
+
options_manager.process_gemfile(scenario_manager.gemfile_path) if scenario_manager.with_gemfile
|
62
|
+
|
57
63
|
puts options_manager.press_announce(scenario_manager.msys?)
|
58
64
|
|
59
65
|
if options_manager.package_within_root?
|
@@ -91,7 +97,6 @@ module Tebako
|
|
91
97
|
|
92
98
|
def generate_files(options_manager, scenario_manager)
|
93
99
|
puts "-- Generating files"
|
94
|
-
scenario_manager.configure_scenario
|
95
100
|
|
96
101
|
v_parts = Tebako::VERSION.split(".")
|
97
102
|
Tebako::Codegen.generate_tebako_version_h(options_manager, v_parts)
|
data/lib/tebako/deploy_helper.rb
CHANGED
data/lib/tebako/error.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2023-
|
3
|
+
# Copyright (c) 2023-2025 [Ribose Inc](https://www.ribose.com).
|
4
4
|
# All rights reserved.
|
5
5
|
# This file is a part of tebako
|
6
6
|
#
|
@@ -42,12 +42,15 @@ module Tebako
|
|
42
42
|
112 => "OS is not supported",
|
43
43
|
113 => "Path to root shall be absolute. Relative path is not allowed",
|
44
44
|
114 => "Entry point is not within the project root",
|
45
|
+
115 => "Failed to load Gemfile",
|
46
|
+
116 => "Ruby version does not satify Gemfile requirements",
|
45
47
|
201 => "Warning. Could not create cache version file"
|
46
48
|
}.freeze
|
47
49
|
|
48
50
|
class << self
|
49
|
-
def packaging_error(code)
|
51
|
+
def packaging_error(code, extm = nil)
|
50
52
|
msg = PACKAGING_ERRORS[code]
|
53
|
+
msg += ": #{extm}" unless extm.nil?
|
51
54
|
msg = "Unknown packaging error" if msg.nil?
|
52
55
|
raise Tebako::Error.new msg, code
|
53
56
|
end
|
@@ -282,6 +282,19 @@ module Tebako
|
|
282
282
|
@press_options ||= "-DPCKG:STRING='#{package}' -DLOG_LEVEL:STRING='#{l_level}' " \
|
283
283
|
end
|
284
284
|
|
285
|
+
def process_gemfile(gemfile_path)
|
286
|
+
folder = File.dirname(gemfile_path)
|
287
|
+
filename = File.basename(gemfile_path)
|
288
|
+
# Change directory to the folder containing the Gemfile
|
289
|
+
# Because Bundler::Definition.build *sometimes* requires to be in
|
290
|
+
# the Gemfile directory
|
291
|
+
Dir.chdir(folder) do
|
292
|
+
@rv = Tebako::RubyVersionWithGemfile.new(@options["Ruby"], filename)
|
293
|
+
end
|
294
|
+
@ruby_ver, @ruby_hash = @rv.extend_ruby_version
|
295
|
+
@ruby_src_dir = nil
|
296
|
+
end
|
297
|
+
|
285
298
|
def relative?(path)
|
286
299
|
Pathname.new(path).relative?
|
287
300
|
end
|
data/lib/tebako/ruby_version.rb
CHANGED
@@ -25,11 +25,12 @@
|
|
25
25
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
26
26
|
# POSSIBILITY OF SUCH DAMAGE.
|
27
27
|
|
28
|
+
require "bundler"
|
28
29
|
require_relative "error"
|
29
30
|
|
30
31
|
# Tebako - an executable packager
|
31
32
|
module Tebako
|
32
|
-
# Ruby version
|
33
|
+
# Ruby version
|
33
34
|
class RubyVersion
|
34
35
|
RUBY_VERSIONS = {
|
35
36
|
"2.7.8" => "c2dab63cbc8f2a05526108ad419efa63a67ed4074dbbcf9fc2b1ca664cb45ba0",
|
@@ -51,13 +52,23 @@ module Tebako
|
|
51
52
|
def initialize(ruby_version)
|
52
53
|
@ruby_version = ruby_version.nil? ? DEFAULT_RUBY_VERSION : ruby_version
|
53
54
|
|
54
|
-
|
55
|
-
version_check
|
56
|
-
version_check_msys
|
55
|
+
run_checks
|
57
56
|
end
|
58
57
|
|
59
58
|
attr_reader :ruby_version
|
60
59
|
|
60
|
+
def api_version
|
61
|
+
@api_version ||= "#{@ruby_version.split(".")[0..1].join(".")}.0"
|
62
|
+
end
|
63
|
+
|
64
|
+
def extend_ruby_version
|
65
|
+
@extend_ruby_version ||= [@ruby_version, RUBY_VERSIONS[@ruby_version]]
|
66
|
+
end
|
67
|
+
|
68
|
+
def lib_version
|
69
|
+
@lib_version ||= "#{@ruby_version.split(".")[0..1].join}0"
|
70
|
+
end
|
71
|
+
|
61
72
|
def ruby3x?
|
62
73
|
@ruby3x ||= @ruby_version[0] == "3"
|
63
74
|
end
|
@@ -82,12 +93,10 @@ module Tebako
|
|
82
93
|
@ruby34 ||= ruby3x? && @ruby_version[2].to_i >= 4
|
83
94
|
end
|
84
95
|
|
85
|
-
def
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
def lib_version
|
90
|
-
@lib_version ||= "#{@ruby_version.split(".")[0..1].join}0"
|
96
|
+
def run_checks
|
97
|
+
version_check_format
|
98
|
+
version_check
|
99
|
+
version_check_msys
|
91
100
|
end
|
92
101
|
|
93
102
|
def version_check
|
@@ -111,9 +120,56 @@ module Tebako
|
|
111
120
|
raise Tebako::Error.new("Ruby version #{@ruby_version} is not supported on Windows", 111)
|
112
121
|
end
|
113
122
|
end
|
123
|
+
end
|
114
124
|
|
115
|
-
|
116
|
-
|
125
|
+
# Ruby version with Gemfile definition
|
126
|
+
class RubyVersionWithGemfile < RubyVersion
|
127
|
+
def initialize(ruby_version, gemfile_path)
|
128
|
+
# Assuming that it does not attempt to load any gems or resolve dependencies
|
129
|
+
# this can be done with any bundler version
|
130
|
+
gemfile = Bundler::Definition.build(gemfile_path, nil, nil)
|
131
|
+
ruby_v = gemfile.ruby_version&.versions
|
132
|
+
if ruby_v.nil?
|
133
|
+
super(ruby_version)
|
134
|
+
else
|
135
|
+
process_gemfile_ruby_version(ruby_version, ruby_v)
|
136
|
+
run_checks
|
137
|
+
end
|
138
|
+
rescue StandardError => e
|
139
|
+
Tebako.packaging_error(115, e.message)
|
140
|
+
end
|
141
|
+
|
142
|
+
def process_gemfile_ruby_version(ruby_version, ruby_v)
|
143
|
+
puts "-- Found Gemfile with Ruby requirements #{ruby_v}"
|
144
|
+
requirement = Gem::Requirement.new(ruby_v)
|
145
|
+
|
146
|
+
if ruby_version.nil?
|
147
|
+
process_gemfile_ruby_version_ud(requirement)
|
148
|
+
else
|
149
|
+
process_gemfile_ruby_version_d(ruby_version, requirement)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def process_gemfile_ruby_version_d(ruby_version, requirement)
|
154
|
+
current_version = Gem::Version.new(ruby_version)
|
155
|
+
unless requirement.satisfied_by?(current_version)
|
156
|
+
raise Tebako::Error.new("Ruby version #{ruby_version} does not satisfy requirement #{ruby_v}", 116)
|
157
|
+
end
|
158
|
+
|
159
|
+
@ruby_version = ruby_version
|
160
|
+
end
|
161
|
+
|
162
|
+
def process_gemfile_ruby_version_ud(requirement)
|
163
|
+
available_versions = RUBY_VERSIONS.keys.map { |v| Gem::Version.new(v) }
|
164
|
+
matching_version = available_versions.find { |v| requirement.satisfied_by?(v) }
|
165
|
+
puts "-- Found matching Ruby version #{matching_version}" if matching_version
|
166
|
+
|
167
|
+
unless matching_version
|
168
|
+
raise Tebako::Error.new("No available Ruby version satisfies requirement #{requirement}",
|
169
|
+
116)
|
170
|
+
end
|
171
|
+
|
172
|
+
@ruby_version = matching_version.to_s
|
117
173
|
end
|
118
174
|
end
|
119
175
|
end
|
@@ -26,6 +26,7 @@
|
|
26
26
|
# POSSIBILITY OF SUCH DAMAGE.
|
27
27
|
|
28
28
|
require "pathname"
|
29
|
+
require "bundler"
|
29
30
|
|
30
31
|
require_relative "error"
|
31
32
|
|
@@ -34,11 +35,12 @@ module Tebako
|
|
34
35
|
# Manages packaging scenario based on input files (gemfile, gemspec, etc)
|
35
36
|
class ScenarioManager
|
36
37
|
def initialize(fs_root, fs_entrance)
|
38
|
+
@with_gemfile = false
|
37
39
|
initialize_root(fs_root)
|
38
40
|
initialize_entry_point(fs_entrance || "stub.rb")
|
39
41
|
end
|
40
42
|
|
41
|
-
attr_reader :fs_entry_point, :fs_mount_point, :fs_entrance
|
43
|
+
attr_reader :fs_entry_point, :fs_mount_point, :fs_entrance, :gemfile_path, :with_gemfile
|
42
44
|
|
43
45
|
def configure_scenario
|
44
46
|
@fs_mount_point = if msys?
|
@@ -92,16 +94,16 @@ module Tebako
|
|
92
94
|
when 0
|
93
95
|
configure_scenario_no_gemspec
|
94
96
|
when 1
|
95
|
-
@scenario = @
|
97
|
+
@scenario = @with_gemfile ? :gemspec_and_gemfile : :gemspec
|
96
98
|
else
|
97
99
|
raise Tebako::Error, "Multiple Ruby gemspecs found in #{@fs_root}"
|
98
100
|
end
|
99
101
|
end
|
100
102
|
|
101
103
|
def configure_scenario_no_gemspec
|
102
|
-
@fs_entry_point = "/local/#{@fs_entrance}" if @
|
104
|
+
@fs_entry_point = "/local/#{@fs_entrance}" if @with_gemfile || @g_length.zero?
|
103
105
|
|
104
|
-
@scenario = if @
|
106
|
+
@scenario = if @with_gemfile
|
105
107
|
:gemfile
|
106
108
|
elsif @g_length.positive?
|
107
109
|
:gem
|
@@ -111,8 +113,9 @@ module Tebako
|
|
111
113
|
end
|
112
114
|
|
113
115
|
def lookup_files
|
116
|
+
@gemfile_path = File.join(@fs_root, "Gemfile")
|
114
117
|
@gs_length = Dir.glob(File.join(@fs_root, "*.gemspec")).length
|
115
|
-
@
|
118
|
+
@with_gemfile = File.exist?(@gemfile_path)
|
116
119
|
@g_length = Dir.glob(File.join(@fs_root, "*.gem")).length
|
117
120
|
end
|
118
121
|
end
|
data/lib/tebako/version.rb
CHANGED
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.12.
|
4
|
+
version: 0.12.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|