Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
ff6e2e1e
Commit
ff6e2e1e
authored
Dec 19, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Ngrams repo missing directory.
parent
6890ae68
Pipeline
#665
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
Settings.hs
src/Gargantext/API/Settings.hs
+9
-3
No files found.
src/Gargantext/API/Settings.hs
View file @
ff6e2e1e
...
@@ -178,14 +178,18 @@ data MockEnv = MockEnv
...
@@ -178,14 +178,18 @@ data MockEnv = MockEnv
makeLenses
''
M
ockEnv
makeLenses
''
M
ockEnv
-- | TODO add this path in Settings
-- | TODO add this path in Settings
repoDir
::
FilePath
repoDir
=
"repos"
repoSnapshot
::
FilePath
repoSnapshot
::
FilePath
repoSnapshot
=
"
repo.json"
repoSnapshot
=
repoDir
<>
"/
repo.json"
-- | TODO add hard coded file in Settings
-- | TODO add hard coded file in Settings
-- This assumes we own the lock on repoSnapshot.
-- This assumes we own the lock on repoSnapshot.
repoSaverAction
::
ToJSON
a
=>
a
->
IO
()
repoSaverAction
::
ToJSON
a
=>
a
->
IO
()
repoSaverAction
a
=
do
repoSaverAction
a
=
do
withTempFile
"
.
"
"tmp-repo.json"
$
\
fp
h
->
do
withTempFile
"
repos
"
"tmp-repo.json"
$
\
fp
h
->
do
-- printDebug "repoSaverAction" fp
-- printDebug "repoSaverAction" fp
L
.
hPut
h
$
encode
a
L
.
hPut
h
$
encode
a
hClose
h
hClose
h
...
@@ -210,6 +214,8 @@ mkRepoSaver repo_var = mkDebounce settings
...
@@ -210,6 +214,8 @@ mkRepoSaver repo_var = mkDebounce settings
readRepoEnv
::
IO
RepoEnv
readRepoEnv
::
IO
RepoEnv
readRepoEnv
=
do
readRepoEnv
=
do
-- Does file exist ? :: Bool
-- Does file exist ? :: Bool
_repoDir
<-
doesDirectoryExist
True
repoDir
repoFile
<-
doesFileExist
repoSnapshot
repoFile
<-
doesFileExist
repoSnapshot
-- Is file not empty ? :: Bool
-- Is file not empty ? :: Bool
...
@@ -230,7 +236,7 @@ readRepoEnv = do
...
@@ -230,7 +236,7 @@ readRepoEnv = do
pure
repo
pure
repo
else
else
pure
initRepo
pure
initRepo
-- TODO save in DB here
saver
<-
mkRepoSaver
mvar
saver
<-
mkRepoSaver
mvar
pure
$
RepoEnv
{
_renv_var
=
mvar
,
_renv_saver
=
saver
,
_renv_lock
=
lock
}
pure
$
RepoEnv
{
_renv_var
=
mvar
,
_renv_saver
=
saver
,
_renv_lock
=
lock
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment