tuxedo-r 0.0.1-x86_64-linux

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90745a96bbaed4ba7faea66a1ed059a77bf1964abbd8e77317e8a97ea79460bc
4
+ data.tar.gz: 7ced61877adc8267bd4aeeb16002256b451ca6bf63b23bed6f2fdd9116eefb67
5
+ SHA512:
6
+ metadata.gz: dbb893e1d2fd9e130829d8ee1e00131e3d5f28de6d22333c0180373fa3aaee457cfc0e11e14ca1e38186547e3f72bc5c17b11fd76797c12f7475aa1c9678f338
7
+ data.tar.gz: 2115df0cb3626d183d562fceaab0c0b966777fed1e511a95c181758aa52d3184fe5542da94befa79425d325877bfdc81227f4d9edfe4766c0de4263b92648789
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Danimar Ribeiro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # tuxedo-r
2
+
3
+ [Tuxedo](https://github.com/danimaribeiro/tuxedo) is a fast Ruby code
4
+ formatter written in Rust. `tuxedo-r` is the Ruby gem that installs it: each
5
+ platform-specific gem carries a precompiled native binary, so no Rust
6
+ toolchain is needed. The name is deliberately ambiguous: the "R" stands for
7
+ both **Ruby** (the language it formats, and the language of this wrapper) and
8
+ **Rust** (the language the `tuxedo` binary itself is written in).
9
+
10
+ ## Installation
11
+
12
+ ```ruby
13
+ group :development, :test do
14
+ gem "tuxedo-r", require: false
15
+ end
16
+ ```
17
+
18
+ ```bash
19
+ bundle install
20
+ bundle exec tuxedo format --check .
21
+ ```
22
+
23
+ Without Bundler:
24
+
25
+ ```bash
26
+ gem install tuxedo-r
27
+ tuxedo format .
28
+ ```
29
+
30
+ RubyGems automatically resolves and installs the platform-specific gem that
31
+ matches your machine (for example `tuxedo-r-x86_64-linux`). This release
32
+ ships a precompiled binary for x86_64 Linux (glibc) only; on any other
33
+ platform, see [Unsupported platforms](#unsupported-platforms). The
34
+ [documentation](https://danimar.dev/tuxedo/docs.html) covers what
35
+ the formatter does, its command line and its configuration.
36
+
37
+ ### Requirements
38
+
39
+ Ruby 3.1 or newer and RubyGems 3.3.22 or newer (`gem update --system`).
40
+ `required_ruby_version` is the Ruby that runs the `tuxedo` shim, not the
41
+ Ruby syntax `tuxedo` accepts. On Alpine and other musl hosts, RubyGems
42
+ older than 3.3.22 resolves the glibc gem, whose binary will not run.
43
+
44
+ ### Unsupported platforms
45
+
46
+ If a precompiled binary isn't available for your platform yet, set
47
+ `TUXEDO_INSTALL_DIR` to a directory containing a `tuxedo` executable (for
48
+ example, one you built yourself from the
49
+ [Rust crate](https://github.com/danimaribeiro/tuxedo)):
50
+
51
+ ```bash
52
+ export TUXEDO_INSTALL_DIR=/path/to/tuxedo/target/release
53
+ bundle exec tuxedo format --check .
54
+ ```
55
+
56
+ ## How it works
57
+
58
+ - The `tuxedo-r` gem itself ships no binary — it's the platform-independent
59
+ "meta" gem.
60
+ - `tuxedo-r-<platform>` gems (built by `rake package`, see
61
+ [`rakelib/package.rake`](https://github.com/danimaribeiro/tuxedo/blob/main/ruby/rakelib/package.rake))
62
+ each bundle a `tuxedo` binary compiled for that target triple, under
63
+ `exe/<platform>/tuxedo`.
64
+ - The `exe/tuxedo` script installed onto your `PATH` is plain Ruby (RubyGems
65
+ requires gem executables to be Ruby scripts) — it just finds the right
66
+ binary for the current platform and `exec`s it, forwarding all arguments and
67
+ the exit status.
68
+
69
+ ## Development
70
+
71
+ ```bash
72
+ cd ruby
73
+ bundle install
74
+ bundle exec rake test
75
+
76
+ # Build the tuxedo binary for every supported platform (requires `cross`
77
+ # for cross-compiled targets: cargo install cross)
78
+ bundle exec rake build:all
79
+
80
+ # Package all platform gems into pkg/
81
+ bundle exec rake package
82
+ ```
data/exe/tuxedo ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # RubyGems executable shims assume a gem's executables are Ruby scripts, so
5
+ # this file exists purely to locate and exec the real, compiled `tuxedo`
6
+ # binary for the current platform.
7
+
8
+ require "tuxedo/r"
9
+
10
+ begin
11
+ command = [Tuxedo::R.executable, *ARGV]
12
+ if Gem.win_platform?
13
+ # `exec` can fail to locate the binary on Windows; `system` is more reliable there.
14
+ system(*command, exception: true)
15
+ else
16
+ exec(*command)
17
+ end
18
+ rescue Tuxedo::R::UnsupportedPlatformException, Tuxedo::R::ExecutableNotFoundException => e
19
+ warn "ERROR: #{e.message}"
20
+ exit 1
21
+ end
Binary file
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tuxedo
4
+ module R
5
+ module NativePlatforms
6
+ # rubygems platform name => rust target triple
7
+ #
8
+ # Keep this in sync with the build matrix in
9
+ # tuxedo/.github/workflows/release.yml
10
+ TARGETS = {
11
+ "arm64-darwin" => "aarch64-apple-darwin",
12
+ "x86_64-darwin" => "x86_64-apple-darwin",
13
+ "x86_64-linux" => "x86_64-unknown-linux-gnu",
14
+ "aarch64-linux" => "aarch64-unknown-linux-gnu",
15
+ "x86_64-linux-musl" => "x86_64-unknown-linux-musl",
16
+ "aarch64-linux-musl" => "aarch64-unknown-linux-musl",
17
+ "x64-mingw-ucrt" => "x86_64-pc-windows-msvc",
18
+ }.freeze
19
+
20
+ def self.binary_name(platform)
21
+ platform.to_s.include?("mingw") ? "tuxedo.exe" : "tuxedo"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tuxedo
4
+ module R
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
data/lib/tuxedo/r.rb ADDED
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "r/version"
4
+ require_relative "r/native_platforms"
5
+
6
+ module Tuxedo
7
+ # The "R" is deliberately ambiguous: this is the Ruby wrapper around a
8
+ # Rust-compiled `tuxedo` binary.
9
+ module R
10
+ DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "..", "exe"))
11
+ GEM_NAME = "tuxedo-r"
12
+
13
+ # Raised when the host platform has no precompiled tuxedo binary published.
14
+ class UnsupportedPlatformException < StandardError
15
+ end
16
+
17
+ # Raised when the tuxedo executable could not be found where expected.
18
+ class ExecutableNotFoundException < StandardError
19
+ end
20
+
21
+ # Raised when TUXEDO_INSTALL_DIR is set but does not exist.
22
+ class DirectoryNotFoundException < StandardError
23
+ end
24
+
25
+ class << self
26
+ # e.g. "x86_64-linux"; on Alpine, `version` carries the musl
27
+ # distinction, without which this would misname the host.
28
+ def platform
29
+ [:cpu, :os, :version].map { |m| Gem::Platform.local.send(m) }.compact.join("-")
30
+ end
31
+
32
+ # Absolute path to the tuxedo binary that should be executed on this host.
33
+ #
34
+ # Resolution order:
35
+ # 1. TUXEDO_INSTALL_DIR env var, if set (escape hatch for local dev / CI
36
+ # builds that want to use a freshly-built binary instead of the one
37
+ # vendored into the installed platform gem).
38
+ # 2. The platform-specific binary bundled into the matching
39
+ # tuxedo-r-<platform> gem.
40
+ def executable(exe_path: DEFAULT_DIR)
41
+ tuxedo_install_dir = ENV["TUXEDO_INSTALL_DIR"]
42
+
43
+ if tuxedo_install_dir
44
+ unless File.directory?(tuxedo_install_dir)
45
+ raise DirectoryNotFoundException, <<~MESSAGE
46
+ TUXEDO_INSTALL_DIR is set to #{tuxedo_install_dir}, but that directory does not exist.
47
+ MESSAGE
48
+ end
49
+
50
+ warn "NOTE: using TUXEDO_INSTALL_DIR to find the tuxedo executable: #{tuxedo_install_dir}"
51
+ exe_file = File.expand_path(File.join(tuxedo_install_dir, "tuxedo"))
52
+ else
53
+ if NativePlatforms::TARGETS.keys.none? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), GEM_NAME) }
54
+ raise UnsupportedPlatformException, <<~MESSAGE
55
+ #{GEM_NAME} does not have a precompiled binary for the #{platform} platform.
56
+ See https://github.com/danimaribeiro/tuxedo/tree/main/ruby#unsupported-platforms for options.
57
+ MESSAGE
58
+ end
59
+
60
+ exe_file = Dir.glob(File.expand_path(File.join(exe_path, "*", "tuxedo{,.exe}"))).find do |f|
61
+ Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), GEM_NAME)
62
+ end
63
+ end
64
+
65
+ if exe_file.nil? || !File.exist?(exe_file)
66
+ raise ExecutableNotFoundException, <<~MESSAGE
67
+ Cannot find the tuxedo executable for #{platform} in #{exe_path}.
68
+
69
+ If you're using Bundler, make sure your lockfile includes this platform:
70
+
71
+ bundle lock --add-platform #{platform}
72
+ bundle install
73
+
74
+ If you're still seeing this after that, check whether
75
+ `bundle config force_ruby_platform` is set to `true`.
76
+
77
+ This version of #{GEM_NAME} may not ship a binary for #{platform} at all; see
78
+ https://github.com/danimaribeiro/tuxedo/tree/main/ruby#unsupported-platforms for options.
79
+ MESSAGE
80
+ end
81
+
82
+ exe_file
83
+ end
84
+ end
85
+ end
86
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tuxedo-r
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: x86_64-linux
6
+ authors:
7
+ - Danimar Ribeiro
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-09-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ Tuxedo is a Ruby code formatter written in Rust, distributed as a
15
+ precompiled native binary wrapped in this Ruby gem (the "R" is both Ruby and
16
+ Rust). It is `bundle exec`-compatible, and a linter is planned.
17
+ email:
18
+ executables:
19
+ - tuxedo
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - LICENSE
24
+ - README.md
25
+ - exe/tuxedo
26
+ - exe/x86_64-linux/tuxedo
27
+ - lib/tuxedo/r.rb
28
+ - lib/tuxedo/r/native_platforms.rb
29
+ - lib/tuxedo/r/version.rb
30
+ homepage: https://github.com/danimaribeiro/tuxedo
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ documentation_uri: https://danimar.dev/tuxedo/docs.html
35
+ source_code_uri: https://github.com/danimaribeiro/tuxedo
36
+ changelog_uri: https://github.com/danimaribeiro/tuxedo/blob/main/CHANGELOG.md
37
+ rubygems_mfa_required: 'true'
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 3.1.0
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 3.3.22
52
+ requirements: []
53
+ rubygems_version: 3.5.22
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: 'A self-contained `tuxedo` executable: a fast Ruby formatter written in Rust.'
57
+ test_files: []