Skip to content

Commit bfa1de5

Browse files
authored
Merge pull request #17 from zummenix/develop
Version 2.1.0
2 parents d63c12e + 073a918 commit bfa1de5

File tree

7 files changed

+294
-258
lines changed

7 files changed

+294
-258
lines changed

Cargo.lock

Lines changed: 89 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mprovision"
3-
version = "2.0.0"
3+
version = "2.1.0"
44
authors = ["Aleksey Kuznetsov <zummenix@gmail.com>"]
55

66
[[bin]]
@@ -10,14 +10,14 @@ doc = false
1010
test = true
1111

1212
[dependencies]
13-
plist = "0.1.0"
14-
chrono = "~0.2.0" # used in plist.
13+
plist = "0.1.3"
14+
chrono = "0.2.25" # used in plist.
1515
memmem = "0.1.1"
16-
futures = "0.1.10"
17-
futures-cpupool = "0.1.2"
18-
num_cpus = "1.2.1"
19-
clap = "2.20.0"
16+
futures = "0.1.13"
17+
futures-cpupool = "0.1.5"
18+
num_cpus = "1.4.0"
19+
clap = "2.23.3"
2020

2121
[dev-dependencies]
22-
expectest = "0.6.0"
22+
expectest = "0.7.0"
2323
tempdir = "0.3.4"

src/bin/cli.rs

Lines changed: 131 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -93,88 +93,91 @@ pub fn parse<I, S>(args: I) -> Result
9393
.about("A tool that helps iOS developers to manage mobileprovision files.")
9494
.version(crate_version!())
9595
.subcommand(SubCommand::with_name("list")
96-
.about("Lists provisioning profiles")
97-
.display_order(0)
98-
.setting(AppSettings::DisableVersion)
99-
.arg(Arg::with_name("TEXT")
100-
.long("text")
101-
.short("t")
102-
.help("Lists provisioning profiles that contain this text")
103-
.display_order(0)
104-
.required(false)
105-
.empty_values(false)
106-
.takes_value(true))
107-
.arg(Arg::with_name("DAYS")
108-
.long("expire-in-days")
109-
.short("d")
110-
.help("Lists provisioning profiles that will expire in days")
111-
.display_order(1)
112-
.required(false)
113-
.empty_values(false)
114-
.takes_value(true))
115-
.arg(Arg::with_name("DIRECTORY")
116-
.long("source")
117-
.help("A directory where to search provisioning profiles")
118-
.required(false)
119-
.empty_values(false)
120-
.takes_value(true)))
96+
.about("Lists provisioning profiles")
97+
.display_order(0)
98+
.setting(AppSettings::DisableVersion)
99+
.arg(Arg::with_name("TEXT")
100+
.long("text")
101+
.short("t")
102+
.help("Lists provisioning profiles that contain this text")
103+
.display_order(0)
104+
.required(false)
105+
.empty_values(false)
106+
.takes_value(true))
107+
.arg(Arg::with_name("DAYS")
108+
.long("expire-in-days")
109+
.short("d")
110+
.help("Lists provisioning profiles that will expire in days")
111+
.display_order(1)
112+
.required(false)
113+
.empty_values(false)
114+
.takes_value(true))
115+
.arg(Arg::with_name("DIRECTORY")
116+
.long("source")
117+
.help("A directory where to search provisioning profiles")
118+
.required(false)
119+
.empty_values(false)
120+
.takes_value(true)))
121121
.subcommand(SubCommand::with_name("show")
122-
.about("Shows details of a provisioning profile using its uuid")
123-
.display_order(1)
124-
.setting(AppSettings::DisableVersion)
125-
.arg(Arg::with_name("UUID")
126-
.help("An uuid of a provisioning profile")
127-
.required(true)
128-
.empty_values(false)
129-
.takes_value(true))
130-
.arg(Arg::with_name("DIRECTORY")
131-
.long("source")
132-
.help("A directory where to search a provisioning profile")
133-
.required(false)
134-
.empty_values(false)
135-
.takes_value(true)))
122+
.about("Shows details of a provisioning profile using its uuid")
123+
.display_order(1)
124+
.setting(AppSettings::DisableVersion)
125+
.arg(Arg::with_name("UUID")
126+
.help("An uuid of a provisioning profile")
127+
.required(true)
128+
.empty_values(false)
129+
.takes_value(true))
130+
.arg(Arg::with_name("DIRECTORY")
131+
.long("source")
132+
.help("A directory where to search a provisioning profile")
133+
.required(false)
134+
.empty_values(false)
135+
.takes_value(true)))
136136
.subcommand(SubCommand::with_name("show-file")
137-
.about("Shows details of a provisioning profile")
138-
.display_order(2)
139-
.setting(AppSettings::DisableVersion)
140-
.arg(Arg::with_name("PATH")
141-
.help("A file path of a provisioning profile")
142-
.required(true)
143-
.empty_values(false)
144-
.takes_value(true)))
137+
.about("Shows details of a provisioning profile")
138+
.display_order(2)
139+
.setting(AppSettings::DisableVersion)
140+
.arg(Arg::with_name("PATH")
141+
.help("A file path of a provisioning profile")
142+
.required(true)
143+
.empty_values(false)
144+
.takes_value(true)))
145145
.subcommand(SubCommand::with_name("remove")
146-
.about("Removes a provisioning profile")
147-
.display_order(3)
148-
.setting(AppSettings::DisableVersion)
149-
.arg(Arg::with_name("UUID")
150-
.help("An uuid of a provisioning profile")
151-
.required(true)
152-
.empty_values(false)
153-
.multiple(true)
154-
.takes_value(true))
155-
.arg(Arg::with_name("DIRECTORY")
156-
.long("source")
157-
.help("A directory where to search a provisioning profile")
158-
.required(false)
159-
.empty_values(false)
160-
.takes_value(true)))
146+
.about("Removes a provisioning profile")
147+
.display_order(3)
148+
.setting(AppSettings::DisableVersion)
149+
.arg(Arg::with_name("UUID")
150+
.help("An uuid of a provisioning profile")
151+
.required(true)
152+
.empty_values(false)
153+
.multiple(true)
154+
.takes_value(true))
155+
.arg(Arg::with_name("DIRECTORY")
156+
.long("source")
157+
.help("A directory where to search a provisioning profile")
158+
.required(false)
159+
.empty_values(false)
160+
.takes_value(true)))
161161
.subcommand(SubCommand::with_name("clean")
162-
.about("Removes expired provisioning profiles")
163-
.display_order(4)
164-
.setting(AppSettings::DisableVersion)
165-
.arg(Arg::with_name("DIRECTORY")
166-
.long("source")
167-
.help("A directory where to clean")
168-
.required(false)
169-
.empty_values(false)
170-
.takes_value(true)));
162+
.about("Removes expired provisioning profiles")
163+
.display_order(4)
164+
.setting(AppSettings::DisableVersion)
165+
.arg(Arg::with_name("DIRECTORY")
166+
.long("source")
167+
.help("A directory where to clean")
168+
.required(false)
169+
.empty_values(false)
170+
.takes_value(true)));
171171

172172
let matches = app.get_matches_from_safe(args)?;
173173
if let Some(list_matches) = matches.subcommand_matches("list") {
174174
let mut params = ListParams::default();
175-
params.filter = list_matches.value_of("TEXT").map(|text| text.to_string());
176-
if let Some(days) = list_matches.value_of("DAYS")
177-
.and_then(|days| days.parse::<i64>().ok()) {
175+
params.filter = list_matches
176+
.value_of("TEXT")
177+
.map(|text| text.to_string());
178+
if let Some(days) = list_matches
179+
.value_of("DAYS")
180+
.and_then(|days| days.parse::<i64>().ok()) {
178181
if days < 0 || days > 365 {
179182
return Err(Error::Custom("DAYS should be between 0 and 365".to_string()));
180183
}
@@ -183,15 +186,27 @@ pub fn parse<I, S>(args: I) -> Result
183186
params.directory = list_matches.value_of("DIRECTORY").map(|dir| dir.into());
184187
Ok(Command::List(params))
185188
} else if let Some(show_matches) = matches.subcommand_matches("show") {
186-
let uuid = show_matches.value_of("UUID").map(|uuid| uuid.to_string()).unwrap();
189+
let uuid = show_matches
190+
.value_of("UUID")
191+
.map(|uuid| uuid.to_string())
192+
.unwrap();
187193
let directory = show_matches.value_of("DIRECTORY").map(|dir| dir.into());
188194
Ok(Command::ShowUuid(uuid, directory))
189195
} else if let Some(show_file_matches) = matches.subcommand_matches("show-file") {
190-
let path = show_file_matches.value_of("PATH").map(|path| path.into()).unwrap();
196+
let path = show_file_matches
197+
.value_of("PATH")
198+
.map(|path| path.into())
199+
.unwrap();
191200
Ok(Command::ShowFile(path))
192201
} else if let Some(remove_matches) = matches.subcommand_matches("remove") {
193-
let uuids = remove_matches.values_of("UUID").unwrap().map(String::from).collect();
194-
let directory = remove_matches.value_of("DIRECTORY").map(|dir| dir.into());
202+
let uuids = remove_matches
203+
.values_of("UUID")
204+
.unwrap()
205+
.map(String::from)
206+
.collect();
207+
let directory = remove_matches
208+
.value_of("DIRECTORY")
209+
.map(|dir| dir.into());
195210
Ok(Command::Remove(uuids, directory))
196211
} else if let Some(clean_matches) = matches.subcommand_matches("clean") {
197212
let directory = clean_matches.value_of("DIRECTORY").map(|dir| dir.into());
@@ -213,42 +228,42 @@ mod tests {
213228

214229
expect!(parse(&["mprovision", "list", "--source", "."]))
215230
.to(be_ok().value(Command::List(ListParams {
216-
filter: None,
217-
expire_in_days: None,
218-
directory: Some(".".into()),
219-
})));
231+
filter: None,
232+
expire_in_days: None,
233+
directory: Some(".".into()),
234+
})));
220235

221236
expect!(parse(&["mprovision", "list", "--text", "abc"]))
222237
.to(be_ok().value(Command::List(ListParams {
223-
filter: Some("abc".to_string()),
224-
expire_in_days: None,
225-
directory: None,
226-
})));
238+
filter: Some("abc".to_string()),
239+
expire_in_days: None,
240+
directory: None,
241+
})));
227242

228243
expect!(parse(&["mprovision", "list", "-t", "abc"]))
229244
.to(be_ok().value(Command::List(ListParams {
230-
filter: Some("abc".to_string()),
231-
expire_in_days: None,
232-
directory: None,
233-
})));
245+
filter: Some("abc".to_string()),
246+
expire_in_days: None,
247+
directory: None,
248+
})));
234249

235250
expect!(parse(&["mprovision", "list", "--text", ""])).to(be_err());
236251

237252
expect!(parse(&["mprovision", "list", "-t", ""])).to(be_err());
238253

239254
expect!(parse(&["mprovision", "list", "--expire-in-days", "3"]))
240255
.to(be_ok().value(Command::List(ListParams {
241-
filter: None,
242-
expire_in_days: Some(3),
243-
directory: None,
244-
})));
256+
filter: None,
257+
expire_in_days: Some(3),
258+
directory: None,
259+
})));
245260

246261
expect!(parse(&["mprovision", "list", "-d", "3"]))
247262
.to(be_ok().value(Command::List(ListParams {
248-
filter: None,
249-
expire_in_days: Some(3),
250-
directory: None,
251-
})));
263+
filter: None,
264+
expire_in_days: Some(3),
265+
directory: None,
266+
})));
252267

253268
expect!(parse(&["mprovision", "list", "--expire-in-days", "-3"])).to(be_err());
254269
expect!(parse(&["mprovision", "list", "-d", "-3"])).to(be_err());
@@ -263,18 +278,25 @@ mod tests {
263278
"3",
264279
"--source",
265280
"."]))
266-
.to(be_ok().value(Command::List(ListParams {
267-
filter: Some("abc".to_string()),
268-
expire_in_days: Some(3),
269-
directory: Some(".".into()),
270-
})));
281+
.to(be_ok().value(Command::List(ListParams {
282+
filter: Some("abc".to_string()),
283+
expire_in_days: Some(3),
284+
directory: Some(".".into()),
285+
})));
271286

272-
expect!(parse(&["mprovision", "list", "-t", "abc", "-d", "3", "--source", "."]))
273-
.to(be_ok().value(Command::List(ListParams {
274-
filter: Some("abc".to_string()),
275-
expire_in_days: Some(3),
276-
directory: Some(".".into()),
277-
})));
287+
expect!(parse(&["mprovision",
288+
"list",
289+
"-t",
290+
"abc",
291+
"-d",
292+
"3",
293+
"--source",
294+
"."]))
295+
.to(be_ok().value(Command::List(ListParams {
296+
filter: Some("abc".to_string()),
297+
expire_in_days: Some(3),
298+
directory: Some(".".into()),
299+
})));
278300
}
279301

280302
#[test]

0 commit comments

Comments
 (0)