Skip to content

Commit

Permalink
Merge ac1ac27 into a5ab5a0
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso authored Aug 24, 2018
2 parents a5ab5a0 + ac1ac27 commit de63c2f
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 20 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Sentimental Versioning](http://sentimentalversioning.org/).

## [Unreleased]


## [2.0.16](https://github.com/MasoniteFramework/core/releases/tag/v2.0.16) - 2018-08-22
### Added
- Added docstrings to nearly all classes
- Added container hooks
- Added strict and override options to the container
- Added a validator command
- Added middleware groups
- Added change log
- Added route compilers

## [2.0.15](https://github.com/MasoniteFramework/core/releases/tag/v2.0.15) - 2018-08-12

Expand Down
4 changes: 2 additions & 2 deletions masonite/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ def _find_annotated_parameter(self, parameter):
"""

for dummy, provider_class in self.providers.items():

if parameter.annotation == provider_class or parameter.annotation == provider_class.__class__:
obj = provider_class
self.fire_hook('resolve', parameter, obj)
return obj
elif inspect.isclass(provider_class) and issubclass(provider_class, parameter.annotation):
elif inspect.isclass(provider_class) and issubclass(provider_class, parameter.annotation) or issubclass(provider_class.__class__, parameter.annotation):
obj = provider_class
self.fire_hook('resolve', parameter, obj)
return obj
Expand Down
9 changes: 8 additions & 1 deletion masonite/contracts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
from .MailContract import MailContract
from .QueueContract import QueueContract
from .SessionContract import SessionContract
from .UploadContract import UploadContract
from .UploadContract import UploadContract

from .managers.BroadcastManagerContract import BroadcastManagerContract
from .managers.CacheManagerContract import CacheManagerContract
from .managers.MailManagerContract import MailManagerContract
from .managers.QueueManagerContract import QueueManagerContract
from .managers.SessionManagerContract import SessionManagerContract
from .managers.UploadManagerContract import UploadManagerContract
5 changes: 5 additions & 0 deletions masonite/contracts/managers/BroadcastManagerContract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from abc import ABC


class BroadcastManagerContract(ABC):
pass
5 changes: 5 additions & 0 deletions masonite/contracts/managers/CacheManagerContract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from abc import ABC


class CacheManagerContract(ABC):
pass
5 changes: 5 additions & 0 deletions masonite/contracts/managers/MailManagerContract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from abc import ABC


class MailManagerContract(ABC):
pass
5 changes: 5 additions & 0 deletions masonite/contracts/managers/QueueManagerContract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from abc import ABC


class QueueManagerContract(ABC):
pass
5 changes: 5 additions & 0 deletions masonite/contracts/managers/SessionManagerContract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from abc import ABC


class SessionManagerContract(ABC):
pass
5 changes: 5 additions & 0 deletions masonite/contracts/managers/UploadManagerContract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from abc import ABC


class UploadManagerContract(ABC):
pass
2 changes: 1 addition & 1 deletion masonite/info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Module for specifying the Masonite version in a central location.
"""

VERSION = '2.0.15'
VERSION = '2.0.16'
3 changes: 2 additions & 1 deletion masonite/managers/BroadcastManager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""" Broadcast Manager Module """

from masonite.contracts import BroadcastManagerContract
from masonite.managers import Manager


class BroadcastManager(Manager):
class BroadcastManager(Manager, BroadcastManagerContract):
"""Manages all broadcast drivers.
Arguments:
Expand Down
5 changes: 3 additions & 2 deletions masonite/managers/CacheManager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""" Cache Manager """

from masonite.managers.Manager import Manager
from masonite.contracts import CacheManagerContract
from masonite.managers import Manager


class CacheManager(Manager):
class CacheManager(Manager, CacheManagerContract):
"""Manages all cache drivers.
Arguments:
Expand Down
5 changes: 3 additions & 2 deletions masonite/managers/MailManager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""" Mail Manager Module """

from masonite.managers.Manager import Manager
from masonite.contracts import MailManagerContract
from masonite.managers import Manager


class MailManager(Manager):
class MailManager(Manager, MailManagerContract):
"""Manages all mail drivers.
Arguments:
Expand Down
5 changes: 3 additions & 2 deletions masonite/managers/QueueManager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""" Queue Manager Module """

from masonite.managers.Manager import Manager
from masonite.contracts import QueueManagerContract
from masonite.managers import Manager


class QueueManager(Manager):
class QueueManager(Manager, QueueManagerContract):
"""Manages all queue drivers.
Arguments:
Expand Down
5 changes: 3 additions & 2 deletions masonite/managers/SessionManager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""" Session Manager Module """

from masonite.managers.Manager import Manager
from masonite.contracts import SessionManagerContract
from masonite.managers import Manager


class SessionManager(Manager):
class SessionManager(Manager, SessionManagerContract):
"""Manages all session drivers.
Arguments:
Expand Down
3 changes: 2 additions & 1 deletion masonite/managers/UploadManager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Upload Manager Module """

from masonite.managers.Manager import Manager
from masonite.contracts import UploadManagerContract
from masonite.managers import Manager


class UploadManager(Manager):
Expand Down
14 changes: 11 additions & 3 deletions tests/test_managers_mail_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

from masonite.app import App
from masonite.exceptions import DriverNotFound
from masonite.managers.MailManager import MailManager
from masonite.drivers.MailSmtpDriver import MailSmtpDriver as MailDriver
from masonite.drivers.MailMailgunDriver import MailMailgunDriver as Mailgun
from masonite.managers import MailManager
from masonite.drivers import MailSmtpDriver as MailDriver
from masonite.drivers import MailMailgunDriver as Mailgun
from masonite.contracts import MailManagerContract
from masonite.view import View


Expand Down Expand Up @@ -34,6 +35,13 @@ def test_mail_manager_loads_container(self):
mailManager = MailManager()
assert mailManager.load_container(self.app)

def test_mail_manager_resolves_from_contract(self):
self.app.bind('MailManager', MailManager())
assert self.app.resolve(self._test_resolve) == self.app.make('MailManager')

def _test_resolve(self, mail: MailManagerContract):
return mail

def test_creates_driver(self):
mailManager = MailManager()

Expand Down

0 comments on commit de63c2f

Please sign in to comment.