]> gitweb.michael.orlitzky.com - dead/htsn.git/commitdiff
Move the Report, Logging, and Terminal modules into their own namespace.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 29 Dec 2013 00:06:43 +0000 (19:06 -0500)
committerMichael Orlitzky <mjo@gentoo.org>
Sun, 29 Dec 2013 00:06:43 +0000 (19:06 -0500)
htsn.cabal
makefile
src/Main.hs
src/Network/Services/TSN/Logging.hs [moved from src/Logging.hs with 98% similarity]
src/Network/Services/TSN/Report.hs [moved from src/Report.hs with 91% similarity]
src/Network/Services/TSN/Terminal.hs [moved from src/Terminal.hs with 98% similarity]
src/OptionalConfiguration.hs
src/Unix.hs

index a25b7e978f47107742999ddaa860b07ffe866618..72c22be5b99c71c57663643db4978e3a8af71ad9 100644 (file)
@@ -230,10 +230,10 @@ executable htsn
     Configuration
     ExitCodes
     FeedHosts
     Configuration
     ExitCodes
     FeedHosts
-    Logging
+    Network.Services.TSN.Logging
     OptionalConfiguration
     OptionalConfiguration
-    Report
-    Terminal
+    Network.Services.TSN.Report
+    Network.Services.TSN.Terminal
     Unix
     Xml
 
     Unix
     Xml
 
index 45ed83809f39941aee435c20c334e29027163b84..d1b5052c3b2f59c1460a9083346d3c1486a80a72 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,19 +1,23 @@
 BIN = dist/build/htsn/htsn
 TESTSUITE_BIN = dist/build/testsuite/testsuite
 BIN = dist/build/htsn/htsn
 TESTSUITE_BIN = dist/build/testsuite/testsuite
+SRCS := $(shell find src/ -type f -name '*.hs')
+TEST_SRCS := $(shell find test/ -type f -name '*.hs')
 
 .PHONY : dist hlint
 
 
 .PHONY : dist hlint
 
-$(BIN): src/*.hs
+$(BIN): $(SRCS)
        runghc Setup.hs clean
        runghc Setup.hs configure --user --prefix=/
        runghc Setup.hs build
 
        runghc Setup.hs clean
        runghc Setup.hs configure --user --prefix=/
        runghc Setup.hs build
 
-profile: src/*.hs
+profile: $(SRCS)
        runghc Setup.hs clean
        runghc Setup.hs clean
-       runghc Setup.hs configure --user --enable-executable-profiling --prefix=/
+       runghc Setup.hs configure --user \
+                                  --enable-executable-profiling \
+                                  --prefix=/
        runghc Setup.hs build
 
        runghc Setup.hs build
 
-doc: *.cabal src/*.hs
+doc: *.cabal $(SRCS)
        runghc Setup.hs configure --user --prefix=/
        runghc Setup.hs hscolour --executables
        runghc Setup.hs haddock --internal    \
        runghc Setup.hs configure --user --prefix=/
        runghc Setup.hs hscolour --executables
        runghc Setup.hs haddock --internal    \
@@ -26,7 +30,7 @@ clean:
        rm -f *.xml
        rm -rf tmp
 
        rm -f *.xml
        rm -rf tmp
 
-$(TESTSUITE_BIN): src/*.hs test/TestSuite.hs
+$(TESTSUITE_BIN): $(SRCS) $(TEST_SRCS)
        runghc Setup.hs configure --user --enable-tests --prefix=/
        runghc Setup.hs build
 
        runghc Setup.hs configure --user --enable-tests --prefix=/
        runghc Setup.hs build
 
index ece44a8b9fb53a6e8d27a9e0eef828205185d255..a06bd2338e62a0371fb90215d43a366478719347 100644 (file)
@@ -38,16 +38,16 @@ import ExitCodes (
   exit_no_username,
   exit_pidfile_exists )
 import FeedHosts ( FeedHosts(..) )
   exit_no_username,
   exit_pidfile_exists )
 import FeedHosts ( FeedHosts(..) )
-import Logging ( init_logging )
+import Network.Services.TSN.Logging ( init_logging )
 import qualified OptionalConfiguration as OC (
   OptionalConfiguration(..),
   from_rc )
 import qualified OptionalConfiguration as OC (
   OptionalConfiguration(..),
   from_rc )
-import Report (
+import Network.Services.TSN.Report (
   report_debug,
   report_info,
   report_warning,
   report_error )
   report_debug,
   report_info,
   report_warning,
   report_error )
-import Terminal ( display_sent )
+import Network.Services.TSN.Terminal ( display_sent )
 import Xml ( parse_xmlfid )
 import Unix ( full_daemonize )
 
 import Xml ( parse_xmlfid )
 import Unix ( full_daemonize )
 
similarity index 98%
rename from src/Logging.hs
rename to src/Network/Services/TSN/Logging.hs
index 63101c6f3735da2dbbbc1b913ae6ec1bc7719105..a20a8977ff05d6ddd5719c461b322f8c1dac8b44 100644 (file)
@@ -1,4 +1,4 @@
-module Logging (
+module Network.Services.TSN.Logging (
   init_logging,
   log_debug,
   log_error,
   init_logging,
   log_debug,
   log_error,
similarity index 91%
rename from src/Report.hs
rename to src/Network/Services/TSN/Report.hs
index 925a018e11c183a7701bb83f32f27b6f05488036..2423352776481c5503a918481ccd77d0fd4d40d6 100644 (file)
@@ -1,19 +1,19 @@
 -- | Convenience functions for reporting (display and/or logging)
 --   status messages.
 --
 -- | Convenience functions for reporting (display and/or logging)
 --   status messages.
 --
-module Report (
+module Network.Services.TSN.Report (
   report_debug,
   report_error,
   report_info,
   report_warning )
 where
 
   report_debug,
   report_error,
   report_info,
   report_warning )
 where
 
-import Logging (
+import Network.Services.TSN.Logging (
   log_debug,
   log_error,
   log_info,
   log_warning )
   log_debug,
   log_error,
   log_info,
   log_warning )
-import Terminal (
+import Network.Services.TSN.Terminal (
   display_debug,
   display_error,
   display_info,
   display_debug,
   display_error,
   display_info,
similarity index 98%
rename from src/Terminal.hs
rename to src/Network/Services/TSN/Terminal.hs
index 064c5ff87e27af60f328f14e9c4d3f05f19cf10d..e24d23cb48ccbb3bd5c15c47cd11aa5f42af3aad 100644 (file)
@@ -1,4 +1,4 @@
-module Terminal (
+module Network.Services.TSN.Terminal (
   display_debug,
   display_error,
   display_info,
   display_debug,
   display_error,
   display_info,
index 33ca3d9d82e1061c467b3f25eee9e16745c5af4d..8790ca075943fe94a0f54e9d291a5c5cfc81b8c7 100644 (file)
@@ -35,8 +35,7 @@ import System.IO.Error ( catchIOError )
 import System.Log ( Priority(..) )
 
 import FeedHosts ( FeedHosts(..) )
 import System.Log ( Priority(..) )
 
 import FeedHosts ( FeedHosts(..) )
-import Logging ( log_error ) -- Can't import report_error from Main
-import Terminal ( display_error ) -- 'cause of circular imports.
+import Network.Services.TSN.Report ( report_error )
 
 
 -- Derive standalone instances of Data and Typeable for Priority. This
 
 
 -- Derive standalone instances of Data and Typeable for Priority. This
@@ -145,12 +144,10 @@ instance DCT.Configured Priority where
 from_rc :: IO OptionalConfiguration
 from_rc = do
   etc  <- catchIOError getSysconfDir (\e -> do
 from_rc :: IO OptionalConfiguration
 from_rc = do
   etc  <- catchIOError getSysconfDir (\e -> do
-                                        display_error (show e)
-                                        log_error (show e)
+                                        report_error (show e)
                                         return "/etc")
   home <- catchIOError getHomeDirectory (\e -> do
                                         return "/etc")
   home <- catchIOError getHomeDirectory (\e -> do
-                                           display_error (show e)
-                                           log_error (show e)
+                                           report_error (show e)
                                            return "$(HOME)")
   let global_config_path = etc </> "htsnrc"
   let user_config_path = home </> ".htsnrc"
                                            return "$(HOME)")
   let global_config_path = etc </> "htsnrc"
   let user_config_path = home </> ".htsnrc"
index 96ec79a8ae798776606678c2971a7464ea7fa406..b6990d2a663e3ef31df3d70ad5efa4e503b127c1 100644 (file)
@@ -31,8 +31,8 @@ import Configuration (
   Configuration( pidfile,
                  run_as_group,
                  run_as_user ))
   Configuration( pidfile,
                  run_as_group,
                  run_as_user ))
-import Logging ( log_info, log_error )
-import Terminal ( display_error )
+import Network.Services.TSN.Logging ( log_info, log_error )
+import Network.Services.TSN.Terminal ( display_error )
 
 -- | Retrieve the uid associated with the given system user name. We
 --   take a Maybe String as an argument so the user name can be passed
 
 -- | Retrieve the uid associated with the given system user name. We
 --   take a Maybe String as an argument so the user name can be passed