tuxedo-r 0.0.3-arm64-darwin

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: b92bccc6f18614b0ab26ba8900bc2e2e40dd11a7e8f13b0ec5370857b593599c
4
+ data.tar.gz: 595151d6996bf7997580d716a9d3700af25008c72ca30dead9304a1ccebd5644
5
+ SHA512:
6
+ metadata.gz: 5d863ab1cd946b14c9a764bc8a9d90b825f0ffcf651b0682a25131007e130d8526388b085bb4a0e5da732e746a25686a6723f76dfc86830e57983cb8fc5a8286
7
+ data.tar.gz: c7bfc5e61bebafcb0029a1832995869eb627c8eab9de86b5ef46526364025b3de460009d4550e2667eaf3a77451fb7e54bf49414d8f7ab5a8c53b878ebdf7905
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,94 @@
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`). From 0.0.3
32
+ there is one for each of these platforms:
33
+
34
+ | Gem platform | Machine |
35
+ | --- | --- |
36
+ | `arm64-darwin` | macOS, Apple Silicon |
37
+ | `x86_64-darwin` | macOS, Intel |
38
+ | `x86_64-linux` | Linux x86_64, glibc 2.28+ (Debian 10, Ubuntu 20.04, RHEL 8) |
39
+ | `aarch64-linux` | Linux arm64, glibc 2.28+ |
40
+ | `x86_64-linux-musl` | Linux x86_64, musl (Alpine) |
41
+ | `aarch64-linux-musl` | Linux arm64, musl (Alpine) |
42
+ | `x64-mingw-ucrt` | Windows x64 (RubyInstaller 3.1+) |
43
+
44
+ 0.0.2 and earlier ship a binary for x86_64 Linux (glibc) only. On any
45
+ other platform, see [Unsupported platforms](#unsupported-platforms). The
46
+ [documentation](https://danimar.dev/tuxedo/docs.html) covers what
47
+ the formatter does, its command line and its configuration.
48
+
49
+ ### Requirements
50
+
51
+ Ruby 3.1 or newer and RubyGems 3.3.22 or newer (`gem update --system`).
52
+ `required_ruby_version` is the Ruby that runs the `tuxedo` shim, not the
53
+ Ruby syntax `tuxedo` accepts. On Alpine and other musl hosts, RubyGems
54
+ older than 3.3.22 resolves the glibc gem, whose binary will not run.
55
+
56
+ ### Unsupported platforms
57
+
58
+ If a precompiled binary isn't available for your platform yet, set
59
+ `TUXEDO_INSTALL_DIR` to a directory containing a `tuxedo` executable
60
+ (`tuxedo.exe` on Windows; for example, one you built yourself from the
61
+ [Rust crate](https://github.com/danimaribeiro/tuxedo)):
62
+
63
+ ```bash
64
+ export TUXEDO_INSTALL_DIR=/path/to/tuxedo/target/release
65
+ bundle exec tuxedo format --check .
66
+ ```
67
+
68
+ ## How it works
69
+
70
+ - The `tuxedo-r` gem itself ships no binary — it's the platform-independent
71
+ "meta" gem.
72
+ - `tuxedo-r-<platform>` gems (built by `rake package`, see
73
+ [`rakelib/package.rake`](https://github.com/danimaribeiro/tuxedo/blob/main/ruby/rakelib/package.rake))
74
+ each bundle a `tuxedo` binary compiled for that target triple, under
75
+ `exe/<platform>/tuxedo` (`tuxedo.exe` on Windows).
76
+ - The `exe/tuxedo` script installed onto your `PATH` is plain Ruby (RubyGems
77
+ requires gem executables to be Ruby scripts) — it just finds the right
78
+ binary for the current platform and `exec`s it, forwarding all arguments and
79
+ the exit status.
80
+
81
+ ## Development
82
+
83
+ ```bash
84
+ cd ruby
85
+ bundle install
86
+ bundle exec rake test
87
+
88
+ # Build the tuxedo binary for every supported platform (requires `cross`
89
+ # for cross-compiled targets: cargo install cross)
90
+ bundle exec rake build:all
91
+
92
+ # Package all platform gems into pkg/
93
+ bundle exec rake package
94
+ ```
Binary file
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
@@ -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 and build-windows jobs 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.3"
6
+ end
7
+ end
data/lib/tuxedo/r.rb ADDED
@@ -0,0 +1,92 @@
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
+ # The executable's file name on this host: Windows will not run a
33
+ # binary without its `.exe`, so TUXEDO_INSTALL_DIR must name it.
34
+ def binary_name
35
+ Gem.win_platform? ? "tuxedo.exe" : "tuxedo"
36
+ end
37
+
38
+ # Absolute path to the tuxedo binary that should be executed on this host.
39
+ #
40
+ # Resolution order:
41
+ # 1. TUXEDO_INSTALL_DIR env var, if set (escape hatch for local dev / CI
42
+ # builds that want to use a freshly-built binary instead of the one
43
+ # vendored into the installed platform gem).
44
+ # 2. The platform-specific binary bundled into the matching
45
+ # tuxedo-r-<platform> gem.
46
+ def executable(exe_path: DEFAULT_DIR)
47
+ tuxedo_install_dir = ENV["TUXEDO_INSTALL_DIR"]
48
+
49
+ if tuxedo_install_dir
50
+ unless File.directory?(tuxedo_install_dir)
51
+ raise DirectoryNotFoundException, <<~MESSAGE
52
+ TUXEDO_INSTALL_DIR is set to #{tuxedo_install_dir}, but that directory does not exist.
53
+ MESSAGE
54
+ end
55
+
56
+ warn "NOTE: using TUXEDO_INSTALL_DIR to find the tuxedo executable: #{tuxedo_install_dir}"
57
+ exe_file = File.expand_path(File.join(tuxedo_install_dir, binary_name))
58
+ else
59
+ if NativePlatforms::TARGETS.keys.none? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), GEM_NAME) }
60
+ raise UnsupportedPlatformException, <<~MESSAGE
61
+ #{GEM_NAME} does not have a precompiled binary for the #{platform} platform.
62
+ See https://github.com/danimaribeiro/tuxedo/tree/main/ruby#unsupported-platforms for options.
63
+ MESSAGE
64
+ end
65
+
66
+ exe_file = Dir.glob(File.expand_path(File.join(exe_path, "*", "tuxedo{,.exe}"))).find do |f|
67
+ Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), GEM_NAME)
68
+ end
69
+ end
70
+
71
+ if exe_file.nil? || !File.exist?(exe_file)
72
+ raise ExecutableNotFoundException, <<~MESSAGE
73
+ Cannot find the tuxedo executable for #{platform} in #{exe_path}.
74
+
75
+ If you're using Bundler, make sure your lockfile includes this platform:
76
+
77
+ bundle lock --add-platform #{platform}
78
+ bundle install
79
+
80
+ If you're still seeing this after that, check whether
81
+ `bundle config force_ruby_platform` is set to `true`.
82
+
83
+ This version of #{GEM_NAME} may not ship a binary for #{platform} at all; see
84
+ https://github.com/danimaribeiro/tuxedo/tree/main/ruby#unsupported-platforms for options.
85
+ MESSAGE
86
+ end
87
+
88
+ exe_file
89
+ end
90
+ end
91
+ end
92
+ 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.3
5
+ platform: arm64-darwin
6
+ authors:
7
+ - Danimar Ribeiro
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-11-18 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/arm64-darwin/tuxedo
26
+ - exe/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: []