{"action":"created","comment":{"url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/comments/192470052","pull_request_review_id":125260722,"id":192470052,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjQ3MDA1Mg==","diff_hunk":"@@ -1,63 +1,91 @@\n package de.triplet.gradle.play\n \n+import com.google.api.services.androidpublisher.AndroidPublisher\n+import de.triplet.gradle.play.internal.ImageType\n+import de.triplet.gradle.play.internal.LISTING_PATH\n+import de.triplet.gradle.play.internal.ListingDetail\n+import de.triplet.gradle.play.internal.PlayPublishTaskBase\n import org.gradle.api.tasks.TaskAction\n import java.io.File\n+import java.net.URL\n \n-open class BootstrapTask : PlayPublishTask() {\n+open class BootstrapTask : PlayPublishTaskBase() {\n     lateinit var outputFolder: File\n \n     @TaskAction\n-    fun bootstrap() {\n-        publish()\n-\n-        bootstrapListing()\n-        bootstrapWhatsNew()\n-        bootstrapAppDetails()\n+    fun bootstrap() = read { editId ->\n+        bootstrapListing(editId)\n+        bootstrapWhatsNew(editId)\n+        bootstrapAppDetails(editId)\n     }\n \n-    private fun bootstrapListing() {\n-        val listings = edits.listings()\n+    private fun AndroidPublisher.Edits.bootstrapListing(editId: String) {\n+        val listings = listings()\n                 .list(variant.applicationId, editId)\n                 .execute()\n                 .listings ?: return\n \n-        listings.forEach { listing ->\n-            val listingDir = outputFolder.validSubFolder(listing.language, LISTING_PATH) ?: return@forEach\n+        for (listing in listings) {\n+            val rootDir = File(outputFolder, \"${listing.language}/$LISTING_PATH\")\n+\n+            fun downloadMetadata() {\n+                fun String.write(detail: ListingDetail) = write(rootDir, detail)\n+\n+                listing.fullDescription.write(ListingDetail.FULL_DESCRIPTION)\n+                listing.shortDescription.write(ListingDetail.SHORT_DESCRIPTION)\n+                listing.title.write(ListingDetail.TITLE)\n+                listing.video.write(ListingDetail.VIDEO)\n+            }\n+\n+            fun downloadImages() {\n+                for (type in ImageType.values()) {\n+                    val images = images()\n+                            .list(variant.applicationId, editId, listing.language, type.fileName)\n+                            .execute()\n+                            .images ?: continue\n+                    val imageDir = File(rootDir, type.fileName)\n \n-            ImageTypes.values().forEach { imageType ->\n-                val images = edits.images()\n-                        .list(variant.applicationId, editId, listing.language, imageType.fileName)\n-                        .execute()\n-                        .images\n-                imageType.saveImages(listingDir, images)\n+                    for (image in images) {","path":"src/main/kotlin/de/triplet/gradle/play/BootstrapTask.kt","position":65,"original_position":65,"commit_id":"73d5d8335d5b9f671693be616ef99cc16217d51e","original_commit_id":"73d5d8335d5b9f671693be616ef99cc16217d51e","user":{"login":"SUPERCILEX","id":9490724,"node_id":"MDQ6VXNlcjk0OTA3MjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9490724?v=4","gravatar_id":"","url":"https://api.github.com/users/SUPERCILEX","html_url":"https://github.com/SUPERCILEX","followers_url":"https://api.github.com/users/SUPERCILEX/followers","following_url":"https://api.github.com/users/SUPERCILEX/following{/other_user}","gists_url":"https://api.github.com/users/SUPERCILEX/gists{/gist_id}","starred_url":"https://api.github.com/users/SUPERCILEX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUPERCILEX/subscriptions","organizations_url":"https://api.github.com/users/SUPERCILEX/orgs","repos_url":"https://api.github.com/users/SUPERCILEX/repos","events_url":"https://api.github.com/users/SUPERCILEX/events{/privacy}","received_events_url":"https://api.github.com/users/SUPERCILEX/received_events","type":"User","site_admin":false},"body":"The for loop is actually shorter than the `forEach` one. Also, a for loop is clearer IMO and just because something exists doesn't mean you have to use it. Dunno, what'd you think?","created_at":"2018-06-01T17:53:43Z","updated_at":"2018-06-01T17:53:43Z","html_url":"https://github.com/Triple-T/gradle-play-publisher/pull/281#discussion_r192470052","pull_request_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/281","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/comments/192470052"},"html":{"href":"https://github.com/Triple-T/gradle-play-publisher/pull/281#discussion_r192470052"},"pull_request":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/281"}},"in_reply_to_id":192313394},"pull_request":{"url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/281","id":190771031,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkwNzcxMDMx","html_url":"https://github.com/Triple-T/gradle-play-publisher/pull/281","diff_url":"https://github.com/Triple-T/gradle-play-publisher/pull/281.diff","patch_url":"https://github.com/Triple-T/gradle-play-publisher/pull/281.patch","issue_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/issues/281","number":281,"state":"open","locked":false,"title":"Massive cleanup: implement best practices, normalize code style, and re-architect + restructure plugin","user":{"login":"SUPERCILEX","id":9490724,"node_id":"MDQ6VXNlcjk0OTA3MjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9490724?v=4","gravatar_id":"","url":"https://api.github.com/users/SUPERCILEX","html_url":"https://github.com/SUPERCILEX","followers_url":"https://api.github.com/users/SUPERCILEX/followers","following_url":"https://api.github.com/users/SUPERCILEX/following{/other_user}","gists_url":"https://api.github.com/users/SUPERCILEX/gists{/gist_id}","starred_url":"https://api.github.com/users/SUPERCILEX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUPERCILEX/subscriptions","organizations_url":"https://api.github.com/users/SUPERCILEX/orgs","repos_url":"https://api.github.com/users/SUPERCILEX/repos","events_url":"https://api.github.com/users/SUPERCILEX/events{/privacy}","received_events_url":"https://api.github.com/users/SUPERCILEX/received_events","type":"User","site_admin":false},"body":"Built on top of #276 \r\n\r\nFixes #274, minor work on #268","created_at":"2018-05-27T05:11:15Z","updated_at":"2018-06-01T17:53:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51753552d7d5d51644c671ff948aeb36135d6959","assignee":null,"assignees":[],"requested_reviewers":[{"login":"bhurling","id":242983,"node_id":"MDQ6VXNlcjI0Mjk4Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/242983?v=4","gravatar_id":"","url":"https://api.github.com/users/bhurling","html_url":"https://github.com/bhurling","followers_url":"https://api.github.com/users/bhurling/followers","following_url":"https://api.github.com/users/bhurling/following{/other_user}","gists_url":"https://api.github.com/users/bhurling/gists{/gist_id}","starred_url":"https://api.github.com/users/bhurling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhurling/subscriptions","organizations_url":"https://api.github.com/users/bhurling/orgs","repos_url":"https://api.github.com/users/bhurling/repos","events_url":"https://api.github.com/users/bhurling/events{/privacy}","received_events_url":"https://api.github.com/users/bhurling/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/281/commits","review_comments_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/281/comments","review_comment_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/issues/281/comments","statuses_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/statuses/73d5d8335d5b9f671693be616ef99cc16217d51e","head":{"label":"SUPERCILEX:cleanup","ref":"cleanup","sha":"73d5d8335d5b9f671693be616ef99cc16217d51e","user":{"login":"SUPERCILEX","id":9490724,"node_id":"MDQ6VXNlcjk0OTA3MjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9490724?v=4","gravatar_id":"","url":"https://api.github.com/users/SUPERCILEX","html_url":"https://github.com/SUPERCILEX","followers_url":"https://api.github.com/users/SUPERCILEX/followers","following_url":"https://api.github.com/users/SUPERCILEX/following{/other_user}","gists_url":"https://api.github.com/users/SUPERCILEX/gists{/gist_id}","starred_url":"https://api.github.com/users/SUPERCILEX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUPERCILEX/subscriptions","organizations_url":"https://api.github.com/users/SUPERCILEX/orgs","repos_url":"https://api.github.com/users/SUPERCILEX/repos","events_url":"https://api.github.com/users/SUPERCILEX/events{/privacy}","received_events_url":"https://api.github.com/users/SUPERCILEX/received_events","type":"User","site_admin":false},"repo":{"id":81623387,"node_id":"MDEwOlJlcG9zaXRvcnk4MTYyMzM4Nw==","name":"gradle-play-publisher","full_name":"SUPERCILEX/gradle-play-publisher","owner":{"login":"SUPERCILEX","id":9490724,"node_id":"MDQ6VXNlcjk0OTA3MjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9490724?v=4","gravatar_id":"","url":"https://api.github.com/users/SUPERCILEX","html_url":"https://github.com/SUPERCILEX","followers_url":"https://api.github.com/users/SUPERCILEX/followers","following_url":"https://api.github.com/users/SUPERCILEX/following{/other_user}","gists_url":"https://api.github.com/users/SUPERCILEX/gists{/gist_id}","starred_url":"https://api.github.com/users/SUPERCILEX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUPERCILEX/subscriptions","organizations_url":"https://api.github.com/users/SUPERCILEX/orgs","repos_url":"https://api.github.com/users/SUPERCILEX/repos","events_url":"https://api.github.com/users/SUPERCILEX/events{/privacy}","received_events_url":"https://api.github.com/users/SUPERCILEX/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SUPERCILEX/gradle-play-publisher","description":"Gradle Plugin to upload your APK and metadata to the Google Play Store","fork":true,"url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher","forks_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/forks","keys_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/teams","hooks_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/hooks","issue_events_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/issues/events{/number}","events_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/events","assignees_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/assignees{/user}","branches_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/branches{/branch}","tags_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/tags","blobs_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/git/refs{/sha}","trees_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/statuses/{sha}","languages_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/languages","stargazers_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/stargazers","contributors_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/contributors","subscribers_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/subscribers","subscription_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/subscription","commits_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/commits{/sha}","git_commits_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/git/commits{/sha}","comments_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/comments{/number}","issue_comment_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/issues/comments{/number}","contents_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/contents/{+path}","compare_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/merges","archive_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/downloads","issues_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/issues{/number}","pulls_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/pulls{/number}","milestones_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/milestones{/number}","notifications_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/labels{/name}","releases_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/releases{/id}","deployments_url":"https://api.github.com/repos/SUPERCILEX/gradle-play-publisher/deployments","created_at":"2017-02-11T01:51:39Z","updated_at":"2018-05-31T03:33:16Z","pushed_at":"2018-06-01T17:48:49Z","git_url":"git://github.com/SUPERCILEX/gradle-play-publisher.git","ssh_url":"git@github.com:SUPERCILEX/gradle-play-publisher.git","clone_url":"https://github.com/SUPERCILEX/gradle-play-publisher.git","svn_url":"https://github.com/SUPERCILEX/gradle-play-publisher","homepage":"","size":741,"stargazers_count":0,"watchers_count":0,"language":"Groovy","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Triple-T:master","ref":"master","sha":"910d5dd1af825d841f7e0f4326f6f3b278470bd3","user":{"login":"Triple-T","id":5947172,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5NDcxNzI=","avatar_url":"https://avatars2.githubusercontent.com/u/5947172?v=4","gravatar_id":"","url":"https://api.github.com/users/Triple-T","html_url":"https://github.com/Triple-T","followers_url":"https://api.github.com/users/Triple-T/followers","following_url":"https://api.github.com/users/Triple-T/following{/other_user}","gists_url":"https://api.github.com/users/Triple-T/gists{/gist_id}","starred_url":"https://api.github.com/users/Triple-T/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Triple-T/subscriptions","organizations_url":"https://api.github.com/users/Triple-T/orgs","repos_url":"https://api.github.com/users/Triple-T/repos","events_url":"https://api.github.com/users/Triple-T/events{/privacy}","received_events_url":"https://api.github.com/users/Triple-T/received_events","type":"Organization","site_admin":false},"repo":{"id":22718907,"node_id":"MDEwOlJlcG9zaXRvcnkyMjcxODkwNw==","name":"gradle-play-publisher","full_name":"Triple-T/gradle-play-publisher","owner":{"login":"Triple-T","id":5947172,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5NDcxNzI=","avatar_url":"https://avatars2.githubusercontent.com/u/5947172?v=4","gravatar_id":"","url":"https://api.github.com/users/Triple-T","html_url":"https://github.com/Triple-T","followers_url":"https://api.github.com/users/Triple-T/followers","following_url":"https://api.github.com/users/Triple-T/following{/other_user}","gists_url":"https://api.github.com/users/Triple-T/gists{/gist_id}","starred_url":"https://api.github.com/users/Triple-T/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Triple-T/subscriptions","organizations_url":"https://api.github.com/users/Triple-T/orgs","repos_url":"https://api.github.com/users/Triple-T/repos","events_url":"https://api.github.com/users/Triple-T/events{/privacy}","received_events_url":"https://api.github.com/users/Triple-T/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Triple-T/gradle-play-publisher","description":"Gradle Plugin to upload your APK and metadata to the Google Play Store","fork":false,"url":"https://api.github.com/repos/Triple-T/gradle-play-publisher","forks_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/forks","keys_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/teams","hooks_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/hooks","issue_events_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/issues/events{/number}","events_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/events","assignees_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/assignees{/user}","branches_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/branches{/branch}","tags_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/tags","blobs_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/git/refs{/sha}","trees_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/statuses/{sha}","languages_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/languages","stargazers_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/stargazers","contributors_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/contributors","subscribers_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/subscribers","subscription_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/subscription","commits_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/commits{/sha}","git_commits_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/git/commits{/sha}","comments_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/comments{/number}","issue_comment_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/issues/comments{/number}","contents_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/contents/{+path}","compare_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/merges","archive_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/downloads","issues_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/issues{/number}","pulls_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls{/number}","milestones_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/milestones{/number}","notifications_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/labels{/name}","releases_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/releases{/id}","deployments_url":"https://api.github.com/repos/Triple-T/gradle-play-publisher/deployments","created_at":"2014-08-07T11:28:01Z","updated_at":"2018-06-01T12:33:56Z","pushed_at":"2018-05-28T01:41:29Z","git_url":"git://github.com/Triple-T/gradle-play-publisher.git","ssh_url":"git@github.com:Triple-T/gradle-play-publisher.git","clone_url":"https://github.com/Triple-T/gradle-play-publisher.git","svn_url":"https://github.com/Triple-T/gradle-play-publisher","homepage":"","size":618,"stargazers_count":2055,"watchers_count":2055,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":183,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":183,"open_issues":29,"watchers":2055,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/281"},"html":{"href":"https://github.com/Triple-T/gradle-play-publisher/pull/281"},"issue":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/issues/281"},"comments":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/issues/281/comments"},"review_comments":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/281/comments"},"review_comment":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/pulls/281/commits"},"statuses":{"href":"https://api.github.com/repos/Triple-T/gradle-play-publisher/statuses/73d5d8335d5b9f671693be616ef99cc16217d51e"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"SUPERCILEX"}}