From 5ac47fd6ffd8d6cfe0fc9910c0d4ac417708ddf4 Mon Sep 17 00:00:00 2001 From: Brian Grinstead Date: Fri, 16 Dec 2016 14:26:10 -0800 Subject: [PATCH] Add a stub CLI tool and run tests on it. Fixes #136. r=rnewman --- .gitignore | 2 +- .travis.yml | 5 +++++ Cargo.toml | 8 ++++++++ README.md | 6 ++++++ cli/Cargo.toml | 7 +++++++ cli/README.md | 3 +++ cli/src/main.rs | 20 ++++++++++++++++++++ src/lib.rs | 5 +++++ 8 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 cli/Cargo.toml create mode 100644 cli/README.md create mode 100644 cli/src/main.rs diff --git a/.gitignore b/.gitignore index aee1f22c..5ac77889 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ Cargo.lock /classes/ /node_modules/ /out/ -/target/ +target/ pom.xml pom.xml.asc /.cljs_node_repl/ diff --git a/.travis.yml b/.travis.yml index 22761ba7..9ed6b679 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1 +1,6 @@ language: rust +script: + - cargo build --verbose + - cargo test --verbose + - cargo build --verbose -p datomish-cli + - cargo test --verbose -p datomish-cli \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 80fab194..ef843bb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,11 @@ version = "0.4.0" authors = ["Richard Newman ", "Nicholas Alexander "] [dependencies] + +[dev-dependencies] +[dev-dependencies.datomish-cli] + path = "cli" + +[[bin]] +name = "datomish-cli" +path = "cli/src/main.rs" \ No newline at end of file diff --git a/README.md b/README.md index cb43cae2..b04920ab 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,12 @@ To run tests use: cargo test ```` +To run the cli use: + +```` +cargo run +```` + ## License Datomish is currently licensed under the Apache License v2.0. See the `LICENSE` file for details. diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100644 index 00000000..83950fb8 --- /dev/null +++ b/cli/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "datomish-cli" +version = "0.0.1" + +[dependencies] +[dependencies.datomish] + path = "../" \ No newline at end of file diff --git a/cli/README.md b/cli/README.md new file mode 100644 index 00000000..b067eb15 --- /dev/null +++ b/cli/README.md @@ -0,0 +1,3 @@ +# datomish-cli + +Note: this isn't actually doing anything and is just a placeholder to get the project structure in place. diff --git a/cli/src/main.rs b/cli/src/main.rs new file mode 100644 index 00000000..861e8670 --- /dev/null +++ b/cli/src/main.rs @@ -0,0 +1,20 @@ +// Copyright 2016 Mozilla +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use +// this file except in compliance with the License. You may obtain a copy of the +// License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +use std::env; +extern crate datomish; + +// This is just a placeholder to get the project structure in place. +fn main() { + println!("Loaded {}", datomish::get_name()); + + let args: Vec = env::args().collect(); + println!("I got {:?} arguments: {:?}.", args.len() - 1, &args[1..]); +} diff --git a/src/lib.rs b/src/lib.rs index cd781274..6f682720 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,11 @@ // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. + +pub fn get_name() -> String { + return String::from("datomish"); +} + pub fn add_two(a: i32) -> i32 { a + 2 }