Skip to content

Conversation

@develar
Copy link
Contributor

@develar develar commented Feb 5, 2016

This pull request supersedes #155. And is required for #251.

Tests and doc added.

@malept
Copy link
Member

malept commented Feb 5, 2016

I would prefer that since you're building on #155, that you rebase + squash that branch so that the original author is still attributed to their changes, and then an additional commit is for you adding the tests and docs requested.

@develar
Copy link
Contributor Author

develar commented Feb 5, 2016

Sorry for noise, I created pull request too early (realized, that my test is not correct). I will add comment when it will be ready. Yeah, writing tests is not easy.

@develar
Copy link
Contributor Author

develar commented Feb 5, 2016

Strange. Tests passed locally, but not on Travis. And in your build (https://travis-ci.org/maxogden/electron-packager/jobs/107157456) I see the same error. I will start build again in a few hours.

@develar
Copy link
Contributor Author

develar commented Feb 5, 2016

so that the original author is still attributed to their changes

Fixed, I set author to pyro2927 <[email protected]>.

@develar develar force-pushed the ignore-out-path branch 2 times, most recently from 2249101 to 23e41ff Compare February 7, 2016 07:50
@develar
Copy link
Contributor Author

develar commented Feb 7, 2016

I don't see what's wrong in my code. And Travis build passed. (I see that another unrelated build also blinking).

Maybe, it will be better to test such functionality only for current platform (not for all platforms) to speedup tests, but I used standard util.testAllPlatforms.

@malept
Copy link
Member

malept commented Feb 7, 2016

Could you add one more test for the new ignore functionality when you don't specify an out? (That's what I meant in the other PR for a "current working directory case".

@develar
Copy link
Contributor Author

develar commented Feb 8, 2016

Could you add one more test for the new ignore functionality when you don't specify an out

It is required to fix #64 I don't like it, but as a tool we cannot teach users, ok. Current solution is not complete, thanks for pointing.

@develar develar force-pushed the ignore-out-path branch 2 times, most recently from 2fe28c3 to ba65340 Compare February 8, 2016 07:50
common.js Outdated
var outIgnores = []
if (normalizedOut === null || normalizedOut === process.cwd()) {
['darwin', 'linux', 'win32'].forEach(function (platform) {
['ia32', 'x64'].forEach(function (arch) {
Copy link
Member

Choose a reason for hiding this comment

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

I would move supportedArchs and supportedPlatforms in index.js to common.js and use those instead. Otherwise, that will make PRs like #107 and #223 more complex than they need to be.

@develar
Copy link
Contributor Author

develar commented Feb 9, 2016

Tests failed due to critical error in all tests —

  1. you pass combination to test and then call Object.create.
  2. Created opts has combination as a prototype.
  3. createInferTest calls delete combination.version directly on original combination instance and... yes, version deleted from prototype and all tests now could be broken.

As part of this pull request I will fix it (we must pass copied combination object to test to avoid manual Object.create and to avoid such problems in the future).

@develar
Copy link
Contributor Author

develar commented Feb 9, 2016

I would move supportedArchs and supportedPlatforms in index.js to common.js

Sorry, tried to minimise, but it is stupid, yes. Fixed.

index.js Outdated
var supportedPlatforms = common.platforms.reduce(function (o, v) {
o[v] = './' + (v === 'darwin' ? 'mac' : v)
return o
}, {})
Copy link
Member

Choose a reason for hiding this comment

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

In my opinion, this makes it a bit more difficult to understand what's going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also prefer to use for of instead of magic function style. But I see forEach in existing code.

Do you want to convert it to

var supportedPlatforms = {}
for (var platform in common.platforms) {
  supportedPlatforms[platform] = './' + (platform === 'darwin' ? 'mac' : platform)
}

?

Copy link
Member

Choose a reason for hiding this comment

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

At the very least, please don't use single-letter variables here. Please also keep in mind that there is a PR to add the Mac App Store (MAS) platform (#223) which currently also uses the mac.js file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Variables renamed. I don't want to pollute file scope, but cannot use let, so, still use reduce instead of for in (for of es6).

Mac App Store (MAS) platform can be added as before — directly to supportedPlatforms (or inside reduce function — in any case we check is equal to darwin?).

Copy link
Member

Choose a reason for hiding this comment

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

I think with your current code, the MAS change will look like this:

result[platform] = './' + (['darwin', 'mas'].indexOf(platform) !== -1 ? 'mac' : platform)

It's not great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or

 var supportedPlatforms = common.platforms.reduce(function (result, platform) {
   result[platform] = './' + (platform === 'darwin' ? 'mac' : platform)
   return result
 }, {
  mas: './mac'
})

Copy link
Member

Choose a reason for hiding this comment

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

Seems like you may as well do either option for darwin as well and get rid of the ternary operator. (Though I'm not convinced that the second option actually works.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems, you don't like ternary operator :)

Ok, my code saves only 2 lines (linux and windows). Maybe we can rename mac.js to darwin.js to consolidate, but I don't think that it is an acceptable solution.

So, I reverted this block to previous.

Copy link
Member

Choose a reason for hiding this comment

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

I'm OK with ternary operators when all parts of the statement are simple.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Travis build passed, please review.

@develar develar force-pushed the ignore-out-path branch 3 times, most recently from 5a9cf3b to 1b1d8d2 Compare February 9, 2016 19:54
@malept malept added this to the Next major or minor version after 5.2.1 milestone Feb 17, 2016
@develar
Copy link
Contributor Author

develar commented Feb 18, 2016

Should I fix something or you just haven't yet time to review it?

@malept
Copy link
Member

malept commented Feb 18, 2016

Sorry, I've been holding off reviewing/merging other PRs because #223 is bigger than the others. Hopefully in the next couple of days.

@malept
Copy link
Member

malept commented Feb 18, 2016

Yep, I figured that you would need to rebase after I merged the PR I mentioned earlier.

@develar
Copy link
Contributor Author

develar commented Feb 22, 2016

@malept I missed your quick reply, sorry. I have rebased.

@malept malept changed the title Automatically ignoring --out path Automatically ignore --out path Feb 29, 2016
malept added a commit that referenced this pull request Feb 29, 2016
Automatically ignore --out path

Closes #155.
@malept malept merged commit d49b932 into electron:master Feb 29, 2016
@develar develar deleted the ignore-out-path branch February 29, 2016 06:46
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.

3 participants