Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/community files #1

Merged
merged 11 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These owners will be the default owners for everything in the repo. Unless a later match takes precedence, @Sidsector9, as primary maintainer will be requested for review when someone opens a Pull Request.
* @Sidsector9 @10up/open-source-practice

# GitHub and WordPress.org specifics
/.github/ @jeffpaul
/.wordpress-org/ @jeffpaul
CODE_OF_CONDUCT.md @jeffpaul
LICENSE.md @jeffpaul
30 changes: 30 additions & 0 deletions .github/workflows/no-response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: No Response

# **What it does**: Closes issues where the original author doesn't respond to a request for information.
# **Why we have it**: To remove the need for maintainers to remember to check back on issues periodically to see if contributors have responded.
# **Who does it impact**: Everyone that works on docs or docs-internal.

on:
issue_comment:
types: [created]
schedule:
# Schedule for five minutes after the hour, every hour
- cron: '5 * * * *'

jobs:
noResponse:
runs-on: ubuntu-latest
steps:
- uses: lee-dohm/[email protected]
with:
token: ${{ github.token }}
daysUntilClose: 14 # Number of days of inactivity before an Issue is closed for lack of response
responseRequiredLabel: "needs:feedback" # Label indicating that a response from the original author is required
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further. See [this blog post on bug reports and the
importance of repro steps](https://www.lee-dohm.com/2015/01/04/writing-good-bug-reports/)
for more information about the kind of information that may be helpful.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/), and will adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - TBD

## [0.1.0] - TBD
### Added
- Initial project release! 🎉

[Unreleased]: https://github.com/10up/wp-compat-validation-tool/compare/trunk...develop
[0.1.0]: https://github.com/10up/1wp-compat-validation-tool/commit/<COMMIT-HASH-HERE>
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing and Maintaining

First, thank you for taking the time to contribute!

The following is a set of guidelines for contributors as well as information and instructions around our maintenance process. The two are closely tied together in terms of how we all work together and set expectations, so while you may not need to know everything in here to submit an issue or pull request, it's best to keep them in the same document.

## Ways to contribute

Contributing isn't just writing code - it's anything that improves the project. All contributions are managed right here on GitHub. Here are some ways you can help:

### Reporting bugs

If you're running into an issue, please take a look through [existing issues](https://github.com/10up/wp-compat-validation-tool/issues) and [open a new one](https://github.com/10up/wp-compat-validation-tool/issues/new) if needed. If you're able, include steps to reproduce, environment information, and screenshots/screencasts as relevant.

### Suggesting enhancements

New features and enhancements are also managed via [issues](https://github.com/10up/wp-compat-validation-tool/issues).

### Pull requests

Pull requests represent a proposed solution to a specified problem. They should always reference an issue that describes the problem and contains discussion about the problem itself. Discussion on pull requests should be limited to the pull request itself, i.e. code review.

For more on how 10up writes and manages code, check out our [10up Engineering Best Practices](https://10up.github.io/Engineering-Best-Practices/).

## Workflow

The `develop` branch is the development branch which means it contains the next version to be released. `trunk` contains the corresponding stable development version. Always work on the `develop` branch and open up PRs against `develop`.

## Release instructions

1. Branch: Starting from `develop`, cut a release branch named `release/X.Y.Z` for your changes.
2. Version bump: Bump the version number in `plugin.php`, `readme.txt`, and any other relevant files if it does not already reflect the version being released.
3. Changelog: Add/update the changelog in `CHANGELOG.md` and `readme.txt`.
4. Props: update `CREDITS.md` file with any new contributors, and confirm maintainers are accurate.
5. New files: Check to be sure any new files/paths that are unnecessary in the production version are included in `.gitattributes` or `.distignore`.
6. Readme updates: Make any other readme changes as necessary. `CHANGELOG.md` and `README.md` are geared toward GitHub and `readme.txt` contains WordPress.org-specific content. The two are slightly different.
7. Merge: Make a non-fast-forward merge from your release branch to `develop` (or merge the pull request), then do the same for `develop` into `trunk`, ensuring you pull the most recent changes into `develop` first (`git checkout develop && git pull origin develop && git checkout trunk && git merge --no-ff develop`). `trunk` contains the stable development version.
8. Push: Push your `trunk` branch to GitHub (e.g. `git push origin trunk`).
9. Compare `trunk` to `develop` to ensure no additional changes were missed. Visit https://github.com/10up/wp-compat-validation-tool/compare/trunk...develop
10. Test the pre-release ZIP locally by downloading it from the **Build release zip** action artifact and installing it locally. Ensure this zip has all the files we expect, that it installs and activates correctly and that all basic functionality is working.
11. Release: Create a [new release](https://github.com/10up/wp-compat-validation-tool/releases/new), naming the tag and the release with the new version number, and targeting the `trunk` branch. Paste the changelog from `CHANGELOG.md` into the body of the release and include a link to the closed issues on the [milestone](https://github.com/10up/wp-compat-validation-tool/milestone/#?closed=1).
12. Close milestone: Edit the [milestone](https://github.com/10up/wp-compat-validation-tool/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description` field), then close the milestone.
13. Punt incomplete items: If any open issues or PRs which were milestoned for `X.Y.Z` do not make it into the release, update their milestone to `X.Y.Z+1`, `X.Y+1.0`, `X+1.0.0` or `Future Release`.

### What to do if things go wrong

If you run into issues during the release process and things have NOT fully deployed to WordPress.org / npm / whatever external-to-GitHub location that we might be publishing to, then the best thing to do will be to delete any Tag (e.g., https://github.com/10up/wp-compat-validation-tool/releases/tag/TAGNAME) or Release that's been created, research what's wrong, and once things are resolved work on re-tagging and re-releasing on GitHub and publishing externally where needed.

If you run into issues during the release process and things HAVE deployed to WordPress.org / npm / whatever external-to-GitHub location that we might be publishing to, then the best thing to do will be to research what's wrong and once things are resolved work on a patch release and tag on GitHub and publishing externally where needed. At the top of the changelog / release notes it's best to note that its a hotfix to resolve whatever issues were found after the previous release.
21 changes: 21 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Credits

The following acknowledges the Maintainers for this repository, those who have Contributed to this repository (via bug reports, code, design, ideas, project management, translation, testing, etc.), and any Libraries utilized.

## Maintainers

The following individuals are responsible for curating the list of issues, responding to pull requests, and ensuring regular releases happen.

[Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul).

## Contributors

Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.

[Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul).

## Libraries

The following software libraries are utilized in this repository.

n/a
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 10up, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
## Usage
# WordPress Compatibility Tool

> Perform PHP and WP version compatibility checks in your plugin.

[![Support Level](https://img.shields.io/badge/support-beta-blueviolet.svg)](#support-level) [![MIT License](https://img.shields.io/github/license/10up/wp-compat-validation-tool.svg)](https://github.com/10up/wp-compat-validation-tool/blob/trunk/LICENSE.md)

## Overview

This library provides API methods to perform version validation checks in WordPress plugins.
Most helpful in situation where the plugin should gracefully exit on activation when system requirements aren't met.

## Setup

In your project's `composer.json`, add the following:

Expand Down Expand Up @@ -27,4 +38,38 @@ In your project's `composer.json`, add the following:
```

Replace `<New_Name_Space>` with a unique namespace specific to your project.
The `WP_Compat_Validation_Tools` will be replaced by `<New_Name_Space>` to avoid namespace collisions in case multiple plugins use this package as their dependency.
The `WP_Compat_Validation_Tools` namespace will be replaced by `<New_Name_Space>` to avoid namespace collisions in situations where multiple plugins use this package as their dependencies.

## Usage

```php
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';

$compat_checker = new \New_Name_Space\Validator();
$compat_checker
->set_plugin_name( '<Your plugin name>' )
->set_php_min_required_version( '7.4' );
if ( ! $compat_checker->is_plugin_compatible() ) {
return;
}
}
```

The `Validator` class should be instantiated immediately after loading the `vendor/autoload.php` class, and the validation checks should be done before loading or instantiating any other composer dependency.

## Support Level

**Beta:** This project is quite new and we're not sure what our ongoing support level for this will be. Bug reports, feature requests, questions, and pull requests are welcome. If you like this project please let us know, but be cautious using this in a Production environment!

## Changelog

A complete listing of all notable changes to 10up Sitemaps is documented in [CHANGELOG.md](https://github.com/10up/wp-compat-validation-tool/blob/develop/CHANGELOG.md).

## Contributing

Please read [CODE_OF_CONDUCT.md](https://github.com/10up/wp-compat-validation-tool/blob/develop/CODE_OF_CONDUCT.md) for details on our code of conduct, [CONTRIBUTING.md](https://github.com/10up/wp-compat-validation-tool/blob/develop/CONTRIBUTING.md) for details on the process for submitting pull requests to us, and [CREDITS.md](https://github.com/10up/wp-compat-validation-tool/blob/develop/CREDITS.md) for a listing of maintainers of, contributors to, and libraries used by 10up Sitemaps.

## Like what you see?

<a href="http://10up.com/contact/"><img src="https://10up.com/uploads/2016/10/10up-Github-Banner.png" width="850" alt="Work with us at 10up"></a>
16 changes: 14 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"name": "siddharth/wp-compat-validation-tools",
"name": "10up/wp-compat-validation-tool",
"description": "Perform PHP and WP version compatibility checks in your plugin.",
"authors": [
{
"name": "10up",
"email": "[email protected]",
"homepage": "https://10up.com",
"role": "Developer"
}
],
"homepage": "https://github.com/10up/wp-compat-validation-tool",
"readme": "https://github.com/10up/wp-compat-validation-tool#readme",
"license": "MIT",
"autoload": {
"psr-4": {
"WP_Compat_Validation_Tools\\": "src/"
"WP_Compat_Validation_Tool\\": "src/"
}
}
}
4 changes: 2 additions & 2 deletions replace-namespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ NEW_NAMESPACE="$1"
find "$SCRIPT_DIR" -type f \( -name "*.php" -o -name "*.json" \) ! -name "$SCRIPT_NAME" | while read -r file; do
echo $file
# Use perl for the replacement in each file
perl -pi -e "s/WP_Compat_Validation_Tools/$NEW_NAMESPACE/g" "$file"
perl -pi -e "s/WP_Compat_Validation_Tool/$NEW_NAMESPACE/g" "$file"
done

# Use find to get all files recursively in the vendor/composer directory
find "$COMPOSER_DIR" -type f \( -name "*.php" -o -name "*.json" \) ! -name "$SCRIPT_NAME" | while read -r file; do
echo $file
# Use perl for the replacement in each file
perl -pi -e "s/WP_Compat_Validation_Tools/$NEW_NAMESPACE/g" "$file"
perl -pi -e "s/WP_Compat_Validation_Tool/$NEW_NAMESPACE/g" "$file"
done
2 changes: 1 addition & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace WP_Compat_Validation_Tools;
namespace WP_Compat_Validation_Tool;

class Validator {
/**
Expand Down