Skip to content

Commit 3e270d0

Browse files
committed
Bump libraries.
1 parent b6150df commit 3e270d0

17 files changed

+3919
-604
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trim_trailing_whitespace = true
1414
indent_style = tab
1515
indent_size = 4
1616

17-
[{.jshintrc,*.json,*.yml}]
17+
[{.jshintrc,*.yml}]
1818
indent_style = space
1919
indent_size = 2
2020

.gitattributes

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Exclude these files from release archives.
3+
#
4+
/.browserslistrc export-ignore
5+
/.editorconfig export-ignore
6+
/.eslintrc export-ignore
7+
/.git export-ignore
8+
/.gitattributes export-ignore
9+
/.github export-ignore
10+
/.gitignore export-ignore
11+
/.wp-env.json export-ignore
12+
/bin export-ignore
13+
/composer.template.yaml export-ignore
14+
/composer.lock export-ignore
15+
/package.json export-ignore
16+
/package-lock.json export-ignore
17+
/phpcs.ruleset.xml export-ignore
18+
/phpunit.xml.dist export-ignore
19+
/stylelint.config.js export-ignore
20+
/tests export-ignore
21+
/webpack.config.js export-ignore
22+
23+
/hametwoo.php export-ignore
24+
25+
#
26+
# Auto detect text files and perform LF normalization
27+
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
28+
#
29+
* text=auto
30+
*.md text
31+
*.php text
32+
*.json text

.github/workflows/test.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI/CD
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
jobs:
8+
# WordPress.org が治ったらもどす
9+
# test:
10+
# name: PHP Unit Test
11+
# strategy:
12+
# matrix:
13+
# php: [ '8.2' ] #PHP versions to check.
14+
# wp: [ 'latest' ] # WordPress version to check.
15+
# uses: tarosky/workflows/.github/workflows/wp-unit-test.yml@main
16+
# with:
17+
# php_version: ${{ matrix.php }}
18+
# wp_version: ${{ matrix.wp }}
19+
20+
lint:
21+
name: PHP Syntax compatibility check
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@master
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: '7.4'
30+
tools: composer
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Install Composer
35+
run: composer install --no-interaction --no-progress --optimize-autoloader --no-suggest
36+
37+
- name: Run PHP Lint
38+
run: composer lint
39+
40+
short-open-tag:
41+
uses: tarosky/workflows/.github/workflows/php-short-open-tag.yml@main
42+
43+
status-check:
44+
name: Status Check
45+
runs-on: ubuntu-latest
46+
if: always()
47+
needs: [ short-open-tag, lint ]
48+
steps:
49+
- uses: re-actors/alls-green@release/v1
50+
with:
51+
jobs: ${{ toJSON(needs) }}

.gitignore

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
.DS_Store
22
Thumbs.db
33
wp-cli.local.yml
4-
node_modules/
5-
vendor/
6-
4+
/node_modules/
5+
/vendor/
6+
/wordpress/
7+
.wp_install_path
8+
*.cache
9+
compose.yaml

.travis.yml

-34
This file was deleted.

.wp-env.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"phpVersion": "8.1",
3+
"core": "WordPress/WordPress#6.6.2",
4+
"config": {
5+
"WP_DEBUG": true,
6+
"WP_DEBUG_LOG": true,
7+
"WP_DEBUG_DISPLAY": true,
8+
"WPMS_ON": true,
9+
"WPMS_SMTP_HOST": "mailhog",
10+
"WPMS_SMTP_PORT": 1025,
11+
"WPMS_MAILER": "smtp",
12+
"HAMAIL_DEBUG": true
13+
},
14+
"plugins": [
15+
".",
16+
"https://downloads.wordpress.org/plugin/query-monitor.latest-stable.zip",
17+
"https://downloads.wordpress.org/plugin/woocommerce.7.9.1.zip",
18+
"https://downloads.wordpress.org/plugin/wp-mail-smtp.latest-stable.zip"
19+
],
20+
"lifecycleScripts": {
21+
"afterStart": "bash bin/after-start-scripts.sh"
22+
}
23+
}

README.md

+43-2
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,63 @@
11
# hametwoo
2+
23
A utility classes for WooCommerce development.
34

45
[![Build Status](https://travis-ci.org/hametuha/hametwoo.svg)](https://travis-ci.org/hametuha/hametwoo)
56

67
## How to Use
78

8-
Include via composer. In your compsoer.json:
9+
Include via composer. In your composer.json:
910

1011
```
1112
{
1213
"require": {
13-
"hametuha/hametwoo": "~0.8"
14+
"hametuha/hametwoo": "~0.9"
1415
}
1516
}
1617
```
1718

1819
This library is useful for making Payment Gateways.
1920

21+
## Development
22+
23+
Composer, Node.js, and Docker are required. At first, clone GitHub repository.
24+
25+
```
26+
git clone git@github.com:hametuha/hametwoo.git
27+
```
28+
29+
Then install dependencies.
30+
31+
```
32+
composer install
33+
npm install
34+
```
35+
36+
Run local environment.
37+
38+
```
39+
npm start
40+
```
41+
42+
Run test.
43+
44+
```
45+
# PHP Unit test in Docker.
46+
npm test
47+
# PHP Code Sniffer
48+
composer lint
49+
# PHP Code Beautifier
50+
composer format
51+
```
52+
53+
To enable mailhog for debug, follow the instruction below.
54+
55+
```
56+
# Get docker container ID.
57+
# Notice: run npm start before this step.
58+
npm run path
59+
# You will get container ID at the .
60+
2061
## License
2162
2263
GPL 3.0 and later.

bin/after-start-scripts.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# 1. .wp_install_path からハッシュ値を読み込む、なければ終了。
2+
if [ ! -f .wp_install_path ]; then
3+
echo ".wp_install_path File not found. Skip installation mailhog"
4+
exit 0
5+
fi
6+
hash_value=$(cat .wp_install_path)
7+
8+
# 2. Replace %network% in compose.template.yaml with hash
9+
sed "s/%NETWORK_NAME%/${hash_value}/g" compose.template.yaml > compose.yaml
10+
11+
# 3. Display status
12+
echo "Hash: ${hash_value} in compose.yml"
13+
14+
docker compose up -d
15+
16+
echo "mailhog http://localhost:8025"

bin/hametwoo-sniff.sh

-4
This file was deleted.

compose.template.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
volumes:
2+
maildir: {}
3+
4+
services:
5+
mail:
6+
image: mailhog/mailhog
7+
container_name: mailhog
8+
ports:
9+
- 1025:1025
10+
- 8025:8025
11+
environment:
12+
MH_STORAGE: maildir
13+
MH_MAILDIR_PATH: /tmp
14+
volumes:
15+
- maildir:/tmp
16+
networks:
17+
- wpnetwork
18+
19+
networks:
20+
wpnetwork:
21+
name: %NETWORK_NAME%_default
22+
external: true

composer.json

+54-24
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,56 @@
11
{
2-
"name": "hametuha/hametwoo",
3-
"description": "A utility classes for WooCommerce development",
4-
"type": "library",
5-
"license": "GPL-3.0-or-later",
6-
"authors": [
7-
{
8-
"name": "fumikito",
9-
"email": "guy@hametuha.com"
10-
}
11-
],
12-
"minimum-stability": "stable",
13-
"require": {
14-
"php": ">=5.4"
15-
},
16-
"require-dev": {
17-
"phpunit/phpunit": "~4.8",
18-
"squizlabs/php_codesniffer": "~2.8",
19-
"wp-coding-standards/wpcs": "~0.11"
20-
},
21-
"autoload": {
22-
"psr-0": {
23-
"Hametuha\\HametWoo": "src/"
24-
}
25-
}
2+
"name": "hametuha/hametwoo",
3+
"description": "A utility classes for WooCommerce development",
4+
"type": "library",
5+
"scripts": {
6+
"test": "phpunit",
7+
"lint": "phpcs --standard=phpcs.ruleset.xml",
8+
"format": "phpcbf --standard=phpcs.ruleset.xml"
9+
},
10+
"license": "GPL-3.0-or-later",
11+
"authors": [
12+
{
13+
"name": "fumikito",
14+
"email": "guy@hametuha.com"
15+
}
16+
],
17+
"minimum-stability": "stable",
18+
"repositories":[
19+
{
20+
"type":"composer",
21+
"url":"https://wpackagist.org",
22+
"only": [
23+
"wpackagist-plugin/*",
24+
"wpackagist-theme/*"
25+
]
26+
}
27+
],
28+
"require": {
29+
"php": ">=7.4"
30+
},
31+
"require-dev": {
32+
"phpunit/phpunit": "^6|^7|^8|^9",
33+
"squizlabs/php_codesniffer": "^3.0",
34+
"wp-coding-standards/wpcs": "^3.0.0",
35+
"yoast/phpunit-polyfills": "^2.0.0",
36+
"wpackagist-plugin/woocommerce": "^7.0"
37+
},
38+
"autoload": {
39+
"psr-0": {
40+
"Hametuha\\HametWoo": "src/"
41+
}
42+
},
43+
"extra": {
44+
"installer-paths": {
45+
"vendor/plugins/{$name}/": [
46+
"type:wordpress-plugin"
47+
]
48+
}
49+
},
50+
"config": {
51+
"allow-plugins": {
52+
"composer/installers": true,
53+
"dealerdirect/phpcodesniffer-composer-installer": true
54+
}
55+
}
2656
}

0 commit comments

Comments
 (0)