Allow tilt/opal to use Opal::Builder with :build or :builder options#864
Merged
elia merged 5 commits intoopal:masterfrom May 17, 2015
Merged
Allow tilt/opal to use Opal::Builder with :build or :builder options#864elia merged 5 commits intoopal:masterfrom
elia merged 5 commits intoopal:masterfrom
Conversation
This allows you to use gems for specific builders instead of modifying global state. In order to do so, it moves use_gem from being a singleton method on Opal to being a module that extends Opal, and including that module in Opal::Builder. To unify the Opal singleton API and Opal::Builder instance API, add append_paths methods to both, with Opal just using appending to the global paths, and Opal::Builder appending the paths to the underlying file_finder inside the path_reader.
Instead, only modify the state of the generated builder. In order to test this, add a CLI#build method that returns the builder object.
Previously this did not duplicate internal structures, causing the objects to not be independent.
If :build option is used, the Opal::Builder defaults are used. If :builder option is used, you can pass in your own custom builder, which could have per-build stubs, append_paths, and use_gems to change building without modifying global state. Using this, it's possible to build arbitrary opal projects that require other files using tilt without sprockets.
Member
|
Great stuff! The failing spec is the one that uses a sprockets server, at a first look seems it's missing a load path, could be related to Opal.paths changes, but not sure yet. Alas I won't have time to debug until tomorrow |
Contributor
Author
|
OK. I'm having some trouble setting up the infrastructure needed to run mspec_phantom locally, if you can take a look tomorrow, that will be great, otherwise I'll give it a shot on Monday. |
Member
|
just for ref |
elia
added a commit
that referenced
this pull request
May 17, 2015
Allow tilt/opal to use Opal::Builder with :build or :builder options
hmdne
pushed a commit
to hmdne/opal
that referenced
this pull request
Jan 27, 2024
Bumps [mocha](https://github.com/mochajs/mocha) from 6.1.4 to 7.1.1. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](mochajs/mocha@v6.1.4...v7.1.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
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.
If :build option is used, the Opal::Builder defaults are used.
If :builder option is used, you can pass in your own custom
builder, which could have per-build stubs, append_paths, and
use_gems to change building without modifying global state.
Using this, it's possible to build arbitrary opal projects that
require other files using tilt without sprockets.
In order to get this to work, I had to make Opal.append_path
and Opal.use_gem available per builder instance, and fix
Opal::Builder#dup to work correctly, which is what the earlier
commits are for.
The Opal::CLI commit is not necessary, but I think it's a good
idea in general to avoid mutating global state unless it is
necessary.