1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! cargo-workspace2 is a library to help manage cargo workspaces
//!
//! Out of the box the `cargo` workspace experience leaves a lot to be
//! desired.  Managing a repo with many crates in it can get out of
//! hand quickly.  Moreover, other tools that try to solve these
//! issues often pick _one_ particular usecase of cargo workspaces,
//! and enforce very strict rules on how to use them.
//!
//! This library aims to solve some of the issues of dealing with
//! workspaces in a way that doesn't enforce a usage mode for the
//! user.
//!
//! This package also publishes a binary (cargo ws2), which is
//! recommended for most users.  In case the binary handles a use-case
//! you have in a way that you don't like, this library aims to
//! provide a fallback so that you don't have to re-implement
//! everything from scratch.
//!
//! ## Using this library
//!
//! Parsing happens in stages.  First you need to use the
//! [`cargo`](./cargo/index.html) module to parse the actual
//! `Cargo.toml` files.  After that you can use the cargo models in
//! [`models`](models/index.html) to further process dependencies, and
//! create a [`DepGraph`](models/struct.DepGraph.html) to resolve queries and make changes.

pub mod cargo;
pub mod models;
pub mod ops;
pub mod query;

#[doc(hidden)]
pub mod cli;

// extern crate toml;
// extern crate toml_edit;

// pub use data_models::graph;
// use data_models::level::Level;
// use graph::DepGraph;
// use std::fs::File;
// pub use utilities::cargo_utils;
// pub use utilities::utils;

// pub mod data_models;
// pub mod utilities;

// pub fn do_batch_release(f: File, lvl: &Level) -> DepGraph {
//     let members = cargo_utils::get_members(f);
//     let configs = cargo_utils::batch_load_configs(&members);

//     let v = configs
//         .iter()
//         .map(|c| cargo_utils::parse_config(c, &members))
//         .fold(DepGraph::new(), |mut graph, (name, deps)| {
//             graph.add_node(name.clone());

//             deps.iter()
//                 .fold(graph, |graph, dep| graph.add_dependency(&name, dep))
//         });

//     println!("{:#?}", v);
//     v
// }