Add TextMate::Gems shared gem store for bundles - #21
Merged
Conversation
Bundles that need RubyGems currently `require` from the system GEM_PATH, which is fragile, or vendor gems per-bundle, which duplicates them. This adds a shared, ABI-keyed gem store plus a per-bundle Gemfile convention. shared/lib/tm/gems.rb — TextMate::Gems.setup(name:, gemfile:): - resolves a bundle's Support/Gemfile from one shared store under ~/Library/Application Support/TextMate/Gems/<ruby_api_version> (override with TM_GEMS_DIR); a gem+version is installed once and reused by every bundle that lists it. - installs silently on first use via `bundle install`; no UI on success. - on failure: one concise native alert (TextMate::UI.alert, no stacktrace), with the full command/output/backtrace written to <store>/install.log; never falls back silently to system gems. shared/lib/tm/gems_test.rb — unit tests for the no-network logic (store keying, default Gemfile path, bundle binary resolution, missing-Gemfile error, log contents and append behaviour). 6 runs, 16 assertions, green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces a shared RubyGems store so bundles can declare dependencies in a
Support/Gemfileand have them installed once into a common, ABI-keyed location — instead of trusting the systemGEM_PATHor vendoring duplicate copies per bundle.shared/lib/tm/gems.rbTextMate::Gems.setup(name:, gemfile:):Support/Gemfilefrom one shared store at~/Library/Application Support/TextMate/Gems/<ruby_api_version>(override viaTM_GEMS_DIR).bundle installwith no window.TextMate::UI.alert, no stacktrace); the full failing command, output, and backtrace go to<store>/install.log. Never falls back silently to system gems.ABI keying is required because native extensions are compiled per Ruby version/arch; pure-Ruby gems share across everything.
shared/lib/tm/gems_test.rbUnit tests for the no-network logic — store keying, default Gemfile path, bundle-binary resolution, missing-Gemfile error, and log contents/append behaviour.
6 runs, 16 assertions, 0 failures.Verified
Exercised end-to-end against a real consumer (the GitHub-Markdown bundle, separate PR): clean store → silent install → render; second run no-network; a second bundle shares the single gem copy; unresolvable Gemfile → exit 1, empty stdout, detail logged.
First consumer
textmatelives/GitHub-Markdown.tmbundle(companion PR) uses this to drop redcarpet + Rouge in place of the Pythonpygmentsdependency. That bundle's command requires$TM_SUPPORT_PATH/lib/tm/gems, so this PR should land first.Design notes:
DESIGN-shared-gems.md(workshop).