File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 8989 }
9090 }
9191
92+ if ( empty ( $ version ) && file_exists ( $ path . '/composer.json ' ) ) {
93+ $ composer_obj = json_decode ( file_get_contents ( $ path . '/composer.json ' ) );
94+ if ( ! empty ( $ composer_obj ->version ) ) {
95+ $ version = '. ' . trim ( $ composer_obj ->version );
96+ }
97+ }
98+
9299 if ( 'zip ' === $ assoc_args ['format ' ] ) {
93100 if ( is_null ( $ archive_file ) ) {
94101 $ archive_file = dirname ( $ path ) . '/ ' . $ archive_base . $ version . '.zip ' ;
Original file line number Diff line number Diff line change @@ -37,3 +37,27 @@ Feature: Generate a distribution archive of a project
3737 """
3838 And the hello-world.zip file should exist
3939 And the wp-content/plugins/hello-world.0.1.0.zip file should not exist
40+
41+ Scenario : Generate a ZIP archive using version number in composer.json
42+ Given an empty directory
43+ And a foo/.distignore file:
44+ """
45+ .gitignore
46+ .distignore
47+ """
48+ And a foo/composer.json file:
49+ """
50+ {
51+ "name": "runcommand/profile",
52+ "description": "Quickly identify what's slow with WordPress.",
53+ "homepage": "https://runcommand.io/wp/profile/",
54+ "version": "0.2.0-alpha"
55+ }
56+ """
57+
58+ When I run `wp dist-archive foo`
59+ Then STDOUT should be:
60+ """
61+ Success: Created foo.0.2.0-alpha.zip
62+ """
63+ And the foo.0.2.0-alpha.zip file should exist
You can’t perform that action at this time.
0 commit comments