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/534 #713

Merged
merged 9 commits into from
Jun 1, 2019
Merged

Feature/534 #713

merged 9 commits into from
Jun 1, 2019

Conversation

josephmancuso
Copy link
Member

This PR introduces the concept of Provider Publishing. This is the concept of a provider being responsible for adding files to an application like migrations or routes or templates.

@josephmancuso josephmancuso self-assigned this May 19, 2019
@josephmancuso
Copy link
Member Author

You can use this by using a new publishing method on a provider:

class SomeProvider:

    def boot(self):
        self.publishes({
            '/from/file': '/to/file'
        })

you can also tag this so you may want to group together multiple files under a namespace like views:

class SomeProvider:

    def boot(self):
        self.publishes({

            '/package/views/admin.html': 'resources/templates/vendor/admin.html',
            '/package/views/dashboard.html': 'resources/templates/vendor/dashboard.html',
            '/package/views/users.html': 'resources/templates/vendor/users.html',
            '/package/views/pages.html': 'resources/templates/vendor/pages.html',

        }, tag='views')

You can then use this by running a new publish command:

$ craft publish SomeProvider --tag views

@coveralls
Copy link

coveralls commented May 19, 2019

Coverage Status

Coverage decreased (-0.03%) to 87.107% when pulling f1cfe14 on feature/534 into 10793e0 on develop.

@josephmancuso
Copy link
Member Author

josephmancuso commented May 19, 2019

since migrations need special logic (create the file with the correct timestamp of right now) you need to run:

class SomeProvider:

    def boot(self):
        self.publishes_migrations([
            '/migration-directory/1',
            '/migration-directory/2'
        ], tag='some-tag')

masonite/packages.py Outdated Show resolved Hide resolved
Copy link
Contributor

@thetonus thetonus left a comment

Choose a reason for hiding this comment

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

Use context managers

masonite/packages.py Outdated Show resolved Hide resolved
@josephmancuso josephmancuso merged commit 247c129 into develop Jun 1, 2019
@josephmancuso josephmancuso deleted the feature/534 branch August 29, 2019 01:25
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.

5 participants