Skip to content

Commit

Permalink
refacto(setup): the process for the contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
bwnyasse committed Feb 6, 2021
1 parent 69dc5f2 commit 3d7e729
Show file tree
Hide file tree
Showing 11 changed files with 361 additions and 36 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ build/
.fvm

# coverage
coverage_badge.svg
coverage/
test/.test_coverage.dart

# .env
.env
.env.tests
lib/env/env.g.dart
68 changes: 51 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,78 @@
# tezart

A dart library that connects to interact with the tezos blockchain. It connects to a tezos node to send transactions, interact with smart contracts.
A dart library that connects to interact with the tezos blockchain.
It connects to a tezos node to send transactions, interact with smart contracts.

## Features

wip
[wip - Classes à exporter](https://www.notion.so/Classes-exposer-fca03549f8ec4800a3ddf734ac0973d9)

## TODO

wip
[wip - Classes à exporter](https://www.notion.so/Classes-exposer-fca03549f8ec4800a3ddf734ac0973d9)

## Usage

wip

## Contribution

### Run a tezos sandbox locally.
You can use: [tqtezos's sandbox](https://assets.tqtezos.com/docs/setup/2-sandbox/)
### Setup your development environment [ for Mac and Linux ]

**Tezart** is a [dart](https://dart.dev/) package that will help your applications to interact with the tezos blockchain.

To ensure that you can contribute to this project, you will need to setup your environment with the installation of the following tools :

- [dart sdk for package development](https://dart.dev/get-dart)
- [docker for local testing](https://docs.docker.com/get-docker/)
- [lefthook to our git hooks](https://github.com/Arkweid/lefthook)
- [test_coverage for our code coverage](https://pub.dev/packages/test_coverage)

#### A. Dart SDK for Package development

You can install **Dart SDK**, by following the [official dart documentation](https://dart.dev/get-dart)
#### B. Docker to run a tezos sandbox locally

1- If you don't have **Docker**, please install it by following the [official docker documentation](https://docs.docker.com/get-docker/)

2- If you have **Docker**, You will need a running blockchain on your local environment to launch the tests. You can use [tqtezos's sandbox](https://assets.tqtezos.com/docs/setup/2-sandbox/) by running the following command :

```
docker run --rm --name my-sandbox --detach -p 20000:20000 tqtezos/flextesa:20201214 delphibox start
docker run --rm \
--name my-sandbox \
--detach -p 20000:20000 \
tqtezos/flextesa:20201214 delphibox start
```

### Setup Lefthook
Install lefthook following [this](https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md#installation) guide, then run :
```
#### C. Setup Lefthook

To install lefthook, just follow [this](https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md#installation) guide, then run :

```sh
lefthook install
```

### Setup env variables
```
cp .env.dist .env
```
#### Verify your setup

### Run tests
```
./tool/run_tests.sh
To ensure that your environment is ready for contribution, please run the following command at the root of the project:

```sh
./tezart.sh --run-setup
```

Following is a sample of a correct setup :

![a-sample-setup](./doc/setup/a-sample-correct-setup.png)

### Utility functions

We provide some utility functions through `tezart.sh` to help you in your development process.

Following is the output usage :

![a-current-usage](./doc/setup/a-current-usage.png)

## Feature requests and bugs

If you want to contribute to this project, please fork the project and submit your pull request. Feature requests and bugs at the [issue tracker](https://github.com/moneytrackio/tezart/issues/new)
If you want to contribute to this project, please fork the project and submit your pull request.
Feature requests and bugs at the [issue tracker](https://github.com/moneytrackio/tezart/issues/new)
Binary file added doc/setup/a-current-usage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/setup/a-sample-correct-setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/env/env.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:envify/envify.dart';
part 'env.g.dart';

@Envify()
@Envify(path: '.env.tests')
abstract class Env {
static const tezosNodeHost = _Env.tezosNodeHost;
static const tezosNodePort = _Env.tezosNodePort;
Expand Down
4 changes: 4 additions & 0 deletions tezart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# utility functions
/bin/bash ./tool/tezart.sh $@
14 changes: 0 additions & 14 deletions tool/coverage-dev.sh

This file was deleted.

7 changes: 7 additions & 0 deletions tool/info-tezart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.___________. _______ ________ ___ .______ .___________.
| || ____|| / / \ | _ \ | |
`---| |----`| |__ `---/ / / ^ \ | |_) | `---| |----`
| | | __| / / / /_\ \ | / | |
| | | |____ / /----./ _____ \ | |\ \----. | |
|__| |_______| /________/__/ \__\ | _| `._____| |__|

84 changes: 84 additions & 0 deletions tool/logger.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash

###################################################################
# Description :
# Utility functions to perform logging.
#
###################################################################

readonly BLUE="\\033[1;34m"
readonly RED="\\033[1;31m"
readonly GREEN="\\033[1;32m"
readonly YELLOW="\\033[1;33m"
readonly MAGENTA="\\033[1;35m"
readonly GRAS="\033[1m"
readonly END="\\033[1;00m"
readonly CHECK_MARK="\xE2\x9C\x94"
readonly SUFFIX="TEZART"

####
## Display url link in output
## $1 message
## $2 url
log::url() {
echo -e "\\e]8;;http://example.com\\aThis is a hyperlink\e]8;;\\a"
}

log::error() {
echo -e "\n$RED [ERROR:$SUFFIX] $* $END" >&2
}

log::error_and_exit() {
echo -e "\n$RED [ERROR:$SUFFIX] $*\n $END" >&2 && exit 1
}

log::info() {
echo -e "\n$GREEN [INFO:$SUFFIX]$END $* $END"
}

log::info_success() {
echo -e "\n$GREEN [INFO:$SUFFIX]$END $* $GREEN $CHECK_MARK $END"
}

log::info_and_exit() {
echo -e "\n$GREEN [INFO:$SUFFIX] $* $END" && exit 0
}

log::debug() {
[[ -n $DEBUG ]] && echo -e "\n$BLUE [DEBUG:$SUFFIX---] $* $END"
}

log::warn() {
echo -e "\n$YELLOW [WARN:$SUFFIX] $* $END"
}

log::warn_and_exit() {
echo -e "\n$YELLOW [WARN:$SUFFIX] $* $END" && exit 0
}

log::message_success() {
echo -e " $* $GREEN $CHECK_MARK $END"
}

log::message_error() {
echo -e " $* $RED x $END"
}

log::title() {
echo -e "\n $* "
}

log::title_success() {
echo -e "\n $* $GREEN $CHECK_MARK $END"
}



log::message() {
echo -e " $* "
}


log::application(){
echo -e "\n\n$GREEN$(cat $BASEDIR/../tool/info-tezart)$END"
}
3 changes: 0 additions & 3 deletions tool/run_tests.sh

This file was deleted.

Loading

0 comments on commit 3d7e729

Please sign in to comment.