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 "default command" behavior #112

Open
sergey-ostapenko opened this issue Jul 10, 2018 · 2 comments
Open

Add "default command" behavior #112

sergey-ostapenko opened this issue Jul 10, 2018 · 2 comments

Comments

@sergey-ostapenko
Copy link
Contributor

sergey-ostapenko commented Jul 10, 2018

It will be great to add default command handler into mbt configs, with possibility to determine name of command invoked:

name: UniversalCommandModule
commands:
  default:
    cmd: sh
    args: 
      - "$MBT_REPO_PATH/scripts/$MBT_COMMAND_NAME.sh"

Acting like that you will be able to add commands without changes in config files. You just need to add new script to the correct location, and that's it.
Even if your projects are not unified, you still can use default command to handle missing commands in your way.

@buddhike
Copy link
Member

Thanks @sergey-ostapenko

Whilst I was working on the first implementation of run-in command, I thought about making it more general purpose like this:

mbt run-in branch ./custom.sh arg1 arg2 arg3
mbt run-in commit <sha> npm run blah
...

That way, you could run any executable without needing to change the spec files. This would be very convenient to the user. However, you loose the visibility in the version control system.
I wonder if this proposal would fall into the same category.

What do you think?

@sergey-ostapenko
Copy link
Contributor Author

sergey-ostapenko commented Jul 11, 2018

@BuddySpike Yes, I think it will work great when you have set of very very similar projects.
The only difference here - you cannot alter command behavior for special cases. Let's consider the following workflow:

  1. You running the command mbt run-in branch --command test
  2. If such command is defined, the step will be executed according to the configuration.
  3. If command is not defined and there is default command handler - it will be used.
  4. If no command and no default handler - command will be reported as skipped for the module.

Also it is not true that we will lose possibility to track changes in source control: script files along with build configurations will be more than enough to track the history.

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

No branches or pull requests

2 participants