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
e9d7a207
Commit
e9d7a207
authored
Mar 02, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CLEAN] fix gitignore on cabal files in order to minimize merge/error risks.
parent
f4aea078
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
374 deletions
+1
-374
.gitignore
.gitignore
+1
-0
gargantext.cabal
gargantext.cabal
+0
-204
Swagger.hs
src/Gargantext/API/Swagger.hs
+0
-170
No files found.
.gitignore
View file @
e9d7a207
.stack-work
*.swp
*.cabal
gargantext.cabal
deleted
100644 → 0
View file @
f4aea078
-- This file has been generated from package.yaml by hpack version 0.21.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: d4561cbff71c5a3432f81acb07d955452c13d94813fdc788977e81067144e27b
name: gargantext
version: 0.1.0.0
synopsis: Deep (Collaborative) Text mining project
description: Please see README.md
category: Data
homepage: https://gargantext.org
author: Gargantext Team
maintainer: team@gargantext.org
copyright: Copyright: (c) 2017-2018: see git logs and README
license: BSD3
license-file: LICENSE
build-type: Simple
cabal-version: >= 1.10
library
exposed-modules:
Gargantext
Gargantext.Analysis
Gargantext.DSL
Gargantext.Database
Gargantext.Database.Instances
Gargantext.Database.Ngram
Gargantext.Database.Node
Gargantext.Database.Facet
Gargantext.Database.NodeNgram
Gargantext.Database.NodeNgramNgram
Gargantext.Database.NodeNode
Gargantext.Database.NodeNodeNgram
Gargantext.Database.Utils
Gargantext.Database.User
Gargantext.Ngrams
Gargantext.Ngrams.Count
Gargantext.Ngrams.CoreNLP
Gargantext.Ngrams.Parser
Gargantext.Ngrams.Lang.En
Gargantext.Ngrams.Lang.Fr
Gargantext.Ngrams.Metrics
Gargantext.Ngrams.TextMining
Gargantext.Ngrams.Occurrences
Gargantext.Parsers
Gargantext.Parsers.WOS
Gargantext.Parsers.Date
Gargantext.Prelude
Gargantext.RCT
Gargantext.API
Gargantext.API.Auth
Gargantext.Types
Gargantext.Types.Main
Gargantext.Types.Node
Gargantext.Utils.DateUtils
Gargantext.Utils.Prefix
other-modules:
Gargantext.API.Count
Gargantext.API.FrontEnd
Gargantext.API.Node
Gargantext.Database.Queries
Gargantext.Utils
Paths_gargantext
hs-source-dirs:
src
default-extensions: NoImplicitPrelude
ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Werror
build-depends:
QuickCheck
, aeson
, aeson-lens
, aeson-pretty
, async
, attoparsec
, base >=4.7 && <5
, base16-bytestring
, bytestring
, case-insensitive
, conduit
, conduit-extra
, containers
, contravariant
, data-time-segment
, directory
, duckling
, extra
, filepath
, http-conduit
, hxt
, ini
, lens
, logging-effect
, opaleye
, parsec
, path
, path-io
, postgresql-simple
, pretty
, product-profunctors
, profunctors
, protolude
, pureMD5
, regex-compat
, safe
, semigroups
, servant
, servant-auth
, servant-client
, servant-mock
, servant-multipart
, servant-server
, servant-static-th
, servant-swagger
, servant-swagger-ui
, split
, swagger2
, tagsoup
, text
, text-metrics
, time
, time-locale-compat
, timezone-series
, transformers
, unordered-containers
, uuid
, vector
, wai
, warp
, yaml
, zip
, zlib
default-language: Haskell2010
executable gargantext
main-is: Main.hs
other-modules:
Paths_gargantext
hs-source-dirs:
app
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -O2
build-depends:
base
, extra
, gargantext
, ini
, text
, unordered-containers
default-language: Haskell2010
test-suite garg-doctest
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Paths_gargantext
hs-source-dirs:
src-doctest
ghc-options: -Wall -Werror -threaded -rtsopts -with-rtsopts=-N
build-depends:
Glob
, QuickCheck
, base
, doctest
, extra
, gargantext
, text
default-language: Haskell2010
test-suite garg-test
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Ngrams.Lang
Ngrams.Lang.En
Ngrams.Lang.Fr
Ngrams.Lang.Occurrences
Ngrams.Metrics
Parsers.WOS
Paths_gargantext
hs-source-dirs:
src-test
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
QuickCheck
, base
, duckling
, extra
, gargantext
, hspec
, parsec
, quickcheck-instances
, text
, time
other-modules:
Ngrams.Lang
Ngrams.Lang.En
Ngrams.Lang.Fr
Ngrams.Lang.Occurrences
Ngrams.Metrics
Parsers.Date
Parsers.Types
Parsers.WOS
Paths_gargantext
default-language: Haskell2010
src/Gargantext/API/Swagger.hs
deleted
100644 → 0
View file @
f4aea078
{-|
Module : Gargantext.API.Swagger
Description : Swagger Documentation API
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
---------------------------------------------------------------------
module
Gargantext.API.Swagger
where
---------------------------------------------------------------------
import
Gargantext.Prelude
import
System.IO
(
FilePath
,
print
)
import
GHC.Generics
(
D1
,
Meta
(
..
),
Rep
)
import
GHC.TypeLits
(
AppendSymbol
,
Symbol
)
import
Control.Lens
import
Data.Aeson.Encode.Pretty
(
encodePretty
)
import
qualified
Data.ByteString.Lazy.Char8
as
BL8
import
Data.Swagger
import
Data.Text
(
Text
,
pack
)
--import qualified Data.Set as Set
import
Database.PostgreSQL.Simple
(
Connection
,
connect
)
import
Network.Wai
import
Network.Wai.Handler.Warp
import
Servant
import
Servant.Mock
(
mock
)
import
Servant.Swagger
import
Servant.Swagger.UI
import
Servant.Static.TH
(
createApiAndServerDecs
)
-- import Servant.API.Stream
import
Gargantext.API.Node
(
Roots
,
roots
,
NodeAPI
,
nodeAPI
,
NodesAPI
,
nodesAPI
)
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
Gargantext.Database.Utils
(
databaseParameters
)
---------------------------------------------------------------------
---------------------------------------------------------------------
type
PortNumber
=
Int
---------------------------------------------------------------------
-- | API Global
-- | API for serving @swagger.json@
-- TODO Do we need to add this in the API ?
-- type SwaggerAPI = "swagger.json" :> Get '[JSON] Swagger
type
SwaggerAPI
=
SwaggerSchemaUI
"swagger-ui"
"swagger.json"
-- | Serve front end files
$
(
createApiAndServerDecs
"FrontEndAPI"
"frontEndServer"
"frontEnd"
)
type
SwaggerFrontAPI
=
SwaggerAPI
:<|>
FrontEndAPI
type
API
=
SwaggerFrontAPI
:<|>
GargAPI
---------------------------------------------------------------------
-- | Server declaration
server
::
Connection
->
Server
API
server
conn
=
swaggerFront
:<|>
roots
conn
:<|>
nodeAPI
conn
:<|>
nodeAPI
conn
:<|>
nodesAPI
conn
:<|>
count
---------------------------------------------------------------------
swaggerFront
::
Server
SwaggerFrontAPI
swaggerFront
=
schemaUiServer
swaggerDoc
:<|>
frontEndServer
gargMock
::
Server
GargAPI
gargMock
=
mock
apiGarg
Proxy
---------------------------------------------------------------------
app
::
Connection
->
Application
app
=
serve
api
.
server
appMock
::
Application
appMock
=
serve
api
(
swaggerFront
:<|>
gargMock
)
---------------------------------------------------------------------
api
::
Proxy
API
api
=
Proxy
apiGarg
::
Proxy
GargAPI
apiGarg
=
Proxy
---------------------------------------------------------------------
schemaUiServer
::
(
Server
api
~
Handler
Swagger
)
=>
Swagger
->
Server
(
SwaggerSchemaUI'
dir
api
)
schemaUiServer
=
swaggerSchemaUIServer
-- Type Familiy for the Documentation
type
family
TypeName
(
x
::
*
)
::
Symbol
where
TypeName
Int
=
"Int"
TypeName
Text
=
"Text"
TypeName
x
=
GenericTypeName
x
(
Rep
x
()
)
type
family
GenericTypeName
t
(
r
::
*
)
::
Symbol
where
GenericTypeName
t
(
D1
(
'M
e
taData
name
mod
pkg
nt
)
f
x
)
=
name
type
Desc
t
n
=
Description
(
AppendSymbol
(
TypeName
t
)
(
AppendSymbol
" | "
n
))
-- | Swagger Specifications
swaggerDoc
::
Swagger
swaggerDoc
=
toSwagger
(
Proxy
::
Proxy
GargAPI
)
&
info
.
title
.~
"Gargantext"
&
info
.
version
.~
"0.1.0"
-- & info.base_url ?~ (URL "http://gargantext.org/")
&
info
.
description
?~
"REST API specifications"
-- & tags .~ Set.fromList [Tag "Garg" (Just "Main perations") Nothing]
&
applyTagsFor
(
subOperations
(
Proxy
::
Proxy
GargAPI
)(
Proxy
::
Proxy
GargAPI
))
[
"Garg"
&
description
?~
"Main operations"
]
&
info
.
license
?~
(
"AGPLV3 (English) and CECILL (French)"
&
url
?~
URL
urlLicence
)
where
urlLicence
=
"https://gitlab.iscpif.fr/gargantext/haskell-gargantext/blob/master/LICENSE"
-- | Output generated @swagger.json@ file for the @'TodoAPI'@.
swaggerWriteJSON
::
IO
()
swaggerWriteJSON
=
BL8
.
writeFile
"swagger.json"
(
encodePretty
swaggerDoc
)
-- | startGargantext takes as parameters port number and Ini file.
startGargantext
::
PortNumber
->
FilePath
->
IO
()
startGargantext
port
file
=
do
print
(
"Starting Gargantext server"
<>
show
port
)
print
(
"http://localhost:"
<>
show
port
)
param
<-
databaseParameters
file
conn
<-
connect
param
run
port
(
app
conn
)
startGargantextMock
::
PortNumber
->
IO
()
startGargantextMock
port
=
do
print
(
pack
"Starting Mock server"
)
print
(
pack
$
"curl "
<>
"-H
\"
content-type: application/json"
<>
"-d
\'
{
\"
query_query
\"
:
\"
query
\"
}
\'
"
<>
"-v http://localhost:"
<>
show
port
<>
"/count"
)
run
port
appMock
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