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

[5.5] Add prompt to vendor:publish to specify which provider/tag to publish #18230

Merged
merged 3 commits into from
Mar 9, 2017
Merged

[5.5] Add prompt to vendor:publish to specify which provider/tag to publish #18230

merged 3 commits into from
Mar 9, 2017

Conversation

fitztrev
Copy link
Contributor

@fitztrev fitztrev commented Mar 6, 2017

By default, artisan vendor:publish will publish everything it can find. Passing the --provider flag is the way around this but you have to lookup the package's service provider class name along with its namespace (long and inconsistent naming across packages).

This pull request adds a prompt to allow the user to specify the package for which they want to publish files.

Prompt can be avoided by using the --all flag or by continuing to pass a --provider.

Edit: Updated screen capture gif below
laravel-vendor-publish4

@browner12
Copy link
Contributor

could you make option 0 publish everything? that way people wouldn't have to remember the flag?

this is awesome, BTW.

@edenreich
Copy link
Contributor

Very cool feature, I think its very useful, good job!

return $this->choice(
"Which package's files would you like to publish?",
ServiceProvider::providersAvailableToPublish()
);
Copy link

@MarkVaughn MarkVaughn Mar 6, 2017

Choose a reason for hiding this comment

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

This might work

        $choice = $this->choice(
            "Which package's files would you like to publish?",
            array_merge(
                ['All'],
                ServiceProvider::providersAvailableToPublish()
            ),
            0
        );
        
        return $choice === 'All' ? null : $choice;

@antonkomarev
Copy link
Contributor

Is there is a way to skip command prompt? It will be useful for deploy automation tools.

@browner12
Copy link
Contributor

you can still use the --provider flag if you'd like to use it with automation

@antonkomarev
Copy link
Contributor

@browner12 thanks! Don't know why I've missed that from first comment.

@fitztrev
Copy link
Contributor Author

fitztrev commented Mar 7, 2017

Thanks for the feedback. I prepended the 0 option to publish all.

screen shot 2017-03-06 at 7 38 38 pm

@bbashy
Copy link
Contributor

bbashy commented Mar 7, 2017

Great stuff!

@taylorotwell
Copy link
Member

Does this also show available tags?

@fitztrev
Copy link
Contributor Author

fitztrev commented Mar 8, 2017

Publishable tags have now been added as choices in the prompt. Gif has been updated to show what it looks like.

@fitztrev fitztrev changed the title [5.5] Add prompt to vendor:publish to specify which provider to publish [5.5] Add prompt to vendor:publish to specify which provider/tag to publish Mar 8, 2017
@browner12
Copy link
Contributor

this update seems a little strange to me. aren't tags a subset of a provider?

Wouldn't you first select a provider, and then (if it has them) select the tag after that?

Is it possible to do a two step choice like this with the command?

@fitztrev
Copy link
Contributor Author

fitztrev commented Mar 8, 2017

Tags are a subset but they can be shared across multiple packages. So this lets you publish all the config or migrations-tagged files for all providers at once.

I'm OK with this functionality. If someone wants to publish only the views for a specific provider that also has config or migrations, they still can use --provider="xyz" --tag=views in conjunction with each other.

@taylorotwell taylorotwell merged commit 117fe45 into laravel:master Mar 9, 2017
@taylorotwell
Copy link
Member

Nice addition @fitztrev!

@jbrooksuk
Copy link
Member

This is awesome!

@mitoop
Copy link
Contributor

mitoop commented Jun 28, 2017

What i want! Awesome!

@juniorb2ss
Copy link

@fitztrev Maybe functionality to publish specific tags and providers like: 4,2,8 in same time.

@fitztrev
Copy link
Contributor Author

@juniorb2ss it's just an interface on top of the --provider and --tags options that were already part of the command. You can't pass multiple --providers. and if you try to do both a provider and a tag, it treats it like an AND. So it would likely be confusing. Not worth it IMO.

@fitztrev fitztrev deleted the vendor-publish-prompt branch September 7, 2017 21:25
@fitztrev fitztrev restored the vendor-publish-prompt branch September 7, 2017 21:25
@fitztrev fitztrev deleted the vendor-publish-prompt branch September 7, 2017 21:25
@fitztrev fitztrev restored the vendor-publish-prompt branch September 7, 2017 21:27
@fitztrev fitztrev deleted the vendor-publish-prompt branch September 7, 2017 21:27
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.

10 participants