Module: McptaskRailsRunner::Binary
- Defined in:
- lib/mcptask_rails_runner/binary.rb
Overview
Locates and executes the bundled Go binary.
Constant Summary collapse
- GEM_ROOT =
File.("../..", __dir__)
- SUPPORTED_PLATFORMS =
%w[ arm64-darwin x86_64-darwin arm64-linux x86_64-linux x64-mingw-ucrt ].freeze
Class Method Summary collapse
-
.exec!(*args) ⇒ Object
Replaces the current process, so the binary's exit code and signal handling reach the caller (rake) unchanged.
- .executable_name ⇒ Object
-
.path(gem_root: GEM_ROOT) ⇒ Object
Absolute path to the bundled binary.
Class Method Details
.exec!(*args) ⇒ Object
Replaces the current process, so the binary's exit code and signal handling reach the caller (rake) unchanged.
48 49 50 |
# File 'lib/mcptask_rails_runner/binary.rb', line 48 def exec!(*args) Kernel.exec(path, *args) end |
.executable_name ⇒ Object
18 19 20 |
# File 'lib/mcptask_rails_runner/binary.rb', line 18 def executable_name Gem.win_platform? ? "mcptask_runner.exe" : "mcptask_runner" end |
.path(gem_root: GEM_ROOT) ⇒ Object
Absolute path to the bundled binary. Never resolved through PATH: the binary shares the mcptask_runner name with the legacy gem's rake namespace, and a PATH lookup could pick up a stale or wrong install.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mcptask_rails_runner/binary.rb', line 25 def path(gem_root: GEM_ROOT) override = ENV["MCPTASK_RUNNER_BIN"] return override unless override.nil? || override.empty? exe = File.join(gem_root, "libexec", executable_name) return exe if File.file?(exe) raise Error, <<~MSG mcptask_runner binary not found at #{exe}. The platform gem for #{Gem::Platform.local} was probably not installed. Supported platforms: #{SUPPORTED_PLATFORMS.join(', ')}. On a supported platform, re-run `bundle install` (and make sure the platform is in Gemfile.lock: `bundle lock --add-platform #{Gem::Platform.local}`). On an unsupported platform, install the binary from https://github.com/jchsoft/mcptask-releases and point the MCPTASK_RUNNER_BIN environment variable at it. MSG end |