Skip to content

Commit a889e92

Browse files
committed
Add contribution guidelines
Previously there were no guidelines for contribution to the project. This change adds those instructions. This change also brings the code in line with contribution guidelines and updates all dependencies to their latest versions. [#53287601]
1 parent 0edd8d2 commit a889e92

82 files changed

Lines changed: 1577 additions & 1265 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.rubocop.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
Documentation:
3+
Enabled: false
4+
LineLength:
5+
Enabled: false
6+
MethodLength:
7+
Max: 25
8+
ParameterLists:
9+
Max: 6

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.0-p0
1+
1.9.3-p448

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
language: ruby
23
rvm:
34
- 2.0.0

CONTRIBUTING.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
_Have something you’d like to contribute to the buildpack? We welcome pull requests, but ask that you carefully read this document first to understand how best to submit them; what kind of changes are likely to be accepted; and what to expect from the Cloud Foundry Java Experience team when evaluating your submission._
2+
3+
_Please refer back to this document as a checklist before issuing any pull request; this will save time for everyone!_
4+
5+
## Understanding the basics
6+
Not sure what a pull request is, or how to submit one? Take a look at GitHub's excellent [help documentation][] first.
7+
8+
[help documentation]: http://help.github.com/send-pull-requests
9+
10+
## Search GitHub Issues first; create an issue if necessary
11+
Is there already an issue that addresses your concern? Do a bit of searching in our [GitHub issue tracker][] to see if you can find something similar. If not, please create a new issue before submitting a pull request unless the change is truly trivial, e.g. typo fixes, removing compiler warnings, etc.
12+
13+
[GitHub issue tracker]: https://github.com/cloudfoundry/java-buildpack/issues
14+
15+
## Discuss non-trivial contribution ideas with committers
16+
17+
If you're considering anything more than correcting a typo or fixing a minor bug, please discuss it on the [vcap-dev][] mailing list before submitting a pull request. We're happy to provide guidance, but please spend an hour or two researching the subject on your own including searching the mailing list for prior discussions.
18+
19+
[vcap-dev]: https://groups.google.com/a/cloudfoundry.org/forum/#!forum/vcap-dev
20+
21+
## Sign the Contributor License Agreement
22+
Please open an issue in the [GitHub issue tracker][] to receive instructions on how to fill out the Contributor License Agreement.
23+
24+
## Use short branch names
25+
Branches used when submitting pull requests should preferably using succinct, lower-case, dash (-) delimited names, such as 'fix-warnings', 'fix-typo', etc. In [fork-and-edit][] cases, the GitHub default 'patch-1' is fine as well. This is important, because branch names show up in the merge commits that result from accepting pull requests, and should be as expressive and concise as possible.
26+
27+
[fork-and-edit]: https://github.com/blog/844-forking-with-the-edit-button
28+
29+
## Mind the whitespace
30+
Please carefully follow the whitespace and formatting conventions already present in the code.
31+
32+
1. Space, not tabs
33+
1. Unix (LF), not DOS (CRLF) line endings
34+
1. Eliminate all trailing whitespace
35+
1. Wrap RubyDoc at 120 characters
36+
1. Aim to wrap code at 120 characters, but favor readability over wrapping
37+
1. Preserve existing formatting; i.e. do not reformat code for its own sake
38+
1. Search the codebase using `git grep` and other tools to discover common naming conventions, etc.
39+
1. Latin-1 (ISO-8859-1) encoding for sources; use `native2ascii` to convert if necessary
40+
41+
## Add Apache license header to all new classes
42+
```ruby
43+
# Cloud Foundry Java Buildpack
44+
# Copyright 2013 the original author or authors.
45+
#
46+
# Licensed under the Apache License, Version 2.0 (the "License");
47+
# you may not use this file except in compliance with the License.
48+
# You may obtain a copy of the License at
49+
#
50+
# http://www.apache.org/licenses/LICENSE-2.0
51+
#
52+
# Unless required by applicable law or agreed to in writing, software
53+
# distributed under the License is distributed on an "AS IS" BASIS,
54+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
55+
# See the License for the specific language governing permissions and
56+
# limitations under the License.
57+
58+
require ...;
59+
```
60+
## Update Apache license header to modified files as necessary
61+
Always check the date range in the license header. For example, if you've modified a file in 2014 whose header still reads
62+
63+
```ruby
64+
# Copyright 2013 the original author or authors.
65+
```
66+
67+
then be sure to update it to 2014 appropriately
68+
69+
```ruby
70+
# Copyright 2013-2014 the original author or authors.
71+
```
72+
73+
## Submit RSpec test cases for all behavior changes
74+
Search the codebase to find related unit tests and add additional test specs within.
75+
76+
## Squash commits
77+
Use `git rebase --interactive`, `git add --patch` and other tools to "squash"multiple commits into atomic changes. In addition to the man pages for git, there are many resources online to help you understand how these tools work. Here is one: <http://book.git-scm.com/4_interactive_rebasing.html>.
78+
79+
## Use real name in git commits
80+
Please configure git to use your real first and last name for any commits you intend to submit as pull requests. For example, this is not acceptable:
81+
82+
```plain
83+
Author: Nickname <user@mail.com>
84+
```
85+
86+
Rather, please include your first and last name, properly capitalized, as submitted against the Pivotal contributor license agreement:
87+
88+
```plain
89+
Author: First Last <user@mail.com>
90+
```
91+
92+
This helps ensure traceability against the CLA, and also goes a long way to ensuring useful output from tools like `git shortlog` and others.
93+
94+
You can configure this globally via the account admin area GitHub (useful for fork-and-edit cases); globally with
95+
96+
```bash
97+
git config --global user.name "First Last"
98+
git config --global user.email user@mail.com
99+
```
100+
101+
or locally for the `java-buildpack` repository only by omitting the `--global` flag:
102+
103+
```bash
104+
cd java-buildpack
105+
git config user.name "First Last"
106+
git config user.email user@mail.com
107+
```
108+
109+
## Format commit messages
110+
Please read and follow the [commit guidelines section of Pro Git][].
111+
112+
Most importantly, please format your commit messages in the following way (adapted from the commit template in the link above):
113+
114+
```plain
115+
Short (50 chars or less) summary of changes
116+
117+
More detailed explanatory text, if necessary. Wrap it to about 72
118+
characters or so. In some contexts, the first line is treated as the
119+
subject of an email and the rest of the text as the body. The blank
120+
line separating the summary from the body is critical (unless you omit
121+
the body entirely); tools like rebase can get confused if you run the
122+
two together.
123+
124+
Further paragraphs come after blank lines.
125+
126+
- Bullet points are okay, too
127+
128+
- Typically a hyphen or asterisk is used for the bullet, preceded by a
129+
single space, with blank lines in between, but conventions vary here
130+
131+
Issue: #10, #11
132+
```
133+
134+
1. Use imperative statements in the subject line, e.g. "Fix broken RubyDoc link"
135+
1. Begin the subject line sentence with a capitalized verb, e.g. "Add, Prune, Fix, Introduce, Avoid, etc."
136+
1. Do not end the subject line with a period
137+
1. Keep the subject line to 50 characters or less if possible
138+
1. Wrap lines in the body at 72 characters or less
139+
1. Mention associated GitHub issue(s) at the end of the commit comment, prefixed with "Issue: " as above
140+
1. In the body of the commit message, explain how things worked before this commit, what has changed, and how things work now
141+
142+
[commit guidelines section of Pro Git]: http://progit.org/book/ch5-2.html#commit_guidelines
143+
144+
## Run all tests prior to submission
145+
See the [Running Tests][] section of the README for instructions. Make sure that all tests pass prior to submitting your pull request.
146+
147+
[Running Tests]: README.md#running-tests
148+
149+
# Submit your pull request
150+
Subject line:
151+
152+
Follow the same conventions for pull request subject lines as mentioned above for commit message subject lines.
153+
154+
In the body:
155+
156+
1. Explain your use case. What led you to submit this change? Why were existing mechanisms in the buildpack insufficient? Make a case that this is a general-purpose problem and that yours is a general-purpose solution, etc.
157+
1. Add any additional information and ask questions; start a conversation, or continue one from GitHub issue
158+
1. Also mention that you have submitted the CLA as described above
159+
160+
Note that for pull requests containing a single commit, GitHub will default the subject line and body of the pull request to match the subject line and body of the commit message. This is fine, but please also include the items above in the body of the request.
161+
162+
## Expect discussion and rework
163+
The Cloud Foundry Java Experience team takes a very conservative approach to accepting contributions to the buildpack. This is to keep code quality and stability as high as possible, and to keep complexity at a minimum. Your changes, if accepted, may be heavily modified prior to merging. You will retain "Author:" attribution for your Git commits granted that the bulk of your changes remain intact. You may be asked to rework the submission for style (as explained above) and/or substance. Again, we strongly recommend discussing any serious submissions with the Cloud Foundry Java Experience team _prior_ to engaging in serious development work.
164+
165+
Note that you can always force push (`git push -f`) reworked / rebased commits against the branch used to submit your pull request. i.e. you do not need to issue a new pull request when asked to make changes.

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
33
group :development do
44
gem 'rake'
55
gem 'redcarpet'
6+
gem 'rubocop'
67
gem 'yard'
78
end
89

Gemfile.lock

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,38 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
addressable (2.3.5)
5-
crack (0.4.0)
5+
ast (1.1.0)
6+
backports (3.3.3)
7+
crack (0.4.1)
68
safe_yaml (~> 0.9.0)
79
diff-lcs (1.2.4)
810
multi_json (1.7.7)
11+
parser (2.0.0.pre2)
12+
ast (~> 1.1)
13+
slop (~> 3.4, >= 3.4.5)
14+
powerpack (0.0.1)
15+
rainbow (1.1.4)
916
rake (10.1.0)
1017
redcarpet (3.0.0)
1118
rspec (2.14.1)
1219
rspec-core (~> 2.14.0)
1320
rspec-expectations (~> 2.14.0)
1421
rspec-mocks (~> 2.14.0)
15-
rspec-core (2.14.2)
22+
rspec-core (2.14.4)
1623
rspec-expectations (2.14.0)
1724
diff-lcs (>= 1.1.3, < 2.0)
1825
rspec-mocks (2.14.1)
26+
rubocop (0.10.0)
27+
backports (~> 3.3.3)
28+
parser (= 2.0.0.pre2)
29+
powerpack (= 0.0.1)
30+
rainbow (>= 1.1.4)
1931
safe_yaml (0.9.4)
2032
simplecov (0.7.1)
2133
multi_json (~> 1.0)
2234
simplecov-html (~> 0.7.1)
2335
simplecov-html (0.7.1)
36+
slop (3.4.5)
2437
webmock (1.13.0)
2538
addressable (>= 2.2.7)
2639
crack (>= 0.3.2)
@@ -33,6 +46,7 @@ DEPENDENCIES
3346
rake
3447
redcarpet
3548
rspec
49+
rubocop
3650
simplecov
3751
webmock
3852
yard

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,22 @@ The buildpack supports configuration and extension through the use of Git reposi
4242
* [Repositories](docs/util-repositories.md)
4343
* [Repository Builders](docs/util-repository-builders.md)
4444
* [Test Applications](docs/util-test-applications.md)
45+
46+
## Running Tests
47+
To run the tests, do the following:
48+
49+
```bash
50+
bundle install
51+
bundle exec rake
52+
```
53+
54+
## Contributing
55+
[Pull requests][] are welcome; see the [contributor guidelines][] for details.
56+
57+
[Pull requests]: http://help.github.com/send-pull-requests
58+
[contributor guidelines]: CONTRIBUTING.md
59+
60+
## License
61+
The Tomcat Builder is released under version 2.0 of the [Apache License][].
62+
63+
[Apache License]: http://www.apache.org/licenses/LICENSE-2.0

Rakefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ RSpec::Core::RakeTask.new
1919
require 'yard'
2020
YARD::Rake::YardocTask.new
2121

22+
require 'rubocop/rake_task'
23+
Rubocop::RakeTask.new
24+
2225
require 'rake/clean'
2326
CLEAN.include %w(.yardoc coverage)
2427
CLOBBER.include %w(doc pkg)
2528

26-
task :default => :spec
29+
task :default => [ :rubocop, :yard, :spec ]

bin/compile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env ruby
2+
# Encoding: utf-8
23
# Cloud Foundry Java Buildpack
34
# Copyright (c) 2013 the original author or authors.
45
#
@@ -15,7 +16,7 @@
1516
# limitations under the License.
1617

1718
$stdout.sync = true
18-
$:.unshift File.expand_path("../../lib", __FILE__)
19+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1920

2021
require 'java_buildpack/buildpack'
2122

bin/detect

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env ruby
2+
# Encoding: utf-8
23
# Cloud Foundry Java Buildpack
34
# Copyright (c) 2013 the original author or authors.
45
#
@@ -15,19 +16,21 @@
1516
# limitations under the License.
1617

1718
$stdout.sync = true
18-
$:.unshift File.expand_path("../../lib", __FILE__)
19+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1920

2021
require 'java_buildpack/buildpack'
2122

2223
build_dir = ARGV[0]
2324

2425
begin
25-
components = JavaBuildpack::Buildpack.new(build_dir).detect().compact
26-
unless components.empty?
27-
puts components.join(', ')
28-
else
26+
components = JavaBuildpack::Buildpack.new(build_dir).detect.compact
27+
28+
if components.empty?
2929
abort
30+
else
31+
puts components.join(', ')
3032
end
33+
3134
rescue => e
3235
puts "Detect failed with exception #{e.inspect}, #{e.backtrace}\n"
3336
abort e.message

0 commit comments

Comments
 (0)