-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Refactor flank scripts (#1533)
Fixes #1541 ## Test Plan > How do we know the code works? All tests pass, Flank scripts work like before ## Checklist - [X] CiCommand - [X] ContributionCommand - [X] DependenciesCommand - [X] PullRequestCommand - [x] IntegrationCommand - [x] ReleaseCommand - [x] ShellCommand - [x] FirebaseCommand, - [x] BuildExampleCommand, - [x] BuildFtlCommand, - [x] RunFtlLocalCommand, - [x] UniversalFrameworkCommand, - [x] OpsCommand, - [x] UpdateBinariesCommand, - [x] BuildFlankCommand, - [x] InstallXcPrettyCommand, - [x] SetupIosEnvCommand - [x] TestArtifactsCommand - [x] Utils - [x] Tests
- Loading branch information
1 parent
9f09d47
commit ae09391
Showing
240 changed files
with
2,034 additions
and
1,702 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
flank-scripts/src/main/kotlin/flank/scripts/ci/CiCommand.kt
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
flank-scripts/src/main/kotlin/flank/scripts/ci/nexttag/NextReleaseTagCommand.kt
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
flank-scripts/src/main/kotlin/flank/scripts/ci/releasenotes/GenerateReleaseNotesCommand.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package flank.scripts.cli | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.core.subcommands | ||
import flank.scripts.cli.ci.CiCommand | ||
import flank.scripts.cli.contribution.ContributionCommand | ||
import flank.scripts.cli.dependencies.DependenciesCommand | ||
import flank.scripts.cli.integration.IntegrationCommand | ||
import flank.scripts.cli.pullrequest.PullRequestCommand | ||
import flank.scripts.cli.release.ReleaseCommand | ||
import flank.scripts.cli.shell.ShellCommand | ||
import flank.scripts.cli.testartifacts.TestArtifactsCommand | ||
|
||
class Main : CliktCommand(name = "flankScripts") { | ||
@Suppress("EmptyFunctionBlock") | ||
override fun run() {} | ||
} | ||
|
||
fun main(args: Array<String>) { | ||
Main().subcommands( | ||
ReleaseCommand, | ||
CiCommand, | ||
DependenciesCommand, | ||
TestArtifactsCommand, | ||
ShellCommand, | ||
PullRequestCommand, | ||
IntegrationCommand, | ||
ContributionCommand | ||
).main(args) | ||
} |
17 changes: 17 additions & 0 deletions
17
flank-scripts/src/main/kotlin/flank/scripts/cli/ci/CiCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package flank.scripts.cli.ci | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.core.subcommands | ||
|
||
object CiCommand : CliktCommand( | ||
help = "Contains command related to CI", | ||
name = "ci" | ||
) { | ||
init { | ||
subcommands(GenerateReleaseNotesCommand, NextReleaseTagCommand) | ||
} | ||
|
||
@Suppress("EmptyFunctionBlock") | ||
override fun run() { | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
flank-scripts/src/main/kotlin/flank/scripts/cli/ci/GenerateReleaseNotesCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package flank.scripts.cli.ci | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.parameters.options.default | ||
import com.github.ajalt.clikt.parameters.options.option | ||
import com.github.ajalt.clikt.parameters.options.required | ||
import com.google.common.annotations.VisibleForTesting | ||
import flank.scripts.ops.ci.createReleaseNotes | ||
|
||
object GenerateReleaseNotesCommand : CliktCommand( | ||
help = "Command to append item to release notes", | ||
name = "generateReleaseNotes" | ||
) { | ||
private val token by option(help = "Git Token").required() | ||
|
||
@VisibleForTesting | ||
internal val releaseNotesFile by option(help = "Path to release_notes.md") | ||
.default("release_notes.md") | ||
|
||
override fun run() { | ||
createReleaseNotes(token, releaseNotesFile) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
flank-scripts/src/main/kotlin/flank/scripts/cli/ci/NextReleaseTagCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package flank.scripts.cli.ci | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.parameters.options.option | ||
import com.github.ajalt.clikt.parameters.options.required | ||
import flank.scripts.ops.ci.createNextReleaseTag | ||
|
||
object NextReleaseTagCommand : CliktCommand( | ||
help = "Print next release tag", | ||
name = "nextReleaseTag" | ||
) { | ||
private val token by option(help = "Git Token").required() | ||
|
||
override fun run() { | ||
createNextReleaseTag(token) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
flank-scripts/src/main/kotlin/flank/scripts/cli/contribution/ContributionCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package flank.scripts.cli.contribution | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.core.subcommands | ||
|
||
object ContributionCommand : CliktCommand( | ||
name = "contribution", | ||
help = "Tasks for assisting with contribution" | ||
) { | ||
init { | ||
subcommands( | ||
GitHooksLinkCommand, | ||
IdeaKtlintCodeStyleCommand | ||
) | ||
} | ||
|
||
@Suppress("EmptyFunctionBlock") | ||
override fun run() { | ||
} | ||
} |
8 changes: 2 additions & 6 deletions
8
...tribution/githooks/GitHooksLinkCommand.kt → ...s/cli/contribution/GitHooksLinkCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
package flank.scripts.contribution.githooks | ||
package flank.scripts.cli.contribution | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import flank.common.logLn | ||
import flank.scripts.utils.runCommand | ||
import flank.scripts.ops.contribution.linkGitHooks | ||
|
||
object GitHooksLinkCommand : CliktCommand( | ||
name = "linkGitHooks", | ||
help = "Creates a link for pre-commit hook for automatic linting" | ||
) { | ||
override fun run() { | ||
logLn("Linking Githooks.") | ||
linkGitHooks() | ||
} | ||
|
||
private fun linkGitHooks() = "git config --local core.hooksPath .githooks/".runCommand() | ||
} |
14 changes: 14 additions & 0 deletions
14
flank-scripts/src/main/kotlin/flank/scripts/cli/contribution/IdeaKtlintCodeStyleCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package flank.scripts.cli.contribution | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import flank.scripts.ops.contribution.applyKtlintToIdea | ||
import kotlinx.coroutines.runBlocking | ||
|
||
object IdeaKtlintCodeStyleCommand : CliktCommand( | ||
name = "applyKtlintToIdea", | ||
help = "Applies Ktlint to this idea project forcefully" | ||
) { | ||
override fun run(): Unit = runBlocking { | ||
applyKtlintToIdea() | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
flank-scripts/src/main/kotlin/flank/scripts/cli/dependencies/DependenciesCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package flank.scripts.cli.dependencies | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.core.subcommands | ||
|
||
object DependenciesCommand : CliktCommand( | ||
name = "dependencies", | ||
help = "Task for manages dependencies" | ||
) { | ||
init { | ||
subcommands(DependenciesUpdateCommand) | ||
} | ||
|
||
@Suppress("EmptyFunctionBlock") | ||
override fun run() { | ||
} | ||
} |
Oops, something went wrong.