Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Fix Branching #7

Closed
4 tasks
mbabker opened this issue Jul 14, 2019 · 0 comments
Closed
4 tasks

Fix Branching #7

mbabker opened this issue Jul 14, 2019 · 0 comments

Comments

@mbabker
Copy link
Contributor

mbabker commented Jul 14, 2019

The branching of this repository should be fixed.

  • Create a 1.x branch from what is presently master

With that done, the following diff should be applied to the composer.json file:

diff --git a/composer.json b/composer.json
index eda994c..095cf8a 100644
--- a/composer.json
+++ b/composer.json
@@ -17,14 +17,14 @@
        }
     },
     "require": {
-        "php": ">=5.3.10",
-        "joomla/coding-standards": "~2.0 || ~3.0"
+        "php": "^5.3.10|^7.0",
+        "joomla/coding-standards": "^2.0|^3.0"
     },
     "require-dev": {
         "phpunit/phpunit": "^4.8.7"
     },
     "suggest" : {
-        "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
+        "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
     },
     "support"    : {
         "issues": "https://github.com/joomla/cms-coding-standards/issues",
@@ -32,7 +32,7 @@
     },
     "extra": {
         "branch-alias": {
-            "dev-master": "1.x-dev"
+            "dev-1.x": "1.x-dev"
         }
     },
     "scripts": {

(Explicitly lists supported PHP branches instead of allowing all versions arbitrarily, changes branch alias for 1.x versions)

  • Tweak the README to explain the branching

This diff will suffice (someone with admin will need to copy the diff from the "edit issue" input because the GitHub parser is breaking at the first set of closing backticks, or just manually apply all changes):

diff --git a/README.md b/README.md
index 5eb1a1f..95a766a 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,19 @@
-# cms-coding-standards
+# Joomla! CMS Coding Standards
 Extended Joomla Coding Standards definition for use in the Joomla CMS environment
 
 This repository includes the [Joomla](https://developer.joomla.org) CMS coding standard definition for [PHP Codesniffer](https://github.com/squizlabs/PHP_CodeSniffer).  The PHP_CodeSniffer standard will never be 100% accurate, but should be viewed as a strong set of guidelines while writing software for Joomla.
 
 See Joomla coding standards documentation at [https://developer.joomla.org/coding-standards.html](https://developer.joomla.org/coding-standards.html)
 
-If you want to contribute and improve this documentation, you can find the source files in the manual section of the master branch [https://github.com/joomla/coding-standards/tree/master/manual](https://github.com/joomla/coding-standards/tree/master/manual)
+If you want to contribute and improve this documentation, you can find the source files in the `manual` directory of the `master` branch of the main [Coding Standards](https://github.com/joomla/coding-standards) repository.
 
 ## Requirements
 
 * PHP 5.3+
 * [PHP Codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) 2.9+
+
 or
+
 * PHP 5.6+
 * [PHP Codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) 3.3.0+
 
@@ -22,27 +24,38 @@ Add `"joomla/cms-coding-standards": "~1.0"` to the require-dev block in your com
 ```json
 {
     "require-dev": {
-		"joomla/cms-coding-standards": "~1.0"
-	}
+        "joomla/cms-coding-standards": "~1.0"
+    }
 }

-Alternatively, you can simply run the following from the command line:
+Alternatively, you can run the following from the command line:

composer global require squizlabs/php_codesniffer "~2.8"
composer require joomla/cms-coding-standards "~1.0"

+## Branching Strategy
+
+This repository presently contains two branches:
+
+* 1.x - Compatible with the Joomla! Coding Standards 2.x or 3.x, Joomla! 3.x, and PHP_CodeSniffer 2.x or 3.x
+* master (2.x) - Compatible with the Joomla! Coding Standards 2.x or 3.x, Joomla! 4.x, and PHP_CodeSniffer 2.x or 3.x
+

Running

-You can use the installed Joomla standard like:
+You can use the installed Joomla-CS standard like:

  • phpcs --standard=Joomla-CMS path/to/code
    +sh +phpcs --standard=Joomla-CMS path/to/code +

Alternatively if it isn't installed you can still reference it by path like:

  • phpcs --standard=path/to/joomla/cms-coding-standards path/to/code
    +sh +phpcs --standard=path/to/joomla/cms-coding-standards path/to/code +

Selectively Applying Rules


(Has a couple of minor formatting tweaks, main point is the "Branching Strategy" section added)

- [ ] Merge changes from new `1.x` branch forward to `master` then `4.0-dev`

```sh
git checkout master
git merge 1.x
git checkout 4.0-dev
git merge master

(Self-explanatory I hope on why to do this)

  • Merge the 4.0-dev branch into master and delete the 4.0-dev branch
git checkout master
git merge 4.0-dev
git branch -D 4.0-dev
git push origin :4.0-dev

(This makes this repo's 2.x version the master branch)

  • Fix the branch alias for the (new) master branch to be 2.x
    "extra": {
        "branch-alias": {
            "dev-master": "2.x-dev"
        }
    },

Once complete, this will establish the 1.x branch as the 1.x version of the CMS coding standards (extending the main coding standards repo) as being compatible with the CMS' 3.x releases, and will establish the master branch as the 2.x version of the CMS coding standards (extending the main coding standards repo) as being compatible with the CMS' 4.x releases.

@mbabker mbabker closed this as completed Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant