Skip to content

Commit 4e132ca

Browse files
authored
Merge pull request #1732 from scala-steward-org/topic/rm-http4s-pkg
Remove http4s packag/prefix from VCSApiAlg implementations
2 parents 88e3d50 + 037f53d commit 4e132ca

27 files changed

+96
-102
lines changed

docs/running.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ example1.realm=Example Realm
8383

8484
### Running locally from sbt
8585

86-
#### Sample run for Gitlab
86+
#### Sample run for GitLab
8787

8888
```
8989
sbt
@@ -130,14 +130,14 @@ docker run -v $PWD:/opt/scala-steward \
130130
There is an article on how they run Scala Steward on-premise at Avast:
131131
* [Running Scala Steward On-premise](https://engineering.avast.io/running-scala-steward-on-premise)
132132

133-
#### Gitlab
133+
#### GitLab
134134

135-
The following describes a setup using Gitlab Docker runner, which you have to setup seperately.
135+
The following describes a setup using GitLab Docker runner, which you have to setup seperately.
136136

137-
1. create a "scalasteward" user in Gitlab
137+
1. create a "scalasteward" user in GitLab
138138
2. assign that user "Developer" permissions in every project that should be managed by Scala Steward
139139
3. login as that user and create a Personal Access Token with `api`, `read_repository` and `write_repository` scopes
140-
4. create a project and add the following Gitlab CI config
140+
4. create a project and add the following GitLab CI config
141141

142142
```yaml
143143
check:

modules/core/src/main/scala/org/scalasteward/core/application/SupportedVCS.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ sealed trait SupportedVCS {
2525
case Bitbucket => "bitbucket"
2626
case BitbucketServer => "bitbucket-server"
2727
case GitHub => "github"
28-
case Gitlab => "gitlab"
28+
case GitLab => "gitlab"
2929
}
3030
}
3131

3232
object SupportedVCS {
3333
case object Bitbucket extends SupportedVCS
3434
case object BitbucketServer extends SupportedVCS
3535
case object GitHub extends SupportedVCS
36-
case object Gitlab extends SupportedVCS
36+
case object GitLab extends SupportedVCS
3737

38-
val all = List(Bitbucket, BitbucketServer, GitHub, Gitlab)
38+
val all = List(Bitbucket, BitbucketServer, GitHub, GitLab)
3939

4040
def parse(s: String): Either[String, SupportedVCS] =
4141
all.find(_.asString === s) match {

modules/core/src/main/scala/org/scalasteward/core/nurture/NurtureAlg.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import org.scalasteward.core.util.{BracketThrow, HttpExistenceClient}
3636
import org.scalasteward.core.vcs.data.{NewPullRequestData, PullRequestState, Repo, RepoOut}
3737
import org.scalasteward.core.vcs.{VCSApiAlg, VCSExtraAlg, VCSRepoAlg}
3838
import org.scalasteward.core.{git, util, vcs}
39-
4039
import scala.util.control.NonFatal
4140

4241
final class NurtureAlg[F[_]](config: Config)(implicit

modules/core/src/main/scala/org/scalasteward/core/util/HttpJsonClient.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ import cats.effect.Sync
2020
import cats.syntax.all._
2121
import io.circe.{Decoder, Encoder}
2222
import org.http4s.Method.{GET, PATCH, POST, PUT}
23+
import org.http4s._
2324
import org.http4s.circe.{jsonEncoderOf, jsonOf}
2425
import org.http4s.client.Client
25-
import org.http4s._
26-
2726
import scala.util.control.NoStackTrace
2827

2928
final class HttpJsonClient[F[_]: Sync](implicit

modules/core/src/main/scala/org/scalasteward/core/vcs/VCSExtraAlg.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ object VCSExtraAlg {
5454
extractIntAfter(uri.path, "pull")
5555
case SupportedVCS.Bitbucket | SupportedVCS.BitbucketServer =>
5656
extractIntAfter(uri.path, "pullrequests")
57-
case SupportedVCS.Gitlab =>
57+
case SupportedVCS.GitLab =>
5858
extractIntAfter(uri.path, "merge_requests")
5959
}
6060
}

modules/core/src/main/scala/org/scalasteward/core/vcs/VCSSelection.scala

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ package org.scalasteward.core.vcs
1818

1919
import io.chrisdavenport.log4cats.Logger
2020
import org.scalasteward.core.application.Config
21-
import org.scalasteward.core.application.SupportedVCS.{Bitbucket, BitbucketServer, GitHub, Gitlab}
21+
import org.scalasteward.core.application.SupportedVCS.{Bitbucket, BitbucketServer, GitHub, GitLab}
2222
import org.scalasteward.core.util.{HttpJsonClient, MonadThrow}
23-
import org.scalasteward.core.vcs.bitbucket.http4s.Http4sBitbucketApiAlg
24-
import org.scalasteward.core.vcs.bitbucketserver.http4s.Http4sBitbucketServerApiAlg
23+
import org.scalasteward.core.vcs.bitbucket.BitbucketApiAlg
24+
import org.scalasteward.core.vcs.bitbucketserver.BitbucketServerApiAlg
2525
import org.scalasteward.core.vcs.data.AuthenticatedUser
26-
import org.scalasteward.core.vcs.github.http4s.Http4sGitHubApiAlg
27-
import org.scalasteward.core.vcs.gitlab.http4s.Http4sGitLabApiAlg
26+
import org.scalasteward.core.vcs.github.GitHubApiAlg
27+
import org.scalasteward.core.vcs.gitlab.GitLabApiAlg
2828

2929
final class VCSSelection[F[_]](implicit
3030
client: HttpJsonClient[F],
3131
user: AuthenticatedUser,
3232
logger: Logger[F],
3333
F: MonadThrow[F]
3434
) {
35-
private def github(config: Config): Http4sGitHubApiAlg[F] = {
36-
import org.scalasteward.core.vcs.github.http4s.authentication.addCredentials
35+
private def github(config: Config): GitHubApiAlg[F] = {
36+
import org.scalasteward.core.vcs.github.authentication.addCredentials
3737

38-
new Http4sGitHubApiAlg[F](config.vcsApiHost, _ => addCredentials(user))
38+
new GitHubApiAlg[F](config.vcsApiHost, _ => addCredentials(user))
3939
}
4040

41-
private def gitlab(config: Config): Http4sGitLabApiAlg[F] = {
42-
import org.scalasteward.core.vcs.gitlab.http4s.authentication.addCredentials
43-
new Http4sGitLabApiAlg[F](
41+
private def gitlab(config: Config): GitLabApiAlg[F] = {
42+
import org.scalasteward.core.vcs.gitlab.authentication.addCredentials
43+
new GitLabApiAlg[F](
4444
config.vcsApiHost,
4545
user,
4646
_ => addCredentials(user),
@@ -49,16 +49,16 @@ final class VCSSelection[F[_]](implicit
4949
)
5050
}
5151

52-
private def bitbucket(config: Config): Http4sBitbucketApiAlg[F] = {
53-
import org.scalasteward.core.vcs.bitbucket.http4s.authentication.addCredentials
52+
private def bitbucket(config: Config): BitbucketApiAlg[F] = {
53+
import org.scalasteward.core.vcs.bitbucket.authentication.addCredentials
5454

55-
new Http4sBitbucketApiAlg(config.vcsApiHost, user, _ => addCredentials(user), config.doNotFork)
55+
new BitbucketApiAlg(config.vcsApiHost, user, _ => addCredentials(user), config.doNotFork)
5656
}
5757

58-
private def bitbucketServer(config: Config): Http4sBitbucketServerApiAlg[F] = {
59-
import org.scalasteward.core.vcs.bitbucket.http4s.authentication.addCredentials
58+
private def bitbucketServer(config: Config): BitbucketServerApiAlg[F] = {
59+
import org.scalasteward.core.vcs.bitbucket.authentication.addCredentials
6060

61-
new Http4sBitbucketServerApiAlg[F](
61+
new BitbucketServerApiAlg[F](
6262
config.vcsApiHost,
6363
_ => addCredentials(user),
6464
config.bitbucketServerUseDefaultReviewers
@@ -68,7 +68,7 @@ final class VCSSelection[F[_]](implicit
6868
def getAlg(config: Config): VCSApiAlg[F] =
6969
config.vcsType match {
7070
case GitHub => github(config)
71-
case Gitlab => gitlab(config)
71+
case GitLab => gitlab(config)
7272
case Bitbucket => bitbucket(config)
7373
case BitbucketServer => bitbucketServer(config)
7474
}

modules/core/src/main/scala/org/scalasteward/core/vcs/bitbucket/http4s/Http4sBitbucketApiAlg.scala renamed to modules/core/src/main/scala/org/scalasteward/core/vcs/bitbucket/BitbucketApiAlg.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.scalasteward.core.vcs.bitbucket.http4s
17+
package org.scalasteward.core.vcs.bitbucket
1818

1919
import cats.syntax.all._
2020
import org.http4s.{Request, Status, Uri}
2121
import org.scalasteward.core.git.Branch
2222
import org.scalasteward.core.util.{HttpJsonClient, MonadThrow, UnexpectedResponse}
2323
import org.scalasteward.core.vcs.VCSApiAlg
24-
import org.scalasteward.core.vcs.bitbucket.Url
25-
import org.scalasteward.core.vcs.bitbucket.http4s.json._
24+
import org.scalasteward.core.vcs.bitbucket.json._
2625
import org.scalasteward.core.vcs.data._
2726

28-
class Http4sBitbucketApiAlg[F[_]](
27+
class BitbucketApiAlg[F[_]](
2928
bitbucketApiHost: Uri,
3029
user: AuthenticatedUser,
3130
modify: Repo => Request[F] => F[Request[F]],

modules/core/src/main/scala/org/scalasteward/core/vcs/bitbucket/http4s/CreatePullRequestRequest.scala renamed to modules/core/src/main/scala/org/scalasteward/core/vcs/bitbucket/CreatePullRequestRequest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.scalasteward.core.vcs.bitbucket.http4s
17+
package org.scalasteward.core.vcs.bitbucket
1818

1919
import io.circe.{Encoder, Json}
2020
import org.scalasteward.core.git.Branch
2121
import org.scalasteward.core.vcs.data.Repo
2222

23-
private[http4s] case class CreatePullRequestRequest(
23+
private[bitbucket] case class CreatePullRequestRequest(
2424
title: String,
2525
sourceBranch: Branch,
2626
sourceRepo: Repo,
2727
destinationBranch: Branch,
2828
description: String
2929
)
3030

31-
private[http4s] object CreatePullRequestRequest {
31+
private[bitbucket] object CreatePullRequestRequest {
3232
implicit val encoder: Encoder[CreatePullRequestRequest] = Encoder.instance { d =>
3333
Json.obj(
3434
("title", Json.fromString(d.title)),

modules/core/src/main/scala/org/scalasteward/core/vcs/bitbucket/http4s/Page.scala renamed to modules/core/src/main/scala/org/scalasteward/core/vcs/bitbucket/Page.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.scalasteward.core.vcs.bitbucket.http4s
17+
package org.scalasteward.core.vcs.bitbucket
1818

1919
import io.circe.Decoder
2020

21-
final private[http4s] case class Page[A](values: List[A])
21+
final private[bitbucket] case class Page[A](values: List[A])
2222

23-
private[http4s] object Page {
23+
private[bitbucket] object Page {
2424
implicit def pageDecoder[A: Decoder]: Decoder[Page[A]] =
2525
Decoder.instance { c =>
2626
c.downField("values").as[List[A]].map(Page(_))

modules/core/src/main/scala/org/scalasteward/core/vcs/bitbucket/http4s/RepositoryResponse.scala renamed to modules/core/src/main/scala/org/scalasteward/core/vcs/bitbucket/RepositoryResponse.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.scalasteward.core.vcs.bitbucket.http4s
17+
package org.scalasteward.core.vcs.bitbucket
1818

1919
import cats.syntax.all._
2020
import io.circe.{ACursor, Decoder, DecodingFailure, Json}
@@ -24,15 +24,15 @@ import org.scalasteward.core.util.uri._
2424
import org.scalasteward.core.vcs.data.{Repo, UserOut}
2525
import scala.annotation.tailrec
2626

27-
final private[http4s] case class RepositoryResponse(
27+
final private[bitbucket] case class RepositoryResponse(
2828
name: String,
2929
mainBranch: Branch,
3030
owner: UserOut,
3131
httpsCloneUrl: Uri,
3232
parent: Option[Repo]
3333
)
3434

35-
private[http4s] object RepositoryResponse {
35+
private[bitbucket] object RepositoryResponse {
3636
implicit private val repoDecoder: Decoder[Repo] = Decoder.instance { c =>
3737
c.as[String].map(_.split('/')).flatMap { parts =>
3838
parts match {

0 commit comments

Comments
 (0)