Skip to content

Commit 0f615aa

Browse files
senden9Empty2k12
authored andcommitted
Switch to cargo-readme for README generation (#29)
1 parent 9f29439 commit 0f615aa

8 files changed

+92
-10
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Description
2+
3+
{ describe your changes here }
4+
5+
### Checklist
6+
- [ ] Formatted code using `cargo fmt --all`
7+
- [ ] Linted code using clippy `cargo clippy --all-targets --all-features -- -D warnings`
8+
- [ ] Updated README.md using `cargo readme > README.md`
9+
- [ ] Reviewed the diff. Did you leave any print statements or unnecessary comments?
10+
- [ ] Any unfinished work that warrants a separate issue captured in an issue with a TODO code comment

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ matrix:
6666
- binutils-dev
6767
- cmake
6868

69+
- rust: stable
70+
env: NAME='readme-check'
71+
before_script:
72+
- bash auxiliary/update_cargo-readme.sh
73+
script:
74+
- bash auxiliary/check_readme_consistency.sh
75+
6976
script: |
7077
export RUST_BACKTRACE=1 &&
7178
cargo build &&

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ The process described here has several goals:
9494

9595
Please follow these steps to have your contribution considered by the maintainers:
9696

97-
1. Follow all instructions in [the template](PULL_REQUEST_TEMPLATE.md)
97+
1. Follow all instructions in [the template](./.github/PULL_REQUEST_TEMPLATE.md)
9898
2. Follow the [styleguides](#styleguides)
9999
3. After you submit your pull request, verify that all [status checks](https://help.github.com/articles/about-status-checks/) are passing <details><summary>What if the status checks are failing?</summary>If a status check is failing, and you believe that the failure is unrelated to your change, please leave a comment on the pull request explaining why you believe the failure is unrelated. A maintainer will re-run the status check for you. If we conclude that the failure was a false positive, then we will open an issue to track that problem with our status check suite.</details>
100100

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ This library is a work in progress. Although we've been using it in production a
3131
we've prioritized features that fit our use cases. This means a feature you might need is not implemented
3232
yet or could be handled better.
3333

34-
Pull requests are always welcome. See [Contributing](./CONTRIBUTING.md) and [Code of Conduct](./CODE_OF_CONDUCT.md).
34+
Pull requests are always welcome. See [Contributing](https://github.com/Empty2k12/influxdb-rust/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://github.com/Empty2k12/influxdb-rust/blob/master/CODE_OF_CONDUCT.md).
3535

36-
## Currently Supported Features
36+
### Currently Supported Features
3737

3838
- Reading and Writing to InfluxDB
3939
- Optional Serde Support for Deserialization
4040
- Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`)
4141
- Authenticated and Unauthenticated Connections
4242

43-
## Planned Features
43+
### Planned Features
4444

4545
- Read Query Builder instead of supplying raw queries
4646
- `#[derive(InfluxDbReadable)]` and `#[derive(InfluxDbWriteable)]` proc macros
@@ -57,13 +57,15 @@ For an example with using Serde deserialization, please refer to [serde_integrat
5757

5858
```rust
5959
use influxdb::{Client, Query, Timestamp};
60+
use serde::Deserialize;
6061
use tokio::runtime::current_thread::Runtime;
6162

6263
// Create a Client with URL `http://localhost:8086`
6364
// and database name `test`
6465
let client = Client::new("http://localhost:8086", "test");
6566

66-
// Let's write something to InfluxDB. First we're creating a `WriteQuery` to write some data.
67+
// Let's write something to InfluxDB. First we're creating a
68+
// WriteQuery to write some data.
6769
// This creates a query which writes a new measurement into a series called `weather`
6870
let write_query = Query::write_query(Timestamp::NOW, "weather")
6971
.add_field("temperature", 82);
@@ -79,7 +81,7 @@ let write_result = rt.block_on(client.query(&write_query));
7981
assert!(write_result.is_ok(), "Write result was not okay");
8082

8183
// Reading data is as simple as writing. First we need to create a query
82-
let read_query = Query::raw_read_query("SELECT _ FROM weather");
84+
let read_query = Query::raw_read_query("SELECT * FROM weather");
8385

8486
// Again, we're blocking until the request is done
8587
let read_result = rt.block_on(client.query(&read_query));
@@ -98,4 +100,5 @@ in the repository.
98100

99101
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
100102

103+
101104
@ 2019 Gero Gerke, All rights reserved.

README.tpl

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<div align="center">
2+
<br/>
3+
<img
4+
alt="rust-influxdb"
5+
src="https://i.imgur.com/4k7l8XJ.png"
6+
width=250px />
7+
<br/>
8+
<br/>
9+
<strong>Unofficial InfluxDB Driver for Rust</strong>
10+
</div>
11+
<br/>
12+
<p align="center">
13+
<a href="https://crates.io/crates/influxdb">
14+
<img src="https://img.shields.io/crates/v/influxdb.svg"/>
15+
</a>
16+
<a href="https://travis-ci.org/Empty2k12/influxdb-rust">
17+
<img src="https://travis-ci.org/Empty2k12/influxdb-rust.svg?branch=master" alt='Build Status' />
18+
</a>
19+
<a href="https://coveralls.io/github/Empty2k12/influxdb-rust?branch=master">
20+
<img src="https://coveralls.io/repos/github/Empty2k12/influxdb-rust/badge.svg?branch=master" alt='Coverage Status' />
21+
</a>
22+
<a href="https://docs.rs/crate/influxdb">
23+
<img src="https://docs.rs/influxdb/badge.svg" alt='Documentation Status' />
24+
</a>
25+
<a href="https://www.rust-lang.org/en-US/">
26+
<img src="https://img.shields.io/badge/Made%20with-Rust-orange.svg" alt='Build with Rust' />
27+
</a>
28+
</p>
29+
30+
{{readme}}
31+
32+
@ 2019 Gero Gerke, All rights reserved.

auxiliary/check_readme_consistency.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/bash
2+
3+
cargo readme > README.md.expected
4+
5+
diff README.md README.md.expected
6+
7+
if [ $? -eq 0 ]
8+
then
9+
echo 'README.md is up to date!'
10+
exit 0
11+
else
12+
echo 'README.md out of date. Run "cargo readme > README.md" and commit again.'
13+
exit 1
14+
fi

auxiliary/update_cargo-readme.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/bash
2+
3+
our_version=$(cargo readme -V | perl -ne 'print $1 while /v([\d.]+)/g')
4+
last_version=$(cargo search cargo-readme | perl -ne 'print $1 while /^cargo-readme = "([\d.]+)"/g')
5+
6+
if [ "$our_version" == "$last_version" ]; then
7+
echo Version $our_version is of cargo-readme is installed and up to date.
8+
else
9+
echo "Install cargo-readme"
10+
cargo install cargo-readme
11+
fi

src/lib.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
//! Library for talking to InfluxDB
2-
//!
31
//! This library is a work in progress. Although we've been using it in production at [OpenVelo](https://openvelo.org/),
4-
//! we're prioritized features that fit our use cases. This means a feature you might need is not implemented
2+
//! we've prioritized features that fit our use cases. This means a feature you might need is not implemented
53
//! yet or could be handled better.
64
//!
5+
//! Pull requests are always welcome. See [Contributing](https://github.com/Empty2k12/influxdb-rust/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://github.com/Empty2k12/influxdb-rust/blob/master/CODE_OF_CONDUCT.md).
6+
//!
77
//! ## Currently Supported Features
88
//!
99
//! - Reading and Writing to InfluxDB
@@ -14,7 +14,7 @@
1414
//! ## Planned Features
1515
//!
1616
//! - Read Query Builder instead of supplying raw queries
17-
//! - `#[derive(InfluxDbWritable)]`
17+
//! - `#[derive(InfluxDbReadable)]` and `#[derive(InfluxDbWriteable)]` proc macros
1818
//!
1919
//! # Quickstart
2020
//!
@@ -66,6 +66,11 @@
6666
//!
6767
//! For further examples, check out the Integration Tests in `tests/integration_tests.rs`
6868
//! in the repository.
69+
//!
70+
//! # License
71+
//!
72+
//! [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
73+
//!
6974
7075
#[macro_use]
7176
extern crate failure;

0 commit comments

Comments
 (0)