packages feed

nuxeo 0.3.1 → 0.3.2

raw patch · 5 files changed

+41/−39 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Nuxeo.Log: Debug :: NuxeoLogType
- Nuxeo.Log: Error :: NuxeoLogType
- Nuxeo.Log: Info :: NuxeoLogType
- Nuxeo.Log: NuxeoLogEntry :: LocalTime -> NuxeoLogType -> Text -> Text -> Text -> NuxeoLogEntry
- Nuxeo.Log: Warning :: NuxeoLogType
- Nuxeo.Log: [nuxeoLogEntryAction] :: NuxeoLogEntry -> Text
- Nuxeo.Log: [nuxeoLogEntryDthr] :: NuxeoLogEntry -> LocalTime
- Nuxeo.Log: [nuxeoLogEntryLog] :: NuxeoLogEntry -> Text
- Nuxeo.Log: [nuxeoLogEntrySection] :: NuxeoLogEntry -> Text
- Nuxeo.Log: [nuxeoLogEntryType] :: NuxeoLogEntry -> NuxeoLogType
- Nuxeo.Log: data NuxeoLogEntry
- Nuxeo.Log: data NuxeoLogType
- Nuxeo.Log: instance GHC.Classes.Eq Nuxeo.Log.NuxeoLogType
- Nuxeo.Log: instance GHC.Read.Read Nuxeo.Log.NuxeoLogType
- Nuxeo.Log: instance GHC.Show.Show Nuxeo.Log.NuxeoLogEntry
- Nuxeo.Log: instance GHC.Show.Show Nuxeo.Log.NuxeoLogType
- Nuxeo.Log: type NuxeoLog = [NuxeoLogEntry]
- Nuxeo.Types: Instance :: Text -> Text -> Text -> Instance
- Nuxeo.Types: data Instance
- Nuxeo.Types: instance GHC.Read.Read Nuxeo.Types.Instance
- Nuxeo.Types: instance GHC.Show.Show Nuxeo.Types.Instance
+ Nuxeo.Types: NuxeoDebug :: NuxeoLogType
+ Nuxeo.Types: NuxeoError :: NuxeoLogType
+ Nuxeo.Types: NuxeoInfo :: NuxeoLogType
+ Nuxeo.Types: NuxeoInstance :: Text -> Text -> Text -> NuxeoInstance
+ Nuxeo.Types: NuxeoLogEntry :: LocalTime -> NuxeoLogType -> Text -> Text -> Text -> NuxeoLogEntry
+ Nuxeo.Types: NuxeoWarning :: NuxeoLogType
+ Nuxeo.Types: [nuxeoLogEntryAction] :: NuxeoLogEntry -> Text
+ Nuxeo.Types: [nuxeoLogEntryDthr] :: NuxeoLogEntry -> LocalTime
+ Nuxeo.Types: [nuxeoLogEntryLog] :: NuxeoLogEntry -> Text
+ Nuxeo.Types: [nuxeoLogEntrySection] :: NuxeoLogEntry -> Text
+ Nuxeo.Types: [nuxeoLogEntryType] :: NuxeoLogEntry -> NuxeoLogType
+ Nuxeo.Types: data NuxeoInstance
+ Nuxeo.Types: data NuxeoLogEntry
+ Nuxeo.Types: data NuxeoLogType
+ Nuxeo.Types: instance GHC.Classes.Eq Nuxeo.Types.NuxeoLogType
+ Nuxeo.Types: instance GHC.Read.Read Nuxeo.Types.NuxeoInstance
+ Nuxeo.Types: instance GHC.Read.Read Nuxeo.Types.NuxeoLogType
+ Nuxeo.Types: instance GHC.Show.Show Nuxeo.Types.NuxeoInstance
+ Nuxeo.Types: instance GHC.Show.Show Nuxeo.Types.NuxeoLogEntry
+ Nuxeo.Types: instance GHC.Show.Show Nuxeo.Types.NuxeoLogType
+ Nuxeo.Types: type NuxeoLog = [NuxeoLogEntry]
- Nuxeo.ElasticSearch: reindex :: Instance -> IO (Either Text Text)
+ Nuxeo.ElasticSearch: reindex :: NuxeoInstance -> IO (Either Text Text)
- Nuxeo.Types: [instanceLogin] :: Instance -> Text
+ Nuxeo.Types: [instanceLogin] :: NuxeoInstance -> Text
- Nuxeo.Types: [instancePassword] :: Instance -> Text
+ Nuxeo.Types: [instancePassword] :: NuxeoInstance -> Text
- Nuxeo.Types: [instanceUrl] :: Instance -> Text
+ Nuxeo.Types: [instanceUrl] :: NuxeoInstance -> Text

Files

app/Main.hs view
@@ -39,7 +39,7 @@    <>  header "nuxeo - nuxeo cli tools")  -- | Exemple reindex instance-reindexInstance :: Instance -> IO ()+reindexInstance :: NuxeoInstance -> IO () reindexInstance i = do   reindexAction <- reindex i   case reindexAction of@@ -49,17 +49,17 @@  -- | Exemple to extract errors from Nuxeo log showErr :: T.Text -> IO()-showErr logFile = (filter (\l -> nuxeoLogEntryType l == Error) <$> parseNuxeoLog (T.unpack logFile))-                                >>= mapM_ (\t -> TIO.putStrLn $-                                                 T.replicate 10 "=" <> "\n"-                                                 <> T.replicate 5 " " <> (T.pack $ show $ nuxeoLogEntryDthr t)-                                                 <> "\n" <> T.replicate 10 "=" <> "\n"-                                                 <> (T.pack $ show $ nuxeoLogEntryType t)-                                                 <> " - "-                                                 <> nuxeoLogEntryAction t-                                                 <> "\n\n"-                                                 <> nuxeoLogEntryLog t-                                          )+showErr logFile = (filter (\l -> nuxeoLogEntryType l == NuxeoError) <$> parseNuxeoLog (T.unpack logFile))+                  >>= mapM_ (\t -> TIO.putStrLn $+                                   T.replicate 10 "=" <> "\n"+                                   <> T.replicate 5 " " <> (T.pack $ show $ nuxeoLogEntryDthr t)+                                   <> "\n" <> T.replicate 10 "=" <> "\n"+                                   <> (T.pack $ show $ nuxeoLogEntryType t)+                                   <> " - "+                                   <> nuxeoLogEntryAction t+                                   <> "\n\n"+                                   <> nuxeoLogEntryLog t+                            )   main :: IO ()@@ -69,5 +69,5 @@    if (instanceLogin /= ""       && instancePassword /= ""-      && reindexUrl /= "") then reindexInstance (Instance reindexUrl instanceLogin instancePassword) else pure ()+      && reindexUrl /= "") then reindexInstance (NuxeoInstance reindexUrl instanceLogin instancePassword) else pure ()   if showErrLogFile /= "" then showErr showErrLogFile else pure ()
nuxeo.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: af58711cda0cd6cfb99bec58266edbca4d13e7105cdeeb315116d5760891a58d+-- hash: befb36841125d1c20bebd327452b5ce949036bf73d3403a4587081f8102dcdc3  name:           nuxeo-version:        0.3.1+version:        0.3.2 description:    Nuxeo tools category:       System homepage:       https://github.com/apeyroux/nuxeo#readme
src/Nuxeo/ElasticSearch.hs view
@@ -12,7 +12,7 @@ import Nuxeo.Types  -- | POST @{"params":{},"context":{}}@ to @\/nuxeo\/site\/automation\/Elasticsearch.Index@-reindex :: Instance -> IO (Either Text Text)+reindex :: NuxeoInstance -> IO (Either Text Text) reindex i =   -- check if instanceUrl is formated   case importURL esUrl of
src/Nuxeo/Log.hs view
@@ -1,10 +1,7 @@ {-# LANGUAGE OverloadedStrings #-}  module Nuxeo.Log (-  NuxeoLog-  , NuxeoLogType (..)-  , NuxeoLogEntry (..)-  , parseNuxeoLog+  parseNuxeoLog   ) where  import           Control.Applicative@@ -15,18 +12,7 @@ import           Data.Conduit.Binary import qualified Data.Text as T import           Data.Time--data NuxeoLogType = Debug | Error | Warning | Info deriving (Show, Read, Eq)--data NuxeoLogEntry = NuxeoLogEntry {-  nuxeoLogEntryDthr :: LocalTime-  , nuxeoLogEntryType :: NuxeoLogType-  , nuxeoLogEntrySection :: T.Text-  , nuxeoLogEntryAction :: T.Text-  , nuxeoLogEntryLog :: T.Text-  } deriving Show--type NuxeoLog = [NuxeoLogEntry]+import           Nuxeo.Types  -- | Parse Nuxeo server.log --@@ -62,10 +48,10 @@   return $ NuxeoLogEntry ptime ptype psection paction (T.pack pnuxeolog)  nuxeoTypeLogParser :: Parser NuxeoLogType-nuxeoTypeLogParser = (string "ERROR" *> return Error)-                     <|> (string "DEBUG" *> return Debug)-                     <|> (string "WARN" *> return Warning)-                     <|> (string "INFO" *> return Info)+nuxeoTypeLogParser = (string "ERROR" *> return NuxeoError)+                     <|> (string "DEBUG" *> return NuxeoDebug)+                     <|> (string "WARN" *> return NuxeoWarning)+                     <|> (string "INFO" *> return NuxeoInfo)                      <|> fail "Invalid NuxeoTypeLog"  nuxeoLogEntrySectionParser :: Parser T.Text
src/Nuxeo/Types.hs view
@@ -1,12 +1,28 @@ {-# LANGUAGE OverloadedStrings #-}  module Nuxeo.Types (-  Instance (..)+  NuxeoInstance (..)+  , NuxeoLog+  , NuxeoLogEntry (..)+  , NuxeoLogType (..)   ) where -import Data.Text +import Data.Text+import Data.Time -data Instance = Instance {+data NuxeoLogType = NuxeoDebug | NuxeoError | NuxeoWarning | NuxeoInfo deriving (Show, Read, Eq)++data NuxeoLogEntry = NuxeoLogEntry {+  nuxeoLogEntryDthr :: LocalTime+  , nuxeoLogEntryType :: NuxeoLogType+  , nuxeoLogEntrySection :: Text+  , nuxeoLogEntryAction :: Text+  , nuxeoLogEntryLog :: Text+  } deriving Show++type NuxeoLog = [NuxeoLogEntry]++data NuxeoInstance = NuxeoInstance {   instanceUrl :: Text   , instanceLogin :: Text   , instancePassword :: Text