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

Add callback to run #547

Closed
wants to merge 1 commit into from
Closed

Add callback to run #547

wants to merge 1 commit into from

Conversation

cellis
Copy link

@cellis cellis commented Feb 11, 2018

This makes it much simpler to hook standard CLI behavior with custom behavior, as detailed in the docs: https://db-migrate.readthedocs.io/en/latest/API/programable/#run

Related: #313

@ghost
Copy link

ghost commented Feb 11, 2018

There were the following issues with this Pull Request

  • Commit: 260becf
    • ✖ message may not be empty
    • ✖ type may not be empty

You may need to change the commit messages to comply with the repository contributing guidelines.


🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding!

Signed-off-by: cellis <cameronellis.ellis@gmail.com>
@ghost
Copy link

ghost commented Feb 11, 2018

There were the following issues with this Pull Request

  • Commit: 8b597d6
    • ✖ message may not be empty
    • ✖ type may not be empty

You may need to change the commit messages to comply with the repository contributing guidelines.


🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding!

@wzrdtales
Copy link
Member

As stated in the issue. Not gonna happen, run is explicitly not returning a callback and never will. It will exit with proper exit codes and is CLI only.

I have however still reviewed your changes, so you know for your next PR what to look out for.

var action = internals.argv._.shift();
var folder = action.split(':');

action = folder[0];
var toExecute = null;
Copy link
Member

Choose a reason for hiding this comment

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

always move definitions to the top of the current scope

Copy link
Member

Choose a reason for hiding this comment

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

also do not initialize something with null just leave it alone when you want to have it published for the scope but filled later.

@@ -4,12 +4,14 @@ var log = require('db-migrate-shared').log;
var optimist = require('optimist');
var load = require('./');
var transition = load('transition');
Promise = require('bluebird');
Copy link
Member

Choose a reason for hiding this comment

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

never require as global

run: function () {
load('run')(this.internals, this.config);
run: function (callback) {
load('run')(this.internals, this.config, callback);
Copy link
Member

Choose a reason for hiding this comment

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

not a valid definition, everything needs to be a promise in the first place. callbacks are just second class citizens and just supported for backwards compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants