Executable rakka
Build-Depends:
- HsHyperEstraier == 0.4.*,
- HsOpenSSL == 0.10.*,
- HsSVN == 0.4.*,
- Lucu == 0.7.*,
- base == 4.3.*,
- bytestring == 0.9.*,
- containers == 0.4.*,
- dataenc == 0.14.*,
- directory == 1.1.*,
- filemanip == 0.3.*,
- filepath == 1.2.*,
- hslogger == 1.1.*,
- hxt == 9.1.*,
- hxt-xpath == 9.1.*,
- magic == 1.0.*,
- mtl == 2.0.*,
- network == 2.3.*,
- parsec == 3.1.*,
- stm == 2.2.*,
- time == 1.2.*,
- time-http == 0.1.*,
- time-w3c == 0.1.*,
- unix == 2.4.*,
- zlib == 0.5.*
+ HsHyperEstraier == 0.4.*,
+ HsOpenSSL == 0.10.*,
+ HsSVN == 0.4.*,
+ Lucu == 0.7.*,
+ base == 4.3.*,
+ base-unicode-symbols == 0.2.*,
+ bytestring == 0.9.*,
+ containers == 0.4.*,
+ dataenc == 0.14.*,
+ directory == 1.1.*,
+ filemanip == 0.3.*,
+ filepath == 1.2.*,
+ hslogger == 1.1.*,
+ hxt == 9.1.*,
+ hxt-xpath == 9.1.*,
+ magic == 1.0.*,
+ mtl == 2.0.*,
+ network == 2.3.*,
+ parsec == 3.1.*,
+ stm == 2.2.*,
+ text == 0.11.*,
+ time == 1.2.*,
+ time-http == 0.1.*,
+ time-w3c == 0.1.*,
+ unix == 2.4.*,
+ zlib == 0.5.*
Main-Is:
Main.hs
Rakka.Resource.Render
Rakka.Resource.Search
Rakka.Resource.SystemConfig
- Rakka.Resource.TrackBack
Rakka.Resource.Users
Rakka.Storage
Rakka.Storage.DefaultPage
Rakka.Storage.Types
Rakka.Storage.Impl
Rakka.SystemConfig
- Rakka.TrackBack
Rakka.Utils
Rakka.Validation
Rakka.Wiki
Rakka.Wiki.Interpreter.Base
Rakka.Wiki.Interpreter.Image
Rakka.Wiki.Interpreter.PageList
- Rakka.Wiki.Interpreter.Trackback
Rakka.Wiki.Interpreter.Outline
Rakka.Wiki.Engine
Rakka.Wiki.Formatter
( Attachment(..)
)
where
-
import Control.Arrow
import Control.Arrow.ArrowList
import System.IO.Unsafe
import Text.XML.HXT.Arrow.ReadDocument
import Text.XML.HXT.Arrow.WriteDocument
import Text.XML.HXT.Arrow.XmlArrow
-import Text.XML.HXT.Arrow.XmlIOStateArrow
import Text.XML.HXT.DOM.TypeDefs
import Text.XML.HXT.DOM.XmlKeywords
, delUser
)
where
-
-import qualified Codec.Binary.UTF8.String as UTF8
import Control.Concurrent.STM
import Control.Monad
import Control.Monad.Trans
import qualified Rakka.Wiki.Interpreter.Base as Base
import qualified Rakka.Wiki.Interpreter.Image as Image
import qualified Rakka.Wiki.Interpreter.PageList as PageList
---import qualified Rakka.Wiki.Interpreter.Trackback as Trackback
import qualified Rakka.Wiki.Interpreter.Outline as Outline
import Subversion.Repository
import System.Directory
import System.FilePath
import System.Log.Logger
import Text.HyperEstraier
-import Text.XML.HXT.Arrow.XmlIOStateArrow
logger :: String
, parseXmlizedPage
)
where
-
-import qualified Codec.Binary.UTF8.String as UTF8
import qualified Data.ByteString.Lazy as Lazy (ByteString)
import qualified Data.ByteString.Lazy as L hiding (ByteString)
import qualified Data.ByteString.Lazy.Char8 as L8 hiding (ByteString)
import Rakka.Utils
import Subversion.Types
import System.FilePath.Posix
-import Text.XML.HXT.Arrow
import Text.XML.HXT.XPath
, getUserID
)
where
-
-import qualified Codec.Binary.UTF8.String as UTF8
import Control.Arrow
import Control.Arrow.ArrowList
import Control.Monad
import System.Log.Logger
import Text.XML.HXT.Arrow.ReadDocument
import Text.XML.HXT.Arrow.WriteDocument
-import Text.XML.HXT.Arrow.XmlIOStateArrow
import Text.XML.HXT.DOM.TypeDefs
import Text.XML.HXT.DOM.XmlKeywords
( resObject
)
where
-
-import qualified Codec.Binary.UTF8.String as UTF8
import Network.HTTP.Lucu
import Rakka.Environment
import Rakka.Page
( fallbackPageEntity
)
where
-
-import qualified Codec.Binary.UTF8.String as UTF8
import Control.Monad.Trans
import qualified Data.ByteString.Lazy as L hiding (ByteString)
import Data.Char
import Rakka.Wiki.Engine
import System.FilePath.Posix
import Text.HyperEstraier hiding (getText)
-import Text.XML.HXT.Arrow
import Text.XML.HXT.XPath
( resRender
)
where
-
-import qualified Codec.Binary.UTF8.String as UTF8
import Control.Arrow
import Control.Arrow.ArrowIO
import Control.Arrow.ArrowList
import Text.XML.HXT.Arrow.Namespace
import Text.XML.HXT.Arrow.WriteDocument
import Text.XML.HXT.Arrow.XmlArrow
-import Text.XML.HXT.Arrow.XmlIOStateArrow
import Text.XML.HXT.DOM.TypeDefs
import Text.XML.HXT.DOM.XmlKeywords
( resSearch
)
where
-
-import qualified Codec.Binary.UTF8.Generic as UTF8
import Control.Monad.Trans
import Data.List
import Data.Maybe
import Rakka.Wiki.Engine
import System.FilePath
import Text.HyperEstraier hiding (getText)
-import Text.XML.HXT.Arrow
import Text.XML.HXT.XPath
( resSystemConfig
)
where
-
import Data.Maybe
import Network.HTTP.Lucu
import Rakka.Environment
import Rakka.Resource
import Rakka.SystemConfig
-import Text.XML.HXT.Arrow
import Text.XML.HXT.XPath
( resUsers
)
where
-
import Control.Monad
import Control.Monad.Trans
import Data.Maybe
import Rakka.Authorization
import Rakka.Environment
import Rakka.Resource
-import Text.XML.HXT.Arrow hiding (when)
resUsers :: Environment -> ResourceDef
, loadDefaultPage
)
where
-
import Control.Arrow
import Control.Arrow.ArrowIO
import Control.Arrow.ArrowList
import System.FilePath.Find hiding (fileName, modificationTime)
import System.Posix.Files
import Text.XML.HXT.Arrow.ReadDocument
-import Text.XML.HXT.Arrow.XmlIOStateArrow
import Text.XML.HXT.DOM.XmlKeywords
, putAttachmentIntoRepository
)
where
-
-import Codec.Binary.UTF8.String
import Control.Monad
import Data.List
import qualified Data.Map as M
, deserializeStringPairs
)
where
-
-import Codec.Binary.UTF8.String
import Control.Arrow.ArrowIO
import Control.Concurrent.STM
import Control.Monad
+{-# LANGUAGE
+ Arrows
+ , UnicodeSyntax
+ #-}
module Rakka.Utils
( yesOrNo
, trueOrFalse
, mkQueryString
)
where
-
-import qualified Codec.Binary.UTF8.String as UTF8
-import Control.Arrow
-import Control.Arrow.ArrowList
-import qualified Data.ByteString.Lazy as Lazy (ByteString)
-import qualified Data.ByteString.Lazy.Char8 as L8 hiding (ByteString)
-import Magic
-import Network.HTTP.Lucu
-import Network.URI
-import System.IO.Unsafe
-
-
-yesOrNo :: Bool -> String
+import qualified Codec.Binary.Url as Url
+import Control.Arrow
+import Control.Arrow.ArrowList
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Lazy as LS
+import qualified Data.ByteString.Lazy.Char8 as L8
+import Data.List
+import qualified Data.Text as T
+import Data.Text.Encoding
+import Network.HTTP.Lucu
+import Network.URI
+import Prelude.Unicode
+import System.IO.Unsafe
+
+
+yesOrNo ∷ Bool → String
yesOrNo True = "yes"
yesOrNo False = "no"
-trueOrFalse :: Bool -> String
+trueOrFalse ∷ Bool → String
trueOrFalse True = "true"
trueOrFalse False = "false"
-parseYesOrNo :: ArrowChoice a => a String Bool
+parseYesOrNo ∷ ArrowChoice a => a String Bool
parseYesOrNo
- = proc str -> do case str of
- "yes" -> returnA -< True
- "no" -> returnA -< False
- _ -> returnA -< error ("Expected yes or no: " ++ str)
+ = proc str → do case str of
+ "yes" → returnA -< True
+ "no" → returnA -< False
+ _ → returnA -< error ("Expected yes or no: " ⧺ str)
-maybeA :: (ArrowList a, ArrowChoice a) => a b c -> a b (Maybe c)
+maybeA ∷ (ArrowList a, ArrowChoice a) => a b c → a b (Maybe c)
maybeA a = listA a
>>>
- proc xs -> case xs of
- [] -> returnA -< Nothing
- (x:_) -> returnA -< Just x
+ proc xs → case xs of
+ [] → returnA -< Nothing
+ (x:_) → returnA -< Just x
-deleteIfEmpty :: (ArrowList a, ArrowChoice a) => a String String
+deleteIfEmpty ∷ (ArrowList a, ArrowChoice a) => a String String
deleteIfEmpty
- = proc str -> do case str of
- "" -> none -< ()
- _ -> returnA -< str
+ = proc str → do case str of
+ "" → none -< ()
+ _ → returnA -< str
-chomp :: String -> String
+chomp ∷ String → String
chomp = reverse . snd . break (/= '\n') . reverse
-guessMIMEType :: Lazy.ByteString -> MIMEType
+guessMIMEType ∷ LS.ByteString → MIMEType
guessMIMEType = read . unsafePerformIO . magicString magic . L8.unpack
where
- magic :: Magic
+ magic ∷ Magic
magic = unsafePerformIO
$ do m <- magicOpen [MagicMime]
magicLoadDefault m
return m
-isSafeChar :: Char -> Bool
+isSafeChar ∷ Char → Bool
isSafeChar c
- | c == '/' = True
- | isReserved c = False
- | c > ' ' && c <= '~' = True
- | otherwise = False
-
-
-mkQueryString :: [(String, String)] -> String
-mkQueryString [] = ""
-mkQueryString ((k, v) : xs) = encode k ++ "=" ++ encode v ++
- if xs == [] then
- ""
- else
- ';' : mkQueryString(xs)
+ | c ≡ '/' = True
+ | isReserved c = False
+ | isUnreserved c = True
+ | otherwise = False
+
+
+mkQueryString ∷ [(T.Text, T.Text)] → String
+{-# INLINEABLE mkQueryString #-}
+mkQueryString = intercalate ";" ∘ map pairToStr
where
- encode :: String -> String
- encode = escapeURIString isSafeChar . UTF8.encodeString
\ No newline at end of file
+ pairToStr ∷ (T.Text, T.Text) → String
+ {-# INLINE pairToStr #-}
+ pairToStr (k, v)
+ = encode k ⧺ ('=':encode v)
+
+ encode ∷ T.Text → String
+ {-# INLINE encode #-}
+ encode = Url.encode ∘ BS.unpack ∘ encodeUtf8
( getValidator
)
where
-
import Control.Arrow
import Control.Arrow.ArrowList
import Control.Arrow.ArrowTree
import System.Directory
import System.FilePath
import Text.XML.HXT.Arrow.XmlArrow
-import Text.XML.HXT.Arrow.XmlIOStateArrow
import Text.XML.HXT.DOM.TypeDefs
-import qualified Text.XML.HXT.RelaxNG.Schema as S
-import Text.XML.HXT.RelaxNG.Validator
-
loadSchema :: FilePath -> IO (IOSArrow XmlTree XmlTree)
loadSchema fpath
, makeDraft
)
where
-
-import qualified Codec.Binary.UTF8.String as UTF8
import qualified Data.ByteString.Lazy as Lazy
import qualified Data.ByteString.Lazy.Char8 as L8 hiding (ByteString)
import Data.Map (Map)
import Rakka.Wiki.Interpreter
import Text.HyperEstraier hiding (getText)
import Text.ParserCombinators.Parsec
-import Text.XML.HXT.Arrow hiding (err)
import Text.XML.HXT.XPath
import Rakka.SystemConfig
import Rakka.Wiki
import Rakka.Wiki.Interpreter
-import Text.XML.HXT.Arrow
import Text.XML.HXT.XPath
--- /dev/null
+--- !ditz.rubyforge.org,2008-03-06/issue
+title: Rakka is rather bitrotted
+desc: We have to repair it ASAP.
+type: :task
+component: Rakka
+release: "0.1"
+reporter: PHO <pho@cielonegro.org>
+status: :in_progress
+disposition:
+creation_time: 2011-07-29 14:12:39.862597 Z
+references: []
+
+id: 1c6bfe78f0f9ebd241b8650eb62939dc932cd6f0
+log_events:
+- - 2011-07-29 14:12:40.853438 Z
+ - PHO <pho@cielonegro.org>
+ - created
+ - ""
+- - 2011-07-29 14:13:16.762514 Z
+ - PHO <pho@cielonegro.org>
+ - changed status from unstarted to in_progress
+ - I'm working on this...
+git_branch:
SUDO ?= sudo
AUTOCONF ?= autoconf
HLINT ?= hlint
+HPC ?= hpc
+DITZ ?= ditz
CONFIGURE_ARGS ?= --disable-optimization
SETUP_FILE := $(wildcard Setup.*hs)
CABAL_FILE := $(wildcard *.cabal)
+PKG_NAME := $(CABAL_FILE:.cabal=)
ifeq ($(shell ls configure.ac 2>/dev/null),configure.ac)
AUTOCONF_AC_FILE := configure.ac
build: setup-config build-hook
./Setup build
+ $(RM_RF) *.tix
build-hook:
$(GHC) --make Setup
clean: clean-hook
- $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo
+ $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo *.tix .hpc
$(FIND) . -name '*~' -exec rm -f {} \;
clean-hook:
./Setup sdist
test: build
+ $(RM_RF) dist/test
./Setup test
+ if ls *.tix >/dev/null 2>&1; then \
+ $(HPC) sum --output="merged.tix" --union --exclude=Main *.tix; \
+ $(HPC) markup --destdir="dist/hpc" --fun-entry-count "merged.tix"; \
+ fi
+
+ditz:
+ $(DITZ) html dist/ditz
+
+fixme:
+ @$(FIND) . \
+ \( -name 'dist' -or -name '.git' -or -name '_darcs' \) -prune \
+ -or \
+ \( -name '*.c' -or -name '*.h' -or \
+ -name '*.hs' -or -name '*.lhs' -or \
+ -name '*.hsc' -or -name '*.cabal' \) \
+ -exec egrep -i '(fixme|thinkme)' {} \+ \
+ || echo 'No FIXME or THINKME found.'
lint:
- $(HLINT) . --report \
- --ignore="Use string literal" \
- --ignore="Use concatMap"
-
-.PHONY: build build-hook setup-config setup-config-hook run clean clean-hook install doc sdist test lint
+ $(HLINT) . --report
+
+push: doc ditz
+ if [ -d "_darcs" ]; then \
+ darcs push; \
+ elif [ -d ".git" ]; then \
+ git push --all && git push --tags; \
+ fi
+ if [ -d "dist/doc" ]; then \
+ rsync -av --delete \
+ dist/doc/html/$(PKG_NAME)/ \
+ www@nem.cielonegro.org:static.cielonegro.org/htdocs/doc/$(PKG_NAME); \
+ fi
+ rsync -av --delete \
+ dist/ditz/ \
+ www@nem.cielonegro.org:static.cielonegro.org/htdocs/ditz/$(PKG_NAME)
+
+.PHONY: build build-hook setup-config setup-config-hook run clean clean-hook install doc sdist test lint push