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
153
Issues
153
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
193325e6
Commit
193325e6
authored
Mar 03, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[APP] command line options added.
parent
f0e3a45b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
12 deletions
+69
-12
Main.hs
app/Main.hs
+55
-5
package.yaml
package.yaml
+1
-0
Facet.hs
src/Gargantext/Database/Facet.hs
+13
-7
No files found.
app/Main.hs
View file @
193325e6
{-|
Module : Main.hs
Description : Gargantext starter
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module
Main
where
import
Options.Generic
import
Data.Text
(
unpack
)
import
Gargantext.Prelude
import
Gargantext.API
(
startGargantext
)
import
Text.Read
(
read
)
import
System.Environment
(
getArgs
)
import
Gargantext.API
(
startGargantext
,
startGargantextMock
)
------------------------------------------------------
data
Mode
=
Dev
|
Mock
|
Prod
deriving
(
Show
,
Read
,
Generic
)
instance
ParseRecord
Mode
instance
ParseField
Mode
instance
ParseFields
Mode
data
MyOptions
=
MyOptions
{
port
::
Maybe
Int
,
iniFile
::
Maybe
Text
,
mode
::
Maybe
Mode
}
deriving
(
Generic
,
Show
)
instance
ParseRecord
MyOptions
main
::
IO
()
main
=
do
(
port
:
iniFile
:
_
)
<-
getArgs
startGargantext
(
read
port
::
Int
)
iniFile
MyOptions
myPort
myIniFile
myMode
<-
getRecord
"Gargantext: collaborative platform for text-mining"
let
myPort'
=
case
myPort
of
Just
p
->
p
Nothing
->
8008
let
start
=
case
myMode
of
--Nothing -> startGargantext myPort' (unpack myIniFile')
Just
Prod
->
startGargantext
myPort'
(
unpack
myIniFile'
)
where
myIniFile'
=
case
myIniFile
of
Nothing
->
panic
"Need gargantext.ini file"
Just
i
->
i
Just
Mock
->
startGargantextMock
myPort'
_
->
startGargantextMock
myPort'
start
package.yaml
View file @
193325e6
...
...
@@ -130,6 +130,7 @@ executable:
-
ini
-
base
-
unordered-containers
-
optparse-generic
tests
:
garg-test
:
...
...
src/Gargantext/Database/Facet.hs
View file @
193325e6
...
...
@@ -21,7 +21,8 @@ Portability : POSIX
{-# LANGUAGE NoMonomorphismRestriction #-}
------------------------------------------------------------------------
module
Gargantext.Database.Facet
where
module
Gargantext.Database.Facet
where
------------------------------------------------------------------------
import
Prelude
hiding
(
null
,
id
,
map
,
sum
,
not
)
...
...
@@ -68,8 +69,15 @@ data Facet id created hyperdata favorite ngramCount =
,
facetDoc_ngramCount
::
ngramCount
}
deriving
(
Show
,
Generic
)
-- | JSON instance
$
(
deriveJSON
(
unPrefix
"facetDoc_"
)
''
F
acet
)
-- | Documentation instance
instance
ToSchema
FacetDoc
-- | Mock and Quickcheck instances
instance
Arbitrary
FacetDoc
where
arbitrary
=
elements
[
FacetDoc
id'
(
jour
year
01
01
)
hp
fav
ngramCount
|
id'
<-
[
1
..
10
]
...
...
@@ -80,18 +88,16 @@ instance Arbitrary FacetDoc where
]
-- Facets / Views for the Front End
-- | Database instances
$
(
makeAdaptorAndInstance
"pFacetDoc"
''
F
acet
)
$
(
makeLensesWith
abbreviatedFields
''
F
acet
)
type
FacetDocRead
=
Facet
(
Column
PGInt4
)
(
Column
PGTimestamptz
)
(
Column
PGJsonb
)
(
Column
PGBool
)
(
Column
PGInt4
)
instance
ToSchema
FacetDoc
$
(
makeAdaptorAndInstance
"pFacetDoc"
''
F
acet
)
$
(
makeLensesWith
abbreviatedFields
''
F
acet
)
------------------------------------------------------------------------
...
...
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