Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: split bin and lib #45

Merged
merged 10 commits into from
Jul 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
84 changes: 64 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,27 @@ version = "0.7.0"
authors = ["Christoph Burgdorf <christoph.burgdorf@bvsn.org>"]
description = "A conventional changelog for the rest of us"

[[bin]]
doc = false
name = "clog"

[dependencies]
regex = "*"
time = "*"
clap = "*"
semver = "*"
toml = "*"
clap = "*"
time = "*"

[dependencies.regex_macros]
version = "*"
optional = true

[features]
default=[]

# For debugging output
debug=[]

# for building with nightly and unstable features
# until regex_macros compiles with nightly again, this should be commented out
# unstable = ["regex_macros"]
Expand Down
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)

test:
cargo test

build:
cargo build

doc:
cd "$(THIS_DIR)"
cp src/lib.rs code.bak
cat README.md | sed -e 's/^/\/\/! /g' > readme.bak
sed -i '/\/\/ DOCS/r readme.bak' src/lib.rs
sed -e "s/\`rust/\`ignore/g" src/lib.rs
sed -e "s/\`toml/\`ignore/g" src/lib.rs
sed -e "s/\`sh/\`ignore/g" src/lib.rs
rm -rf docs/*
(cargo doc --no-deps && make clean) || (make clean && false)

clean:
cp -r target/doc/* docs/
cd "$(THIS_DIR)"
mv code.bak src/lib.rs || true
rm *.bak || true
91 changes: 78 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,45 @@ The way this works, is every time you make a commit, you ensure your commit subj

### Usage

```
There are two ways to use `clog`, via the command line or a library in your applicaitons.

#### Command Line

```sh
USAGE:
clog [FLAGS] [OPTIONS]
clog [FLAGS] [OPTIONS]

FLAGS:
--from-latest-tag use latest tag as start (instead of --from)
-c, --config The Clog Configuration TOML file to use (Defaults to '.clog.toml')**
-F, --from-latest-tag use latest tag as start (instead of --from)
-h, --help Prints help information
--major Increment major version by one (Sets minor and patch to 0)
--minor Increment minor version by one (Sets patch to 0)
--patch Increment patch version by one
-v, --version Prints version information
-M, --major Increment major version by one (Sets minor and patch to 0)
-m, --minor Increment minor version by one (Sets patch to 0)
-p, --patch Increment patch version by one
-V, --version Prints version information

OPTIONS:
--from <from> e.g. 12a8546
-f, --from <from> e.g. 12a8546
-g, --git-dir <gitdir> Local .git directory (defaults to current dir + '.git')*
-o, --outfile <outfile> Where to write the changelog (Defaults to 'changelog.md')
-r, --repository <repository> e.g. https://github.com/thoughtram/clog
--link-style <style> The commit link style to use, defaults to github [values: Github, Gitlab, Stash]
--subtitle <subtitle> e.g. crazy-release-title
--to <to> e.g. 8057684 (Defaults to HEAD when omitted)
-r, --repository <repo> Repo used for link generation (without the .git, e.g. https://github.com/thoughtram/clog)
-l, --link-style <style> The style of repository link to generate (Defaults to github) [values: Github, Gitlab, Stash]
-s, --subtitle <subtitle> e.g. "Crazy Release Title"
-t, --to <to> e.g. 8057684 (Defaults to HEAD when omitted)
--setversion <ver> e.g. 1.0.1
-w, --work-tree <workdir> Local working tree of the git project (defaults to current dir)*

* If your .git directory is a child of your project directory (most common, such as
/myproject/.git) AND not in the current working directory (i.e you need to use --work-tree or
--git-dir) you only need to specify either the --work-tree (i.e. /myproject) OR --git-dir (i.e.
/myproject/.git), you don't need to use both.

** If using the --config to specify a clog configuration TOML file NOT in the current working
directory (meaning you need to use --work-tree or --git-dir) AND the TOML file is inside your
project directory (i.e. /myproject/.clog.toml) you do not need to use --work-tree or --git-dir.
```

### Try it!
##### Try it!

1. Clone the repo `git clone https://github.com/thoughtram/clog && cd clog`

Expand All @@ -52,6 +68,55 @@ OPTIONS:

3. Run clog `./target/release/clog -r https://github.com/thoughtram/clog --setversion 0.1.0 --subtitle crazy-dog --from 6d8183f`

#### As a Library

See the documentation for information on using `clog` in your applications.

##### Try it!

1. Clone the `clog` repo so that you have something to search through (Because `clog` uses
specially formatted commit messages)
```
$ git clone https://github.com/thoughtram/clog ~/clog
```

2. Add `clog` as a dependency in your `Cargo.toml`

```toml
[dependencies]
clog = "*"
```

3. Use the following in your `src/main.rs`

```rust
extern crate clog;

use clog::Clog;

fn main() {
// Create the struct
let mut clog = Clog::with_dir("~/clog").unwrap_or_else(|e| {
println!("{}",e);
std::process::exit(1);
});

// Set some options
clog.repository("https://github.com/thoughtram/clog")
.subtitle("Crazy Dog")
.from("6d8183f")
.version("0.1.0");

// Write the changelog to the current working directory
//
// Alternatively we could have used .write_changelog_to("/somedir/some_file.md")
clog.write_changelog();
}
```

4. Compile and run `$ cargo build --release && ./target/release/bin_name
5. View the output in your favorite markdown viewer! `$ vim changelog.md`

### Default Options

`clog` can also be configured using a default configuration file so that you don't have to specify all the options each time you want to update your changelog. To do this add a `.clog.toml` file to your repository.
Expand Down
Binary file added docs/FiraSans-Medium.woff
Binary file not shown.
Binary file added docs/FiraSans-Regular.woff
Binary file not shown.
Binary file added docs/Heuristica-Italic.woff
Binary file not shown.
Binary file added docs/SourceCodePro-Regular.woff
Binary file not shown.
Binary file added docs/SourceCodePro-Semibold.woff
Binary file not shown.
Binary file added docs/SourceSerifPro-Bold.woff
Binary file not shown.
Binary file added docs/SourceSerifPro-Regular.woff
Binary file not shown.
Empty file.
1 change: 1 addition & 0 deletions docs/aho_corasick/autiter/sidebar-items.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions docs/aho_corasick/autiter/struct.Match.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../aho_corasick/struct.Match.html">
</head>
<body>
<p>Redirecting to <a href="../../aho_corasick/struct.Match.html">../../aho_corasick/struct.Match.html</a>...</p>
<script>location.replace("../../aho_corasick/struct.Match.html" + location.search + location.hash);</script>
</body>
</html>
10 changes: 10 additions & 0 deletions docs/aho_corasick/autiter/struct.Matches.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../aho_corasick/struct.Matches.html">
</head>
<body>
<p>Redirecting to <a href="../../aho_corasick/struct.Matches.html">../../aho_corasick/struct.Matches.html</a>...</p>
<script>location.replace("../../aho_corasick/struct.Matches.html" + location.search + location.hash);</script>
</body>
</html>
10 changes: 10 additions & 0 deletions docs/aho_corasick/autiter/struct.MatchesOverlapping.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../aho_corasick/struct.MatchesOverlapping.html">
</head>
<body>
<p>Redirecting to <a href="../../aho_corasick/struct.MatchesOverlapping.html">../../aho_corasick/struct.MatchesOverlapping.html</a>...</p>
<script>location.replace("../../aho_corasick/struct.MatchesOverlapping.html" + location.search + location.hash);</script>
</body>
</html>
10 changes: 10 additions & 0 deletions docs/aho_corasick/autiter/struct.StreamMatches.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../aho_corasick/struct.StreamMatches.html">
</head>
<body>
<p>Redirecting to <a href="../../aho_corasick/struct.StreamMatches.html">../../aho_corasick/struct.StreamMatches.html</a>...</p>
<script>location.replace("../../aho_corasick/struct.StreamMatches.html" + location.search + location.hash);</script>
</body>
</html>
10 changes: 10 additions & 0 deletions docs/aho_corasick/autiter/struct.StreamMatchesOverlapping.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../aho_corasick/struct.StreamMatchesOverlapping.html">
</head>
<body>
<p>Redirecting to <a href="../../aho_corasick/struct.StreamMatchesOverlapping.html">../../aho_corasick/struct.StreamMatchesOverlapping.html</a>...</p>
<script>location.replace("../../aho_corasick/struct.StreamMatchesOverlapping.html" + location.search + location.hash);</script>
</body>
</html>
10 changes: 10 additions & 0 deletions docs/aho_corasick/autiter/trait.Automaton.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../aho_corasick/trait.Automaton.html">
</head>
<body>
<p>Redirecting to <a href="../../aho_corasick/trait.Automaton.html">../../aho_corasick/trait.Automaton.html</a>...</p>
<script>location.replace("../../aho_corasick/trait.Automaton.html" + location.search + location.hash);</script>
</body>
</html>
Empty file.
1 change: 1 addition & 0 deletions docs/aho_corasick/full/sidebar-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
initSidebarItems({"struct":[["FullAcAutomaton","A complete Aho-Corasick automaton."]]});
Loading