]> gitweb @ CieloNegro.org - Rakka.git/commitdiff
/dumpRepos
authorpho <pho@cielonegro.org>
Fri, 28 Mar 2008 07:38:42 +0000 (16:38 +0900)
committerpho <pho@cielonegro.org>
Fri, 28 Mar 2008 07:38:42 +0000 (16:38 +0900)
darcs-hash:20080328073842-62b54-ac916d3da4f16bbef84f5af9e2cabcaea294bc9a.gz

Main.hs
Rakka.cabal
Rakka/Resource/DumpRepos.hs [new file with mode: 0644]

diff --git a/Main.hs b/Main.hs
index 02a4cf4702996013cfdcc6dc07c6646b1d707bb0..c4bb0485b13ff28f9d1ac49e51d427de0b4deb47 100644 (file)
--- a/Main.hs
+++ b/Main.hs
@@ -7,6 +7,7 @@ import           Network.HTTP.Lucu
 import           OpenSSL
 import           Rakka.Environment
 import           Rakka.Resource.CheckAuth
+import           Rakka.Resource.DumpRepos
 import           Rakka.Resource.Index
 import           Rakka.Resource.JavaScript
 import           Rakka.Resource.PageEntity
@@ -144,6 +145,7 @@ resTree :: Environment -> ResTree
 resTree env
     = mkResTree [ ([]              , resIndex        env)
                 , (["checkAuth"   ], resCheckAuth    env)
+                , (["dumpRepos"   ], resDumpRepos    env)
                 , (["js"          ], javaScript         )
                 , (["object"      ], resObject       env)
                 , (["render"      ], resRender       env)
index 0e0ed4540ee7ad49b388345a151d6f4bd36523d7..384a3e94085923c9780e6e9f48476f9fe58ef282 100644 (file)
@@ -58,8 +58,8 @@ Flag hardest-optimization
 
 Executable rakka
     Build-Depends:
-        FileManip, HTTP, HUnit, HsHyperEstraier, HsOpenSSL, HsSVN,
-        Lucu, base, bytestring, containers, dataenc, directory,
+        FileManip, HTTP, HUnit, HsHyperEstraier, HsOpenSSL, HsSVN >=
+        0.3.1, Lucu, base, bytestring, containers, dataenc, directory,
         utf8-string, filepath, hslogger, hxt, magic, mtl, network,
         parsec, stm, time, unix, zlib
     Main-Is:
@@ -71,6 +71,7 @@ Executable rakka
         Rakka.Page
         Rakka.Resource
         Rakka.Resource.CheckAuth
+        Rakka.Resource.DumpRepos
         Rakka.Resource.Index
         Rakka.Resource.JavaScript
         Rakka.Resource.Object
diff --git a/Rakka/Resource/DumpRepos.hs b/Rakka/Resource/DumpRepos.hs
new file mode 100644 (file)
index 0000000..068528a
--- /dev/null
@@ -0,0 +1,29 @@
+module Rakka.Resource.DumpRepos
+    ( resDumpRepos
+    )
+    where
+
+import           Control.Monad.Trans
+import           Network.HTTP.Lucu
+import           Rakka.Environment
+import           Subversion.Repository
+
+resDumpRepos :: Environment -> ResourceDef
+resDumpRepos env
+    = ResourceDef {
+        resUsesNativeThread = False
+      , resIsGreedy         = False
+      , resGet              = Just $ dumpRepos $ envRepository env
+      , resHead             = Nothing
+      , resPost             = Nothing
+      , resPut              = Nothing
+      , resDelete           = Nothing
+      }
+
+
+dumpRepos :: Repository -> Resource ()
+dumpRepos repos
+    = do setContentType $ read "application/octet-stream"
+         -- FIXME: 最終更新時刻が判るはず。
+         dump <- liftIO $ dumpRepository repos Nothing Nothing False True
+         outputLBS dump