|
51 | 51 | have some unit tests and be documented so that other people can help maintain
|
52 | 52 | the rewrite.
|
53 | 53 |
|
| 54 | + @sect{scalacenter/scalafix.g8} |
| 55 | + @p |
| 56 | + Run the following commands to generate a skeleton project |
| 57 | + |
| 58 | + @hl.scala |
| 59 | + // by convention, --rewrite= should match the Github repo name. |
| 60 | + // this makes it possible for users to run `scalafix github:org/reponame/v1.0` |
| 61 | + sbt new scalacenter/scalafix.g8 --rewrite "reponame" --version=v1.0 |
| 62 | + cd reponame/scalafix |
| 63 | + sbt tests/test |
| 64 | + @p |
| 65 | + Note that the @code{scalafix} directory is a self-contained sbt build |
| 66 | + and can be put into the root directory of your repo. |
| 67 | + The tests are written using @sect.ref{scalafix-testkit}. |
| 68 | + |
54 | 69 | @sect{Example rewrites}
|
55 | 70 | The Scalafix repository contains several example rewrites and tests,
|
56 | 71 | see @lnk("here", "https://github.com/scalacenter/scalafix/tree/master/scalafix-core/src/main/scala/scalafix/rewrite").
|
|
159 | 174 | @p
|
160 | 175 | You have implemented a rewrite, you have tests, it works,
|
161 | 176 | and now you want to share it with the world. Congrats!
|
162 |
| - There are several ways to share a rewrite: |
| 177 | + There are several ways to share a rewrite if the rewrite is contained in |
| 178 | + a single file and uses no external dependencies, |
163 | 179 | @ul
|
164 | 180 | @li
|
165 |
| - If the rewrite is contained in a single file, then you can create a gist |
166 |
| - and tell users to use the @sect.ref{http:} protocol, |
167 |
| - @code{scalafix --rewrites https://gist....}. |
168 |
| - @li |
169 |
| - If your rewrite uses a custom library @code{foo}, then it's a bit tricky |
170 |
| - to share it. See @issue(201) for more updates. |
| 181 | + If you used @sect.ref{scalacenter/scalafix.g8} to build your project, |
| 182 | + push your rewrite to github and tell users to run |
| 183 | + @code{scalafix github:org/$reponame/$version}. |
171 | 184 | @li
|
| 185 | + otherwise, tell users to use the @sect.ref{http:} protocol, |
| 186 | + @code{scalafix --rewrites https://gist....} where the url |
| 187 | + points to the plaintext contents of your rewrite. |
| 188 | + |
| 189 | + If your rewrite uses a custom library @code{foo}, then it's a bit tricky |
| 190 | + to share it. See @issue(201) for more updates. |
0 commit comments