Skip to content

Commit be20adb

Browse files
committed
Merge 3f869c8 into 379cfbe
2 parents 379cfbe + 3f869c8 commit be20adb

File tree

2 files changed

+148
-104
lines changed

2 files changed

+148
-104
lines changed

README-DEV.md

+44-27
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@
55
If you wish to contribute to Zend Framework, please be sure to
66
read/subscribe to the following resources:
77

8-
- ZF2 Requirements:
9-
http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Requirements
108
- Coding Standards:
119
http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards
1210
- ZF Git Guide:
1311
[README-GIT.md](README-GIT.md)
1412
- Contributor's Guide:
15-
http://framework.zend.com/wiki/display/ZFDEV/Contributing+to+Zend+Framework
13+
http://framework.zend.com/participate/contributor-guide
1614
- ZF Contributor's mailing list:
1715
Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html
1816
Subscribe: [email protected]
1917
- ZF Contributor's IRC channel:
20-
#zftalk.2 on Freenode.net
18+
#zftalk.dev on Freenode.net
2119

2220
If you are working on new features, or refactoring an existing
2321
component, please create a proposal. You can do this in on the RFC's
@@ -31,29 +29,48 @@ issues we've encountered in refactoring.
3129

3230
To run tests:
3331

34-
- Make sure you have a recent version of PHPUnit installed; 3.6.0
35-
minimally.
36-
- Enter the `tests/` subdirectory.
37-
- Execute PHPUnit, providing a path to a component directory for which
38-
you wish to run tests, or a specific test class file.
39-
40-
```sh
41-
% phpunit Zend/Http
42-
% phpunit Zend/Http/Header/EtagTest.php
43-
```
44-
45-
- You may also provide the `--group` switch; in such cases, provide the
46-
top-level component name:
47-
48-
```sh
49-
% phpunit --group Zend_Http
50-
```
51-
This will likely lead to errors, so it's usually best to specify a
52-
specific component in which to run test:
53-
54-
```sh
55-
% phpunit --group ZF-XYZ Zend/Http
56-
```
32+
- Make sure you have a recent version of PHPUnit installed; 3.6.0
33+
minimally.
34+
- Enter the `tests/` subdirectory.
35+
- Execute PHPUnit, providing a path to a component directory for which
36+
you wish to run tests, or a specific test class file.
37+
38+
```sh
39+
% phpunit ZendTest/Http
40+
% phpunit ZendTest/Http/Header/EtagTest.php
41+
```
42+
43+
- You may also provide the `--group` switch; in such cases, provide the
44+
top-level component name:
45+
46+
```sh
47+
% phpunit --group Zend_Http
48+
```
49+
50+
This will likely lead to errors, so it's usually best to specify a
51+
specific component in which to run test:
52+
53+
```sh
54+
% phpunit --group ZF-XYZ Zend/Http
55+
```
56+
- Alternately, use the `run-tests.php` script. This can be executed with no
57+
arguments to run all tests:
58+
59+
```sh
60+
% php run-tests.php
61+
```
62+
63+
You can also provide top-level component names to run tests for individual
64+
components or several components at a time. The component name is the the
65+
component namespace, without the `Zend\` prefix:
66+
67+
```sh
68+
% php run-tests Mvc
69+
```
70+
71+
```sh
72+
% php run-tests ModuleManager Mvc View Navigation
73+
```
5774

5875
You can turn on conditional tests with the TestConfiguration.php file.
5976
To do so:

README-GIT.md

+104-77
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
# USING THE GIT REPOSITORY
22

3-
## Initial Setup
4-
5-
First, make sure you know the email address associated with your JIRA
6-
credentials. All commits pushed to the master repository are checked
7-
against these addresses, so your repository will need to be configured
8-
to use that address. The following will give you that information:
9-
10-
1. Visit the ZF Crowd install: http://framework.zend.com/crowd
11-
2. Log in, if you aren't.
12-
3. Find the "My Profile" link in the upper right of the page, and follow
13-
it.
14-
4. The resulting page will display your profile, including the _email_
15-
address with which you are registered. Make a note of it.
16-
173
## Setup your own public repository
184

19-
Your next step is to establish a public repository from which we can
5+
Your first step is to establish a public repository from which we can
206
pull your work into the master repository. You have two options: use
217
github or other public site, or setup/use your own repository.
228

9+
While you can use a private repository and utilize ``git format-patch`` to
10+
submit patches, this is discouraged as it does not facilitate public peer
11+
review.
12+
2313
### Option 1: GitHub
2414

2515
1. Setup a GitHub account (http://github.com/), if you haven't yet
@@ -32,14 +22,7 @@ github or other public site, or setup/use your own repository.
3222
% cd zf2
3323
```
3424

35-
4. Configure git to use the email address with which you are registered
36-
in JIRA:
37-
38-
```sh
39-
% git config user.email <your email address>
40-
```
41-
42-
5. Add a remote to the canonical ZF repository, so you can keep your fork
25+
4. Add a remote to the canonical ZF repository, so you can keep your fork
4326
up-to-date:
4427

4528
```sh
@@ -49,10 +32,10 @@ github or other public site, or setup/use your own repository.
4932

5033
### Option 2: Personal Repository
5134

52-
We assume you will use gitosis (http://progit.org/book/ch4-7.html) or gitolite
53-
(http://progit.org/book/ch4-8.html) to host your own repository. If
54-
you go this route, we will assume you have the knowledge to do so, or
55-
know where to obtain it. We will not assist you in setting up such a
35+
We assume you will use gitosis (http://git-scm.com/book/en/Git-on-the-Server-Gitosis)
36+
or gitolite (http://git-scm.com/book/en/Git-on-the-Server-Gitolite) to host your
37+
own repository. If you go this route, we will assume you have the knowledge to
38+
do so, or know where to obtain it. We will not assist you in setting up such a
5639
repository.
5740

5841
1. Create a new repository
@@ -61,33 +44,26 @@ repository.
6144
% git init
6245
```
6346

64-
2. Configure git to use the email address with which you are registered
65-
in JIRA:
66-
67-
```sh
68-
% git config user.email <your email address>
69-
```
70-
71-
3. Add an "origin" remote pointing to your gitosis/gitolite repo:
47+
2. Add an "origin" remote pointing to your gitosis/gitolite repo:
7248

7349
```sh
7450
% git remote add origin git://yourdomain/yourrepo.git
7551
```
7652

77-
4. Add a remote for the ZF repository and fetch it
53+
3. Add a remote for the ZF repository and fetch it
7854

7955
```sh
8056
% git remote add zf2 https://github.com/zendframework/zf2.git
8157
% git fetch zf2
8258
```
8359

84-
5. Create a new branch for the ZF repository (named "zf/master" here)
60+
4. Create a new branch for the ZF repository (named "zf/master" here)
8561

8662
```sh
8763
% git checkout -b zf/master zf2/master
8864
```
8965

90-
6. Create your master branch off the ZF branch, and push to your
66+
5. Create your master branch off the ZF branch, and push to your
9167
repository
9268

9369
```sh
@@ -100,29 +76,80 @@ repository.
10076
The ZF2 Travis-CI will confirm that code style standards are met
10177
by using ```php-cs-fixer``` (https://github.com/fabpot/PHP-CS-Fixer) during it's build runs.
10278
103-
To reduce the number of red Travis-CI builds, the following Git pre-commit hook can help catch code style
104-
issues before committing.
79+
To reduce the number of red Travis-CI builds, the following Git pre-commit hook
80+
can help catch code style issues before committing. Save it as
81+
```.git/hooks/pre-commit```, and make sure it is executable.
10582
10683
```sh
107-
#!/bin/sh
108-
# Git pre-commit hook to confirm ZF2 code style
109-
# Install under: zf2/.git/hooks/pre-commit (and ensure it is executable)
110-
111-
PROJECTROOT=`echo $(cd ${0%/*}/../../ && pwd -P)`/
112-
FIXER=php-cs-fixer
113-
114-
RES=`${FIXER} fix $PROJECTROOT -v --dry-run --level=psr2`
115-
if [ "$RES" != "" ]; then
116-
echo "ZF2 Coding standards are not correct, cancelling your commit."
117-
echo ""
118-
echo $RES
119-
echo ""
120-
echo "To fix, run:"
121-
echo ""
122-
echo " ${FIXER} fix ${PROJECTROOT} -v --level=psr2"
123-
echo ""
124-
exit 1
125-
fi
84+
#!/usr/bin/env php
85+
<?php
86+
/**
87+
* .git/hooks/pre-commit
88+
*
89+
* This pre-commit hooks will check for PHP errors (lint), and make sure the
90+
* code is PSR-2 compliant.
91+
*
92+
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
93+
*
94+
* @author Mardix http://github.com/mardix
95+
* @author Matthew Weier O'Phinney http://mwop.net/
96+
* @since 4 Sept 2012
97+
*/
98+
99+
$exit = 0;
100+
101+
/*
102+
* collect all files which have been added, copied or
103+
* modified and store them in an array called output
104+
*/
105+
$output = array();
106+
exec('git diff --cached --name-status --diff-filter=ACM', $output);
107+
108+
foreach ($output as $file) {
109+
if ('D' === substr($file, 0, 1)) {
110+
// deleted file; do nothing
111+
continue;
112+
}
113+
114+
$fileName = trim(substr($file, 1));
115+
116+
/*
117+
* Only PHP files
118+
*/
119+
$extension = pathinfo($fileName, PATHINFO_EXTENSION);
120+
if (!preg_match('/^ph(p|tml)$/', $extension)) {
121+
continue;
122+
}
123+
124+
/*
125+
* Check for parse errors
126+
*/
127+
$output = array();
128+
$return = 0;
129+
exec("php -l " . escapeshellarg($fileName), $output, $return);
130+
131+
if ($return != 0) {
132+
echo "PHP file fails to parse: " . $fileName . ":" . PHP_EOL;
133+
echo implode(PHP_EOL, $lintOutput) . PHP_EOL;
134+
$exit = 1;
135+
continue;
136+
}
137+
138+
/*
139+
* PHP-CS-Fixer
140+
*/
141+
$output = array();
142+
$return = null;
143+
exec("php-cs-fixer --dry-run --level=psr2 " . escapeshellarg($fileName), $output, $return);
144+
if ($return != 0 || !empty($output)) {
145+
echo "PHP file fails contains CS issues: " . $fileName . ":" . PHP_EOL;
146+
echo implode(PHP_EOL, $output) . PHP_EOL;
147+
$exit = 1;
148+
continue;
149+
}
150+
}
151+
152+
exit($exit);
126153
```
127154
128155
## Keeping Up-to-Date
@@ -140,6 +167,10 @@ the following:
140167
% git push origin
141168
```
142169
170+
If you're tracking other branches -- for example, the "develop" branch, where
171+
new feature development occurs -- you'll want to do the same operations for that
172+
branch; simply substibute "develop" for "master".
173+
143174
## Working on Zend Framework
144175
145176
When working on Zend Framework, we recommend you do each new feature or
@@ -199,6 +230,16 @@ email indicating you have changes to pull:
199230
- The nature of the changes (e.g., `implements
200231
Zend_Service_Twitter`, `fixes ZF-9295`, etc.)
201232
233+
### What branch to issue the pull request against?
234+
235+
Which branch should you issue a pull request against?
236+
237+
- For fixes against the stable release, issue the pull request against the
238+
"master" branch.
239+
- For new features, or fixes that introduce new elements to the public API (such
240+
as new public methods or properties), issue the pull request against the
241+
"develop" branch.
242+
202243
## Branch Cleanup
203244
204245
As you might imagine, if you are a frequent contributor, you'll start to
@@ -228,24 +269,10 @@ RSS feeds may be found at:
228269
229270
where &lt;branch&gt; is a branch in the repository.
230271
231-
To subscribe to git email notifications, send an email to:
232-
233-
234-
235-
You will need to reply to the verification email sent to you by this
236-
list.
237-
238-
Should you wish to filter emails from the list, they will use the
239-
"subject" line of commit messages, preceded by `[branch] `, and come
240-
272+
To subscribe to git email notifications, simply watch or fork the zf2 repository
273+
on GitHub.
241274
242275
## CONTRIBUTORS AND COMMITTERS
243276
244-
For the immediate future, and until we create a community process team,
245-
only the Zend team will be committers. If you have a patch or
246-
feature-set you wish to have incorporated into the repository, please
247-
issue a pull request to a committer. A pull request may be done by using
248-
git's "git-send-email" functionality, or by sending a request to a
249-
committer indicating the URL of your repository, the branch that should
250-
be pulled, and/or the specific revision(s) to pull.
251-
277+
Both Zend's internal Zend Framework team and the members of the Community Review
278+
team have push privileges to the ZF2 repository.

0 commit comments

Comments
 (0)