Skip to content

Commit

Permalink
Merge 0.10 into snaplet-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Nov 9, 2012
2 parents 9e9f11b + 0388a5f commit 2e136c3
Show file tree
Hide file tree
Showing 29 changed files with 442 additions and 214 deletions.
3 changes: 1 addition & 2 deletions project_template/default/foo.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ Executable projname
Build-depends:
base >= 4 && < 5,
bytestring >= 0.9.1 && < 0.11,
data-lens >= 2.0.1 && < 2.11,
data-lens-template >= 2.1 && < 2.2,
heist >= 0.10 && < 0.11,
lens >= 3.2 && < 3.3,
MonadCatchIO-transformers >= 0.2.1 && < 0.4,
mtl >= 2 && < 3,
snap >= 0.10 && < 0.11,
Expand Down
4 changes: 2 additions & 2 deletions project_template/default/src/Application.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module Application where

------------------------------------------------------------------------------
import Data.Lens.Template
import Control.Lens
import Snap.Snaplet
import Snap.Snaplet.Heist
import Snap.Snaplet.Auth
Expand All @@ -19,7 +19,7 @@ data App = App
, _auth :: Snaplet (AuthManager App)
}

makeLens ''App
makeLenses ''App

instance HasHeist App where
heistLens = subSnaplet heist
Expand Down
2 changes: 2 additions & 0 deletions project_template/tutorial/src/Part2.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
>
> data Bar = Bar
>
> fooInit :: SnapletInit b Foo
> fooInit = makeSnaplet "foo" "Foo snaplet" Nothing $ do
> return Foo
>
> barInit :: SnapletLens b Foo -> SnapletInit b Bar
> barInit h = makeSnaplet "bar" "Bar snaplet" Nothing $ do
> return Bar
2 changes: 1 addition & 1 deletion project_template/tutorial/src/Tutorial.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ by our application as well as any other state we might want.
> , _companyName :: IORef B.ByteString
> }
>
> makeLenses [''App]
> makeLenses ''App

The field names begin with an underscore because of some more complicated
things going on under the hood. However, all you need to know right now is
Expand Down
6 changes: 4 additions & 2 deletions snap.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ Library
containers >= 0.3 && < 0.6,
directory >= 1.0 && < 1.3,
directory-tree >= 0.10 && < 0.12,
data-lens >= 2.0.1 && < 2.11,
data-lens-template >= 2.1 && < 2.2,
dlist >= 0.5 && < 0.6,
errors >= 1.3 && < 1.4,
filepath >= 1.1 && < 1.4,
hashable >= 1.1 && < 1.2,
heist >= 0.10 && < 0.11,
<<<<<<< HEAD
HUnit >= 1.2 && < 2,
=======
lens >= 3.2 && < 3.3,
>>>>>>> upstream/0.10
logict >= 0.4.2 && < 0.6,
mtl > 2.0 && < 2.2,
mwc-random >= 0.8 && < 0.13,
Expand Down
233 changes: 233 additions & 0 deletions snap.cabal.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
name: snap
version: 0.10.0
synopsis: Top-level package for the Snap Web Framework
description:
This is the top-level package for the official Snap Framework libraries.
It includes:
.
* The Snaplets API
.
* The \"snap\" executable program for generating starter projects
.
* Snaplets for sessions, authentication, and templates
.
To get started, issue the following sequence of commands:
.
@$ cabal install snap
$ mkdir myproject
$ cd myproject
$ snap init@
.
If you have trouble or any questions, see our FAQ page
(<http://snapframework.com/faq>) or the documentation
(<http://snapframework.com/docs>).

license: BSD3
license-file: LICENSE
author: Ozgun Ataman, Doug Beardsley, Gregory Collins, Carl Howells, Chris Smith
maintainer: snap@snapframework.com
build-type: Simple
cabal-version: >= 1.8
homepage: http://snapframework.com/
category: Web, Snap

extra-source-files:
CONTRIBUTORS,
LICENSE,
README.md,
README.SNAP.md,
project_template/barebones/.ghci,
project_template/barebones/foo.cabal,
project_template/barebones/log/access.log,
project_template/barebones/src/Main.hs,
project_template/default/.ghci,
project_template/default/foo.cabal,
project_template/default/log/access.log,
project_template/default/log/error.log,
project_template/default/static/screen.css,
project_template/default/snaplets/heist/templates/base.tpl,
project_template/default/snaplets/heist/templates/index.tpl,
project_template/default/snaplets/heist/templates/_login.tpl,
project_template/default/snaplets/heist/templates/login.tpl,
project_template/default/snaplets/heist/templates/_new_user.tpl,
project_template/default/snaplets/heist/templates/new_user.tpl,
project_template/default/snaplets/heist/templates/userform.tpl,
project_template/default/src/Application.hs,
project_template/default/src/Main.hs,
project_template/default/src/Site.hs,
project_template/tutorial/.ghci,
project_template/tutorial/foo.cabal,
project_template/tutorial/log/placeholder,
project_template/tutorial/src/Part2.lhs,
project_template/tutorial/src/Tutorial.lhs,
extra/hscolour.css,
extra/haddock.css,
extra/logo.gif,
test/snap-testsuite.cabal,
test/runTestsAndCoverage.sh,
test/suite/TestSuite.hs,
test/suite/NestTest.hs,
test/suite/Snap/TestCommon.hs,
test/suite/Snap/Snaplet/Internal/Lensed/Tests.hs,
test/suite/Snap/Snaplet/Internal/RST/Tests.hs,
test/suite/Snap/Snaplet/Internal/Tests.hs,
test/suite/Snap/Snaplet/Internal/LensT/Tests.hs,
test/suite/Blackbox/Types.hs,
test/suite/Blackbox/FooSnaplet.hs,
test/suite/Blackbox/BarSnaplet.hs,
test/suite/Blackbox/Common.hs,
test/suite/Blackbox/EmbeddedSnaplet.hs,
test/suite/Blackbox/Tests.hs,
test/suite/Blackbox/App.hs,
test/suite/SafeCWD.hs,
test/suite/AppMain.hs,
test/non-cabal-appdir/db.cfg,
test/non-cabal-appdir/bad.tpl,
test/non-cabal-appdir/snaplets/baz/templates/bazpage.tpl,
test/non-cabal-appdir/snaplets/baz/templates/bazconfig.tpl,
test/non-cabal-appdir/snaplets/baz/devel.cfg,
test/non-cabal-appdir/snaplets/embedded/extra-templates/extra.tpl,
test/non-cabal-appdir/snaplets/embedded/snaplets/heist/templates/embeddedpage.tpl,
test/non-cabal-appdir/snaplets/heist/templates/index.tpl,
test/non-cabal-appdir/snaplets/heist/templates/session.tpl,
test/non-cabal-appdir/snaplets/heist/templates/splicepage.tpl,
test/non-cabal-appdir/snaplets/heist/templates/page.tpl,
test/non-cabal-appdir/good.tpl,
test/non-cabal-appdir/log/placeholder,
test/non-cabal-appdir/devel.cfg,
test/foosnaplet/templates/foopage.tpl,
test/foosnaplet/devel.cfg

Library
hs-source-dirs: src

exposed-modules:
Snap,
Snap.Snaplet
Snap.Snaplet.Heist
Snap.Snaplet.HeistNoClass
Snap.Snaplet.Auth
Snap.Snaplet.Auth.Backends.JsonFile
Snap.Snaplet.Config
Snap.Snaplet.Session
Snap.Snaplet.Session.Common
Snap.Snaplet.Session.SessionManager
Snap.Snaplet.Session.Backends.CookieSession
Snap.Snaplet.Test

other-modules:
Control.Access.RoleBased.Checker
Control.Access.RoleBased.Role
Control.Access.RoleBased.Types
Control.Access.RoleBased.Internal.Role
Control.Access.RoleBased.Internal.RoleMap
Control.Access.RoleBased.Internal.Rule
Control.Access.RoleBased.Internal.Types
Snap.Snaplet.Auth.AuthManager
Snap.Snaplet.Auth.Types
Snap.Snaplet.Auth.Handlers
Snap.Snaplet.Auth.SpliceHelpers
Snap.Snaplet.Internal.Initializer
Snap.Snaplet.Internal.LensT
Snap.Snaplet.Internal.Lensed
Snap.Snaplet.Internal.RST
Snap.Snaplet.Internal.Types
Snap.Snaplet.Session.SecureCookie

build-depends:
MonadCatchIO-transformers >= 0.2 && < 0.4,
aeson >= 0.6 && < 0.7,
attoparsec >= 0.10 && < 0.11,
base >= 4 && < 5,
bytestring >= 0.9.1 && < 0.11,
cereal >= 0.3 && < 0.4,
clientsession >= 0.8 && < 0.9,
configurator >= 0.1 && < 0.3,
comonad >= 1.1 && < 3.1,
containers >= 0.3 && < 0.6,
directory >= 1.0 && < 1.3,
directory-tree >= 0.10 && < 0.12,
dlist >= 0.5 && < 0.6,
errors >= 1.3 && < 1.4,
filepath >= 1.1 && < 1.4,
hashable >= 1.1 && < 1.2,
heist >= 0.10 && < 0.11,
<<<<<<< HEAD
HUnit >= 1.2 && < 2,
=======
lens >= 3.2 && < 3.3,
>>>>>>> upstream/0.10
logict >= 0.4.2 && < 0.6,
mtl > 2.0 && < 2.2,
mwc-random >= 0.8 && < 0.13,
pwstore-fast >= 2.2 && < 2.4,
regex-posix >= 0.95 && < 1,
snap-core >= 0.9.2 && < 0.10,
snap-server >= 0.9.2 && < 0.10,
stm >= 2.2 && < 2.5,
syb >= 0.1 && < 0.4,
text >= 0.11 && < 0.12,
time >= 1.1 && < 1.5,
transformers >= 0.2 && < 0.4,
unordered-containers >= 0.1.4 && < 0.3,
vector >= 0.7.1 && < 0.11,
vector-algorithms >= 0.4 && < 0.6,
xmlhtml >= 0.1 && < 0.3

extensions:
BangPatterns,
CPP,
DeriveDataTypeable,
ExistentialQuantification,
FlexibleContexts,
FlexibleInstances,
GeneralizedNewtypeDeriving,
MultiParamTypeClasses,
NoMonomorphismRestriction,
OverloadedStrings,
PackageImports,
Rank2Types,
RecordWildCards,
ScopedTypeVariables,
TemplateHaskell,
TypeFamilies,
TypeOperators,
TypeSynonymInstances

if impl(ghc >= 6.12.0)
ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
-fno-warn-orphans -fno-warn-unused-do-bind
else
ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
-fno-warn-orphans

Executable snap
hs-source-dirs: src
main-is: Snap/Starter.hs

other-modules: Snap.StarterTH

build-depends:
base >= 4 && < 5,
bytestring >= 0.9.1 && < 0.11,
containers >= 0.3 && < 0.6,
directory >= 1.0 && < 1.3,
directory-tree >= 0.10 && < 0.12,
filepath >= 1.1 && < 1.4,
old-time >= 1.0 && < 1.2,
snap-server >= 0.9.1 && < 0.10,
template-haskell >= 2.2 && < 2.9,
text >= 0.11 && < 0.12

ghc-prof-options: -prof -auto-all

if impl(ghc >= 6.12.0)
ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
-fno-warn-orphans -fno-warn-unused-do-bind
else
ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
-fno-warn-orphans

source-repository head
type: git
location: https://github.com/snapframework/snap.git
6 changes: 2 additions & 4 deletions src/Snap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ see "Snap.Snaplet". For the core web server API, see "Snap.Core".

module Snap
( module Control.Applicative
, module Control.Lens
, module Control.Monad.State
, module Data.Lens.Common
, module Data.Lens.Template
, module Snap.Core
, module Snap.Http.Server
, module Snap.Snaplet
) where

import Control.Applicative
import Control.Lens
import Control.Monad.State
import Data.Lens.Common
import Data.Lens.Template
import Snap.Core
import Snap.Http.Server
import Snap.Snaplet
Expand Down
3 changes: 3 additions & 0 deletions src/Snap/Snaplet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ module Snap.Snaplet
, runSnaplet
, combineConfig
, serveSnaplet

-- * Snaplet Lenses
, SnapletLens
) where


Expand Down
3 changes: 1 addition & 2 deletions src/Snap/Snaplet/Auth/AuthManager.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module Snap.Snaplet.Auth.AuthManager

------------------------------------------------------------------------------
import Data.ByteString (ByteString)
import Data.Lens.Lazy
import Data.Text (Text)
import Data.Time
import Web.ClientSession
Expand Down Expand Up @@ -70,7 +69,7 @@ data AuthManager b = forall r. IAuthBackend r => AuthManager {
backend :: r
-- ^ Storage back-end

, session :: Lens b (Snaplet SessionManager)
, session :: SnapletLens b SessionManager
-- ^ A lens pointer to a SessionManager

, activeUser :: Maybe AuthUser
Expand Down
3 changes: 1 addition & 2 deletions src/Snap/Snaplet/Auth/Backends/JsonFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import Data.Map (Map)
import Data.Maybe (fromJust, isJust)
import Data.Text (Text)
import qualified Data.Text as T
import Data.Lens.Lazy
import Data.Time
import Web.ClientSession
import System.Directory
Expand All @@ -38,7 +37,7 @@ import Snap.Snaplet.Session
-- | Initialize a JSON file backed 'AuthManager'
initJsonFileAuthManager :: AuthSettings
-- ^ Authentication settings for your app
-> Lens b (Snaplet SessionManager)
-> SnapletLens b SessionManager
-- ^ Lens into a 'SessionManager' auth snaplet will
-- use
-> FilePath
Expand Down
3 changes: 1 addition & 2 deletions src/Snap/Snaplet/Auth/Handlers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Control.Applicative
import Control.Error
import Control.Monad.State
import Data.ByteString (ByteString)
import Data.Lens.Lazy
import Data.Serialize hiding (get)
import Data.Time
import Data.Text.Encoding (decodeUtf8)
Expand Down Expand Up @@ -469,7 +468,7 @@ logoutUser target = logout >> target
-- This function has no DB cost - only checks to see if a user_id is present
-- in the current session.
--
requireUser :: Lens b (Snaplet (AuthManager b))
requireUser :: SnapletLens b (AuthManager b)
-- ^ Lens reference to an "AuthManager"
-> Handler b v a
-- ^ Do this if no authenticated user is present.
Expand Down
Loading

0 comments on commit 2e136c3

Please sign in to comment.