Skip to content

Commit

Permalink
Merge pull request #10 from infinum/develop
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
iruzevic authored Apr 15, 2019
2 parents 37527f3 + 9aa1308 commit 52707ce
Show file tree
Hide file tree
Showing 27 changed files with 924 additions and 208 deletions.
17 changes: 17 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Hi there! Thanks for helping out in improving Eightshift Libs.

## Reporting an issue

If you are not sure how something works be sure to read our [readme](https://github.com/infinum/eightshift-libs/blob/master/README.md) and [wiki](https://github.com/infinum/eightshift-libs/wiki). If you found a bug in the code, please [open an issue](https://github.com/infinum/eightshift-libs/issues/new) and follow the instructions in the issue template.

## Contributing patches and new features

If you found a bug and want to fix it, or you want to add some new and cool feature, [fork](https://github.com/infinum/wp-boilerplate#fork-destination-box) our repository, then create a `feature` branch from the `master` branch. For instance `feature/some-bug-fix` or `feature/some-cool-new-feature`.

Once you've coded things up, be sure you check that your code is following our [coding standards](https://github.com/infinum/coding-standards-wp). Also test that your code isn't breaking anything :)

Then submit a pull request to `develop` branch. Once we check everything we'll merge the changes into `master` with correct version correction (noted by the milestone flag and `future release` tag).

## Integration testing

If you want to create integration tests for your code that would be great. We will add some in due time, and they are not necessary for a PR.
35 changes: 35 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!--- Hi there! We see that you like our boilerplate and you have found an issue. -->
<!--- This means a lot to us, because it help us improving our code :) -->
<!--- Please use the Title field to provide a clear summary of the issue. -->

<!-- These comments won't be shown in the issue, but will help in creating a better
issue tracker, so that the maintainers of this project can help track the bug down and
squash it, or sort out any misunderstanding about the code.
Use the Preview link to see the final version before submitting. -->

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant, that means a lot to us -->
1.
2.
3.
4.

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* PHP version:
* Development environment: <!-- For development: MAMP, XAMPP, VVV, Docker, Laravel Valet, none if on live server -->
* Server type: <!-- Apache, Nginx, IIS -->
* Operating System and version:
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor
node_modules
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
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# Eightshift Libs

TBD
This library is aimed at bringing the modern development tools to the [Eightshift WordPress Boilerplate](https://github.com/infinum/wp-boilerplate), but you can use it on any WordPress project.

It uses central service instantiator that instatiates all classes that obey single responsibility principle (SRP). Every class is responsible for registering its own hooks. This provides a more testable environment for your project.

We provide some helpers, abstract classes, interfaces and abstractions on original WordPress functionlality to help you write more modern code.

Provided functionality:
* Main theme/plugin entrypoint.
* Post Type Registration.
* Taxonomy Registration.
* Gutenberg Blocks Registration.
* Assets Manifest data.

## :mailbox: Who do I talk to?

For questions talk to:

* [[email protected]]([email protected])
* [[email protected]]([email protected])
* [[email protected]]([email protected])
* [[email protected]]([email protected])

Eightshift WordPress Boilerplate is maintained and sponsored by Eightshift and Infinum.

## :scroll: License

Eightshift WordPress Boilerplate is Copyright ©2019 Eightshift. It is free software, and may be redistributed under the terms specified in the LICENSE file.
49 changes: 49 additions & 0 deletions bin/lintPhp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# pre-commit.sh
#
# This hook is ran every time a commit is attempted. For commit to pass, the minimum requirement is that
# WPCS checks pass.

PROJECT=`php -r "echo dirname(dirname(realpath('$0')));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`

#Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='
'
SFILES="$1"
IFS=$oIFS
fi
SFILES=${SFILES:-$STAGED_FILES_CMD}

echo "-----------------"
echo "Checking PHP Lint"
echo "-----------------"
for FILE in $SFILES
do
php -l -d display_errors=0 $PROJECT/$FILE
if [ $? != 0 ]
then
echo "Fix the error before commit."
exit 1
fi
FILES="$FILES $PROJECT/$FILE"
done

if [ "$FILES" != "" ]
then
echo "--------------------"
echo "Running Code Sniffer"
echo "--------------------"
composer check-cs -- -p --parallel=4 --colors $FILES
if [ $? != 0 ]
then
echo "Possible warnings and errors found."
exit 1
fi
fi

exit $?
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* File that holds faq custom post type registration details
*
* @since 1.0.0
* @package Custom_Namespace\Admin
* @package Custom_Namespace\Examples
*
* TODO: Refactor and test
*/

namespace Custom_Namespace\Admin;
namespace Custom_Namespace\Examples;

use Eightshift_Libs\Custom_Post_Type\Base_Post_Type;
use Eightshift_Libs\Custom_Post_Type\Label_Generator;
Expand All @@ -16,7 +18,7 @@
*
* @since 1.0.0
*/
final class Faq extends Base_Post_Type {
final class Example_Faq_Post_Type extends Base_Post_Type {

/**
* The custom post type type slug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
* File that holds taxonomy class for fax taxonomy registration
*
* @since 1.0.0
* @package Custom_Namespace\Admin
* @package Custom_Namespace\Examples
*
* TODO: Refactor and test
*/

namespace Custom_Namespace\Admin;
namespace Custom_Namespace\Examples;

use Eightshift_Libs\Custom_Taxonomy\Base_Taxonomy;
use Eightshift_Libs\Custom_Post_Type\Label_Generator;

use Custom_Namespace\Admin\Faq;
use Custom_Namespace\Examples\Example_Faq_Post_Type;

/**
* Class Faq_Taxonomy.
* Class Example_Faq_Taxonomy.
*
* @since 1.0.0
*/
class Faq_Taxonomy extends Base_Taxonomy {
class Example_Faq_Taxonomy extends Base_Taxonomy {
/**
* The systems custom taxonomy type slug
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*
* @since 1.0.0
* @package Custom_Namespace\Blocks\Heading
*
* TODO: Refactor and test
*/

namespace Custom_Namespace\Blocks\Heading;
Expand All @@ -13,7 +15,7 @@
/**
* Class Heading
*/
class Heading extends Base_Block {
class Example_Heading extends Base_Block {

/**
* Block's name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
/**
* The file that defines the main start class
*
* A class definition that includes attributes and functions used across both the
* A class definition that Core attributes and functions used across both the
* theme-facing side of the site and the admin area.
*
* @since 1.0.0
* @package Custom_Namespace\Includes
* @package Custom_Namespace\Core
*
* TODO: Refactor and test
*/

namespace Custom_Namespace\Includes;
namespace Custom_Namespace\Core;

use Eightshift_Libs\Core\Main as LibMain;

Expand All @@ -24,7 +26,7 @@
* Also maintains the unique identifier of this theme as well as the current
* version of the theme.
*/
class Main extends LibMain {
class Example_Main extends LibMain {

/**
* Get the list of services to register.
Expand Down
Loading

0 comments on commit 52707ce

Please sign in to comment.