Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Support custom blueprint options in new and init commands #5329

Merged
merged 4 commits into from Jan 26, 2016

Conversation

bendemboski
Copy link
Contributor

The new and init commands can be given a custom blueprint to use. This modifies those commands to be aware of blueprint-specific options and pass them through, like the generate command.

This is handy in the near-term for custom app/addon blueprints that accept options, and could pave the way to add options to the built-in blueprints if that ever seems valuable. A few examples I can think of immediately are the server port and the root URL.

I didn't make any changes to the help output because the default blueprints don't support any custom options and ember help new appName --blueprint=./my-blueprint seems like a weird use case.

@stefanpenner
Copy link
Contributor

looks great. @trek would love your 👀 since the remote/external blueprint was your creation, want to make sure this is aligned with your goals for it.

command.beforeRun(['app']);
expect(pluck(command.availableOptions, 'name')).to.contain('custom-blueprint-option');
} finally {
safeRestore(Blueprint, 'lookup');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our other tests have the safeRestore in the afterEach so it's only needed once for all tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I didn't want to stub out lookup in every test, but you're suggesting that I put the safeRestore in afterEach, but keep the stub in the test body?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we added the safe version with a string arg so it only restores if it was stubbed.

@stefanpenner
Copy link
Contributor

kicking windows

@trek
Copy link
Contributor

trek commented Jan 25, 2016

@bendemboski can you give some usage examples in the description?

try{
blueprint = this.lookupBlueprint(rawArgs[0]);
this.registerOptions(blueprint);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nitpic: } catch(e) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all my stylistic preferences as well, but I basically copied this method from here. Should I prefer style over consistency here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer the above mentioned style guide.

I would love to enforce style with JSCS or similar sometime soon, that way we can keep this consistent.

Ben Demboski added 4 commits January 25, 2016 13:57
The new and init commands can be given a custom blueprint to use. This modifies those commands to be aware of blueprint-specific options and pass them through, like the generate command.

This is handy in the near-term for custom app/addon blueprints that accept options, and could pave the way to add options to the build-in blueprints if that ever seems valuable. A few examples I can think of immediately are the server port and the root URL.
@stefanpenner
Copy link
Contributor

single failure is unrelated and fixed upstream. Thanks for the contribution :)

stefanpenner added a commit that referenced this pull request Jan 26, 2016
[ENHANCEMENT] Support custom blueprint options in new and init commands
@stefanpenner stefanpenner merged commit fe5fc8a into ember-cli:master Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants