├── .gitignore ├── .travis.yml ├── Cargo.toml ├── LICENSE ├── README.md ├── public ├── css │ └── main.css └── img │ ├── back.png │ ├── background.png │ ├── beakers.png │ ├── cnt_blue.png │ ├── cnt_blue_bottom.png │ ├── cnt_blue_top.png │ ├── cnt_green.png │ ├── cnt_green_bottom.png │ ├── cnt_green_top.png │ ├── cnt_orange.png │ ├── cnt_orange_bottom.png │ ├── cnt_orange_top.png │ ├── favicon.png │ ├── foot.png │ ├── logo.png │ └── sub.png ├── src └── main.rs └── templates ├── games.hbs ├── index.hbs ├── rules.hbs └── test.hbs /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *~ 3 | *# 4 | *.o 5 | *.so 6 | *.swp 7 | *.dylib 8 | *.dSYM 9 | *.dll 10 | *.rlib 11 | *.dummy 12 | *.exe 13 | /target/ 14 | Cargo.lock 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | 3 | name = "pluto" 4 | version = "0.0.2" 5 | authors = [ 6 | "bvssvni ", 7 | "Haggus " 8 | ] 9 | keywords = ["gamedev", "competition", "piston"] 10 | description = "Server software for Pluto, the Rust gamedev competition" 11 | license = "MIT OR Apache-2.0" 12 | repository = "https://github.com/PistonDevelopers/redox.git" 13 | homepage = "https://github.com/PistonDevelopers/redox" 14 | 15 | [[bin]] 16 | 17 | name = "redox" 18 | path = "src/main.rs" 19 | 20 | [dependencies] 21 | iron = "0.3.0" 22 | postgres = "0.11.0" 23 | staticfile = "0.2.0" 24 | mount = "0.1.0" 25 | router = "0.1.0" 26 | logger = "0.0.3" 27 | handlebars-iron = "0.15.1" 28 | rustc-serialize = "0.3.16" 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 PistonDevelopers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | pluto 2 | ===== 3 | 4 | Game competition server software for Rust gamedev community 5 | 6 | [How to contribute](https://github.com/PistonDevelopers/piston/blob/master/CONTRIBUTING.md) 7 | 8 | ## License 9 | 10 | Licensed under either of 11 | 12 | * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) 13 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 14 | 15 | at your option. 16 | 17 | ### Contribution 18 | 19 | Unless you explicitly state otherwise, any contribution intentionally submitted 20 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any 21 | additional terms or conditions. 22 | -------------------------------------------------------------------------------- /public/css/main.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, applet, object, iframe, 2 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 3 | a, abbr, acronym, address, big, cite, code, 4 | del, dfn, em, font, img, ins, kbd, q, s, samp, 5 | small, strike, strong, sub, sup, tt, var, 6 | dl, dt, dd, ol, ul, li, 7 | fieldset, form, label, legend, 8 | table, caption, tbody, tfoot, thead, tr, th, td { 9 | margin: 0; 10 | padding: 0; 11 | border: 0; 12 | outline: 0; 13 | font-weight: inherit; 14 | font-style: inherit; 15 | font-size: 100%; 16 | font-family: inherit; 17 | vertical-align: baseline; 18 | } 19 | 20 | p { margin: 16px 0; } 21 | 22 | ul { 23 | margin: 5px 0; 24 | list-style-type: square; 25 | } 26 | 27 | html { 28 | height: 100%; 29 | } 30 | 31 | body { 32 | display: block; 33 | margin: 0; 34 | padding: 0; 35 | height: 100%; 36 | line-height: 1; 37 | color: black; 38 | background: url("/img/background.png"); 39 | } 40 | 41 | #container { 42 | min-height: 100%; 43 | position: relative; 44 | min-width: 1024px; 45 | background: url("/img/back.png") repeat-y 74px; 46 | } 47 | 48 | header { 49 | background-color: #0e232e; 50 | height: 96px; 51 | } 52 | 53 | header > .logo { 54 | display: inline-block; 55 | padding: 0px 50px; 56 | } 57 | 58 | nav { 59 | vertical-align: top; 60 | float: right; 61 | padding-right: 50px; 62 | display: inline-block 63 | } 64 | 65 | nav > ul { 66 | list-style-type: none; 67 | display: inline-block; 68 | } 69 | 70 | nav > ul > li { 71 | display: inline; 72 | line-height: 96px; 73 | padding: 35px 50px; 74 | } 75 | 76 | nav > ul > li > a { 77 | color: white; 78 | text-decoration: none; 79 | font-size: 22px; 80 | font-family: 'Roboto', Verdana, serif; 81 | } 82 | 83 | .subheader { 84 | display: block; 85 | background: url("/img/sub.png") repeat-y 74px; 86 | background-color: #2b3f48; 87 | height: 16px; 88 | } 89 | 90 | .content { 91 | padding: 20px 20px 60px 20px; 92 | color: white; 93 | font-size: 16px; 94 | font-family: 'Roboto', Verdana, serif; 95 | } 96 | 97 | .frame { 98 | padding: 0 0 16px 16px; 99 | margin: 0 0 16px 0; 100 | } 101 | 102 | .frame ul { 103 | padding-left: 25px; 104 | } 105 | 106 | .frame-blue { 107 | background: url("/img/cnt_blue_top.png") no-repeat top left, url("/img/cnt_blue_bottom.png") no-repeat bottom right; 108 | } 109 | 110 | .frame-blue-content { 111 | min-height: 16px; 112 | background: url("/img/cnt_blue.png") repeat-y top right; 113 | background-color: #19aeff; 114 | box-shadow: -16px 16px 0 0 #005c94; 115 | padding: 10px; 116 | } 117 | 118 | .frame-green { 119 | background: url("/img/cnt_green_top.png") no-repeat top left, url("/img/cnt_green_bottom.png") no-repeat bottom right; 120 | } 121 | 122 | .frame-green-content { 123 | min-height: 16px; 124 | background: url("/img/cnt_green.png") repeat-y top right; 125 | background-color: #ccff42; 126 | box-shadow: -16px 16px 0 0 #009023; 127 | padding: 10px; 128 | color: black; 129 | } 130 | 131 | .frame-orange { 132 | background: url("/img/cnt_orange_top.png") no-repeat top left, url("/img/cnt_orange_bottom.png") no-repeat bottom right; 133 | } 134 | 135 | .frame-orange-content { 136 | min-height: 16px; 137 | background: url("/img/cnt_orange.png") repeat-y top right; 138 | background-color: #ff9900; 139 | box-shadow: -16px 16px 0 0 #804d00; 140 | padding: 10px; 141 | color: black; 142 | } 143 | 144 | footer { 145 | position: absolute; 146 | width: 100%; 147 | bottom: 0; 148 | left: 0; 149 | height: 50px; 150 | line-height: 50px; 151 | color: white; 152 | background: url("/img/foot.png") repeat-y 50px; 153 | background-color: #0e232e; 154 | text-align: center; 155 | font-size: 14; 156 | font-family: 'Roboto', Verdana, serif; 157 | } 158 | -------------------------------------------------------------------------------- /public/img/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/back.png -------------------------------------------------------------------------------- /public/img/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/background.png -------------------------------------------------------------------------------- /public/img/beakers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/beakers.png -------------------------------------------------------------------------------- /public/img/cnt_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_blue.png -------------------------------------------------------------------------------- /public/img/cnt_blue_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_blue_bottom.png -------------------------------------------------------------------------------- /public/img/cnt_blue_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_blue_top.png -------------------------------------------------------------------------------- /public/img/cnt_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_green.png -------------------------------------------------------------------------------- /public/img/cnt_green_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_green_bottom.png -------------------------------------------------------------------------------- /public/img/cnt_green_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_green_top.png -------------------------------------------------------------------------------- /public/img/cnt_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_orange.png -------------------------------------------------------------------------------- /public/img/cnt_orange_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_orange_bottom.png -------------------------------------------------------------------------------- /public/img/cnt_orange_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/cnt_orange_top.png -------------------------------------------------------------------------------- /public/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/favicon.png -------------------------------------------------------------------------------- /public/img/foot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/foot.png -------------------------------------------------------------------------------- /public/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/logo.png -------------------------------------------------------------------------------- /public/img/sub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PistonDevelopers/pluto/cee1f545d7d4462f6a9479eacb758fe6cc18983f/public/img/sub.png -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | extern crate iron; 2 | extern crate staticfile; 3 | extern crate mount; 4 | extern crate router; 5 | extern crate logger; 6 | extern crate handlebars_iron as hbs; 7 | extern crate rustc_serialize; 8 | 9 | use std::collections::BTreeMap; 10 | use iron::prelude::*; 11 | use iron::status; 12 | use staticfile::Static; 13 | use mount::Mount; 14 | use router::Router; 15 | use logger::Logger; 16 | use hbs::{Template, HandlebarsEngine, DirectorySource}; 17 | use rustc_serialize::json::{ToJson, Json}; 18 | 19 | fn index(_: &mut Request) -> IronResult { 20 | let mut resp = Response::new(); 21 | resp.set_mut(Template::new("index", String::new())).set_mut(status::Ok); 22 | Ok(resp) 23 | } 24 | 25 | fn rules(_: &mut Request) -> IronResult { 26 | let mut resp = Response::new(); 27 | resp.set_mut(Template::new("rules", String::new())).set_mut(status::Ok); 28 | Ok(resp) 29 | } 30 | 31 | fn games(_: &mut Request) -> IronResult { 32 | let mut resp = Response::new(); 33 | resp.set_mut(Template::new("games", String::new())).set_mut(status::Ok); 34 | Ok(resp) 35 | } 36 | 37 | struct User { 38 | name: String, 39 | age: u16, 40 | } 41 | 42 | impl ToJson for User { 43 | fn to_json(&self) -> Json { 44 | let mut map: BTreeMap = BTreeMap::new(); 45 | 46 | map.insert("name".to_string(), self.name.to_json()); 47 | map.insert("age".to_string(), self.age.to_json()); 48 | map.to_json() 49 | } 50 | } 51 | 52 | fn test(_: &mut Request) -> IronResult { 53 | let data = User { 54 | name: "Adam".to_string(), 55 | age: 32u16, 56 | }; 57 | 58 | let mut resp = Response::new(); 59 | resp.set_mut(Template::new("test", data)).set_mut(status::Ok); 60 | Ok(resp) 61 | } 62 | 63 | fn main() { 64 | let mut bars = HandlebarsEngine::new(); 65 | bars.add(Box::new(DirectorySource::new("./templates/", ".hbs"))); 66 | 67 | if let Err(r) = bars.reload() { 68 | panic!("{:?}", r); 69 | } 70 | 71 | let mut router = Router::new(); 72 | router. 73 | get("/", index). 74 | get("/rules", rules). 75 | get("/games", games). 76 | get("/test", test); 77 | 78 | let mut mount = Mount::new(); 79 | mount. 80 | mount("/", router). 81 | mount("/css", Static::new("public/css")). 82 | mount("/img", Static::new("public/img")); 83 | 84 | let (logger_before, logger_after) = Logger::new(None); 85 | let mut chain = Chain::new(mount); 86 | chain.link_before(logger_before); 87 | chain.link_after(logger_after); 88 | chain.link_after(bars); 89 | 90 | let url = "localhost:3000"; 91 | match Iron::new(chain).http(url) { 92 | Ok(_) => println!("Pluto running on http://{}", url), 93 | Err(e) => println!("Pluto failed to run. Error: {}", e) 94 | }; 95 | } 96 | -------------------------------------------------------------------------------- /templates/games.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Pluto - Games 8 | 9 | 10 |
11 |
12 | 15 | 22 |
23 |
24 |
25 |
26 |
27 |

Pluto is a gamedev competition website for the Rust programming language. It is currently maintained and developed as part of the Piston project.

28 |

GAMES

29 |

30 | Our goals are: 31 |

    32 |
  • To have fun!
  • 33 |
  • To spread awareness about Rust
  • 34 |
  • Test and develop new libraries for Rust server software
  • 35 |
36 |

37 |
38 |
39 |
40 |
Pluto © 2015
41 |
42 | 43 | 44 | -------------------------------------------------------------------------------- /templates/index.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Pluto - Home 8 | 9 | 10 |
11 |
12 | 15 | 22 |
23 |
24 |
25 |
26 |
27 |

Pluto is a gamedev competition website for the Rust programming language. It is currently maintained and developed as part of the Piston project.

28 |

29 | Our goals are: 30 |

    31 |
  • To have fun!
  • 32 |
  • To spread awareness about Rust
  • 33 |
  • Test and develop new libraries for Rust server software
  • 34 |
35 |

36 |
37 |
38 |
39 |
40 |

41 | Todo: 42 |

    43 |
  • Set up public server
  • 44 |
  • Github login
  • 45 |
  • Build voting system
  • 46 |
  • Web design
  • 47 |
48 |

49 |
50 |
51 |
52 |
53 |

54 | News: 55 |

    56 |
  • Set up public server
  • 57 |
  • Github login
  • 58 |
  • Build voting system
  • 59 |
  • Web design
  • 60 |
61 |

62 |
63 |
64 |
65 |
Pluto © 2015
66 |
67 | 68 | 69 | -------------------------------------------------------------------------------- /templates/rules.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Pluto - Rules 8 | 9 | 10 |
11 |
12 | 15 | 22 |
23 |
24 |
25 |
26 |
27 |

Pluto is a gamedev competition website for the Rust programming language. It is currently maintained and developed as part of the Piston project.

28 |

RULES

29 |

30 | Our goals are: 31 |

    32 |
  • To have fun!
  • 33 |
  • To spread awareness about Rust
  • 34 |
  • Test and develop new libraries for Rust server software
  • 35 |
36 |

37 |
38 |
39 |
40 |
Pluto © 2015
41 |
42 | 43 | 44 | -------------------------------------------------------------------------------- /templates/test.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Pluto - Test 8 | 9 | 10 |
11 |
12 | 15 | 22 |
23 |
24 |
25 |
26 |
27 | User: {{name}}
28 | Age: {{age}} 29 |
30 |
31 |
32 | 33 |
34 | 35 | 36 | --------------------------------------------------------------------------------