Add a stub CLI tool and run tests on it. Fixes #136. r=rnewman

This commit is contained in:
Brian Grinstead 2016-12-16 14:26:10 -08:00 committed by GitHub
parent f7c97e776c
commit 5ac47fd6ff
8 changed files with 55 additions and 1 deletions

2
.gitignore vendored
View file

@ -18,7 +18,7 @@ Cargo.lock
/classes/ /classes/
/node_modules/ /node_modules/
/out/ /out/
/target/ target/
pom.xml pom.xml
pom.xml.asc pom.xml.asc
/.cljs_node_repl/ /.cljs_node_repl/

View file

@ -1 +1,6 @@
language: rust language: rust
script:
- cargo build --verbose
- cargo test --verbose
- cargo build --verbose -p datomish-cli
- cargo test --verbose -p datomish-cli

View file

@ -4,3 +4,11 @@ version = "0.4.0"
authors = ["Richard Newman <rnewman@twinql.com>", "Nicholas Alexander <nalexander@mozilla.com>"] authors = ["Richard Newman <rnewman@twinql.com>", "Nicholas Alexander <nalexander@mozilla.com>"]
[dependencies] [dependencies]
[dev-dependencies]
[dev-dependencies.datomish-cli]
path = "cli"
[[bin]]
name = "datomish-cli"
path = "cli/src/main.rs"

View file

@ -78,6 +78,12 @@ To run tests use:
cargo test cargo test
```` ````
To run the cli use:
````
cargo run
````
## License ## License
Datomish is currently licensed under the Apache License v2.0. See the `LICENSE` file for details. Datomish is currently licensed under the Apache License v2.0. See the `LICENSE` file for details.

7
cli/Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "datomish-cli"
version = "0.0.1"
[dependencies]
[dependencies.datomish]
path = "../"

3
cli/README.md Normal file
View file

@ -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.

20
cli/src/main.rs Normal file
View file

@ -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<String> = env::args().collect();
println!("I got {:?} arguments: {:?}.", args.len() - 1, &args[1..]);
}

View file

@ -8,6 +8,11 @@
// CONDITIONS OF ANY KIND, either express or implied. See the License for the // CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License. // 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 { pub fn add_two(a: i32) -> i32 {
a + 2 a + 2
} }