Skip to content

Commit

Permalink
Merge c3a03da into 16819c9
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Jun 6, 2019
2 parents 16819c9 + c3a03da commit 2f3774e
Show file tree
Hide file tree
Showing 241 changed files with 4,375 additions and 2,918 deletions.
23 changes: 23 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# generated by deepsource.io
version = 1

test_patterns = [
'tests/**/*.py'
]

exclude_patterns = [
'databases/migrations/*'
]

[[analyzers]]
name = "python"
enabled = true
runtime_version = "3.x.x"

[analyzers.meta]
max_line_length = 99

# Test coverage analyzer
[[analyzers]]
name = "test-coverage"
enabled = true
42 changes: 40 additions & 2 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
APP_NAME=Masonite 2.1
APP_ENV=local
APP_DEBUG=True
KEY=your-secret-key

MAIL_DRIVER=smtp
MAIL_FROM_ADDRESS=sandboxXX.mailgun.org
MAIL_FROM_NAME=Masonite
Expand All @@ -9,8 +14,41 @@ MAIL_PASSWORD=
MAILGUN_SECRET=key-xx
MAILGUN_DOMAIN=xx.mailgun.org

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=masonite
DB_USERNAME=root
DB_PASSWORD=root
DB_LOG=True

STRIPE_CLIENT=
STRIPE_SECRET=

STORAGE_DRIVER=disk

S3_CLIENT=
S3_SECRET=
S3_BUCKET=

RACKSPACE_USERNAME=
RACKSPACE_SECRET=
RACKSPACE_CONTAINER=
RACKSPACE_REGION=

AZURE_NAME=
AZURE_SECRET=
AZURE_CONNECTION=
AZURE_CONTAINER=

QUEUE_DRIVER=async
QUEUE_USERNAME=
QUEUE_VHOST=
QUEUE_PASSWORD=
QUEUE_HOST=
QUEUE_PORT=
QUEUE_CHANNEL=

PUSHER_APP_ID=
PUSHER_CLIENT=
PUSHER_SECRET=

ABLY_SECRET=
8 changes: 8 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DB_DRIVER=sqlite
DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=masonite.db
DB_USERNAME=root
DB_PASSWORD=
APP_DEBUG=True
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ tests/bootstrap/cache/*.txt
/uploads/
.coverage
.idea/
masonite.db
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ matrix:
dist: xenial
sudo: true
- python: 3.6
script: travis_retry coverage run -m pytest && coveralls
script: travis_retry coverage run -m pytest && coveralls && coverage xml && curl https://deepsource.io/cli | sh && ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml

install:
- pip install masonite_cli
- pip install -e .
- pip install -r requirements.txt

script:
- travis_retry coverage run -m pytest
- travis_retry coverage run -m pytest && coveralls
- flake8 masonite/ --ignore=E501,F401,E128,E402,E731,F821,E712,W503

deploy:
Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,52 @@ 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/).

## [2.2.b2](https://github.com/MasoniteFramework/core/releases/tag/v2.2.b2) - 2019-04-27
### Added
- Added a accept(*) to the upload drivers
- Added a lot more view helpers
- Added better test case for database tests

### Changed
- Changed Craft serve command now reloads by default. You can still pass in the -r flag but it is not required. You can also disable reloading by using craft serve -d for --dont-reload
- Changed all pytest tests to unittests


## [2.1.27](https://github.com/MasoniteFramework/core/releases/tag/v2.1.27) - 2019-04-27
### Added
- [Added collect helper](https://docs.masoniteproject.com/the-basics/helper-functions#collect)
- [Added a new way to add URL params to the route method when not specified.](https://docs.masoniteproject.com/the-basics/requests#route-parsing)

## [2.1.26](https://github.com/MasoniteFramework/core/releases/tag/v2.1.26) - 2019-03-31
### Fixed
- Fixed issue where channel was not reopening after closing for AMQP driver

## [2.1.25](https://github.com/MasoniteFramework/core/releases/tag/v2.1.25) - 2019-03-31
### Fixed
- Fixed issue where the amqp driver was not closing connections and channels after use

## [2.1.24](https://github.com/MasoniteFramework/core/releases/tag/v2.1.24) - 2019-03-31
### Fixed
- Fixed issue where queue jobs would fail because of a Unicode character (the checkmark) being printed out which would cause the job to fail. Now the command will print out a [Y] character if it cannot print out of a check mark.

## [2.1.23](https://github.com/MasoniteFramework/core/releases/tag/v2.1.23) - 2019-03-24
### Added
- [Added Cors middleware](https://docs.masoniteproject.com/security/headers#cors).
- [You can now use `@` line statements inside your jinja templates](https://docs.masoniteproject.com/the-basics/views#view-syntax)

### Changed
- Command command now appends `Command` to the end of the class name
- Exception is now thrown when a route name is not found using the `route` method on the request class

### Fixed
- [x] Fixed deprecation warnings with regex strings in tests

## [2.1.22](https://github.com/MasoniteFramework/core/releases/tag/v2.1.22) - 2019-03-17
### Fixed
- Fixed Auth command not adding route names
- Fixed issue with compact command not working with multiple None types
- Fixed issue Japanese characters not returning correct content length

## [2.1.21](https://github.com/MasoniteFramework/core/releases/tag/v2.1.21) - 2019-03-14
### Added
- [Added run_again_on_fail and run_times](https://docs.masoniteproject.com/useful-features/queues-and-jobs#specifying-failed-jobs)
Expand Down
70 changes: 70 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
ably = "==1.0.1"
"asn1crypto" = "==0.24.0"
atomicwrites = "==1.2.1"
attrs = "==18.2.0"
backpack = "==0.1"
bcrypt = "==3.1.4"
blinker = "==1.4"
"boto3" = "==1.5.24"
botocore = "==1.8.50"
certifi = "==2018.8.24"
cffi = "==1.11.5"
chardet = "==3.0.4"
cleo = "==0.6.5"
coverage = "==4.5.1"
coveralls = "*"
cryptography = "==2.3"
docopt = "==0.6.2"
docutils = "==0.14"
idna = "==2.6"
inflection = "==0.3.1"
jmespath = "==0.9.3"
lazy-object-proxy = "==1.3.1"
more-itertools = "==4.3.0"
msgpack-python = "==0.5.6"
ndg-httpsclient = "==0.5.1"
orator = "==0.9.7"
pastel = "==0.1.0"
pendulum = "==1.4.4"
pluggy = "==0.7.1"
psutil = "==5.4.7"
pusher = "==1.7.4"
py = "==1.6.0"
pyaml = "==16.12.2"
"pyasn1" = "==0.4.4"
pycparser = "==2.18"
pylev = "==1.3.0"
python-dateutil = "==2.7.3"
python-dotenv = "==0.9.1"
pytz = "==2018.5"
pytzdata = "==2018.5"
requests = "==2.18.4"
requests-file = "==1.4.3"
"s3transfer" = "==0.1.13"
simplejson = "==3.16.0"
six = "==1.11.0"
tabulate = "==0.8.2"
tldextract = "==2.2.0"
tzlocal = "==1.5.1"
"urllib3" = "==1.22"
"validator.py" = "==1.2.5"
waitress = "==1.1.0"
whitenoise = "==4.0"
wrapt = "==1.10.11"
"flake8" = "==3.5.0"
pika = "*"
Faker = "==0.7.18"
"Jinja2" = "==2.10"
MarkupSafe = "==1.0"
Pygments = "==2.2.0"
pyOpenSSL = "==18.0.0"
PyYAML = "==3.13"

[dev-packages]

5 changes: 2 additions & 3 deletions app/User.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
""" User Model """
"""User Model."""

from config.database import Model


class User(Model):
"""User Model
"""
"""User Model."""

__fillable__ = ['name', 'email', 'password']

Expand Down
9 changes: 9 additions & 0 deletions app/http/controllers/ControllerTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ def returns_a_dict(self):

def param(self):
return self.request.param('id')

def get_param(self, first):
self.request.first = first
return self.request

def get_param_and_object(self, first, view: View):
self.request.first = first
self.request.view = view
return self.request
9 changes: 3 additions & 6 deletions app/http/controllers/TestController.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from cleo import Command
from masonite.exceptions import DebugException

from masonite.request import Request
from masonite import Queue
from app.jobs.TestJob import TestJob
from masonite import Queue
from masonite.request import Request


class TestController:
Expand Down Expand Up @@ -39,7 +36,7 @@ def json(self):
return 'success'

def bad(self):
return 5/0
return 5 / 0

def session(self, request: Request):
request.session.set('test', 'value')
Expand Down
31 changes: 31 additions & 0 deletions app/http/controllers/UnitTestController.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""A UnitTestController Module."""

from masonite.request import Request
from masonite.controllers import Controller


class UnitTestController(Controller):
"""UnitTestController Controller Class."""

def __init__(self, request: Request):
"""UnitTestController Initializer
Arguments:
request {masonite.request.Request} -- The Masonite Request class.
"""
self.request = request

def show(self):
return 'got'

def store(self):
return 'posted'

def params(self):
return self.request.input('test')

def get_params(self):
return self.request.input('test')

def user(self):
return self.request.user().name
12 changes: 6 additions & 6 deletions app/http/controllers/WelcomeController.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
""" Welcome The User To Masonite """
"""Welcome The User To Masonite."""

from masonite.view import View
from masonite.request import Request


class WelcomeController:
"""Controller For Welcoming The User
"""
"""Controller For Welcoming The User."""

def show(self, view: View, request: Request):
"""Shows the welcome page.
"""Show the welcome page.
Arguments:
view {masonite.view.View} -- The Masonite view class.
Expand All @@ -18,5 +17,6 @@ def show(self, view: View, request: Request):
Returns:
masonite.view.View -- The Masonite view class.
"""

return view.render('welcome', {'app': request.app().make('Application')})
return view.render('welcome', {
'app': request.app().make('Application')
})
16 changes: 5 additions & 11 deletions app/http/middleware/AuthenticationMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
""" Authentication Middleware """
"""Authentication Middleware."""

from masonite.request import Request


class AuthenticationMiddleware:
"""Middleware To Check If The User Is Logged In
"""
"""Middleware To Check If The User Is Logged In."""

def __init__(self, request: Request):
"""Inject Any Dependencies From The Service Container
"""Inject Any Dependencies From The Service Container.
Arguments:
Request {masonite.request.Request} -- The Masonite request object
"""

self.request = request

def before(self):
"""Run This Middleware Before The Route Executes
"""

"""Run This Middleware Before The Route Executes."""
if not self.request.user():
self.request.redirect_to('login')

def after(self):
"""Run This Middleware After The Route Executes
"""

"""Run This Middleware After The Route Executes."""
pass
6 changes: 4 additions & 2 deletions app/http/middleware/CsrfMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
""" CSRF Middleware """
"""CSRF Middleware."""

from masonite.middleware import CsrfMiddleware as Middleware


class CsrfMiddleware(Middleware):
""" Verify CSRF Token Middleware """
"""Verify CSRF Token Middleware."""

exempt = []
every_request = False
token_length = 30
Loading

0 comments on commit 2f3774e

Please sign in to comment.