Skip to content

Commit

Permalink
fix data file path and config parsing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aviaviavi committed Oct 10, 2018
1 parent 3099937 commit 6af45b2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .toodles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Toodles will ignore a file that matches any of the entires

ignore:
- test.js
- stack-work
- test.js
- stack-work
10 changes: 7 additions & 3 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import qualified Control.Exception as E
import Control.Monad
import Control.Monad.IO.Class
import Data.Aeson
import qualified Data.ByteString.Lazy.Char8 as B8S
import qualified Data.ByteString.Char8 as B8SS
import Data.Either
import Data.IORef
import Data.List
Expand All @@ -23,6 +23,7 @@ import Data.String.Utils
import qualified Data.Text as T
import Data.Version (showVersion)
import Data.Void
import qualified Data.Yaml as Y
import GHC.Generics
import Network.Wai.Handler.Warp
import Paths_toodles
Expand Down Expand Up @@ -464,7 +465,7 @@ ignoreFile (ToodlesConfig ignoredPaths) file =
let p = T.pack file
in T.isInfixOf "node_modules" p || T.isSuffixOf "pb.go" p ||
T.isSuffixOf "_pb2.py" p ||
any (\regex -> file =~ regex) ignoredPaths
any (\r -> file =~ r :: Bool) ignoredPaths

getExtension :: FilePath -> T.Text
getExtension path = last $ T.splitOn "." (T.pack path)
Expand Down Expand Up @@ -516,10 +517,13 @@ runFullSearch :: ToodlesArgs -> IO TodoListResult
runFullSearch userArgs =
let projectRoot = directory userArgs
in do
putStrLn $ "configPath: " ++ projectRoot ++ "/.toodles.yaml"
configExists <- doesFileExist $ projectRoot ++ "/.toodles.yaml"
config <- if configExists
then eitherDecode' . B8S.pack <$> readFile (projectRoot ++ "/.toodles.yaml")
then Y.decodeEither' . B8SS.pack <$> readFile (projectRoot ++ "/.toodles.yaml")
else return . Right $ ToodlesConfig []
when (isLeft config)
$ putStrLn $ "[WARNING] Invalid .toodles.yaml: " ++ show config
allFiles <- getAllFiles (fromRight (ToodlesConfig []) config) projectRoot
let parsedTodos = concatMap runTodoParser allFiles
filteredTodos =
Expand Down
4 changes: 3 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: toodles
version: 0.1.0.2
version: 0.1.0.3
github: "aviaviavi/toodles"
license: MIT
author: "Avi Press"
Expand All @@ -9,6 +9,8 @@ category: Project Management

extra-source-files:
- README.md

data-files:
- web/js/app.js
- web/js/*
- web/html/*
Expand Down
5 changes: 3 additions & 2 deletions toodles.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
--
-- see: https://github.com/sol/hpack
--
-- hash: 0c94110ed79d4a78056d1cae812a11d9a0d804c4c24304ced9b15ea51db5d3db
-- hash: 703679257a67bc8f02883cf8b85e4c1c53a777ac55e49065b72d92d2c829fb2b

name: toodles
version: 0.1.0.2
version: 0.1.0.3
synopsis: Manage the TODO entries in your code
description: See the README on GitHub at <https://github.com/aviaviavi/toodles#readme>
category: Project Management
Expand All @@ -19,6 +19,7 @@ build-type: Simple
cabal-version: >= 1.10
extra-source-files:
README.md
data-files:
web/css/bulma.min.css
web/css/font-awesome.min.css
web/css/toodles.css
Expand Down
3 changes: 1 addition & 2 deletions web/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ $(document).ready(function() {
})
}.bind(this)
},
// TODO(avi|p=2|key=a val) - make sorts persist refreshes
// TODO(avi|p=2|key=a val) - make sorts persist refreshes
// TODO(avi|p=2|key=a val) - make sorts persist refreshes
sortTodos: function(sortField) {
if (!sortField || typeof sortField !== 'string') {
sortField = this.customSortSelected
Expand Down

0 comments on commit 6af45b2

Please sign in to comment.