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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//! # Calculate next semantic bump and/or version number
//!
//! Calculates the next semantic bump and/or version number based on
//! the current version number and the conventional commits made
//! since the last version has been released.
//!
//! ## Usage
//!
//! Add the dependency to Cargo.toml
//!
//! ```toml
//! [dependencies]
//! nextsv = "0.19.24"
//! ```
//!
//! Calculation workflow:
//! 1. Create the configuration
//! 2. Build the calculator
//! 3. Report the calculation
//!
//! Report the results from the calculator
//!
//! ```no_run
//! # use nextsv::{CalculatorConfig, ForceBump, Hierarchy};
//! # use std::ffi::OsString;
//! #
//! # fn main() -> Result<(), nextsv::Error> {
//! # struct Args {
//! # prefix: String,
//! # level: bool,
//! # number: bool,
//! # force: Option<ForceBump>,
//! # require: Vec<OsString>,
//! # enforce_level: Hierarchy,
//! # check: Option<Hierarchy>,
//! #
//! # };
//! // arguments collected from CLI
//! let args = Args {
//! prefix: String::from("v"),
//! level: true,
//! number: true,
//! force: None,
//! require: vec![OsString::from("README.md"), OsString::from("CHANGES.md"), ],
//! enforce_level: Hierarchy::Feature,
//! check: None,
//! };
//!
//! // 1. Create the configuration
//!
//! let mut calculator_config = CalculatorConfig::new();
//!
//! // Set the version number prefix
//! calculator_config = calculator_config.set_prefix(&args.prefix);
//!
//! // What do we want to output?
//! calculator_config = calculator_config.set_bump_report(args.level);
//! calculator_config = calculator_config.set_version_report(args.number);
//!
//! // Is the bump level being forced?
//! if let Some(force) = args.force {
//! calculator_config = calculator_config.set_force_bump(force);
//! };
//!
//! // Are there files that must be updated? What change level should they be enforced at?
//! if !args.require.is_empty() {
//! calculator_config = calculator_config.add_required_files(args.require);
//! calculator_config = calculator_config.set_required_enforcement(args.enforce_level);
//! };
//!
//! // Is three a threshold set that must be met before proceeding with a change?
//! if let Some(check_level) = args.check {
//! calculator_config = calculator_config.set_reporting_threshold(check_level);
//! }
//!
//! // 2. Build the calculator
//! // Apply the config and create a calculator
//! let calculator = calculator_config.build()?;
//!
//! // 3. Report the calculations
//! println!("{}", calculator.report());
//!
//! # Ok(())
//! # }
//! ```
pub use ;
pub use Error;
pub use Workspace;
// pub use version::VersionTag;