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

Feature dry run #7

Merged
merged 22 commits into from
Jul 5, 2016
Merged

Feature dry run #7

merged 22 commits into from
Jul 5, 2016

Conversation

jeffrifwald
Copy link
Contributor

@jeffrifwald jeffrifwald commented Jul 4, 2016

@ryan-roemer
Adds a dry run command that runs through the postversion and postpublish scripts using mock-fs. Addresses #5.

Here is what the dry run command looks like run on publishr itself:

screen shot 2016-07-04 at 2 52 02 pm

@coveralls
Copy link

coveralls commented Jul 4, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 1432277 on jmcriffey:feature-dryRun into 4119305 on FormidableLabs:master.

@coveralls
Copy link

coveralls commented Jul 4, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 4744307 on jmcriffey:feature-dryRun into 4119305 on FormidableLabs:master.

@coveralls
Copy link

coveralls commented Jul 5, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 7e3ba1e on jmcriffey:feature-dryRun into 4119305 on FormidableLabs:master.

@@ -1,60 +1,69 @@
import {exec} from "child_process";
Copy link
Member

@ryan-roemer ryan-roemer Jul 5, 2016

Choose a reason for hiding this comment

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

If you've changed this just to be able to patch this in tests, you don't need to...

Raw:

import {exec} from "child_process";

exec();

babel output:

var _child_process = require("child_process");

(0, _child_process.exec)();

The same applies after refactoring to sinon (for sandbox.stub(childProcess, "exec")) where it would still work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I'm not sure why I thought I needed to do that.

@ryan-roemer
Copy link
Member

@jmcriffey -- First review pass done. Let's refactor to not patch exec. Feel free to hit me up on slack if you want to chat game plan more!

import fileUtils from "./file-utils";
import fs from "fs";
import logger from "./logger";
import mockfs from "mock-fs";
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't merely importing this start the monkey-patching of node internals? I think we want a lazy require in here right before we actually need to start doing stuff...

Copy link
Contributor Author

@jeffrifwald jeffrifwald Jul 5, 2016

Choose a reason for hiding this comment

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

Yeah that is correct. It doesn't actually replace anything in the file system until you call it, but I'll go ahead lazy require it to make sure we correctly read the package file.

@jeffrifwald
Copy link
Contributor Author

@ryan-roemer This is ready for another look over.

It has also been updated so that mock-fs retains the read/write permissions. This will cause the dry run to fail if you try to manipulate files without the correct permissions.


exec(cmd, cb) {
if (git.dry) {
exec("git status", cb);
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 like the idea of calling git status here in place of any destructive git commands to make sure git is callable.
Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

What are all the commands we can run? git status seems like a good dry run counterpart to git checkout. Some other git commands have a dry run capability IIRC.

@coveralls
Copy link

coveralls commented Jul 5, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 942fd51 on jmcriffey:feature-dryRun into 4119305 on FormidableLabs:master.

@ryan-roemer
Copy link
Member

@jmcriffey -- One question, rest lgtm without re-review unless you want it.

@jeffrifwald jeffrifwald merged commit eb6b3ca into FormidableLabs:master Jul 5, 2016
@jeffrifwald jeffrifwald mentioned this pull request Jul 5, 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

3 participants