-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Robin uploads for Web apps (#2238)
- Loading branch information
1 parent
b3225fa
commit 7fe934d
Showing
5 changed files
with
102 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ bin | |
|
||
# media assets | ||
maestro-orchestra/src/test/resources/media/assets/* | ||
|
||
# Local files | ||
local/ |
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 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
38 changes: 38 additions & 0 deletions
38
maestro-cli/src/main/java/maestro/cli/web/WebInteractor.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,38 @@ | ||
package maestro.cli.web | ||
|
||
import maestro.cli.util.FileUtils.isWebFlow | ||
import maestro.orchestra.yaml.YamlCommandReader | ||
import java.io.File | ||
|
||
object WebInteractor { | ||
|
||
fun createManifestFromWorkspace(workspaceFile: File): File? { | ||
val appId = inferAppId(workspaceFile) ?: return null | ||
|
||
val manifest = """ | ||
{ | ||
"url": "$appId" | ||
} | ||
""".trimIndent() | ||
|
||
val manifestFile = File.createTempFile("manifest", ".json") | ||
manifestFile.writeText(manifest) | ||
return manifestFile | ||
} | ||
|
||
private fun inferAppId(file: File): String? { | ||
if (file.isDirectory) { | ||
return file.listFiles() | ||
?.firstNotNullOfOrNull { inferAppId(it) } | ||
} | ||
|
||
if (!file.isWebFlow()) { | ||
return null | ||
} | ||
|
||
return file.readText() | ||
.let { YamlCommandReader.readConfig(file.toPath()) } | ||
.appId | ||
} | ||
|
||
} |