Skip to content

Commit 3b0fb6e

Browse files
Initial commit
0 parents  commit 3b0fb6e

File tree

18 files changed

+1994
-0
lines changed

18 files changed

+1994
-0
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
16+
[{.jshintrc,*.json,*.yml}]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[{*.txt,wp-config-sample.php}]
21+
end_of_line = crlf

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
composer.lock
3+
node_modules/
4+
vendor/

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
sudo: false
2+
3+
language: php
4+
5+
notifications:
6+
email:
7+
on_success: never
8+
on_failure: change
9+
10+
branches:
11+
only:
12+
- master
13+
14+
php:
15+
- 5.3
16+
- 5.6
17+
18+
cache:
19+
- composer
20+
- $HOME/.composer/cache
21+
22+
env:
23+
global:
24+
- WP_CLI_BIN_DIR=/tmp/wp-cli-phar
25+
26+
before_script:
27+
- bash bin/install-package-tests.sh
28+
29+
script: ./vendor/bin/behat

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
runcommand/dist-archive
2+
=======================
3+
4+
Create a distribution archive based on a project's .distignore
5+
6+
[![Build Status](https://travis-ci.org/runcommand/dist-archive.svg?branch=master)](https://travis-ci.org/runcommand/dist-archive)
7+
8+
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing)
9+
10+
## Using
11+
12+
13+
~~~
14+
wp dist-archive <path> [--format=<format>]
15+
~~~
16+
17+
**OPTIONS**
18+
19+
<path>
20+
Path to the project that includes a .distignore file.
21+
22+
[--format=<format>]
23+
Choose the format for the archive.
24+
---
25+
default: zip
26+
options:
27+
- zip
28+
- targz
29+
---
30+
31+
32+
33+
## Installing
34+
35+
Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with `wp cli update`.
36+
37+
Once you've done so, you can install this package with `wp package install runcommand/dist-archive`.
38+
39+
## Contributing
40+
41+
Code and ideas are more than welcome.
42+
43+
Please [open an issue](https://github.com/runcommand/dist-archive/issues) with questions, feedback, and violent dissent. Pull requests are expected to include test coverage.

bin/install-package-tests.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
PACKAGE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )"
6+
7+
download() {
8+
if [ `which curl` ]; then
9+
curl -s "$1" > "$2";
10+
elif [ `which wget` ]; then
11+
wget -nv -O "$2" "$1"
12+
fi
13+
}
14+
15+
install_wp_cli() {
16+
17+
# the Behat test suite will pick up the executable found in $WP_CLI_BIN_DIR
18+
mkdir -p $WP_CLI_BIN_DIR
19+
download https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar $WP_CLI_BIN_DIR/wp
20+
chmod +x $WP_CLI_BIN_DIR/wp
21+
22+
}
23+
24+
download_behat() {
25+
26+
cd $PACKAGE_DIR
27+
download https://getcomposer.org/installer installer
28+
php installer
29+
php composer.phar require --dev behat/behat='~2.5'
30+
31+
}
32+
33+
install_db() {
34+
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot
35+
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1"' -uroot
36+
}
37+
38+
install_wp_cli
39+
download_behat
40+
install_db

command.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
if ( ! class_exists( 'WP_CLI' ) ) {
4+
return;
5+
}
6+
7+
/**
8+
* Create a distribution archive based on a project's .distignore file.
9+
*
10+
* ## OPTIONS
11+
*
12+
* <path>
13+
* : Path to the project that includes a .distignore file.
14+
*
15+
* [--format=<format>]
16+
* : Choose the format for the archive.
17+
* ---
18+
* default: zip
19+
* options:
20+
* - zip
21+
* - targz
22+
* ---
23+
*
24+
* @when before_wp_Load
25+
*/
26+
$dist_archive_command = function( $args, $assoc_args ) {
27+
28+
list( $path ) = $args;
29+
$path = rtrim( $path, '/' ) . '/';
30+
31+
$dist_ignore_path = $path . '.distignore';
32+
if ( ! file_exists( $dist_ignore_path ) ) {
33+
WP_CLI::error( 'No .distignore file found.' );
34+
}
35+
36+
};
37+
WP_CLI::add_command( 'dist-archive', $dist_archive_command );

composer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "runcommand/dist-archive",
3+
"description": "Create a distribution archive based on a project's .distignore",
4+
"license": "MIT",
5+
"authors": [],
6+
"minimum-stability": "dev",
7+
"autoload": {
8+
"files": [ "command.php" ]
9+
},
10+
"require": {},
11+
"require-dev": {
12+
"behat/behat": "~2.5"
13+
},
14+
"extras": {
15+
"commands": [
16+
"dist-archive"
17+
]
18+
}
19+
}

0 commit comments

Comments
 (0)