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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 807b6f8dbd3ccbbb76cbb8420d6093b250e88608a8a90c8fb0eda55f87bbf22c
4
- data.tar.gz: 0533e6d8cfd25c021486c0b56931843347adb96fdb6b8ae3ba28021db8596547
3
+ metadata.gz: 7e2523a45a7bf0056d60edc34bea0f532ea2e0ccffd01bfd4b040dff9f84d2f5
4
+ data.tar.gz: 7d4fa4525e8354ebee03b7f45159453ddfd083440fd3b4c1610ec49e9e827539
5
5
  SHA512:
6
- metadata.gz: 4a538a4801bfab70efc3635c2f6bc492ff866cac46222291b59fa8893fbfeaef225dc60e64e5503c556d41d12ef1c2e890117704e480b0b69cb971b6df28011a
7
- data.tar.gz: bafabd8faabf050e41ce921ea69e9c6a5d3e950c0006ef3c50a1cb1c78112cac68d1ae4f3829c3bf380309ffbf114bdf3e6da10f542780dd1be9bfbbe829db0f
6
+ metadata.gz: 9c58f2118b25682e51d87ad35e1c2fdacf340437ccbcf7c17775b58ce6f32556d90bf9b4897c600b9a2aa9439a6135abd876eefa1dd4317a316af6f859a0a041
7
+ data.tar.gz: 1ada088241995965c30c6a2219e36e6ee9972f52a1daf721685e44ec5f8768a30bf6e5a8f232e4818f1d39c49795bedbb892aa82cef614c398d62613e2b4dffa
@@ -30,11 +30,8 @@ MAKEFILE
30
30
 
31
31
  File.write('Makefile', makefile_content)
32
32
 
33
- unless success
34
- puts ' Installation failed - binary could not be installed'
35
- puts 'This may still work if the binary becomes available at runtime'
36
- puts 'or if you build it manually using: rake build_rust'
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 or builds from source
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
- log_warning 'Pre-built binary not available, falling back to compilation...'
37
- build_binary_from_source
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
- log_warning "Platform #{RUBY_PLATFORM} not supported for pre-built binaries"
41
- build_binary_from_source
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. Development context
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
 
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FluentTools
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
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.2.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: '0'
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: '0'
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
- This fluent-tools gem will try to use a pre-built binary for your platform.
84
- If unavailable, it will compile the Rust binary during installation.
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
- If compilation is needed, make sure you have Rust installed: https://rustup.rs/
89
+ For more information: https://github.com/Automattic/fluent-rust-tools
87
90
  rdoc_options: []
88
91
  require_paths:
89
92
  - lib