fluent-tools 0.2.0 → 0.3.0
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/ext/fluent_tools/extconf.rb +4 -7
- data/installer.rb +10 -69
- data/lib/fluent_tools/command_executor.rb +1 -25
- data/lib/fluent_tools/utils.rb +7 -0
- data/lib/fluent_tools/version.rb +1 -1
- metadata +15 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e2523a45a7bf0056d60edc34bea0f532ea2e0ccffd01bfd4b040dff9f84d2f5
|
4
|
+
data.tar.gz: 7d4fa4525e8354ebee03b7f45159453ddfd083440fd3b4c1610ec49e9e827539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c58f2118b25682e51d87ad35e1c2fdacf340437ccbcf7c17775b58ce6f32556d90bf9b4897c600b9a2aa9439a6135abd876eefa1dd4317a316af6f859a0a041
|
7
|
+
data.tar.gz: 1ada088241995965c30c6a2219e36e6ee9972f52a1daf721685e44ec5f8768a30bf6e5a8f232e4818f1d39c49795bedbb892aa82cef614c398d62613e2b4dffa
|
data/ext/fluent_tools/extconf.rb
CHANGED
@@ -30,11 +30,8 @@ MAKEFILE
|
|
30
30
|
|
31
31
|
File.write('Makefile', makefile_content)
|
32
32
|
|
33
|
-
|
34
|
-
puts '
|
35
|
-
|
36
|
-
puts '
|
37
|
-
exit 1
|
33
|
+
if success
|
34
|
+
puts '✅ Installation complete'
|
35
|
+
else
|
36
|
+
puts 'ℹ️ Installation complete - binary couldn\'t be downloaded but will be resolved at runtime'
|
38
37
|
end
|
39
|
-
|
40
|
-
puts '✅ Extension configuration complete'
|
data/installer.rb
CHANGED
@@ -13,7 +13,7 @@ require 'pathname'
|
|
13
13
|
require_relative 'lib/fluent_tools/utils'
|
14
14
|
|
15
15
|
# Installer for fluent-rust-tools gem
|
16
|
-
# Downloads pre-built binaries
|
16
|
+
# Downloads pre-built binaries
|
17
17
|
class FluentToolsInstaller
|
18
18
|
include FluentTools::Utils::Logger
|
19
19
|
|
@@ -22,6 +22,7 @@ class FluentToolsInstaller
|
|
22
22
|
end
|
23
23
|
|
24
24
|
# Main installation method
|
25
|
+
# rubocop:disable Naming/PredicateMethod
|
25
26
|
def install!
|
26
27
|
log_info "🚀 Installing #{FluentTools::Utils::BINARY_NAME}#{" `#{@version}`" if @version}..."
|
27
28
|
|
@@ -33,14 +34,17 @@ class FluentToolsInstaller
|
|
33
34
|
log_success 'Installation complete using pre-built binary!'
|
34
35
|
true
|
35
36
|
else
|
36
|
-
|
37
|
-
|
37
|
+
log_error 'Pre-built binary not available for this platform/version'
|
38
|
+
log_error "Please check available releases at: https://github.com/#{FluentTools::Utils::REPO_OWNER}/#{FluentTools::Utils::REPO_NAME}/releases"
|
39
|
+
false
|
38
40
|
end
|
39
41
|
else
|
40
|
-
|
41
|
-
|
42
|
+
log_error "Platform #{RUBY_PLATFORM} not supported"
|
43
|
+
log_error "Please check available releases at: https://github.com/#{FluentTools::Utils::REPO_OWNER}/#{FluentTools::Utils::REPO_NAME}/releases"
|
44
|
+
false
|
42
45
|
end
|
43
46
|
end
|
47
|
+
# rubocop:enable Naming/PredicateMethod
|
44
48
|
|
45
49
|
private
|
46
50
|
|
@@ -127,7 +131,7 @@ class FluentToolsInstaller
|
|
127
131
|
end
|
128
132
|
|
129
133
|
def install_binary(binary_data, platform)
|
130
|
-
install_dir = determine_install_dir
|
134
|
+
install_dir = FluentTools::Utils.determine_install_dir
|
131
135
|
FileUtils.mkdir_p(install_dir)
|
132
136
|
|
133
137
|
binary_extension = FluentTools::Utils.binary_extension(platform)
|
@@ -146,67 +150,4 @@ class FluentToolsInstaller
|
|
146
150
|
log_info "✅ Binary installed successfully (#{File.size(binary_path)} bytes)"
|
147
151
|
@binary_path = binary_path
|
148
152
|
end
|
149
|
-
|
150
|
-
# rubocop:disable Naming/PredicateMethod
|
151
|
-
def build_binary_from_source
|
152
|
-
log_info '🔨 Building from source...'
|
153
|
-
|
154
|
-
# Find project root (where Cargo.toml and Makefile are)
|
155
|
-
project_root = find_project_root
|
156
|
-
unless project_root
|
157
|
-
log_error 'Could not find project root (Cargo.toml)'
|
158
|
-
return false
|
159
|
-
end
|
160
|
-
|
161
|
-
# Use Makefile to build the binary
|
162
|
-
Dir.chdir(project_root) do
|
163
|
-
unless system('make build_native')
|
164
|
-
log_error 'Failed to build Rust binary using Makefile'
|
165
|
-
return false
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
# Copy binary to install location
|
170
|
-
copy_built_binary(project_root)
|
171
|
-
log_success 'Binary built and installed successfully!'
|
172
|
-
|
173
|
-
true
|
174
|
-
end
|
175
|
-
# rubocop:enable Naming/PredicateMethod
|
176
|
-
|
177
|
-
def find_project_root
|
178
|
-
Pathname.pwd.ascend do |dir|
|
179
|
-
return dir.to_s if File.exist?(File.join(dir, 'Cargo.toml'))
|
180
|
-
end
|
181
|
-
nil
|
182
|
-
end
|
183
|
-
|
184
|
-
def copy_built_binary(project_root)
|
185
|
-
install_dir = determine_install_dir
|
186
|
-
FileUtils.mkdir_p(install_dir)
|
187
|
-
|
188
|
-
binary_extension = FluentTools::Utils.binary_extension
|
189
|
-
source_binary = File.join(project_root, 'target', 'release', "#{FluentTools::Utils::BINARY_NAME}#{binary_extension}")
|
190
|
-
dest_binary = File.join(install_dir, "#{FluentTools::Utils::BINARY_NAME}#{binary_extension}")
|
191
|
-
|
192
|
-
raise "Built binary not found at #{source_binary}" unless File.exist?(source_binary)
|
193
|
-
|
194
|
-
FileUtils.cp(source_binary, dest_binary)
|
195
|
-
@binary_path = dest_binary
|
196
|
-
end
|
197
|
-
|
198
|
-
def determine_install_dir
|
199
|
-
# First check if we're in the development context (has Cargo.toml in parent dirs)
|
200
|
-
project_root = find_project_root
|
201
|
-
if project_root
|
202
|
-
# Development context - put in ruby/bin relative to project root
|
203
|
-
File.join(project_root, 'ruby', 'bin')
|
204
|
-
else
|
205
|
-
# We're in a gem installation context - create bin directory in current gem location
|
206
|
-
current_dir = File.expand_path('..', __dir__)
|
207
|
-
bin_dir = File.join(current_dir, 'bin')
|
208
|
-
FileUtils.mkdir_p(bin_dir)
|
209
|
-
bin_dir
|
210
|
-
end
|
211
|
-
end
|
212
153
|
end
|
@@ -59,16 +59,7 @@ module FluentTools
|
|
59
59
|
gem_binary = File.join(__dir__, '..', '..', 'bin', binary_name)
|
60
60
|
return gem_binary if File.executable?(gem_binary)
|
61
61
|
|
62
|
-
# 2.
|
63
|
-
if development_context?
|
64
|
-
dev_binary = File.join(project_root, 'target', 'release', binary_name)
|
65
|
-
return dev_binary if File.executable?(dev_binary)
|
66
|
-
|
67
|
-
ruby_binary = File.join(project_root, 'ruby', 'bin', binary_name)
|
68
|
-
return ruby_binary if File.executable?(ruby_binary)
|
69
|
-
end
|
70
|
-
|
71
|
-
# 3. System PATH
|
62
|
+
# 2. System PATH
|
72
63
|
system_binary = `which #{binary_name} 2>/dev/null`.strip
|
73
64
|
return system_binary unless system_binary.empty?
|
74
65
|
|
@@ -76,21 +67,6 @@ module FluentTools
|
|
76
67
|
gem_binary
|
77
68
|
end
|
78
69
|
|
79
|
-
def development_context?
|
80
|
-
!project_root.nil?
|
81
|
-
end
|
82
|
-
|
83
|
-
def project_root
|
84
|
-
@project_root ||= find_project_root
|
85
|
-
end
|
86
|
-
|
87
|
-
def find_project_root
|
88
|
-
Pathname.new(__dir__).ascend do |dir|
|
89
|
-
return dir.to_s if File.exist?(File.join(dir, 'Cargo.toml'))
|
90
|
-
end
|
91
|
-
nil
|
92
|
-
end
|
93
|
-
|
94
70
|
def validate_input_file!(path)
|
95
71
|
return if File.exist?(path)
|
96
72
|
|
data/lib/fluent_tools/utils.rb
CHANGED
@@ -81,6 +81,13 @@ module FluentTools
|
|
81
81
|
PLATFORM_RUST_TARGETS[platform]
|
82
82
|
end
|
83
83
|
|
84
|
+
def self.determine_install_dir
|
85
|
+
root_gem_dir = File.join(__dir__, '..', '..')
|
86
|
+
bin_dir = File.join(root_gem_dir, 'bin')
|
87
|
+
FileUtils.mkdir_p(bin_dir)
|
88
|
+
bin_dir
|
89
|
+
end
|
90
|
+
|
84
91
|
# Logger mixin to provide consistent logging across tools
|
85
92
|
module Logger
|
86
93
|
def log_info(message, verbose: true)
|
data/lib/fluent_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Automattic
|
@@ -28,30 +28,30 @@ dependencies:
|
|
28
28
|
name: rubocop-rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.7'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '0.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.6'
|
55
55
|
description: A Ruby gem that wraps a Rust CLI tool for converting between Mozilla's
|
56
56
|
Fluent localization format and other formats like Android XML string resources and
|
57
57
|
GNU gettext PO files
|
@@ -80,10 +80,13 @@ metadata:
|
|
80
80
|
source_code_uri: https://github.com/Automattic/fluent-rust-tools
|
81
81
|
changelog_uri: https://github.com/Automattic/fluent-rust-tools/blob/main/CHANGELOG.md
|
82
82
|
post_install_message: |
|
83
|
-
|
84
|
-
|
83
|
+
✅ fluent-tools installed successfully!
|
84
|
+
|
85
|
+
This gem will automatically try to download pre-built binaries for your platform.
|
86
|
+
If a pre-built binary is not available, you can checkout the project and build one manually using:
|
87
|
+
cd ruby && bundle exec rake build_rust
|
85
88
|
|
86
|
-
|
89
|
+
For more information: https://github.com/Automattic/fluent-rust-tools
|
87
90
|
rdoc_options: []
|
88
91
|
require_paths:
|
89
92
|
- lib
|