Skip to content

Commit 141573b

Browse files
authored
Merge pull request #101 from wp-cli/100-show-the-size-of-the-file-when-it-creates
2 parents a525f7d + 264ff61 commit 141573b

File tree

3 files changed

+108
-106
lines changed

3 files changed

+108
-106
lines changed

features/dist-archive.feature

Lines changed: 18 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ Feature: Generate a distribution archive of a project
1111
And the wp-content/plugins/hello-world/bin directory should exist
1212

1313
When I run `wp dist-archive wp-content/plugins/hello-world`
14-
Then STDOUT should be:
15-
"""
16-
Success: Created hello-world.0.1.0.zip
17-
"""
14+
Then STDOUT should match /^Success: Created hello-world.0.1.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
1815
And STDERR should be empty
1916
And the wp-content/plugins/hello-world.0.1.0.zip file should exist
2017

@@ -37,10 +34,7 @@ Feature: Generate a distribution archive of a project
3734
And the wp-content/plugins/hello-world/bin directory should exist
3835

3936
When I run `wp dist-archive wp-content/plugins/hello-world --format=targz`
40-
Then STDOUT should be:
41-
"""
42-
Success: Created hello-world.0.1.0.tar.gz
43-
"""
37+
Then STDOUT should match /^Success: Created hello-world.0.1.0.tar.gz \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
4438
And STDERR should be empty
4539
And the wp-content/plugins/hello-world.0.1.0.tar.gz file should exist
4640

@@ -63,10 +57,7 @@ Feature: Generate a distribution archive of a project
6357
And the wp-content/plugins/hello-world/bin directory should exist
6458

6559
When I run `wp dist-archive wp-content/plugins/hello-world hello-world.zip`
66-
Then STDOUT should be:
67-
"""
68-
Success: Created hello-world.zip
69-
"""
60+
Then STDOUT should match /^Success: Created hello-world.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
7061
And the wp-content/plugins/hello-world.zip file should exist
7162
And the wp-content/plugins/hello-world.0.1.0.zip file should not exist
7263

@@ -80,10 +71,7 @@ Feature: Generate a distribution archive of a project
8071
And the wp-content/plugins/hello-world/bin directory should exist
8172

8273
When I run `wp dist-archive wp-content/plugins/hello-world wp-content`
83-
Then STDOUT should be:
84-
"""
85-
Success: Created hello-world.0.1.0.zip
86-
"""
74+
Then STDOUT should match /^Success: Created hello-world.0.1.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
8775
And the wp-content/hello-world.0.1.0.zip file should exist
8876
And the wp-content/plugins/hello-world.0.1.0.zip file should not exist
8977

@@ -100,10 +88,7 @@ Feature: Generate a distribution archive of a project
10088
Then the subdir directory should exist
10189

10290
When I run `wp dist-archive wp-content/plugins/hello-world ./subdir/hello-world.zip`
103-
Then STDOUT should be:
104-
"""
105-
Success: Created hello-world.zip
106-
"""
91+
Then STDOUT should match /^Success: Created hello-world.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
10792
And STDERR should be empty
10893
And the {RUN_DIR}/subdir/hello-world.zip file should exist
10994

@@ -117,10 +102,7 @@ Feature: Generate a distribution archive of a project
117102
And the wp-content/plugins/hello-world/bin directory should exist
118103

119104
When I run `wp dist-archive wp-content/plugins/hello-world {RUN_DIR}/wp-content/`
120-
Then STDOUT should be:
121-
"""
122-
Success: Created hello-world.0.1.0.zip
123-
"""
105+
Then STDOUT should match /^Success: Created hello-world.0.1.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
124106
And STDERR should be empty
125107
And the {RUN_DIR}/wp-content/hello-world.0.1.0.zip file should exist
126108

@@ -147,10 +129,7 @@ Feature: Generate a distribution archive of a project
147129
"""
148130

149131
When I run `wp dist-archive foo`
150-
Then STDOUT should be:
151-
"""
152-
Success: Created foo.0.2.0-alpha.zip
153-
"""
132+
Then STDOUT should match /^Success: Created foo.0.2.0-alpha.zip \(Size: \d* [a-zA-Z]{1,3}\)$/
154133
And the foo.0.2.0-alpha.zip file should exist
155134

156135
When I run `rm -rf foo`
@@ -178,10 +157,7 @@ Feature: Generate a distribution archive of a project
178157
"""
179158

180159
When I run `wp dist-archive --create-target-dir wp-content/plugins/hello-world {RUN_DIR}/some/nested/folder/hello-world.zip`
181-
Then STDOUT should be:
182-
"""
183-
Success: Created hello-world.zip
184-
"""
160+
Then STDOUT should match /^Success: Created hello-world.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
185161
And STDERR should be empty
186162
And the {RUN_DIR}/some/nested/folder/hello-world.zip file should exist
187163

@@ -195,10 +171,7 @@ Feature: Generate a distribution archive of a project
195171
And the wp-content/plugins/hello-world/bin directory should exist
196172

197173
When I run `wp dist-archive . {RUN_DIR}/hello-world.zip` from 'wp-content/plugins/hello-world'
198-
Then STDOUT should be:
199-
"""
200-
Success: Created hello-world.zip
201-
"""
174+
Then STDOUT should match /^Success: Created hello-world.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
202175
And STDERR should be empty
203176
And the {RUN_DIR}/hello-world.zip file should exist
204177

@@ -212,10 +185,7 @@ Feature: Generate a distribution archive of a project
212185
And the wp-content/plugins/hello-world/bin directory should exist
213186

214187
When I run `wp dist-archive . hello-world.zip` from 'wp-content/plugins/hello-world'
215-
Then STDOUT should be:
216-
"""
217-
Success: Created hello-world.zip
218-
"""
188+
Then STDOUT should match /^Success: Created hello-world.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
219189
And STDERR should be empty
220190
And the {RUN_DIR}/wp-content/plugins/hello-world.zip file should exist
221191

@@ -229,10 +199,7 @@ Feature: Generate a distribution archive of a project
229199
And the wp-content/plugins/hello-world/bin directory should exist
230200

231201
When I run `wp dist-archive . ./hello-world.zip` from 'wp-content/plugins/hello-world'
232-
Then STDOUT should be:
233-
"""
234-
Success: Created hello-world.zip
235-
"""
202+
Then STDOUT should match /^Success: Created hello-world.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
236203
And STDERR should be empty
237204
And the {RUN_DIR}/wp-content/plugins/hello-world/hello-world.zip file should exist
238205

@@ -246,10 +213,7 @@ Feature: Generate a distribution archive of a project
246213
And the wp-content/plugins/hello-world/bin directory should exist
247214

248215
When I run `wp dist-archive wp-content/plugins/hello-world .`
249-
Then STDOUT should be:
250-
"""
251-
Success: Created hello-world.0.1.0.zip
252-
"""
216+
Then STDOUT should match /^Success: Created hello-world.0.1.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
253217
And STDERR should be empty
254218
And the {RUN_DIR}/hello-world.0.1.0.zip file should exist
255219

@@ -263,10 +227,7 @@ Feature: Generate a distribution archive of a project
263227
And the wp-content/plugins/hello-world/bin directory should exist
264228

265229
When I run `wp dist-archive wp-content/plugins/hello-world --plugin-dirname=foobar-world`
266-
Then STDOUT should be:
267-
"""
268-
Success: Created foobar-world.0.1.0.zip
269-
"""
230+
Then STDOUT should match /^Success: Created foobar-world.0.1.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
270231
And STDERR should be empty
271232
And the wp-content/plugins/foobar-world.0.1.0.zip file should exist
272233

@@ -292,10 +253,7 @@ Feature: Generate a distribution archive of a project
292253
Then STDERR should be empty
293254

294255
When I run `wp dist-archive wp-content/plugins/hello-world`
295-
Then STDOUT should be:
296-
"""
297-
Success: Created hello-world.0.2.0.zip
298-
"""
256+
Then STDOUT should match /^Success: Created hello-world.0.2.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
299257
And STDERR should be empty
300258
And the wp-content/plugins/hello-world.0.2.0.zip file should exist
301259

@@ -393,10 +351,7 @@ Feature: Generate a distribution archive of a project
393351
And the wp-content/plugins/hello-world/bin directory should exist
394352

395353
When I run `wp dist-archive wp-content/plugins/hello-world --filename-format={name}-{version}`
396-
Then STDOUT should be:
397-
"""
398-
Success: Created hello-world-0.1.0.zip
399-
"""
354+
Then STDOUT should match /^Success: Created hello-world-0.1.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
400355
And STDERR should be empty
401356
And the wp-content/plugins/hello-world-0.1.0.zip file should exist
402357

@@ -410,10 +365,7 @@ Feature: Generate a distribution archive of a project
410365
And the wp-content/plugins/hello-world/bin directory should exist
411366

412367
When I run `wp dist-archive wp-content/plugins/hello-world hello-world.zip --filename-format={name}-{version}`
413-
Then STDOUT should be:
414-
"""
415-
Success: Created hello-world.zip
416-
"""
368+
Then STDOUT should match /^Success: Created hello-world.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
417369
And STDERR should be empty
418370
And the wp-content/plugins/hello-world.zip file should exist
419371
And the wp-content/plugins/hello-world-0.1.0.zip file should not exist
@@ -431,10 +383,7 @@ Feature: Generate a distribution archive of a project
431383
"""
432384

433385
When I run `wp dist-archive foo --filename-format={name}-{version}`
434-
Then STDOUT should be:
435-
"""
436-
Success: Created foo.zip
437-
"""
386+
Then STDOUT should match /^Success: Created foo.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
438387
And STDERR should be empty
439388
And the foo.zip file should exist
440389

@@ -451,10 +400,7 @@ Feature: Generate a distribution archive of a project
451400
Then the subdir directory should exist
452401

453402
When I run `wp dist-archive wp-content/plugins/hello-world ./subdir/hello-world-dist.zip`
454-
Then STDOUT should be:
455-
"""
456-
Success: Created hello-world-dist.zip
457-
"""
403+
Then STDOUT should match /^Success: Created hello-world-dist.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
458404
And STDERR should be empty
459405
And the {RUN_DIR}/subdir/hello-world-dist.zip file should exist
460406

features/distignore.feature

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ Feature: Generate a distribution archive of a project
3030
"""
3131

3232
When I run `wp dist-archive foo`
33-
Then STDOUT should be:
34-
"""
35-
Success: Created foo.zip
36-
"""
33+
Then STDOUT should match /^Success: Created foo.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
3734

3835
When I run `rm -rf foo`
3936
Then the foo directory should not exist
@@ -67,10 +64,7 @@ Feature: Generate a distribution archive of a project
6764
"""
6865

6966
When I run `wp dist-archive foo --format=<format>`
70-
Then STDOUT should be:
71-
"""
72-
Success: Created foo.<extension>
73-
"""
67+
Then STDOUT should match /^Success: Created foo.<extension> \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
7468
And the foo.<extension> file should exist
7569

7670
When I run `rm -rf foo`
@@ -112,10 +106,7 @@ Feature: Generate a distribution archive of a project
112106
Then the foo/.git/subfolder/version.control file should exist
113107

114108
When I run `wp dist-archive foo --format=<format>`
115-
Then STDOUT should be:
116-
"""
117-
Success: Created foo.<extension>
118-
"""
109+
Then STDOUT should match /^Success: Created foo.<extension> \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
119110
And the foo.<extension> file should exist
120111

121112
When I run `rm -rf foo`
@@ -164,10 +155,7 @@ Feature: Generate a distribution archive of a project
164155
"""
165156

166157
When I run `wp dist-archive foo --format=<format> --plugin-dirname=<plugin-dirname>`
167-
Then STDOUT should be:
168-
"""
169-
Success: Created <plugin-dirname>.<extension>
170-
"""
158+
Then STDOUT should match /^Success: Created <plugin-dirname>.<extension> \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
171159
And the <plugin-dirname>.<extension> file should exist
172160

173161
When I run `rm -rf foo`
@@ -215,10 +203,7 @@ Feature: Generate a distribution archive of a project
215203
"""
216204

217205
When I run `wp dist-archive foo --format=<format> --plugin-dirname=<plugin-dirname>`
218-
Then STDOUT should be:
219-
"""
220-
Success: Created <plugin-dirname>.<extension>
221-
"""
206+
Then STDOUT should match /^Success: Created <plugin-dirname>.<extension> \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
222207
And the <plugin-dirname>.<extension> file should exist
223208

224209
When I run `rm -rf foo`
@@ -262,10 +247,7 @@ Feature: Generate a distribution archive of a project
262247
"""
263248

264249
When I run `wp dist-archive foo --format=<format> --plugin-dirname=<plugin-dirname>`
265-
Then STDOUT should be:
266-
"""
267-
Success: Created <plugin-dirname>.<extension>
268-
"""
250+
Then STDOUT should match /^Success: Created <plugin-dirname>.<extension> \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
269251
And the <plugin-dirname>.<extension> file should exist
270252

271253
When I run `rm -rf foo`
@@ -310,10 +292,7 @@ Feature: Generate a distribution archive of a project
310292
"""
311293

312294
When I run `wp dist-archive foo --format=<format> --plugin-dirname=<plugin-dirname>`
313-
Then STDOUT should be:
314-
"""
315-
Success: Created <plugin-dirname>.<extension>
316-
"""
295+
Then STDOUT should match /^Success: Created <plugin-dirname>.<extension> \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
317296
And the <plugin-dirname>.<extension> file should exist
318297

319298
When I run `mv foo sourcefoo`
@@ -360,10 +339,7 @@ Feature: Generate a distribution archive of a project
360339
"""
361340

362341
When I run `wp dist-archive foo --format=<format> --plugin-dirname=<plugin-dirname>`
363-
Then STDOUT should be:
364-
"""
365-
Success: Created <plugin-dirname>.<extension>
366-
"""
342+
Then STDOUT should match /^Success: Created <plugin-dirname>.<extension> \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/
367343
And the <plugin-dirname>.<extension> file should exist
368344

369345
When I run `mv foo sourcefoo`

0 commit comments

Comments
 (0)