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

Adds yam & config file #563

Merged
merged 8 commits into from
Jun 12, 2014
Merged

Adds yam & config file #563

merged 8 commits into from
Jun 12, 2014

Conversation

twokul
Copy link
Contributor

@twokul twokul commented May 2, 2014

Closes #440

Adds support for .ember-cli settings file which looks like this:

{
  "port": 4200,
  "host": "0.0.0.0",
  "live-reload": true,
  "environment": "development"
}

By default, ember-cli is going to look for .ember-cli file in two places: the current directory and your home directory. You can put your personal settings in your home .ember-cli file, team shared settings should stay in project .ember-cli.

@stefanpenner
Copy link
Contributor

great name 👍

@stefanpenner
Copy link
Contributor

before we merge, some examples + ecli should utilize the config file. That way we know if this path is correct

@twokul
Copy link
Contributor Author

twokul commented May 2, 2014

@stefanpenner this a pre-PR for bringing analytics prompts back. I haven't really thought what we should put in .ember-cli except collectAnalytics = true/false.

@rwjblue
Copy link
Member

rwjblue commented May 2, 2014

@twokul Sure, but this doesn't do that yet, c/d? Meaning, lets see this thing work and have some tests to ensure the prompting + saving work in the context of ember-cli, then we can :shipit:...

@twokul
Copy link
Contributor Author

twokul commented May 2, 2014

It sets up the config file and reads/writes to it.

@twokul
Copy link
Contributor Author

twokul commented May 2, 2014

I can base prompt PR on this one.

this.message = message;
this.stack = (new Error()).stack;
this.stack = (new Error()).stack;
}

ProjectNotFoundError.constructor = ProjectNotFoundError;
ProjectNotFoundError.prototype = new Error();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use Object.create(Error.prototype) there.

new Error() runs the constructor and I think we don't really want that

http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript#comment17126532_5251506 (comment)

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
Contributor Author

Choose a reason for hiding this comment

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

a subject for a separate PR

@fsmanuel
Copy link
Contributor

fsmanuel commented May 2, 2014

@twokul i would like to see proxy options and ci or silence in .ember-cli

@twokul
Copy link
Contributor Author

twokul commented May 2, 2014

@fsmanuel that's the plan

@fsmanuel
Copy link
Contributor

fsmanuel commented May 2, 2014

@twokul 👍

@stefanpenner
Copy link
Contributor

can you add support for the config file to have:

  • --proxy
  • --port
  • --blueprint

@@ -3,6 +3,7 @@
var nopt = require('nopt');
var chalk = require('chalk');
var path = require('path');
var merge = require('lodash-node').merge;
Copy link
Contributor

Choose a reason for hiding this comment

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

can you require the explicit module that contains merge?

Copy link
Contributor

Choose a reason for hiding this comment

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

lodash/objects/merge or something

@stefanpenner
Copy link
Contributor

LGTM

}
};

var getUserHome = function getUserHome() {
Copy link
Contributor

Choose a reason for hiding this comment

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

var is not needed, the named function statement is sufficient.

@stefanpenner
Copy link
Contributor

left some small comments, also this needs a rebase

@rwjblue
Copy link
Member

rwjblue commented Jun 1, 2014

Looks like this needs another rebase.

@stefanpenner - Anything else needed on this (other than the rebase)?

'live-reload': true
});

touch(homePath, {
Copy link
Contributor

Choose a reason for hiding this comment

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

im abit concerned that this actually mutates my global config

Copy link
Contributor

Choose a reason for hiding this comment

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

paging @twokul

Copy link
Contributor Author

Choose a reason for hiding this comment

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

local settings in the project take precedence over your global settings. if local .ember-cli doesn't exists, your global settings will take over. does that answer your concern?

Copy link
Member

Choose a reason for hiding this comment

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

@twokul - The issue is that this test will modify the actual files in my home directory when running.

Copy link
Member

Choose a reason for hiding this comment

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

And if you look a few lines below, it will delete the file too. This means that I cannot have a ~/.ember-cli file while developing on the ember-cli project itself, but will have to manually recreate when I want to work on actual ember-cli applications (aka client projects).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rjackson @stefanpenner sorry for confusion, I pushed the fix.

@stefanpenner
Copy link
Contributor

this would be lovely to get in, it has been pending for a month. Can you please address the test concern?

@rwjblue
Copy link
Member

rwjblue commented Jun 6, 2014

@twokul - This is causing the fingerprinting smoke test to fail. Not sure yet exactly why, could you look into it?

@twokul
Copy link
Contributor Author

twokul commented Jun 6, 2014

@rjackson looking into it

@andycrum
Copy link
Contributor

andycrum commented Jun 7, 2014

Anything new here? Would love to have this in master so I can use a couple of the things :)

'live-reload': true
});

homeSettings = touchIfExists(homePath, {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we not actually touch (or rely) peoples home dir during the tests? Simply configuration Yam with a path for home, via ./fixtures/home/. and ./fixtures/project/. would be best.

@andycrum
Copy link
Contributor

andycrum commented Jun 8, 2014

@rjackson @twokul so the smoke test is failing because the test is calling build --environment=production, but it's actually generating the development environment. Changing blueprint/.ember-cli to production fixes it, strangely. In this case, maybe it's just failing because it's using an ember with an old blueprint to run the test?

@rwjblue
Copy link
Member

rwjblue commented Jun 8, 2014

The command line provided environment should win (meaning regardless of what was set in .ember-cli if an --environment option was specified it should be used).

Generally, I see the order of precedence (last wins):

  1. Config file.
  2. Environment variable.
  3. Command line option.

This is essentially least specific to most specific.

@andycrum
Copy link
Contributor

andycrum commented Jun 8, 2014

@rjackson yeah, the command line actually does win if you do a manual new and build. That's why this is so confusing. I'm not sure how the test is triggering the build that would cause it to use development

@andycrum
Copy link
Contributor

andycrum commented Jun 8, 2014

Actually, the command line does not win. That is the issue (I had forgotten to npm link so I was running an older version of ember when trying the commands manually).

@rwjblue
Copy link
Member

rwjblue commented Jun 11, 2014

Looks like this has been updated to handle the various concerns that @stefanpenner and I pointed out. Probably ready for another review.

@andycrum
Copy link
Contributor

Yay passing tests! Is this okay to be merged into master?

host: '0.0.0.0'
});

settings = new Yam('ember-cli').getAll();
Copy link
Member

Choose a reason for hiding this comment

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

Can we modify to use the (recent) ability to mock the homePath with Yam? And just use a fixture in tests/fixtures to load the home settings (from above).

@@ -0,0 +1,41 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the recent changes (to mock yam) caused this to be an unneeded change.

Can you move this back to tests/helpers/file-utils.js (with the original contents)?

rwjblue added a commit that referenced this pull request Jun 12, 2014
@rwjblue rwjblue merged commit c05c3fb into ember-cli:master Jun 12, 2014
@stefanpenner
Copy link
Contributor

👍

@rwjblue
Copy link
Member

rwjblue commented Jun 12, 2014

BOOM

@twokul twokul deleted the config branch June 12, 2014 12:30
@alvincrespo
Copy link

👍 I'm stoked for this!

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.

Config file
7 participants