Skip to content

Commit

Permalink
updated - loaded and dist script
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveJonesDev committed Jun 5, 2024
1 parent 3b83d8f commit 499a167
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 20 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
},
"autoload": {
"psr-4": {
"EDECU\\Inc\\": "inc/"
"EqualizeDigital\\EnableContributorUploads\\": "inc/"
}
},
"autoload-dev": {
"psr-4": {
"EDECU\\Inc\\": "inc/"
"EqualizeDigital\\EnableContributorUploads\\": "inc/"
}
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions enable-contributor-uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Text Domain: enable-contributor-uploads
*/

use EqualizeDigital\EnableContributorUploads\Inc\Plugin;
use EqualizeDigital\EnableContributorUploads\Plugin;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
Expand All @@ -36,6 +36,6 @@
}

// Initialize the plugin.
if ( class_exists( 'EqualizeDigital\EnableContributorUploads\Inc\Plugin' ) ) {
if ( class_exists( 'EqualizeDigital\EnableContributorUploads\Plugin' ) ) {
( new Plugin() )->init();
}
6 changes: 3 additions & 3 deletions inc/plugin.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Class file for the Accessibility Checker plugin.
* Class file for the Enable Contributor Uploads plugin.
*
* @package Accessibility_Checker
* @package Enable_Contributor_Uploads
*/

namespace EqualizeDigital\EnableContributorUploads\Inc;
namespace EqualizeDigital\EnableContributorUploads;

/**
* Class Plugin
Expand Down
15 changes: 9 additions & 6 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Accessibility Checker">
<description>Accessibility Checker Wordpress Coding Standards</description>
<ruleset name="WordPress Coding Standards for Enable Contributor Uploads">
<description>Enable Contributor Uploads Wordpress Coding Standards</description>

<!-- Scan all files in directory -->
<file>.</file>
Expand Down Expand Up @@ -147,9 +147,12 @@
</rule>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>

<!-- Ignore class names -->
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>*/plugin.php</exclude-pattern>
</rule>
<!-- Exclude rules that block PSR-4 compliance -->
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
</rule>
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
</rule>

</ruleset>
24 changes: 18 additions & 6 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
#Remove the contents of the dist folder
# Remove the contents of the dist folder
rm -frd ./dist
mkdir ./dist

#Run the wp script that produces the zip
# Ensure the vendor folder is present in the current directory
if [ ! -d "./vendor" ]; then
echo "Vendor folder not found. Exiting."
exit 1
fi

# Run the wp script that produces the zip
npx wp-scripts plugin-zip

# unzip the zip into its own folder so we can zip that
# Unzip the zip into its own folder so we can zip that
unzip enable-contributor-uploads.zip -d ./dist/enable-contributor-uploads

# Check if vendor folder is present in the unzipped content
if [ ! -d "./dist/enable-contributor-uploads/vendor" ]; then
echo "Vendor folder is missing in the unzipped content. Adding it manually."
cp -r ./vendor ./dist/enable-contributor-uploads/vendor
fi

# plugin-zip includes package.json which is not needed for the plugin, so remove.
rm ./dist/enable-contributor-uploads/package.json
rm ./dist/enable-contributor-uploads/README.md

#remove the original zip
# Remove the original zip
rm enable-contributor-uploads.zip

#move into the dist folder and zip the plugin's folder
# Move into the dist folder and zip the plugin's folder
cd ./dist
zip -r enable-contributor-uploads.zip ./enable-contributor-uploads

#cleanup and drop back into the original dir
# Cleanup and drop back into the original dir
rm -r ./enable-contributor-uploads
cd ..
2 changes: 1 addition & 1 deletion tests/phpunit/TestPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Enable_Contributor_Uploads
*/

use EqualizeDigital\EnableContributorUploads\Inc\Plugin;
use EqualizeDigital\EnableContributorUploads\Plugin;

/**
* Plugin test case.
Expand Down

0 comments on commit 499a167

Please sign in to comment.