Renamed to Yesod
This commit is contained in:
parent
16b854df1a
commit
b4406b6a81
@ -20,11 +20,10 @@ module Data.Object.Instances
|
||||
, Html (..)
|
||||
) where
|
||||
|
||||
import Data.Object
|
||||
import Data.Object.Text
|
||||
import qualified Data.ByteString.Lazy as B
|
||||
import Web.Encodings (encodeJson)
|
||||
import Text.Yaml (encodeText)
|
||||
import Text.Yaml (encodeText')
|
||||
import qualified Data.Text.Lazy as LT
|
||||
import Data.Text.Lazy (Text)
|
||||
import Data.Convertible.Text
|
||||
@ -65,7 +64,7 @@ newtype Yaml = Yaml { unYaml :: Text }
|
||||
instance ConvertAttempt (Object Text Text) Yaml where
|
||||
convertAttempt = return . convertSuccess
|
||||
instance ConvertSuccess (Object Text Text) Yaml where
|
||||
convertSuccess = Yaml . encodeText
|
||||
convertSuccess = Yaml . convertSuccess . encodeText'
|
||||
|
||||
-- | Represents as an entire HTML 5 document by using the following:
|
||||
--
|
||||
|
||||
@ -30,7 +30,6 @@ module Data.Object.Translate
|
||||
) where
|
||||
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Object
|
||||
import Control.Monad.Attempt
|
||||
import Data.Object.Text
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -1,7 +1,7 @@
|
||||
The following license covers this documentation, and the source code, except
|
||||
where otherwise indicated.
|
||||
|
||||
Copyright 2008, Michael Snoyman. All rights reserved.
|
||||
Copyright 2009, Michael Snoyman. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
12
Test.hs
12
Test.hs
@ -1,12 +0,0 @@
|
||||
import Test.Framework (defaultMain)
|
||||
|
||||
import qualified Web.Restful.Response
|
||||
import qualified Web.Restful.Utils
|
||||
import qualified Web.Restful.Resource
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMain
|
||||
[ Web.Restful.Response.testSuite
|
||||
, Web.Restful.Utils.testSuite
|
||||
, Web.Restful.Resource.testSuite
|
||||
]
|
||||
@ -1,6 +1,6 @@
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful
|
||||
-- Module : Yesod
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -11,23 +11,23 @@
|
||||
-- Lightweight framework for designing RESTful APIs.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful
|
||||
module Yesod
|
||||
(
|
||||
module Data.Object
|
||||
, module Web.Restful.Request
|
||||
, module Web.Restful.Response
|
||||
, module Web.Restful.Application
|
||||
, module Web.Restful.Definitions
|
||||
, module Web.Restful.Handler
|
||||
, module Web.Restful.Resource
|
||||
, module Yesod.Request
|
||||
, module Yesod.Response
|
||||
, module Yesod.Application
|
||||
, module Yesod.Definitions
|
||||
, module Yesod.Handler
|
||||
, module Yesod.Resource
|
||||
, Application
|
||||
) where
|
||||
|
||||
import Data.Object
|
||||
import Web.Restful.Request
|
||||
import Web.Restful.Response
|
||||
import Web.Restful.Application
|
||||
import Web.Restful.Definitions
|
||||
import Web.Restful.Handler
|
||||
import Web.Restful.Resource
|
||||
import Yesod.Request
|
||||
import Yesod.Response
|
||||
import Yesod.Application
|
||||
import Yesod.Definitions
|
||||
import Yesod.Handler
|
||||
import Yesod.Resource
|
||||
import Hack (Application)
|
||||
@ -5,7 +5,7 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Application
|
||||
-- Module : Yesod.Application
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -16,7 +16,7 @@
|
||||
-- Defining the application.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Application
|
||||
module Yesod.Application
|
||||
(
|
||||
toHackApp
|
||||
, RestfulApp (..)
|
||||
@ -35,13 +35,13 @@ import Hack.Middleware.Gzip
|
||||
import Hack.Middleware.Jsonp
|
||||
import Hack.Middleware.MethodOverride
|
||||
|
||||
import Web.Restful.Request
|
||||
import Web.Restful.Response
|
||||
import Web.Restful.Utils
|
||||
import Web.Restful.Handler
|
||||
import Web.Restful.Definitions
|
||||
import Web.Restful.Constants
|
||||
import Web.Restful.Resource
|
||||
import Yesod.Request
|
||||
import Yesod.Response
|
||||
import Yesod.Utils
|
||||
import Yesod.Handler
|
||||
import Yesod.Definitions
|
||||
import Yesod.Constants
|
||||
import Yesod.Resource
|
||||
|
||||
import Data.Convertible.Text
|
||||
import Control.Arrow ((***))
|
||||
@ -1,6 +1,6 @@
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Constants
|
||||
-- Module : Yesod.Constants
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -11,7 +11,7 @@
|
||||
-- Constants used throughout Restful.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Constants
|
||||
module Yesod.Constants
|
||||
( authCookieName
|
||||
) where
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Definitions
|
||||
-- Module : Yesod.Definitions
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -13,7 +13,7 @@
|
||||
-- Definitions throughout Restful.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Definitions
|
||||
module Yesod.Definitions
|
||||
( Verb (..)
|
||||
, toVerb
|
||||
, Resource
|
||||
@ -5,7 +5,7 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Handler
|
||||
-- Module : Yesod.Handler
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -16,7 +16,7 @@
|
||||
-- Define Handler stuff.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Handler
|
||||
module Yesod.Handler
|
||||
( -- * Handler monad
|
||||
HandlerT
|
||||
, HandlerIO
|
||||
@ -33,8 +33,8 @@ module Web.Restful.Handler
|
||||
, header
|
||||
) where
|
||||
|
||||
import Web.Restful.Request
|
||||
import Web.Restful.Response
|
||||
import Yesod.Request
|
||||
import Yesod.Response
|
||||
|
||||
import Control.Exception hiding (Handler)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Response.AtomFeed
|
||||
-- Module : Yesod.Response.AtomFeed
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -14,12 +14,12 @@
|
||||
--
|
||||
---------------------------------------------------------
|
||||
|
||||
module Web.Restful.Helpers.AtomFeed
|
||||
module Yesod.Helpers.AtomFeed
|
||||
( AtomFeed (..)
|
||||
, AtomFeedEntry (..)
|
||||
) where
|
||||
|
||||
import Web.Restful.Response
|
||||
import Yesod.Response
|
||||
|
||||
import Data.Time.Clock
|
||||
import Web.Encodings
|
||||
@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Helpers.Auth
|
||||
-- Module : Yesod.Helpers.Auth
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -13,7 +13,7 @@
|
||||
-- Authentication through the authentication package.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Helpers.Auth
|
||||
module Yesod.Helpers.Auth
|
||||
( AuthResource
|
||||
, authHandler
|
||||
, authResourcePattern
|
||||
@ -26,8 +26,8 @@ import qualified Web.Authenticate.Rpxnow as Rpxnow
|
||||
import qualified Web.Authenticate.OpenId as OpenId
|
||||
import Data.Enumerable
|
||||
|
||||
import Web.Restful
|
||||
import Web.Restful.Constants
|
||||
import Yesod
|
||||
import Yesod.Constants
|
||||
|
||||
import Control.Applicative ((<$>), Applicative (..))
|
||||
import Control.Monad.Reader
|
||||
@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Response.AtomFeed
|
||||
-- Module : Yesod.Response.AtomFeed
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -14,7 +14,7 @@
|
||||
--
|
||||
---------------------------------------------------------
|
||||
|
||||
module Web.Restful.Helpers.Sitemap
|
||||
module Yesod.Helpers.Sitemap
|
||||
( sitemap
|
||||
, robots
|
||||
, SitemapUrl (..)
|
||||
@ -22,11 +22,11 @@ module Web.Restful.Helpers.Sitemap
|
||||
, SitemapChangeFreq (..)
|
||||
) where
|
||||
|
||||
import Web.Restful.Handler
|
||||
import Web.Restful.Response
|
||||
import Yesod.Handler
|
||||
import Yesod.Response
|
||||
import Web.Encodings
|
||||
import qualified Hack
|
||||
import Web.Restful.Request
|
||||
import Yesod.Request
|
||||
import Data.Time (UTCTime)
|
||||
|
||||
data SitemapLoc = AbsLoc String | RelLoc String
|
||||
@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Helpers.Static
|
||||
-- Module : Yesod.Helpers.Static
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -13,7 +13,7 @@
|
||||
-- Serve static files from a Restful app.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Helpers.Static
|
||||
module Yesod.Helpers.Static
|
||||
( serveStatic
|
||||
, FileLookup
|
||||
, fileLookupDir
|
||||
@ -23,7 +23,7 @@ import qualified Data.ByteString as B
|
||||
import System.Directory (doesFileExist)
|
||||
import Control.Applicative ((<$>))
|
||||
|
||||
import Web.Restful
|
||||
import Yesod
|
||||
|
||||
type FileLookup = FilePath -> IO (Maybe B.ByteString)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE OverlappingInstances #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Request
|
||||
-- Module : Yesod.Request
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -13,7 +13,7 @@
|
||||
-- Code for extracting parameters from requests.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Request
|
||||
module Yesod.Request
|
||||
(
|
||||
-- * Parameter
|
||||
-- $param_overview
|
||||
@ -49,8 +49,8 @@ module Web.Restful.Request
|
||||
|
||||
import qualified Hack
|
||||
import Data.Function.Predicate (equals)
|
||||
import Web.Restful.Constants
|
||||
import Web.Restful.Utils
|
||||
import Yesod.Constants
|
||||
import Yesod.Utils
|
||||
import Control.Applicative (Applicative (..))
|
||||
import Web.Encodings
|
||||
import Data.Time.Calendar (Day, fromGregorian)
|
||||
@ -6,7 +6,7 @@
|
||||
{-# LANGUAGE StandaloneDeriving #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Resource
|
||||
-- Module : Yesod.Resource
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -17,7 +17,7 @@
|
||||
-- Defines the Resource class.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Resource
|
||||
module Yesod.Resource
|
||||
( ResourceName (..)
|
||||
, fromString
|
||||
, checkPattern
|
||||
@ -30,8 +30,8 @@ module Web.Restful.Resource
|
||||
) where
|
||||
|
||||
import Data.List.Split (splitOn)
|
||||
import Web.Restful.Definitions
|
||||
import Web.Restful.Handler
|
||||
import Yesod.Definitions
|
||||
import Yesod.Handler
|
||||
import Data.List (intercalate)
|
||||
import Data.Enumerable
|
||||
import Data.Char (isDigit)
|
||||
@ -161,7 +161,7 @@ validatePatterns (x:xs) =
|
||||
#if TEST
|
||||
---- Testing
|
||||
testSuite :: Test
|
||||
testSuite = testGroup "Web.Restful.Resource"
|
||||
testSuite = testGroup "Yesod.Resource"
|
||||
[ testCase "non-overlap" caseOverlap1
|
||||
, testCase "overlap" caseOverlap2
|
||||
, testCase "overlap-slurp" caseOverlap3
|
||||
@ -6,7 +6,7 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Response
|
||||
-- Module : Yesod.Response
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -17,7 +17,7 @@
|
||||
-- Generating responses.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Response
|
||||
module Yesod.Response
|
||||
( Response (..)
|
||||
-- * Representations
|
||||
, RepT
|
||||
@ -47,7 +47,6 @@ module Web.Restful.Response
|
||||
) where
|
||||
|
||||
import Data.Time.Clock
|
||||
import Data.Object
|
||||
import Data.Object.Text
|
||||
import Data.Object.Translate
|
||||
import Data.Object.Instances
|
||||
@ -200,7 +199,7 @@ instance HasReps (Reps m) where
|
||||
#if TEST
|
||||
----- Testing
|
||||
testSuite :: Test
|
||||
testSuite = testGroup "Web.Restful.Response"
|
||||
testSuite = testGroup "Yesod.Response"
|
||||
[
|
||||
]
|
||||
#endif
|
||||
@ -1,7 +1,7 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
---------------------------------------------------------
|
||||
--
|
||||
-- Module : Web.Restful.Utils
|
||||
-- Module : Yesod.Utils
|
||||
-- Copyright : Michael Snoyman
|
||||
-- License : BSD3
|
||||
--
|
||||
@ -13,7 +13,7 @@
|
||||
-- These are all functions which could be exported to another library.
|
||||
--
|
||||
---------------------------------------------------------
|
||||
module Web.Restful.Utils
|
||||
module Yesod.Utils
|
||||
( parseHttpAccept
|
||||
, tryLookup
|
||||
#if TEST
|
||||
@ -46,7 +46,7 @@ tryLookup def key = fromMaybe def . lookup key
|
||||
#if TEST
|
||||
----- Testing
|
||||
testSuite :: Test
|
||||
testSuite = testGroup "Web.Restful.Response"
|
||||
testSuite = testGroup "Yesod.Response"
|
||||
[ testCase "tryLookup1" caseTryLookup1
|
||||
, testCase "tryLookup2" caseTryLookup2
|
||||
]
|
||||
12
runtests.hs
Normal file
12
runtests.hs
Normal file
@ -0,0 +1,12 @@
|
||||
import Test.Framework (defaultMain)
|
||||
|
||||
import qualified Yesod.Response
|
||||
import qualified Yesod.Utils
|
||||
import qualified Yesod.Resource
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMain
|
||||
[ Yesod.Response.testSuite
|
||||
, Yesod.Utils.testSuite
|
||||
, Yesod.Resource.testSuite
|
||||
]
|
||||
@ -1,15 +1,16 @@
|
||||
name: restful
|
||||
version: 0.1.12
|
||||
name: yesod
|
||||
version: 0.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
maintainer: Michael Snoyman <michael@snoyman.com>
|
||||
synopsis: A Restful front controller built on Hack.
|
||||
description: This package stradles the line between framework and simply a controller. It provides minimal support for model and view, mostly focusing on making a controller which adheres strictly to RESTful principles.
|
||||
category: Web
|
||||
stability: unstable
|
||||
cabal-version: >= 1.2
|
||||
build-type: Simple
|
||||
homepage: http://github.com/snoyberg/restful/tree/master
|
||||
homepage: http://github.com/snoyberg/yesod
|
||||
|
||||
flag buildtests
|
||||
description: Build the executable to run unit tests
|
||||
@ -42,15 +43,15 @@ library
|
||||
convertible-text >= 0.0.0 && < 0.1,
|
||||
clientsession >= 0.0.1 && < 0.1,
|
||||
zlib >= 0.5.2.0 && < 0.6
|
||||
exposed-modules: Web.Restful,
|
||||
Web.Restful.Constants,
|
||||
Web.Restful.Request,
|
||||
Web.Restful.Response,
|
||||
Web.Restful.Utils,
|
||||
Web.Restful.Definitions,
|
||||
Web.Restful.Handler,
|
||||
Web.Restful.Application,
|
||||
Web.Restful.Resource,
|
||||
exposed-modules: Yesod,
|
||||
Yesod.Constants,
|
||||
Yesod.Request,
|
||||
Yesod.Response,
|
||||
Yesod.Utils,
|
||||
Yesod.Definitions,
|
||||
Yesod.Handler,
|
||||
Yesod.Application,
|
||||
Yesod.Resource,
|
||||
Data.Object.Instances,
|
||||
Data.Object.Translate,
|
||||
Hack.Middleware.MethodOverride,
|
||||
@ -58,10 +59,10 @@ library
|
||||
Hack.Middleware.Jsonp,
|
||||
Hack.Middleware.CleanPath,
|
||||
Hack.Middleware.Gzip,
|
||||
Web.Restful.Helpers.Auth,
|
||||
Web.Restful.Helpers.Static,
|
||||
Web.Restful.Helpers.AtomFeed,
|
||||
Web.Restful.Helpers.Sitemap
|
||||
Yesod.Helpers.Auth,
|
||||
Yesod.Helpers.Static,
|
||||
Yesod.Helpers.AtomFeed,
|
||||
Yesod.Helpers.Sitemap
|
||||
ghc-options: -Wall -Werror
|
||||
|
||||
executable runtests
|
||||
@ -76,4 +77,4 @@ executable runtests
|
||||
else
|
||||
Buildable: False
|
||||
ghc-options: -Wall
|
||||
main-is: Test.hs
|
||||
main-is: runtests.hs
|
||||
Loading…
Reference in New Issue
Block a user