From f519b55ffe72acd791bdc91b16918603afce1995 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 29 Aug 2013 20:39:40 -0400 Subject: [PATCH] Rename the project to Halcyon. --- doc/man1/{twat.1 => halcyon.1} | 23 ++++++++++++----------- twat.cabal => halcyon.cabal | 13 +++++++------ makefile | 2 +- src/CommandLine.hs | 7 ++++--- src/Main.hs | 14 +++++++------- src/OptionalConfiguration.hs | 4 ++-- 6 files changed, 33 insertions(+), 30 deletions(-) rename doc/man1/{twat.1 => halcyon.1} (62%) rename twat.cabal => halcyon.cabal (91%) diff --git a/doc/man1/twat.1 b/doc/man1/halcyon.1 similarity index 62% rename from doc/man1/twat.1 rename to doc/man1/halcyon.1 index a3e8992..743b55b 100644 --- a/doc/man1/twat.1 +++ b/doc/man1/halcyon.1 @@ -1,17 +1,18 @@ -.TH twat 1 +.TH halcyon 1 .SH NAME -twat \- Twat twats tweets so you don't have to Twitter. +halcyon \- Halcyon monitors a list of Twitter accounts and displays or +emails any new tweets. .SH SYNOPSIS -\fBtwat\fR [\fBOPTIONS\fR] [\fBUSERNAMES\fR] +\fBhalcyon\fR [\fBOPTIONS\fR] [\fBUSERNAMES\fR] .SH INPUT .P -Twat takes no input proper; instead, it takes a list of usernames from -either the command-line or the ~/.twatrc file, and watches those +Halcyon takes no input proper; instead, it takes a list of usernames from +either the command-line or the ~/.halcyonrc file, and watches those users' timelines. .SH OUTPUT @@ -19,24 +20,24 @@ users' timelines. .P Any new tweets from watched users are written to stdout. If to/from email addresses are provided (either on the command-line or in -~/.twatrc), then sendmail will be used to email the new tweet to the +~/.halcyonrc), then sendmail will be used to email the new tweet to the specified \fIfrom\fR address. .SH DESCRIPTION .P -Twat watches a list of Twitter timelines, and writes any new tweets to +Halcyon watches a list of Twitter timelines, and writes any new tweets to stdout. It can also optionally email the new tweets to a given email address. .P New tweets are gathered at a fixed interval, specified in seconds by the \fB\-\-heartbeat\fR (default: 600) option. .P -Twat uses the Twitter API, which now requires you to have a developer +Halcyon uses the Twitter API, which now requires you to have a developer account. You can sign up for free at https://dev.twitter.com/. Once you have done this, you can authorize your own account to access itself. You will then be given four tokens, which need to be fed to -twat: +halcyon: .IP \[bu] 2 Consumer Key @@ -64,8 +65,8 @@ Your Twitter API access secret. .SH CONFIGURATION FILE .P -The file ~/.twatrc can contain any of the options (and usernames) that -would otherwise be specified on the command-line. +The file ~/.halcyonrc can contain any of the options (and usernames) +that would otherwise be specified on the command-line. .SH BUGS diff --git a/twat.cabal b/halcyon.cabal similarity index 91% rename from twat.cabal rename to halcyon.cabal index d8180f9..8e8119f 100644 --- a/twat.cabal +++ b/halcyon.cabal @@ -1,18 +1,19 @@ -name: twat -version: 0.0 +name: halcyon +version: 0.0.1 cabal-version: >= 1.8 author: Michael Orlitzky maintainer: Michael Orlitzky license: GPL-3 license-file: doc/LICENSE -homepage: http://michael.orlitzky.com/code/twat.php +homepage: http://michael.orlitzky.com/code/halcyon.php bug-reports: mailto:michael@orlitzky.com category: Utils, Web synopsis: - Twat twats tweets so you don't have to Twitter. + Halcyon monitors a list of Twitter accounts and displays or emails + any new tweets. build-type: Simple -executable twat +executable halcyon build-depends: aeson == 0.6.*, authenticate-oauth == 1.4.*, @@ -110,5 +111,5 @@ test-suite testsuite source-repository head type: git - location: http://michael.orlitzky.com/git/twat.git + location: http://michael.orlitzky.com/git/halcyon.git branch: master diff --git a/makefile b/makefile index 986de5c..00368ea 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -BIN = dist/build/twat/twat +BIN = dist/build/halcyon/halcyon TESTSUITE_BIN = dist/build/testsuite/testsuite .PHONY : dist doc test diff --git a/src/CommandLine.hs b/src/CommandLine.hs index cf63b48..06c072e 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -11,17 +11,18 @@ import System.Exit (ExitCode(..), exitWith) import System.IO (hPutStrLn, stderr) -- Get the version from Cabal. -import Paths_twat (version) +import Paths_halcyon (version) import Data.Version (showVersion) import ExitCodes import OptionalConfiguration description :: String -description = "Twat twats tweets so you don't have to twitter." +description = + "Monitor a list of Twitter accounts and display or email any new tweets." program_name :: String -program_name = "twat" +program_name = "halcyon" my_summary :: String my_summary = program_name ++ "-" ++ (showVersion version) diff --git a/src/Main.hs b/src/Main.hs index b4fd956..c104874 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -39,7 +39,7 @@ thread_sleep seconds = do -- /Date: / header, and returns the updated message. message_from_status :: Maybe TimeZone -> Message -> String -> Status -> Message message_from_status mtz message default_date status = - message { subject = "Twat: " ++ (screen_name (user status)), + message { subject = "Halcyon: " ++ (screen_name (user status)), body = (pretty_print mtz status), headers = ((headers message) ++ ["Date: " ++ date])} where @@ -166,8 +166,8 @@ get_latest_status_id cfg username = do -- recursive loop that checks for updates forever. The message -- argument is optional and is passed to recurse in case the updates -- should be emailed. -run_twat :: Cfg -> Maybe Message -> String -> IO () -run_twat cfg msg username = do +run :: Cfg -> Maybe Message -> String -> IO () +run cfg msg username = do latest_status_id <- get_latest_status_id cfg username recurse cfg username latest_status_id msg return () @@ -189,7 +189,7 @@ construct_message cfg = do from = f } -- |The main function just parses the command-line arguments and then --- forks off calls to 'run_twat' for each supplied username. After +-- forks off calls to 'run' for each supplied username. After -- forking, main loops forever. main :: IO () main = do @@ -214,9 +214,9 @@ main = do -- message object to be passed to all of our threads. let message = construct_message cfg - -- Execute run_twat on each username in a new thread. - let run_twat_curried = run_twat cfg message - _ <- mapM (forkIO . run_twat_curried) (get_usernames (usernames cfg)) + -- Execute run on each username in a new thread. + let run_curried = run cfg message + _ <- mapM (forkIO . run_curried) (get_usernames (usernames cfg)) _ <- forever $ -- This thread (the one executing main) doesn't do anything, diff --git a/src/OptionalConfiguration.hs b/src/OptionalConfiguration.hs index 77b3a06..0b5fd0a 100644 --- a/src/OptionalConfiguration.hs +++ b/src/OptionalConfiguration.hs @@ -2,7 +2,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} --- | The program will parse ~/.twatrc for any available configuration +-- | The program will parse ~/.halcyonrc for any available configuration -- directives, resulting in an OptionalCfg. The command-line -- arguments will be used to create another OptionalCfg, and the two -- will be merged. Finally, a default_config will be updated from @@ -89,7 +89,7 @@ instance Monoid OptionalCfg where from_rc :: IO OptionalCfg from_rc = do - cfg <- DC.load [ DC.Optional "$(HOME)/.twatrc" ] + cfg <- DC.load [ DC.Optional "$(HOME)/.halcyonrc" ] cfg_consumer_key <- DC.lookup cfg "consumer-key" cfg_consumer_secret <- DC.lookup cfg "consumer-secret" cfg_access_token <- DC.lookup cfg "access-token" -- 2.44.2