diff --git a/app/src/main/java/taggy/composition/GitProviderModuleDefault.kt b/app/src/main/java/taggy/composition/GitProviderModuleDefault.kt index 221366f..8bb9770 100644 --- a/app/src/main/java/taggy/composition/GitProviderModuleDefault.kt +++ b/app/src/main/java/taggy/composition/GitProviderModuleDefault.kt @@ -17,8 +17,6 @@ class GitProviderModuleDefault( var service: GitService service = GitServiceDefault(console, getConsoleAdapter()) service = GitServiceFetch(service, console) - if (arguments.push) - service = GitServicePush(service) if (arguments.force) service = GitServiceForce(service) service = GitServiceLogging(service, log.getLogger()) diff --git a/provider-git/src/main/java/taggy/provider/git/GitServicePush.kt b/provider-git/src/main/java/taggy/provider/git/GitServicePush.kt deleted file mode 100644 index 4e78652..0000000 --- a/provider-git/src/main/java/taggy/provider/git/GitServicePush.kt +++ /dev/null @@ -1,21 +0,0 @@ -package taggy.provider.git - -class GitServicePush( - private val source: GitService -) : GitService by source { - - override fun createTag(tag: Tag): Result { - return source.createTag(tag) - .mapCatching { pushTag(tag).getOrThrow() } - } - - private fun pushTag(tag: Tag): Result { - val remotes = getRemotes().getOrDefault(emptyList()) - val results = mutableListOf>() - for (remote in remotes) { - results += pushTag(remote, tag) - } - return results.firstOrNull { it.isFailure } ?: Result.success(Unit) - } - -} \ No newline at end of file diff --git a/provider-git/src/test/java/taggy/provider/git/GitServicePushTest.kt b/provider-git/src/test/java/taggy/provider/git/GitServicePushTest.kt deleted file mode 100644 index de7e5eb..0000000 --- a/provider-git/src/test/java/taggy/provider/git/GitServicePushTest.kt +++ /dev/null @@ -1,33 +0,0 @@ -package taggy.provider.git - -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.mockito.Mock -import org.mockito.MockitoAnnotations -import org.mockito.kotlin.whenever -import kotlin.test.expect - -internal class GitServicePushTest { - - private lateinit var service: GitServicePush - private lateinit var remote: Remote - - @Mock - lateinit var source: GitService - - @BeforeEach - fun setUp() { - MockitoAnnotations.openMocks(this).close() - service = GitServicePush(source) - remote = Remote("barfoo") - whenever(source.getRemotes()).thenReturn(Result.success(listOf(remote))) - } - - @Test - fun createTag() { - val tag = Tag("foo") - whenever(source.pushTag(remote, tag)).thenReturn(Result.success(Unit)) - expect(Result.success(Unit)) { service.createTag(tag) } - } - -} \ No newline at end of file