heyefi 2.0.0.1 → 2.0.0.2
raw patch · 4 files changed
+106/−101 lines, 4 files
Files
- README.md +1/−0
- heyefi.cabal +49/−45
- src/HEyefi/Main.hs +0/−56
- src/Main.hs +56/−0
README.md view
@@ -53,5 +53,6 @@ # Changelog +2.0.0.1 2017-12-06 Makes tests pass fixing nix build 2.0.0.0 2017-11-18 Program output should be immediately written to stdout, instead of being buffered until the program finishes. 1.1.0.0 2017-01-02 fixed build of version 0.13.0.0 of optparse-applicative, which removes Data.Monoid exports
heyefi.cabal view
@@ -1,9 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.18.1.+-- This file has been generated from package.yaml by hpack version 0.21.2. -- -- see: https://github.com/sol/hpack+--+-- hash: 504ff0c864ccb4be8289c6e55b3ce9ed911f54b3b2d70c4cb2867c8b932c1b0a name: heyefi-version: 2.0.0.1+version: 2.0.0.2 synopsis: A server for Eye-Fi SD cards. description: This server listens for Eye-Fi cards that want to upload files to a computer and stores them in an upload directory. It is meant to be run as a system daemon. category: Network@@ -24,39 +26,39 @@ location: https://github.com/ryantm/heyefi executable heyefi- main-is: HEyefi/Main.hs+ main-is: Main.hs hs-source-dirs: src default-extensions: OverloadedStrings ScopedTypeVariables GeneralizedNewtypeDeriving NoImplicitPrelude ghc-options: -Wall build-depends:- base >=4.8 && <=5- , stm- , unix+ HandsomeSoup , MissingH+ , base >=4.8 && <=5 , bytestring- , utf8-string- , time- , iso8601-time- , warp- , wai- , http-types- , HandsomeSoup- , hxt , case-insensitive- , multipart- , tar , configurator- , unordered-containers- , text- , temporary , directory+ , exceptions , filepath+ , http-types+ , hxt+ , iso8601-time , mtl- , transformers- , exceptions- , random+ , multipart , optparse-applicative+ , random+ , stm+ , tar+ , temporary+ , text+ , time+ , transformers+ , unix+ , unordered-containers+ , utf8-string+ , wai+ , warp other-modules: HEyefi.App HEyefi.CommandLineOptions@@ -71,6 +73,7 @@ HEyefi.Texts HEyefi.Types HEyefi.UploadPhoto+ Paths_heyefi default-language: Haskell2010 test-suite spec@@ -82,37 +85,37 @@ default-extensions: OverloadedStrings ScopedTypeVariables GeneralizedNewtypeDeriving NoImplicitPrelude ghc-options: -Wall build-depends:- base >=4.8 && <=5- , stm- , unix+ HandsomeSoup , MissingH+ , base >=4.8 && <=5 , bytestring- , utf8-string- , time- , iso8601-time- , warp- , wai- , http-types- , HandsomeSoup- , hxt , case-insensitive- , multipart- , tar , configurator- , unordered-containers- , text- , temporary , directory- , filepath- , mtl- , transformers , exceptions- , random- , optparse-applicative+ , filepath , hspec , hspec-wai- , wai-extra+ , http-types+ , hxt+ , iso8601-time+ , mtl+ , multipart+ , optparse-applicative+ , random , silently+ , stm+ , tar+ , temporary+ , text+ , time+ , transformers+ , unix+ , unordered-containers+ , utf8-string+ , wai+ , wai-extra+ , warp other-modules: HEyefi.AppSpec HEyefi.ConfigSpec@@ -128,7 +131,6 @@ HEyefi.Constant HEyefi.Hex HEyefi.Log- HEyefi.Main HEyefi.Prelude HEyefi.Soap HEyefi.SoapResponse@@ -136,4 +138,6 @@ HEyefi.Texts HEyefi.Types HEyefi.UploadPhoto+ Main+ Paths_heyefi default-language: Haskell2010
− src/HEyefi/Main.hs
@@ -1,56 +0,0 @@-module Main where--import HEyefi.App (app)-import HEyefi.CommandLineOptions (handleOptionsThenMaybe)-import HEyefi.Config (monitorConfig, newConfig, runWithConfig)-import HEyefi.Constant (port, configPath)-import HEyefi.Log (logInfoIO)-import HEyefi.Prelude-import HEyefi.Types (SharedConfig)--import Control.Concurrent (forkIO)-import Control.Concurrent.STM (- newTVar- , atomically- , writeTVar- , TVar- , readTVar )-import Control.Monad (forever, void)-import Network.Wai.Handler.Warp (run)-import System.IO-import System.Posix.Signals (installHandler, sigHUP, Handler( Catch ))---handleHup :: TVar (Maybe Int) -> IO ()-handleHup wakeSig = atomically (writeTVar wakeSig (Just 1))--hangupSignal :: IO (TVar (Maybe Int))-hangupSignal = do- wakeSig <- atomically (newTVar Nothing)- _ <- installHandler sigHUP (Catch (handleHup wakeSig)) Nothing- return wakeSig--readAndMonitorSharedConfig :: TVar (Maybe Int) ->- SharedConfig ->- IO ()-readAndMonitorSharedConfig wakeSig sharedConfig =- void (forkIO (forever- (do- c <- atomically (readTVar sharedConfig)- runWithConfig c (- monitorConfig (unpack configPath) sharedConfig wakeSig))))--runHeyefi :: IO ()-runHeyefi = do- wakeSig <- hangupSignal- sharedConfig <- newConfig-- readAndMonitorSharedConfig wakeSig sharedConfig-- logInfoIO (listeningOnPort (tshow port))- run port (app sharedConfig)--main :: IO ()-main = do- hSetBuffering stdout LineBuffering- handleOptionsThenMaybe runHeyefi
+ src/Main.hs view
@@ -0,0 +1,56 @@+module Main where++import HEyefi.App (app)+import HEyefi.CommandLineOptions (handleOptionsThenMaybe)+import HEyefi.Config (monitorConfig, newConfig, runWithConfig)+import HEyefi.Constant (port, configPath)+import HEyefi.Log (logInfoIO)+import HEyefi.Prelude+import HEyefi.Types (SharedConfig)++import Control.Concurrent (forkIO)+import Control.Concurrent.STM (+ newTVar+ , atomically+ , writeTVar+ , TVar+ , readTVar )+import Control.Monad (forever, void)+import Network.Wai.Handler.Warp (run)+import System.IO+import System.Posix.Signals (installHandler, sigHUP, Handler( Catch ))+++handleHup :: TVar (Maybe Int) -> IO ()+handleHup wakeSig = atomically (writeTVar wakeSig (Just 1))++hangupSignal :: IO (TVar (Maybe Int))+hangupSignal = do+ wakeSig <- atomically (newTVar Nothing)+ _ <- installHandler sigHUP (Catch (handleHup wakeSig)) Nothing+ return wakeSig++readAndMonitorSharedConfig :: TVar (Maybe Int) ->+ SharedConfig ->+ IO ()+readAndMonitorSharedConfig wakeSig sharedConfig =+ void (forkIO (forever+ (do+ c <- atomically (readTVar sharedConfig)+ runWithConfig c (+ monitorConfig (unpack configPath) sharedConfig wakeSig))))++runHeyefi :: IO ()+runHeyefi = do+ wakeSig <- hangupSignal+ sharedConfig <- newConfig++ readAndMonitorSharedConfig wakeSig sharedConfig++ logInfoIO (listeningOnPort (tshow port))+ run port (app sharedConfig)++main :: IO ()+main = do+ hSetBuffering stdout LineBuffering+ handleOptionsThenMaybe runHeyefi