Skip to content

Commit c3cce27

Browse files
committed
Document scalacenter/scalafix.g8 in docs.
1 parent 21c9d18 commit c3cce27

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

readme/ImplementingRewrites.scalatex

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@
5151
have some unit tests and be documented so that other people can help maintain
5252
the rewrite.
5353

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+
5469
@sect{Example rewrites}
5570
The Scalafix repository contains several example rewrites and tests,
5671
see @lnk("here", "https://github.com/scalacenter/scalafix/tree/master/scalafix-core/src/main/scala/scalafix/rewrite").
@@ -159,13 +174,17 @@
159174
@p
160175
You have implemented a rewrite, you have tests, it works,
161176
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,
163179
@ul
164180
@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}.
171184
@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.

readme/Testkit.scalatex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
semantic scalafix rewrites.
1111

1212
@p
13-
Note. This section may be incomplete, in case of any questions
14-
don't hestitate to ask on @gitter.
13+
Note. You may prefer to use the @sect.ref{scalacenter/scalafix.g8} template
14+
to generate the following boilerplate.
15+
In case of any problems, don't hestitate to ask on @gitter.
1516

1617
@p
1718
The following instructions assume you are using sbt.

0 commit comments

Comments
 (0)