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

File collision menu, tests for individual generators, mocha:generator and better looking output #63

Closed
wants to merge 10 commits into from

Conversation

mklabs
Copy link
Contributor

@mklabs mklabs commented Sep 22, 2012

A lot of stuff in there. The most relevant points being the file menu collision check on every file writes, and the reworked log output.

  • mv *.js lib/
  • added file collision menu, checks every file system write,
    checking existing file, if it's identical. If it's not, shows up the
    file collision menu (Y to overwrite, n to skip, d to compute file diff,
    a to overwrite all, q to quit)
  • Set arguments required state based on provided defaults.
  • Make sure to update the this.options hash in generator when
    using this.option(), setting up default value appropriately.
  • Addition of mocha:generator, invoked by the generator one. Stubs
    out a new mocha test suite. Arguments can be used to setup file
    assertions automatically.
  • Added tests for individual generators. Generators making use of
    prompts are not tested yet (it requires us pulling in the Runnable
    helper from yeoman). npm test is happy with 200+ tests.
  • add support/ directory, scripts to generate mocha specs for a given
    generator. To use ./support/test <generator> with <generator> being
    the name of the generator. What it does: it goes into a temporary dir,
    trigger the given generator, redirect the output and parse out the
    created files, figures out the appropriate yeoman init mocha:generator ... command.
  • reworked the logging output to be nested and padded depending on the generators / hooks invoked.
  • replace old references to new / generate commands by init in USAGE files

Once again, most of the inspiration is coming from Rails generators.

New output:

Output

Collision example:

Collision

thx to @sindresorhus for the screenshots! (and feedbacks)

Should close #38 #48 #58

@sindresorhus
Copy link
Member

\o/*9999

I've been testing this out today, and it's awesome!

@paulirish
Copy link
Member

wow wow wow!

@@ -70,10 +73,19 @@ actions.destinationRoot = function destinationRoot(root) {
// - the destination path to be relative to application Gruntfile's directory
// (most likely cwd)
actions.copy = function copy(source, destination, options) {
var self = this;
Copy link
Member

Choose a reason for hiding this comment

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

Can you use .bind(this) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright 75b69eb9bc03d46edc527fbb72fad57150aadb41

@sindresorhus
Copy link
Member

Reviewed this PR, and it looks very good too me. A lot of awesome improvements. And the new collision handling is just marvelous!

@addyosmani
Copy link
Member

This is amazing work, @mklabs. Loving the new additions and cannot wait to land the collision handling.

@sindresorhus
Copy link
Member

@addyosmani This looks good to me. Can we get this merged?

@addyosmani
Copy link
Member

@sindresorhus Happy to merge. @mklabs do you think you'll have time to rebase today?

@mklabs
Copy link
Contributor Author

mklabs commented Sep 24, 2012

Yes doing it right now.

@addyosmani
Copy link
Member

Awesome. Looking forward to it :)

* mv *.js lib/
* added file collision menu, checks every file system write,
* checking existing file, if it's identical. If it's not, shows up the
  file collision menu (Y to overwrite, n to skip, d to compute file diff,
  a to overwrite all, q to quit)
* Added tests for individual generators. Generators making use of
  prompts are not tested yet (it requires us pulling in the Runnable
  helper from yeoman)
* Auto-generation of tests with the generator generator
* Addition of mocha:generator, invoked by the generator one. Stubs
* out a new mocha test suite. Arguments can be used to setup file
  assertions automatically.
* Set arguments required state based on provided defaults.
* Make sure to update the `this.options` hash in generator when
* using `this.option()`, setting up default value appropriately.
* add support/ directory, scripts to generate mocha specs for a given
  generator. To use `./support/test <generator>` with <generator> being
    the name of the generator. What it does, it goes into a temporary dir,
  trigger the given generator, redirect the output and parse out the
  created files, figures out the appropriate `yeoman init mocha:generator
  ...` command.
* fix fallbacks behavior
* move actions.js file into their own dir, automate the include
* detect image types, and setup noProcess accordingly
* use prompt directly, mainly to bypass the Are you sure? check on
  conflicts.
* added log API for each status (identical, force, skip, ..)
* shared to hook with any local generator (which might require another
  instance of logger). process.logging is used following logref spec:
  https://github.com/mikeal/logref
* sort namespaces with help output
* readme update
* move back to one describe / it
* remove bash script, redone as much as possible as node script
* all tests regenerated
@mklabs
Copy link
Contributor Author

mklabs commented Sep 24, 2012

Rebased, forced push. Should be ok now.

@mklabs mklabs closed this in eb27e4d Sep 24, 2012
@sindresorhus
Copy link
Member

Landed. Awesome work on this Mickael. It really improves the use of generators!

mklabs added a commit that referenced this pull request Nov 21, 2012
…cha:generator and better looking output. Fixes #38, Fixes #48, Fixes #58
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.

Refactor Generators
4 participants