Merge pull request #12 from brson/contributing

Add automatic build and publish script
This commit is contained in:
Bradley Anderson 2017-02-25 16:50:16 -06:00 committed by GitHub
commit f15e9a8158
18 changed files with 70 additions and 454 deletions

View file

@ -1,123 +0,0 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contributing - </title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="">
<link rel="stylesheet" href="book.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" href="favicon.png">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<!-- MathJax -->
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- Fetch JQuery from CDN but have a local fallback -->
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='jquery.js'%3E%3C/script%3E"));
}
</script>
</head>
<body class="light">
<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme = localStorage.getItem('theme');
if (theme == null) { theme = 'light'; }
$('body').removeClass().addClass(theme);
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript">
var sidebar = localStorage.getItem('sidebar');
if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") }
else if (sidebar === "visible") { $("html").addClass("sidebar-visible") }
</script>
<div id="sidebar" class="sidebar">
<ul class="chapter"><li class="affix"><a href="../README.html">Table of Contents</a></li><li class="affix"><a href="pages/error_handling_note.html">A Note About Error Handling</a></li><li><a href="pages/IO.html"><strong>1.</strong> IO</a></li><li><ul class="section"><li><a href="pages/byteorder.html"><strong>1.1.</strong> Byteorder</a></li><li><a href="pages/file_io.html"><strong>1.2.</strong> File IO</a></li><li><a href="pages/cli_parsing.html"><strong>1.3.</strong> Command Line Parsing</a></li></ul></li><li><a href="pages/serialization.html"><strong>2.</strong> Serialization</a></li><li><ul class="section"><li><a href="pages/json.html"><strong>2.1.</strong> JSON</a></li><li><a href="pages/toml.html"><strong>2.2.</strong> TOML</a></li></ul></li><li><a href="../CONTRIBUTING.html" class="active">Contributing</a></li></ul>
</div>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar" class="menu-bar">
<div class="left-buttons">
<i id="sidebar-toggle" class="fa fa-bars"></i>
<i id="theme-toggle" class="fa fa-paint-brush"></i>
</div>
<h1 class="menu-title"></h1>
<div class="right-buttons">
<i id="print-button" class="fa fa-print" title="Print this book"></i>
</div>
</div>
<div id="content" class="content">
<a class="header" href="#contributing" name="contributing"><h1>Contributing</h1></a>
</div>
<!-- Mobile navigation buttons -->
<a href="pages/toml.html" class="mobile-nav-chapters previous">
<i class="fa fa-angle-left"></i>
</a>
</div>
<a href="pages/toml.html" class="nav-chapters previous" title="You can navigate through the chapters using the arrow keys">
<i class="fa fa-angle-left"></i>
</a>
</div>
<!-- Local fallback for Font Awesome -->
<script>
if ($(".fa").css("font-family") !== "FontAwesome") {
$('<link rel="stylesheet" type="text/css" href="_FontAwesome/css/font-awesome.css">').prependTo('head');
}
</script>
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>
</body>
</html>

View file

@ -1 +1,40 @@
# Contributing
# Contributing to the Rust Cookbook
Have something useful to add to the Rust Cookbook? We'd love to have it!
This document contains information and guidelines that you should read before
contributing to the project. If you think something in this document should change,
feel free propose a change in a pull request.
## Table of Contents
* [Getting Started](#getting-started)
* [How to Contribute](#how-to-contribute)
* [Crates](#crates)
* [Tests](#tests)
* [Style](#style)
* [Git Commit Messages](#git-commit-messages)
* [Snippet Style](#snippet-style)
## Getting Started
TODO: Mention Trello and how to join (if we keep using it)
## How to Contribute
TODO: Reporting bugs
TODO: Project page suggestions
TODO: Fixing bugs
TODO: Pull requests
## Crates
TODO: How to add new crates to project
## Tests
TODO: Write about writing tests
## Style
### Git Commit Messages
https://chris.beams.io/posts/git-commit/
TODO: Possibly take relevant parts from this post or write our own
### Snippet Style
TODO: Talk about writing good idiomatic code
TODO: Maybe provide a template?

View file

@ -1,134 +0,0 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Table of Contents - </title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="">
<link rel="stylesheet" href="book.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" href="favicon.png">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<!-- MathJax -->
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- Fetch JQuery from CDN but have a local fallback -->
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='jquery.js'%3E%3C/script%3E"));
}
</script>
</head>
<body class="light">
<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme = localStorage.getItem('theme');
if (theme == null) { theme = 'light'; }
$('body').removeClass().addClass(theme);
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript">
var sidebar = localStorage.getItem('sidebar');
if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") }
else if (sidebar === "visible") { $("html").addClass("sidebar-visible") }
</script>
<div id="sidebar" class="sidebar">
<ul class="chapter"><li class="affix"><a href="../README.html" class="active">Table of Contents</a></li><li class="affix"><a href="pages/error_handling_note.html">A Note About Error Handling</a></li><li><a href="pages/IO.html"><strong>1.</strong> IO</a></li><li><ul class="section"><li><a href="pages/byteorder.html"><strong>1.1.</strong> Byteorder</a></li><li><a href="pages/file_io.html"><strong>1.2.</strong> File IO</a></li><li><a href="pages/cli_parsing.html"><strong>1.3.</strong> Command Line Parsing</a></li></ul></li><li><a href="pages/serialization.html"><strong>2.</strong> Serialization</a></li><li><ul class="section"><li><a href="pages/json.html"><strong>2.1.</strong> JSON</a></li><li><a href="pages/toml.html"><strong>2.2.</strong> TOML</a></li></ul></li><li><a href="../CONTRIBUTING.html">Contributing</a></li></ul>
</div>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar" class="menu-bar">
<div class="left-buttons">
<i id="sidebar-toggle" class="fa fa-bars"></i>
<i id="theme-toggle" class="fa fa-paint-brush"></i>
</div>
<h1 class="menu-title"></h1>
<div class="right-buttons">
<i id="print-button" class="fa fa-print" title="Print this book"></i>
</div>
</div>
<div id="content" class="content">
<a class="header" href="#cookin-with-rust" name="cookin-with-rust"><h1>Cookin' with Rust</h1></a>
<p>A practical guide to the Rust crate ecosystem.</p>
<a class="header" href="#recipes" name="recipes"><h2>Recipes</h2></a>
<a class="header" href="#a-hrefsrcpagesbyteordermdbyteordera-img-srchttpsimgshieldsiocratesvrustc-serializesvglabelbyteorder-altbyteorder-a-hrefhttpsdocsrsbyteorderbyteordera" name="a-hrefsrcpagesbyteordermdbyteordera-img-srchttpsimgshieldsiocratesvrustc-serializesvglabelbyteorder-altbyteorder-a-hrefhttpsdocsrsbyteorderbyteordera"><h3><a href="src/pages/byteorder.md">Byteorder</a> [<img src="https://img.shields.io/crates/v/rustc-serialize.svg?label=byteorder" alt="byteorder" />]<a href="https://docs.rs/byteorder">byteorder</a></h3></a>
<a class="header" href="#a-hrefsrcpagesfileiomdfile-ioa-img-srchttpsimgshieldsiocratesvrustc-serializesvglabelfile-altfile-a-hrefhttpsdocrust-langorgstdfsstructfilehtmlfilea" name="a-hrefsrcpagesfileiomdfile-ioa-img-srchttpsimgshieldsiocratesvrustc-serializesvglabelfile-altfile-a-hrefhttpsdocrust-langorgstdfsstructfilehtmlfilea"><h3><a href="src/pages/fileio.md">File IO</a> [<img src="https://img.shields.io/crates/v/rustc-serialize.svg?label=file" alt="file" />]<a href="https://doc.rust-lang.org/std/fs/struct.File.html">file</a></h3></a>
<a class="header" href="#a-hrefsrcpagescliparsingmdcommand-line-parsinga-img-srchttpsimgshieldsiocratesvrustc-serializesvglabelclap-altclap-a-hrefhttpskbknappgithubioclap-rsclapstructarghtmlclapa" name="a-hrefsrcpagescliparsingmdcommand-line-parsinga-img-srchttpsimgshieldsiocratesvrustc-serializesvglabelclap-altclap-a-hrefhttpskbknappgithubioclap-rsclapstructarghtmlclapa"><h3><a href="src/pages/cliparsing.md">Command Line Parsing</a> [<img src="https://img.shields.io/crates/v/rustc-serialize.svg?label=clap" alt="clap" />]<a href="https://kbknapp.github.io/clap-rs/clap/struct.Arg.html">clap</a></h3></a>
<a class="header" href="#a-hrefsrcpagesjsonmdjsona-img-srchttpsimgshieldsiocratesvrustc-serializesvglabeljson-altjson-a-hrefhttpjsonrsdocjsonjsona" name="a-hrefsrcpagesjsonmdjsona-img-srchttpsimgshieldsiocratesvrustc-serializesvglabeljson-altjson-a-hrefhttpjsonrsdocjsonjsona"><h3><a href="src/pages/json.md">JSON</a> [<img src="https://img.shields.io/crates/v/rustc-serialize.svg?label=json" alt="json" />]<a href="http://json.rs/doc/json">json</a></h3></a>
<a class="header" href="#contributing" name="contributing"><h2>Contributing</h2></a>
<p>If you'd like to make changes to the project, please see <a href="CONTRIBUTING.md">this guide</a>.</p>
<a class="header" href="#license" name="license"><h2>License</h2></a>
<p>MIT/Apache-2.0</p>
<!-- Links -->
</div>
<!-- Mobile navigation buttons -->
<a href="pages/error_handling_note.html" class="mobile-nav-chapters next">
<i class="fa fa-angle-right"></i>
</a>
</div>
<a href="pages/error_handling_note.html" class="nav-chapters next" title="You can navigate through the chapters using the arrow keys">
<i class="fa fa-angle-right"></i>
</a>
</div>
<!-- Local fallback for Font Awesome -->
<script>
if ($(".fa").css("font-family") !== "FontAwesome") {
$('<link rel="stylesheet" type="text/css" href="_FontAwesome/css/font-awesome.css">').prependTo('head');
}
</script>
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>
</body>
</html>

View file

@ -116,20 +116,6 @@
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -109,20 +109,6 @@
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -159,20 +159,6 @@ fn main() { run().unwrap() }
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -109,20 +109,6 @@
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -137,20 +137,6 @@ TODO: Maybe provide a template?</p>
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -146,20 +146,6 @@ makes the <code>?</code> operator work</p>
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -109,20 +109,6 @@
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -148,20 +148,6 @@ fn main(){
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -110,20 +110,6 @@
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -210,20 +210,6 @@ fn main() {
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -109,20 +109,6 @@
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -117,20 +117,6 @@
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -176,20 +176,6 @@ fn main() {
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

View file

@ -440,20 +440,6 @@ TODO: Maybe provide a template?</p>
<!-- Livereload script (if served using the cli tool) -->
<script type="text/javascript">
var socket = new WebSocket("ws://localhost:3001");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload(true); // force reload from server (not from cache)
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script src="highlight.js"></script>
<script src="book.js"></script>

30
build-site.sh Executable file
View file

@ -0,0 +1,30 @@
# Returns 1 if program is installed and 0 otherwise
function program_installed {
local return_=1
type $1 >/dev/null 2>&1 || { local return_=0; }
echo "$return_"
}
function main() {
# Ensure required programs are installed
if [ $(program_installed git) == 0 ]; then
echo "Please install Git."
elif [ $(program_installed ghp-import) == 0 ]; then
echo "Please install ghp-import: pip install ghp-import."
elif [ $(program_installed mdbook) == 0 ]; then
echo "Please install mdbook: cargo install mdbook."
else
echo "Copying CONTRIBUTING.md to src/pages/contributing.md"
cp CONTRIBUTING.md src/pages/contributing.md
echo "Building site to book/"
mdbook build
echo "Committing book directory to gh-pages branch"
ghp-import -p book
# echo ""
# echo "To push changes to site, run ghp-import -p book"
fi
}
main