From 15468871b7fd53b6ff9902612f2036cf23f8c2dc Mon Sep 17 00:00:00 2001 From: Mark Wales Date: Mon, 5 Oct 2020 17:07:18 +0100 Subject: [PATCH 1/5] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 00000000..9f04401b --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +taskell.app \ No newline at end of file From 6e30de41becf01d16481b1c0a1ff9bf60fbc24a3 Mon Sep 17 00:00:00 2001 From: Mark Wales Date: Tue, 30 Mar 2021 14:44:37 +0100 Subject: [PATCH 2/5] chore: updates Stack resolver --- stack.yaml | 4 ++-- stack.yaml.lock | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/stack.yaml b/stack.yaml index 6bd9c745..6b98c2df 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,6 +1,6 @@ -resolver: lts-16.14 +resolver: lts-17.8 pvp-bounds: both packages: - . extra-deps: - - tz-0.1.3.3 + - tz-0.1.3.5 diff --git a/stack.yaml.lock b/stack.yaml.lock index 4f86fcdb..84139575 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -5,15 +5,15 @@ packages: - completed: - hackage: tz-0.1.3.3@sha256:b9de0c1b10825460ff14a237209a8bf7747f47979601d35621276556bf63d2ca,5086 + hackage: tz-0.1.3.5@sha256:fb17ca50a7d943e511c0ca70342dc83f66aa2532de2745632f1f5f9b1ad783c4,5086 pantry-tree: - size: 1180 - sha256: ae6af45f3dba5a478ea9cc77c718f955fcc5c96f2dc0f4ede34c4a15a3e85ac1 + size: 1179 + sha256: 6482698ea1b1a93bd684fca35836b35e8cdf53fe51b0fa6b215afa7da1f983a6 original: - hackage: tz-0.1.3.3 + hackage: tz-0.1.3.5 snapshots: - completed: - size: 532382 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/14.yaml - sha256: 1ef27e36f38824abafc43224ca612211b3828fa9ffd31ba0fc2867ae2e19ba90 - original: lts-16.14 + size: 565720 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/17/8.yaml + sha256: 76bf8992ff8dfe6eda9c02f81866138c2369344d5011ab39ae403457c4448b03 + original: lts-17.8 From 0bcc23556a4c5c9921148b9a6a71742705da93d3 Mon Sep 17 00:00:00 2001 From: Mark Wales Date: Tue, 30 Mar 2021 08:59:14 +0100 Subject: [PATCH 3/5] fix: update filepath handling (#95) - Wasn't handling relative paths properly - Would cause issues if a different directory was given as the path - More consistent use of `FilePath` This whole file could do with a refactor - it's got very messy over the years. --- src/Taskell/IO.hs | 73 ++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/src/Taskell/IO.hs b/src/Taskell/IO.hs index f463b7e2..62a2d66b 100644 --- a/src/Taskell/IO.hs +++ b/src/Taskell/IO.hs @@ -4,7 +4,8 @@ import ClassyPrelude import Control.Monad.Reader (runReader) import Data.Text.Encoding (decodeUtf8With) -import System.Directory (doesFileExist, getCurrentDirectory) +import System.Directory (doesFileExist, doesDirectoryExist, canonicalizePath, makeRelativeToCurrentDirectory) +import Data.Either (fromRight) import Data.Time.Zones (TZ) @@ -38,14 +39,23 @@ data Next Lists | Exit + +getPath :: Text -> ReaderConfig FilePath +getPath path = do + config <- asks ioConfig + canonicial <- lift $ canonicalizePath (unpack path) + let defaultFilename = filename (general config) + isDir <- lift $ doesDirectoryExist canonicial + pure $ if isDir then canonicial defaultFilename else canonicial + parseArgs :: [Text] -> ReaderConfig Next parseArgs ["-v"] = pure $ Output version parseArgs ["-h"] = pure $ Output usage -parseArgs ["-t", boardID, file] = loadTrello boardID file -parseArgs ["-g", identifier, file] = loadGitHub identifier file -parseArgs ["-i", file] = fileInfo file -parseArgs [file] = loadFile file -parseArgs [] = (pack . filename . general <$> asks ioConfig) >>= loadFile +parseArgs ["-t", boardID, file] = getPath file >>= loadTrello boardID +parseArgs ["-g", identifier, file] = getPath file >>= loadGitHub identifier +parseArgs ["-i", file] = getPath file >>= fileInfo +parseArgs [file] = getPath file >>= loadFile +parseArgs [] = getPath "" >>= loadFile parseArgs _ = pure $ Error (unlines ["Invalid options", "", usage]) load :: ReaderConfig Next @@ -54,34 +64,41 @@ load = getArgs >>= parseArgs colonic :: FilePath -> Text -> Text colonic path = ((pack path <> ": ") <>) -loadFile :: Text -> ReaderConfig Next +createLoad :: FilePath -> Lists -> ReaderConfig Next +createLoad path lists = do + relative <- lift $ makeRelativeToCurrentDirectory path + pure $ Load relative lists + +loadFile :: FilePath -> ReaderConfig Next loadFile filepath = do mPath <- exists filepath case mPath of Nothing -> pure Exit - Just path -> either (Error . colonic path) (Load path) <$> readData path + Just path -> do + lists <- readData path + case lists of + Left err -> pure $ Error (colonic path err) + Right ls -> createLoad path ls -loadRemote :: (token -> FilePath -> ReaderConfig Next) -> token -> Text -> ReaderConfig Next -loadRemote createFn identifier filepath = do - let path = unpack filepath +loadRemote :: (token -> FilePath -> ReaderConfig Next) -> token -> FilePath -> ReaderConfig Next +loadRemote createFn identifier path = do exists' <- fileExists path if exists' - then pure $ Error (filepath <> " already exists") + then pure $ Error (pack path <> " already exists") else createFn identifier path -loadTrello :: Trello.TrelloBoardID -> Text -> ReaderConfig Next +loadTrello :: Trello.TrelloBoardID -> FilePath -> ReaderConfig Next loadTrello = loadRemote createTrello -loadGitHub :: GitHub.GitHubIdentifier -> Text -> ReaderConfig Next +loadGitHub :: GitHub.GitHubIdentifier -> FilePath -> ReaderConfig Next loadGitHub = loadRemote createGitHub -fileInfo :: Text -> ReaderConfig Next -fileInfo filepath = do - let path = unpack filepath +fileInfo :: FilePath -> ReaderConfig Next +fileInfo path = do exists' <- fileExists path if exists' - then either (Error . colonic path) (Output . analyse filepath) <$> readData path - else pure $ Error (filepath <> " does not exist") + then either (Error . colonic path) (Output . analyse (pack path)) <$> readData path + else pure $ Error (pack path <> " does not exist") createRemote :: (Config -> Maybe token) @@ -99,9 +116,8 @@ createRemote tokenFn missingToken getFn identifier path = do lists <- lift $ runReaderT (getFn identifier) token case lists of Left txt -> pure $ Error txt - Right ls -> - promptCreate path >>= - bool (pure Exit) (Load path ls <$ lift (writeData tz config ls path)) + Right ls -> do + promptCreate path >>= bool (pure Exit) (lift (writeData tz config ls path) >> createLoad path ls) createTrello :: Trello.TrelloBoardID -> FilePath -> ReaderConfig Next createTrello = createRemote (Trello.token . trello) trelloUsage Trello.getLists @@ -109,9 +125,8 @@ createTrello = createRemote (Trello.token . trello) trelloUsage Trello.getLists createGitHub :: GitHub.GitHubIdentifier -> FilePath -> ReaderConfig Next createGitHub = createRemote (GitHub.token . github) githubUsage GitHub.getLists -exists :: Text -> ReaderConfig (Maybe FilePath) -exists filepath = do - let path = unpack filepath +exists :: FilePath -> ReaderConfig (Maybe FilePath) +exists path = do exists' <- fileExists path if exists' then pure $ Just path @@ -121,17 +136,15 @@ fileExists :: FilePath -> ReaderConfig Bool fileExists path = lift $ doesFileExist path promptCreate :: FilePath -> ReaderConfig Bool -promptCreate path = do - cwd <- lift $ pack <$> getCurrentDirectory - lift $ promptYN PromptYes $ concat ["Create ", cwd, "/", pack path, "?"] +promptCreate path = lift $ promptYN PromptYes $ concat ["Create ", pack path, "?"] -- creates taskell file createPath :: FilePath -> ReaderConfig () createPath path = do config <- asks ioConfig tz <- asks ioTZ - template <- readData =<< templatePath <$> lift getDir - let ls = either (const initial) id template + template <- readData . templatePath =<< lift getDir + let ls = fromRight initial template lift (writeData tz config ls path) -- writes Tasks to json file From d9c6a177d2321f72fb33d1ff129fd6d6f31c4c29 Mon Sep 17 00:00:00 2001 From: Mark Wales Date: Tue, 30 Mar 2021 08:59:14 +0100 Subject: [PATCH 4/5] chore: update docs dependencies --- docs/Gemfile.lock | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 28ae905f..6947046e 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -5,77 +5,75 @@ GEM public_suffix (>= 2.0.2, < 5.0) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - capistrano (3.14.1) + capistrano (3.16.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) colorator (1.1.0) - concurrent-ruby (1.1.7) - em-websocket (0.5.1) + concurrent-ruby (1.1.8) + em-websocket (0.5.2) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) eventmachine (1.2.7) - ffi (1.13.1) + ffi (1.15.0) forwardable-extended (2.6.0) http_parser.rb (0.6.0) - i18n (1.8.5) + i18n (1.8.9) concurrent-ruby (~> 1.0) - jekyll (4.1.1) + jekyll (4.2.0) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) i18n (~> 1.0) jekyll-sass-converter (~> 2.0) jekyll-watch (~> 2.0) - kramdown (~> 2.1) + kramdown (~> 2.3) kramdown-parser-gfm (~> 1.0) liquid (~> 4.0) mercenary (~> 0.4.0) pathutil (~> 0.9) rouge (~> 3.0) safe_yaml (~> 1.0) - terminal-table (~> 1.8) + terminal-table (~> 2.0) jekyll-sass-converter (2.1.0) sassc (> 2.0.1, < 3.0) jekyll-watch (2.2.1) listen (~> 3.0) - kramdown (2.3.0) + kramdown (2.3.1) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) liquid (4.0.3) - listen (3.2.1) + listen (3.5.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) - multi_json (1.15.0) net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) net-ssh (6.1.0) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (4.0.5) - pygments.rb (1.2.1) - multi_json (>= 1.0.0) - rake (13.0.1) + public_suffix (4.0.6) + pygments.rb (2.2.0) + rake (13.0.3) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) rexml (3.2.4) - rouge (3.21.0) + rouge (3.26.0) safe_yaml (1.0.5) sassc (2.4.0) ffi (~> 1.9) - sshkit (1.21.0) + sshkit (1.21.2) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - terminal-table (1.8.0) + terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (1.7.0) PLATFORMS - ruby + x86_64-darwin-20 DEPENDENCIES capistrano @@ -84,4 +82,4 @@ DEPENDENCIES pygments.rb BUNDLED WITH - 2.1.4 + 2.2.15 From 08fa247a0fa38907e90ea9f15d7697a83b9e612e Mon Sep 17 00:00:00 2001 From: Mark Wales Date: Tue, 30 Mar 2021 14:57:08 +0100 Subject: [PATCH 5/5] chore: version bump --- docs/_config.yml | 2 +- package.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_config.yml b/docs/_config.yml index ee80e20b..4e2d8ce6 100755 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -3,7 +3,7 @@ title: taskell tagline: Command-line Kanban board/task management baseurl: "" locale: "en" -version: 1.10.1 +version: 1.11.0 destination: _site/public exclude: [deployment, Capfile, log, Gemfile, Gemfile.lock] diff --git a/package.yaml b/package.yaml index 8d800c7b..89079666 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: taskell -version: '1.10.1' +version: '1.11.0' category: Command Line Tools author: Mark Wales maintainer: mark@smallhadroncollider.com