Skip to content

Commit

Permalink
website for docs (#190)
Browse files Browse the repository at this point in the history
* Fixes #203
* Travis uploads haddocks
* Link to local docs
* add navigation structure
* merge upstream
  • Loading branch information
kejace authored Feb 1, 2020
1 parent 3b13a56 commit ab6477b
Show file tree
Hide file tree
Showing 101 changed files with 160 additions and 21 deletions.
26 changes: 22 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,31 @@ jobs:

- echo "Test simple-storage"
- make docker-test-prebake
- docker-compose -f hs-abci-examples/simple-storage/docker-compose.yaml -p test-hs-abci-examples-simple-storage-e2e up -d
- docker-compose -f hs-abci-docs/simple-storage/docker-compose.yaml -p test-hs-abci-examples-simple-storage-e2e up -d
- make test-simple-storage
- docker-compose -f hs-abci-examples/simple-storage/docker-compose.yaml -p test-hs-abci-examples-simple-storage-e2e down -v --rmi local
- docker-compose -f hs-abci-docs/simple-storage/docker-compose.yaml -p test-hs-abci-examples-simple-storage-e2e down -v --rmi local

- echo "Test nameservice"
- make docker-test-prebake
- docker-compose -f hs-abci-examples/nameservice/docker-compose-test.yaml -p test-hs-abci-examples-nameservice-e2e up -d
- docker-compose -f hs-abci-docs/nameservice/docker-compose-test.yaml -p test-hs-abci-examples-nameservice-e2e up -d
- make test-nameservice
- docker-compose -f hs-abci-examples/nameservice/docker-compose-test.yaml -p test-hs-abci-examples-nameservice-e2e down -v --rmi local
- docker-compose -f hs-abci-docs/nameservice/docker-compose-test.yaml -p test-hs-abci-examples-nameservice-e2e down -v --rmi local

- stage: publish website
script:
- echo "building website"
- travis_wait 120 stack --skip-ghc-check install tintin
- make build-site
- make build-docs-local
- mkdir -p ./hs-abci-docs/.stack-work/tintin/rendered/haddocks
- find ./ -type f -name "index.html" | grep -v tintin | sed 's/index.html//g' | xargs -I {} cp -r {} hs-abci-docs/.stack-work/tintin/rendered/haddocks/
deploy:
provider: pages
local-dir: ./hs-abci-docs/.stack-work/tintin/rendered
email: [email protected]
name: Deployment Bot
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: true
on:
branch: master
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ SIMPLE_STORAGE_BINARY := $(shell stack exec -- which simple-storage)
help: ## Ask for help!
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

# Thank you Apple
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SED=sed -i''
endif
ifeq ($(UNAME_S),Darwin)
SED=sed -i ''
endif

#####################
# Linting and Styling
#####################
Expand All @@ -22,8 +31,8 @@ hlint: ## Run hlint on all haskell projects
hs-abci-extra \
hs-abci-sdk \
hs-abci-test-utils \
hs-abci-examples/simple-storage \
hs-abci-examples/nameservice \
hs-abci-docs/simple-storage \
hs-abci-docs/nameservice \
hs-iavl-client

stylish: ## Run stylish-haskell over all haskell projects
Expand All @@ -42,8 +51,16 @@ stylish: ## Run stylish-haskell over all haskell projects
###################

build-docs-local: ## Build the haddocks documentation for just this project (no dependencies)
find . -type f -name "package.yaml" -exec $(SED) -e 's/- -fplugin=Polysemy.Plugin/- -fdefer-type-errors/g' {} + && \
find . -type f -name "package.yaml" -exec $(SED) -e 's/- -Wall/- -fno-warn-deferred-type-errors/g' {} + && \
stack haddock --no-haddock-deps

build-site: ## Build the tintin site
find ./hs-abci-docs/ -type f -name "*.md" -exec $(SED) -e 's/~~~ haskell.*/```haskell/g' {} + && \
find ./hs-abci-docs/ -type f -name "*.md" -exec $(SED) -e 's/~~~/```/g' {} + && \
cd hs-abci-docs && \
tintin run

#####################
# Core Libraries
#####################
Expand Down
10 changes: 10 additions & 0 deletions hs-abci-docs/.tintin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: kepler
synopsis: Haskell Cosmos SDK
github: f-o-a-m/kepler
author: Martin Allen
authorWebsite: https://foam.space
color: #5E5184
#logo: https://pbs.twimg.com/profile_images/791467713956839424/pBRQn1wt_400x400.jpg
titleFont: Poiret One
titleFontWeight: 400
bodyFont: PT Sans
15 changes: 15 additions & 0 deletions hs-abci-docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Thank you Apple
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SED=sed -i''
endif
ifeq ($(UNAME_S),Darwin)
SED=sed -i ''
endif

pre-process:
find ./doc/ -type f,l -name "*.md" -exec $(SED) -e 's/~~~ haskell.*/```haskell/g' {} + && \
find ./doc/ -type f,l -name "*.md" -exec $(SED) -e 's/~~~/```/g' {} +

tintin:
tintin run
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0100-Tutorial.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0310-Overview.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0320-BaseApp.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0330-Modules.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0410-Overview.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0420-Types.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0430-Message.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0440-Keeper.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0450-Query.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0460-Module.md
1 change: 1 addition & 0 deletions hs-abci-docs/doc/0470-Application.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Logging
---

# Logging

The SDK has built in support for structured logging via the [katip](https://hackage.haskell.org/package/katip) logging library. Even still, the SDK is agnostic to where you want your logs to go. Katip logs are managed by *scribes* whos job is precisely this, so the output depends on which scribes you use. The two most common scribes are the [console scribe](https://hackage.haskell.org/package/katip-0.8.3.0/docs/Katip-Scribes-Handle.html#v:mkHandleScribe) and the [Elasticsearch scribe](https://hackage.haskell.org/package/katip-elasticsearch).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Metrics
---

# Metrics

The SDK has some built in support for metrics via [prometheus](https://prometheus.io/), but ultimately you may choose a different runtime interpretation for the metrics, or even choose to ignore it entirely.
Expand Down
7 changes: 7 additions & 0 deletions hs-abci-docs/doc/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Home
---

The home of Kepler.
Link to [hackage](https://hackage.haskell.org/package/kepler)
Link to [hs-abci-sdk](haddocks/hs-abci-sdk/)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Foundations - Overview
---

# Overview

The SDK relies heavily on two abstractions to facilitate application development, effects systems and Modules.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Foundations - BaseApp
---

# BaseApp

`BaseApp` is the set of effects that the SDK operates with and are freely available
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Foundations - Module
---

# Modules

## Definition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Overview
---

## Introduction

We're going to build an example application that mirrors the `golang` [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) example application called [Nameservice](https://github.com/cosmos/sdk-tutorials/tree/master/nameservice). There is also a tutorial for that application which you can find [here](https://tutorials.cosmos.network/nameservice/tutorial/00-intro.html) for comparison.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Nameservice - Overview
---

# Overview

This section is where we sketch the definition of the Nameservice module and application. It's to everyones benefit if module structures follow a similar file heirachy as the Nameservice module, or any module found in the SDK. In the case of Nameservice this roughly translates to
Expand All @@ -22,4 +26,4 @@ The contents of these modules are roughly as follows:
- `Nameservice.Router` - Defines the transaction router for the module.
- `Namervice` Defines the module itself and re-exports any types or utils necessary for using this module as a dependency.

The reason why we suggest this is that each of these haskell modules is buiding up one of the core components of our defition of a module, and it provides a nice logical split between these pieces.
The reason why we suggest this is that each of these haskell modules is buiding up one of the core components of our defition of a module, and it provides a nice logical split between these pieces.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Nameservice - Types
---

# Types

The `Types` module is used to define the basic types that the module will make use of. This includes things like custom error types, event types, database types, etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Nameservice - Message
---

# Message

## Message Types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Nameservice - Keeper
---

# Keeper

## Definition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Nameservice - Query
---

# Query

## Tutorial.Nameservice.Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Nameservice - Module
---

# Module

## Tutorial.Nameservice.Module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Nameservice - Application
---

# Application

## From Modules to App
Expand Down
9 changes: 9 additions & 0 deletions hs-abci-docs/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: kepler
version: 1.0.0.0
github: "f-o-a-m/kepler"
license: BSD3
author: "f-o-a-m"
maintainer: "[email protected]"
copyright: "2020 FOAM"
synopsis: "Haskell cosmos sdk"
description: Please see the README on GitHub at <https://github.com/f-o-a-m/kepler>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion hs-abci-sdk/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ library:
- validation
ghc-options:
- -fplugin=Polysemy.Plugin
- -Werror
- -Wall
- -Werror
- -Wcompat
- -Widentities
- -Wincomplete-uni-patterns
Expand Down
10 changes: 5 additions & 5 deletions hs-abci-sdk/src/Tendermint/SDK/BaseApp/Metrics/Prometheus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ evalNothing = do
raise $ evalNothing a
)

-- | Increments existing count, if it doesn't exist, creates a new
-- | counter and increments it.
evalMetrics
:: Member (Embed IO) r
=> MetricsState
-> Sem (Metrics ': r) a
-> Sem r a
evalMetrics state@MetricsState{..} = do
interpretH (\case
-- | Increments existing count; if it doesn't exist, creates a new
-- | counter and increments it.
interpretH (\case
IncCount ctrName -> do
let c@MetricIdentifier{..} = countToIdentifier ctrName
cid = metricIdStorable c
Expand All @@ -199,8 +199,8 @@ evalMetrics state@MetricsState{..} = do
pure counterMap
pureT ()

-- | Updates a histogram with the time it takes to do an action
-- | If histogram doesn't exist, creates a new one and observes it.
-- Updates a histogram with the time it takes to do an action
-- If histogram doesn't exist, creates a new one and observes it.
WithTimer histName action -> do
start <- liftIO $ getCurrentTime
a <- runT action
Expand Down
4 changes: 2 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ packages:
- ./hs-abci-extra
- ./hs-abci-sdk
- ./hs-abci-test-utils
- ./hs-abci-examples/simple-storage
- ./hs-abci-examples/nameservice
- ./hs-abci-docs/simple-storage
- ./hs-abci-docs/nameservice
- ./hs-iavl-client

extra-deps:
Expand Down

0 comments on commit ab6477b

Please sign in to comment.