toboggan 0.1.0.0 → 0.1.0.1
raw patch · 5 files changed
+140/−13 lines, 5 filesdep +tweet-hsdep −clitdep ~basedep ~directorydep ~madlang
Dependencies added: tweet-hs
Dependencies removed: clit
Dependency ranges changed: base, directory, madlang, optparse-generic, toboggan
Files
- README.md +1/−1
- configure/horoscope.mad +43/−0
- src/Web/Toboggan.hs +8/−4
- stack.yaml +77/−0
- toboggan.cabal +11/−8
README.md view
@@ -26,7 +26,7 @@ curl -sSL http://haskellstack.org | sh ``` -and then use `stack install` to install. +and then use `stack install toboggan` to install. ### Configuration
+ configure/horoscope.mad view
@@ -0,0 +1,43 @@+:define reason+ 0.1 "Mercury is in retrograde. "+ 0.2 "The stars are full of mysteries. "+ 0.1 "The bones never lie. "+ 0.1 "Jupiter is ascending. "+ 0.1 "A strange man has come into your life. "+ 0.1 "Odd. "+ 0.1 "Tea leaves are always difficult to read. "+ 0.2 "Strange things happen. "+:define person+ 0.23 "A close friend will "+ 0.4 "You will "+ 0.1 "A family member will "+ 0.16 "A mysterious stranger will "+ 0.04 "The president of a small island will "+ 0.07 "A fairly large spider will "+:define goodfortune+ 0.04 person "make rain on the planet Mars."+ 0.2 person "have good things coming."+ 0.3 "Nice things will happen today."+ 0.06 person "become the president of a small island."+ 0.2 person "get an unexpected gift."+ 0.1 person "eat tasty spaghetti." + 0.1 person "find the love of your life."+:define badfortune+ 0.13 person "hurt your toe."+ 0.14 person "watch a TV show that isnt even that good."+ 0.2 person "get heckin angry for no reason"+ 0.13 person "steal a wallet but itll be EMPTY."+ 0.05 person "will watch a cat do unspeakable things."+ 0.1 person "commit treason."+ 0.25 "Just avoid ladders in general."+:define gnomic+ 0.2 "Watch out for large bodies of water."+ 0.1 "Harrison Ford might be single so theres still hope??"+ 0.1 "Do or do not, there is no try"+ 0.35 "The stars are shrouded in mystery."+ 0.05 "The US President is on camera watching Russian women pee on each other. "+ 0.2 "At least you arent in a coma yet. "+:return+ 0.4 reason badfortune+ 0.44 reason goodfortune+ 0.16 gnomic
src/Web/Toboggan.hs view
@@ -17,11 +17,13 @@ import Control.Monad import System.Directory import Options.Generic+import Data.Maybe -- | Data type for a twitter bot: configuration options and a CLI option data TwitterBot = TwitterBot { config :: FilePath <?> "Path to the .mad template"- , cred :: FilePath <?> "Path to credentials file"+ , cred :: Maybe FilePath <?> "Path to credentials file (default ~/.cred)" , cron :: Bool <?> "Display example crontab for a twitter bot"+ , extras :: [String] <?> "Extra inputs from command line" } deriving (Generic) instance ParseRecord TwitterBot@@ -35,15 +37,17 @@ -- | Turn a `TwitterBot` into an IO action program :: TwitterBot -> IO () program twitterBot = do+ homeDir <- getHomeDirectory let configR = unHelpful . config $ twitterBot- horoscope <- runFile configR- let credR = unHelpful . cred $ twitterBot+ let ins = map T.pack $ unHelpful . extras $ twitterBot+ generatedText <- runFile ins configR+ let credR = fromMaybe (homeDir ++ "/.cred") . unHelpful . cred $ twitterBot if (unHelpful . cron $ twitterBot) then do dir <- getCurrentDirectory putStrLn (cronStr ++ "~/.local/bin/toboggan --cred " ++ dir ++ "/" ++ credR ++ " --config " ++ dir ++ "/" ++ configR ++ "\n") else pure ()- void $ basicTweet (T.unpack horoscope) credR+ void $ basicTweet (T.unpack generatedText) credR -- | helper string for printing the crontab cronStr :: String
+ stack.yaml view
@@ -0,0 +1,77 @@+# This file was automatically generated by 'stack init'+#+# Some commonly used options have been documented as comments in this file.+# For advanced use and comprehensive documentation of the format, please see:+# http://docs.haskellstack.org/en/stable/yaml_configuration/++# A warning or info to be displayed to the user on config load.+user-message: ! 'Warning (added by new or init): Specified resolver could not satisfy+ all dependencies. Some external packages have been added as dependencies.++ You can suppress this message by removing it from stack.yaml++'++# Resolver to choose a 'specific' stackage snapshot or a compiler version.+# A snapshot resolver dictates the compiler version and the set of packages+# to be used for project dependencies. For example:+#+# resolver: lts-3.5+# resolver: nightly-2015-09-21+# resolver: ghc-7.10.2+# resolver: ghcjs-0.1.0_ghc-7.10.2+# resolver:+# name: custom-snapshot+# location: "./custom-snapshot.yaml"+resolver: lts-8.6++# User packages to be built.+# Various formats can be used as shown in the example below.+#+# packages:+# - some-directory+# - https://example.com/foo/bar/baz-0.0.2.tar.gz+# - location:+# git: https://github.com/commercialhaskell/stack.git+# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a+# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a+# extra-dep: true+# subdirs:+# - auto-update+# - wai+#+# A package marked 'extra-dep: true' will only be built if demanded by a+# non-dependency (i.e. a user package), and its test suites and benchmarks+# will not be run. This is useful for tweaking upstream packages.+packages:+- '.'+# Dependency packages to be pulled from upstream that are not in the resolver+# (e.g., acme-missiles-0.3)+extra-deps:+- madlang-2.1.0.1+- tibetan-utils-0.1.1.2+- tweet-hs-0.5.3.2++# Override default flag values for local packages and extra-deps+flags: {}++# Extra package databases containing global packages+extra-package-dbs: []++# Control whether we use the GHC we find on the path+# system-ghc: true+#+# Require a specific version of stack, using version ranges+# require-stack-version: -any # Default+# require-stack-version: ">=1.4"+#+# Override the architecture used by stack, especially useful on Windows+# arch: i386+# arch: x86_64+#+# Extra directories used by stack for building+# extra-include-dirs: [/path/to/dir]+# extra-lib-dirs: [/path/to/dir]+#+# Allow a newer minor version of GHC than the snapshot specifies+# compiler-check: newer-minor
toboggan.cabal view
@@ -1,11 +1,12 @@ name: toboggan-version: 0.1.0.0+version: 0.1.0.1 cabal-version: >=1.10 build-type: Simple license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2016 Vanessa McHale maintainer: tmchale@wisc.edu+stability: experimental homepage: https://github.com/vmchale/toboggan#readme synopsis: Twitter bot generator description:@@ -14,6 +15,8 @@ author: Vanessa McHale extra-source-files: README.md+ configure/horoscope.mad+ stack.yaml source-repository head type: git@@ -24,20 +27,20 @@ Web.Toboggan build-depends: base >=4.7 && <5,- madlang >=0.1.0.1 && <0.2,- clit >=0.2.0.0 && <0.3,+ madlang >=2.1.0.1 && <2.2,+ tweet-hs >=0.5.3.2 && <0.6, text >=1.2.2.1 && <1.3,- directory >=1.2.6.2 && <1.3,- optparse-generic >=1.1.1 && <1.2+ directory >=1.3.0.0 && <1.4,+ optparse-generic >=1.1.4 && <1.2 default-language: Haskell2010 hs-source-dirs: src executable toboggan main-is: Main.hs build-depends:- base >=4.9.0.0 && <4.10,- toboggan >=0.1.0.0 && <0.2+ base >=4.9.1.0 && <4.10,+ toboggan >=0.1.0.1 && <0.2 default-language: Haskell2010 hs-source-dirs: app- ghc-options: -threaded -rtsopts -with-rtsopts=-N+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -O3 -fllvm -optlo-O3