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] Change blueprint command options to type String to avoid nopt transformations #3820

Merged

Conversation

rodyhaddad
Copy link
Contributor

Before this PR, the --blueprint option in the new and init commands got validated as a gitUrl or a path.

When used as a path, it would get resolved to an absolute path, making it point to a specific blueprint on the filesystem depending on the current working directory.

This PR changes it to a String, so it won't be modified before getting lookup'ed up by Blueprint.lookup

This doesn't break it being used as a gitUrl, because that check happens again in the InstallBlueprint task.

It does break it from being used as a path to a blueprint on the filesystem. Instead now it's used as a blueprint in one of the regular lookup paths.

I don't believe this will affect many people, if any. I imagine people always rely on the default app blueprint when using new or init.

I considered keeping it backward compatible, but the new behaviour might be what we actually want moving forward.

The only test this breaks is this one, which I'm for removing/modifying, but wanted someone else's opinion.

\cc @stefanpenner

@stefanpenner
Copy link
Contributor

I considered keeping it backward compatible, but the new behaviour might be what we actually want moving forward.

it seems like people being required to provide a relative or absolutely path, should be sufficient we dont need to resolve non-path like things.

I believe https://github.com/ember-cli/ember-cli/blob/master/tests/acceptance/new-test.js#L130 should fail in its current form, but work with --blueprint=./my_blueprint thoughts?

@rodyhaddad
Copy link
Contributor Author

Sure, that sounds very reasonable.

How would we technical detect it though? Check for the presence of '/' in the blueprint name and assume it's a path?

@stefanpenner
Copy link
Contributor

How would we technical detect it though? Check for the presence of '/' in the blueprint name and assume it's a path?

ya, relative or absolute.

@rodyhaddad rodyhaddad force-pushed the blueprint-option-as-string branch 2 times, most recently from 87d5d79 to ac13a3a Compare April 16, 2015 18:19
@rodyhaddad
Copy link
Contributor Author

@stefanpenner I updated the PR and added an extra test for absolute paths.

Let me know if there's anything I should change before merging.

@stefanpenner
Copy link
Contributor

looking now

@@ -72,6 +72,10 @@ module.exports = Command.extend({
return Promise.reject(new SilentError('We currently do not support a name of `' + packageName + '`.'));
}

if (blueprintOpts.blueprint[0] === '.') {
blueprintOpts.blueprint = path.resolve(process.cwd(), blueprintOpts.blueprint);
Copy link
Contributor

Choose a reason for hiding this comment

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

at first, I thought this was a mistake. But I believe it to be correct, as you want:

cd app/ && ember --blueprint=../blueprints/foo

to be relative the cwd, not the project root.

👍

@stefanpenner
Copy link
Contributor

1 last comment, and then i feel good to merge this.

…rmations

This is alright, as the check for `gitUrl` happens in the install-blueprint
task anyway.
@rodyhaddad
Copy link
Contributor Author

@stefanpenner Tada!

stefanpenner added a commit that referenced this pull request Apr 16, 2015
[ENHANCEMENT] Change blueprint command options to type String to avoid nopt transformations
@stefanpenner stefanpenner merged commit 7bfa00f into ember-cli:master Apr 16, 2015
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

2 participants