Pārlūkot izejas kodu

Describe "simple" setup, leveraging the CI build.

- trimmed a bunch: the fewer words used, the more words read.
- removed step-by-step full setup in favor of referring to the CI
  script.
John S. Ryan 10 gadus atpakaļ
vecāks
revīzija
0216567555
1 mainītis faili ar 42 papildinājumiem un 186 dzēšanām
  1. 42
    186
      README.md

+ 42
- 186
README.md Parādīt failu

1
 # xJava [![Build Status](https://travis-ci.org/exercism/xjava.svg?branch=master)](https://travis-ci.org/exercism/xjava)
1
 # xJava [![Build Status](https://travis-ci.org/exercism/xjava.svg?branch=master)](https://travis-ci.org/exercism/xjava)
2
 
2
 
3
-Exercism Exercises in Java.
3
+Source for Exercism Exercises in Java.
4
 
4
 
5
 ## Contributing Guide
5
 ## Contributing Guide
6
 
6
 
9
 ## Table of Contents
9
 ## Table of Contents
10
 
10
 
11
 * [Overview](#overview)
11
 * [Overview](#overview)
12
-* [Getting Setup](#getting-setup)
12
+* [Contributing With Minimal Setup](#contributing-with-minimal-setup)
13
 * [Getting Familiar With the Codebase](#getting-familiar-with-the-codebase)
13
 * [Getting Familiar With the Codebase](#getting-familiar-with-the-codebase)
14
-  * [The Rootproject](#the-rootproject)
15
-  * [The Problem Subprojects](#the-problem-subprojects)
16
-  * [Running The Build](#running-the-build)
17
-* [Developing](#developing)
18
-  *  [Tip: gradle clean before exercism fetch](#tip-gradle-clean-before-exercism-fetch)
19
-* [Submitting Your Contribution](#submitting-your-contribution)
20
-  * [Doing the Commit Dance](#doing-the-commit-dance)
21
-  * [Making the Pull Request](#making-the-pull-request)
22
-* [Reverting Your CLI Config](#reverting-your-cli-config)
14
+  * [The `exercises` Module](#the-exercises-module)
15
+  * [The Problem Submodules](#the-problem-submodules)
16
+* [Advanced: Complete Local Setup](#advanced-complete-local-setup)
17
+  * [Tip: `gradle clean` before `exercism fetch`](#tip-gradle-clean-before-exercism-fetch)
23
 
18
 
24
 
19
 
25
 ## Overview
20
 ## Overview
26
 
21
 
27
-This guide walks you through how to contribute to the Java language track.  It is opinionated and specific to allow those who are relatively new to Free Open Source Software to have a fighting chance of being successful.  However, if you know what you're doing, we intend these instructions to be guidelines.
28
-
29
-The steps described herein were composed on OS X.  They will presumably work with no change on any \*nix distro.  Almost all of them will work on Windows; though you might want to use cygwin or some other Unix support for creating soft-links.  Otherwise, you'll need to improvise on some steps.  If you *do* find a nice workflow for Windows, please feel free to submit a PR for changes to this doc.  Thanks!
30
-
31
-This guide flows chronologically, from setting-up your environment, taking a quick tour of the build process to finally what it takes to successfully submit.
22
+This guide covers contributing to the Java track.  If you are new, this guide is for you.
32
 
23
 
33
 If, at any point, you're having any trouble, pop in the [Gitter exercism/dev room](https://gitter.im/exercism/dev) for help.
24
 If, at any point, you're having any trouble, pop in the [Gitter exercism/dev room](https://gitter.im/exercism/dev) for help.
34
 
25
 
26
+## Contributing With Minimal Setup
35
 
27
 
36
-## Getting Set Up
37
-
38
-You'll *need* the following:
39
-
40
-* Java 1.8+
41
-* Gradle 2.x
42
-* Ruby 1.9+  (to run the [x-api](https://github.com/exercism/x-api)).
43
-* Git 1.x
44
-
45
-If you haven't already, please read our advice on [Git Workflow](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#maintaining-a-track).
46
-
47
-
48
-Here's one way to get setup:
49
-
50
-1. **Stand-up the x-api, locally.**  You should ultimate verify your work by delivering your problem through the exercism CLI and solving it from that `exercism fetch`'ed copy.  The CLI fetches problems from the x-api.  You'll need your own instance of the x-api running locally.
28
+First things first: by contributing to Exercism, you are making this learning tool that much better and improving our industry as a whole... thank you!!!
51
 
29
 
52
-	```
53
-	cd ~
54
-	mkdir -p workspace/exercism && cd workspace/exercism
55
-	git clone https://github.com/exercism/x-api
56
-	cd x-api
57
-	bundle install
58
-	git submodule init
59
-	git submodule update
60
-	rackup
61
-	```
30
+To submit a fix for an existing exercise or port an exercise to Java with the least amount of setup:
62
 
31
 
63
-If you want more details, check out the [x-api README](https://github.com/exercism/x-api/blob/master/README.md).
32
+1. **Ensure you have the basic Java tooling installed:**  JDK 1.8+, an editor and Gradle 2.x.
64
 
33
 
65
-2. **Configure your exercism CLI to point to that x-api.** Out of the box, the CLI is configured to point to the production instances of the API (for account-specific data) and X-API (for problem data).  You need to configure your CLI to point to the X-API instance you stood up in the prior step.
34
+   (see [exercism.io: Installing Java](http://exercism.io/languages/java/installing))
35
+-  **Setup a branch on a fork of [exercism/xjava](https://github.com/exercism/xjava) on your computer.**
66
 
36
 
67
-	If you haven't already, you'll need need to [install the CLI](http://exercism.io/cli).
37
+   See [GitHub Help: Forking](https://help.github.com/articles/fork-a-repo/).  Use those instructions (in conjunction with [Exercism Contributing Guide](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#git-basics)) to:
38
+   * "fork" a repository on GitHub;
39
+   - install `git`;
40
+   - "clone" a copy of your fork;
41
+   - configure an "upstream remote" (in this case, `exercism/xjava`);
42
+   - create a branch to house your work
43
+-  **Write the codes.**  Do your work on that branch you just created.
68
 
44
 
69
-	```
70
-	cd ~
71
-	mkdir -p workspace/exercism/exercises
72
-	cd ~/workspace/exercism/exercises
73
-	exercism configure --dir=~/workspace/exercism/exercises
74
-	exercism configure --api http://localhost:9292
75
-	exercism debug
76
-	exercism fetch java bob
77
-	tree java
78
-	```
45
+   The [Getting Familiar With the Codebase](#getting-familiar-with-the-codebase) section, below, is an orientation.
46
+-  **Commit, push and create a pull request.**
79
 
47
 
80
-	If things are properly setup:
81
-	* `exercism debug` output will include "`XAPI: http://localhost:9292 [connected]`"
82
-	* `tree java` will look something like this:
83
-
84
-		```
85
-		java
86
-		└── bob
87
-		    ├── README.md
88
-		    ├── build.gradle
89
-		    └── src
90
-		        └── test
91
-		            └── java
92
-		                └── BobTest.java
93
-		```
94
-
95
-3. **Point your local x-api to your xjava fork.**  Most people contribute by submitting pull request from their fork of the track repo (covered below).  To make it easy to develop, replace the java problem set in your local x-api with your fork:
96
-
97
-	If you haven't already, fork the track repo: [exercism/xjava](https://github.com/exercism/xjava).
98
-
99
-	```
100
-	cd ~/workspace/exercism/
101
-	git clone git@github.com:jtigger/xjava.git
102
-	git remote add upstream https://github.com/exercism/xjava.git
103
-	git pull --rebase upstream/master
104
-	cd ~/workspace/exercism/x-api/tracks
105
-	mv java java-original
106
-	ln -s ../../xjava java
107
-	```
48
+   Something like:
49
+   ```
50
+   $ git add .
51
+   $ git commit -m "(An intention-revealing commit message)"
52
+   $ git push
53
+   ```
108
 
54
 
109
-You are now ready to go!
55
+   [Exercism Contributing Guide :: Commit Messages](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#commit-messages) provides practical advice on crafting meaningful commit messages.
56
+-  **Verify that your work passes all tests.**  When you create a pull request (PR), GitHub triggers a build on Travis CI.  Your PR will not be merged unless those tests pass.
110
 
57
 
111
 ## Getting Familiar With the Codebase
58
 ## Getting Familiar With the Codebase
112
 
59
 
117
 
64
 
118
 This repo is a mulit-project gradle build.
65
 This repo is a mulit-project gradle build.
119
 
66
 
120
-### The Rootproject
67
+### The `exercises` Module
121
 
68
 
122
-The rootproject is a container for the problem subprojects.
69
+This is the top-level module, contained in the `exercises` directory.  It is a container for the problem sub-modules.
123
 
70
 
124
   * it's `build.gradle` points the "main" sourceset to the example code.
71
   * it's `build.gradle` points the "main" sourceset to the example code.
125
   * it's `settings.gradle` names each of the subprojects, one for each problem in the set.
72
   * it's `settings.gradle` names each of the subprojects, one for each problem in the set.
126
 
73
 
74
+### The Problem Submodules
127
 
75
 
128
-### The Problem Subprojects
129
-
130
-The `exercises` subdirectory contains all of the problem subprojects.
131
-Each problem/subproject is a subdirectory of the same name as its slug.
76
+The `exercises` subdirectory contains all of the problem submodules.
77
+Each problem/submodule is a subdirectory of the same name as its slug.
132
 
78
 
133
   * it's `build.gradle` names dependencies required to work that problem.
79
   * it's `build.gradle` names dependencies required to work that problem.
134
 
80
 
135
-Each problem/subproject has three source sets:
81
+Each problem/submodule has three source sets:
136
 
82
 
137
 * `src/test/java/` — a test suite defining the edges of the problem
83
 * `src/test/java/` — a test suite defining the edges of the problem
138
 * `src/example/java/` — an example solution that passes all the tests
84
 * `src/example/java/` — an example solution that passes all the tests
139
 * `src/main/java/` — starter source files, if required/desired *(this directory usually only has a `.keep` file in it)*.
85
 * `src/main/java/` — starter source files, if required/desired *(this directory usually only has a `.keep` file in it)*.
140
 
86
 
141
-### Running The Build
142
-
143
-To run all the tests against example code:
87
+----
144
 
88
 
145
-```
146
-cd ~/workspace/exercism/xjava/exercises
147
-gradle assemble check
148
-```
149
-
150
-To run the test against just one problem, run gradle from within that directory:
151
-
152
-```
153
-cd ~/workspace/exercism/xjava/exercises/bob
154
-gradle assemble check
155
-```
156
-
157
-To run the complete build as done on CI (which includes compiling any "starter" code and running the configlet tool):
89
+## Advanced: Complete Local Setup
158
 
90
 
159
-```
160
-cd ~/workspace/exercism/xjava
161
-./bin/build.sh
162
-```
91
+If you are going to make significant contribution(s) to the track, you might find it handy to have a complete local install of exercism on your computer.  This way, you can run the full suite of tests without having to create/update a PR.
163
 
92
 
164
-## Developing
93
+The easiest way to achieve this is simply use the `bin/journey-test.sh` script.  However, you may want to perform other tests, depending on what you are doing.  You can do so by duplicating the setup performed by the `bin/journey-test.sh` script.
165
 
94
 
166
-### Tip: gradle clean before exercism fetch
95
+### Tip: `gradle clean` before `exercism fetch`
167
 
96
 
168
 If you `exercism fetch` after doing a build, the CLI will fail with the following error message:
97
 If you `exercism fetch` after doing a build, the CLI will fail with the following error message:
169
 
98
 
180
 2015-09-06 15:21:01 - JSON::GeneratorError - source sequence is illegal/malformed utf-8:
109
 2015-09-06 15:21:01 - JSON::GeneratorError - source sequence is illegal/malformed utf-8:
181
 ```
110
 ```
182
 
111
 
183
-This is because some files generated by the build can't be served from the x-api.  That's actually fine.  To fix this, simply make sure you do a clean in your xjava repo before you fetch:
112
+This is because some files generated by the build can't be served from the x-api.  This is by design: the CLI does not serve binaries.  To fix this, simply make sure you do a clean in your `xjava` repo before you fetch:
184
 
113
 
185
 ```
114
 ```
186
 cd ~/workspace/exercism/xjava/exercises
115
 cd ~/workspace/exercism/xjava/exercises
189
 exercism fetch java bob
118
 exercism fetch java bob
190
 ```
119
 ```
191
 
120
 
192
-## Submitting Your Contribution
193
-
194
-First of all... Exercism is meant help programmers, world-wide, to develop their skills and in doing so help raise the bar on our industry as a whole.  Your contribution is making that experience even better.  Thank you!
195
-
196
-Before you submit a pull request, please ensure:
197
-
198
-- the test suite covers the essential parts of the problem and interesting corner cases.
199
-- the build script (`./bin/build.sh`) compiles and tests your code successfully.
200
-
201
-
202
-### Doing the Commit Dance
203
-*(These instructions assume you setup your development environment using the instructions above.)*
204
-
205
-1. **Run the build script, locally.**
206
-
207
-   ```
208
-   cd ~/workspace/exercism/xjava
209
-   ./bin/build.sh
210
-   ```
211
-
212
-   ...verify that the script runs successfully.
213
-
214
-   Then, since your x-api is serving from this directory, make it pristine (see [Tip: gradle clean before exercism fetch](#tip-gradle-clean-before-exercism-fetch) for details):
215
-
216
-   ```
217
-   cd ~/workspace/exercism/xjava/exercises
218
-   gradle clean
219
-   ```
220
-
221
-2. **Fetch the problem from your local x-api, using the CLI.**
222
-
223
-   ```
224
-   cd ~/workspace/exercism/exercises
225
-   exercism fetch java <problem-slug>
226
-   ```
227
-
228
-   verify that the fetched problem does *not* contain any files not needed for the problem.
229
-   
230
-   Note: some changes may require that you restart your local copy of the API server.
231
-
232
-3. **Run the tests against the example source.**
233
-
234
-   ```
235
-   cd ~/workspace/exercism/exercises/java/<problem-slug>
236
-   cp ~/workspace/exercism/xjava/exercises/<problem-slug>/src/example/java/* src/main/java
237
-   gradle check
238
-   ```
239
-
240
-   verify that all tests pass.
241
-
242
-If you've successfully navigated to this point, you're ready to make that pull request!
243
-
244
-### Making the Pull Request
245
-
246
-Hopefully you've read our [Git Workflow](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#maintaining-a-track) and done your work on a clone of a fork of the exercism xjava repo.
247
-
248
-After you've pushed your changes to your fork (best done on a branch, remember), it's a matter of going to GitHub and submitting a pull request.
249
-
250
-When you do so, notice that it automatically kicks off a CI build on Travis.  This is an important step: **be sure to wait for the CI results to come back before you leave!**  Pull Requests that do no pass CI will not be merged in.
251
-
252
-One of the track maintainers will review your PR as soon as we can.
253
-
254
-If you need help, drop in on the [Gitter exercism/dev room](https://gitter.im/exercism/dev).
255
-
256
-
257
-## Reverting Your CLI Config
258
-
259
-In the setup, above, we configured the CLI client to point to your local x-api instance.  Presumably, you like to submit solutions, yourself.  To revert your CLI back to the the production x-api:
260
-
261
-```
262
-exercism configure --api http://x.exercism.io
263
-```
264
-
265
 
121
 
266
 # License
122
 # License
267
 
123