Skip to content

Commit

Permalink
added publish command
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed May 19, 2019
1 parent 509532f commit f7a335b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
28 changes: 28 additions & 0 deletions masonite/commands/PublishCommand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Publish Service Providers"""
from cleo import Command


class PublishCommand(Command):
"""
Publishes a Service Provider
publish
{name : Name of the Service Provider you want to publish}
{--t|tag=None : The tag of the provider you want to publish}
"""

def handle(self):
print(self.option('tag'))
from config import providers

for provider in providers.PROVIDERS:
if provider.__name__ == self.argument('name'):
if self.option('tag') != 'None':
provider().publish(tag=self.option('tag'))

provider().publish()

return

raise ValueError('Could not find the {} provider'.format(self.argument('name')))

1 change: 1 addition & 0 deletions masonite/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .ModelCommand import ModelCommand
from .ModelDocstringCommand import ModelDocstringCommand
from .ProviderCommand import ProviderCommand
from .PublishCommand import PublishCommand
from .QueueWorkCommand import QueueWorkCommand
from .QueueTableCommand import QueueTableCommand
from .RuleCommand import RuleCommand
Expand Down
3 changes: 3 additions & 0 deletions masonite/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,8 @@ def publish(self, tag=None):
else:
publishing_items = self._publishes

if not len(publishing_items):
raise NotImplementedError('This provider does not publish anything')

for from_location, to_location in publishing_items.items():
append_file(from_location, to_location)
3 changes: 2 additions & 1 deletion masonite/providers/AppProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
MigrateRefreshCommand, MigrateResetCommand,
MigrateRollbackCommand, MigrateStatusCommand,
ModelCommand, ModelDocstringCommand,
ProviderCommand, QueueTableCommand,
ProviderCommand, PublishCommand, QueueTableCommand,
QueueWorkCommand, RoutesCommand, RuleCommand,
RuleEnclosureCommand, SeedCommand,
SeedRunCommand, ServeCommand, TinkerCommand,
Expand Down Expand Up @@ -74,6 +74,7 @@ def _load_commands(self):
self.app.bind('MasoniteModelCommand', ModelCommand())
self.app.bind('MasoniteModelDocstringCommand', ModelDocstringCommand())
self.app.bind('MasoniteProviderCommand', ProviderCommand())
self.app.bind('MasonitePublishCommand', PublishCommand())
self.app.bind('MasoniteQueueWorkCommand', QueueWorkCommand())
self.app.bind('MasoniteQueueTableCommand', QueueTableCommand())
self.app.bind('MasoniteViewCommand', ViewCommand())
Expand Down

0 comments on commit f7a335b

Please sign in to comment.