{"action":"created","comment":{"url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/comments/94190969","pull_request_review_id":14721934,"id":94190969,"diff_hunk":"@@ -0,0 +1,207 @@\n+<?php\n+/**\n+ * Migrate groups from WordPress to Hugo data as YAML\n+ */\n+namespace HH_Hugo;\n+\n+class Migrate_Group {\n+\n+\t/**\n+\t * @var WP_Post WordPress post object to migrate\n+\t */\n+\tprotected $page = null;\n+\n+\t/**\n+\t * @var string Geocoding API with placeholder for city name\n+\t */\n+\tprotected $geo_api_url = 'https://api.mapbox.com/geocoding/v5/mapbox.places/%s.json?access_token=%s';\n+\n+\t/**\n+\t * Instantiate and migrate\n+\t *\n+\t * @param string|int|WP_Post $group WordPress post ID or slug or WP_Post\n+\t * @param int $parent_id ID of WordPress parent page\n+\t * @param bool $dry_run If true, mock migration only. Defaults to false.\n+\t */\n+\tfunction __construct( $group, $parent_id = 0, $dry_run = false ) {\n+\t\t$content_dir = defined( 'HH_HUGO_UNIT_TESTS_RUNNING' ) ? 'hugo-groups-test' : 'hugo-groups';\n+\t\t$this->dest_dir = trailingslashit( HH_HUGO_COMMAND_DIR ) . $content_dir;\n+\n+\t\t// just return the class for unit testing\n+\t\tif ( empty( $group ) && defined( 'HH_HUGO_UNIT_TESTS_RUNNING' ) ) {\n+\t\t\treturn;\n+\t\t}\n+\n+\t\t$is_wp_post = is_object( $group ) && 'WP_Post' === get_class( $group );\n+\t\t$this->page = $is_wp_post ? $group : $this->get_page( $group, $parent_id );\n+\n+\t\t$this->data = $this->setup_data( $this->page->ID );\n+\t\t$this->filename = sanitize_title( $this->page->post_title ) . '.yml';\n+\n+\t\tif ( ! $dry_run ) {\n+\t\t\t$written = $this->write_file( $this->filename, $this->data );\n+\t\t\tif ( ! $written ) {\n+\t\t\t\t$this->result = array( 'error' => 'Error writing file: ' . $this->filename );\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t}\n+\t\t$this->result = array( 'success' => 'Migrated ' . $this->filename );\n+\t}\n+\n+\t/**\n+\t * Instantiate and migrate","path":"inc/migrate-group.php","position":52,"original_position":52,"commit_id":"784cf3a988d14f6d9a55ab54bfd5aa4047663279","original_commit_id":"784cf3a988d14f6d9a55ab54bfd5aa4047663279","user":{"login":"GFargo","id":3642037,"avatar_url":"https://avatars.githubusercontent.com/u/3642037?v=3","gravatar_id":"","url":"https://api.github.com/users/GFargo","html_url":"https://github.com/GFargo","followers_url":"https://api.github.com/users/GFargo/followers","following_url":"https://api.github.com/users/GFargo/following{/other_user}","gists_url":"https://api.github.com/users/GFargo/gists{/gist_id}","starred_url":"https://api.github.com/users/GFargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GFargo/subscriptions","organizations_url":"https://api.github.com/users/GFargo/orgs","repos_url":"https://api.github.com/users/GFargo/repos","events_url":"https://api.github.com/users/GFargo/events{/privacy}","received_events_url":"https://api.github.com/users/GFargo/received_events","type":"User","site_admin":false},"body":"Same as above function, intentional?","created_at":"2016-12-29T23:19:33Z","updated_at":"2016-12-30T00:02:14Z","html_url":"https://github.com/hackshackers/hh-hugo-cli/pull/4#discussion_r94190969","pull_request_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/comments/94190969"},"html":{"href":"https://github.com/hackshackers/hh-hugo-cli/pull/4#discussion_r94190969"},"pull_request":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/4","id":99684537,"html_url":"https://github.com/hackshackers/hh-hugo-cli/pull/4","diff_url":"https://github.com/hackshackers/hh-hugo-cli/pull/4.diff","patch_url":"https://github.com/hackshackers/hh-hugo-cli/pull/4.patch","issue_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues/4","number":4,"state":"open","locked":false,"title":"Migrate groups","user":{"login":"joshkadis","id":997097,"avatar_url":"https://avatars.githubusercontent.com/u/997097?v=3","gravatar_id":"","url":"https://api.github.com/users/joshkadis","html_url":"https://github.com/joshkadis","followers_url":"https://api.github.com/users/joshkadis/followers","following_url":"https://api.github.com/users/joshkadis/following{/other_user}","gists_url":"https://api.github.com/users/joshkadis/gists{/gist_id}","starred_url":"https://api.github.com/users/joshkadis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshkadis/subscriptions","organizations_url":"https://api.github.com/users/joshkadis/orgs","repos_url":"https://api.github.com/users/joshkadis/repos","events_url":"https://api.github.com/users/joshkadis/events{/privacy}","received_events_url":"https://api.github.com/users/joshkadis/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-29T18:24:58Z","updated_at":"2016-12-30T00:02:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5fb7e3ac162c7e9cca28106c910135b61671cf5f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/4/commits","review_comments_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/4/comments","review_comment_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues/4/comments","statuses_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/statuses/784cf3a988d14f6d9a55ab54bfd5aa4047663279","head":{"label":"hackshackers:migrate-groups","ref":"migrate-groups","sha":"784cf3a988d14f6d9a55ab54bfd5aa4047663279","user":{"login":"hackshackers","id":786789,"avatar_url":"https://avatars.githubusercontent.com/u/786789?v=3","gravatar_id":"","url":"https://api.github.com/users/hackshackers","html_url":"https://github.com/hackshackers","followers_url":"https://api.github.com/users/hackshackers/followers","following_url":"https://api.github.com/users/hackshackers/following{/other_user}","gists_url":"https://api.github.com/users/hackshackers/gists{/gist_id}","starred_url":"https://api.github.com/users/hackshackers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hackshackers/subscriptions","organizations_url":"https://api.github.com/users/hackshackers/orgs","repos_url":"https://api.github.com/users/hackshackers/repos","events_url":"https://api.github.com/users/hackshackers/events{/privacy}","received_events_url":"https://api.github.com/users/hackshackers/received_events","type":"Organization","site_admin":false},"repo":{"id":77461426,"name":"hh-hugo-cli","full_name":"hackshackers/hh-hugo-cli","owner":{"login":"hackshackers","id":786789,"avatar_url":"https://avatars.githubusercontent.com/u/786789?v=3","gravatar_id":"","url":"https://api.github.com/users/hackshackers","html_url":"https://github.com/hackshackers","followers_url":"https://api.github.com/users/hackshackers/followers","following_url":"https://api.github.com/users/hackshackers/following{/other_user}","gists_url":"https://api.github.com/users/hackshackers/gists{/gist_id}","starred_url":"https://api.github.com/users/hackshackers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hackshackers/subscriptions","organizations_url":"https://api.github.com/users/hackshackers/orgs","repos_url":"https://api.github.com/users/hackshackers/repos","events_url":"https://api.github.com/users/hackshackers/events{/privacy}","received_events_url":"https://api.github.com/users/hackshackers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hackshackers/hh-hugo-cli","description":"WP-CLI command to migrate from WordPress to Hugo","fork":false,"url":"https://api.github.com/repos/hackshackers/hh-hugo-cli","forks_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/forks","keys_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/teams","hooks_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/hooks","issue_events_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues/events{/number}","events_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/events","assignees_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/assignees{/user}","branches_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/branches{/branch}","tags_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/tags","blobs_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/languages","stargazers_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/stargazers","contributors_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/contributors","subscribers_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/subscribers","subscription_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/subscription","commits_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/contents/{+path}","compare_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/merges","archive_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/downloads","issues_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues{/number}","pulls_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/labels{/name}","releases_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/releases{/id}","deployments_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/deployments","created_at":"2016-12-27T14:30:19Z","updated_at":"2016-12-27T14:30:34Z","pushed_at":"2016-12-29T20:43:44Z","git_url":"git://github.com/hackshackers/hh-hugo-cli.git","ssh_url":"git@github.com:hackshackers/hh-hugo-cli.git","clone_url":"https://github.com/hackshackers/hh-hugo-cli.git","svn_url":"https://github.com/hackshackers/hh-hugo-cli","homepage":null,"size":110,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hackshackers:master","ref":"master","sha":"dc5605b26ae3b414e95afcf4bfa3978f8ae83ea6","user":{"login":"hackshackers","id":786789,"avatar_url":"https://avatars.githubusercontent.com/u/786789?v=3","gravatar_id":"","url":"https://api.github.com/users/hackshackers","html_url":"https://github.com/hackshackers","followers_url":"https://api.github.com/users/hackshackers/followers","following_url":"https://api.github.com/users/hackshackers/following{/other_user}","gists_url":"https://api.github.com/users/hackshackers/gists{/gist_id}","starred_url":"https://api.github.com/users/hackshackers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hackshackers/subscriptions","organizations_url":"https://api.github.com/users/hackshackers/orgs","repos_url":"https://api.github.com/users/hackshackers/repos","events_url":"https://api.github.com/users/hackshackers/events{/privacy}","received_events_url":"https://api.github.com/users/hackshackers/received_events","type":"Organization","site_admin":false},"repo":{"id":77461426,"name":"hh-hugo-cli","full_name":"hackshackers/hh-hugo-cli","owner":{"login":"hackshackers","id":786789,"avatar_url":"https://avatars.githubusercontent.com/u/786789?v=3","gravatar_id":"","url":"https://api.github.com/users/hackshackers","html_url":"https://github.com/hackshackers","followers_url":"https://api.github.com/users/hackshackers/followers","following_url":"https://api.github.com/users/hackshackers/following{/other_user}","gists_url":"https://api.github.com/users/hackshackers/gists{/gist_id}","starred_url":"https://api.github.com/users/hackshackers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hackshackers/subscriptions","organizations_url":"https://api.github.com/users/hackshackers/orgs","repos_url":"https://api.github.com/users/hackshackers/repos","events_url":"https://api.github.com/users/hackshackers/events{/privacy}","received_events_url":"https://api.github.com/users/hackshackers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hackshackers/hh-hugo-cli","description":"WP-CLI command to migrate from WordPress to Hugo","fork":false,"url":"https://api.github.com/repos/hackshackers/hh-hugo-cli","forks_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/forks","keys_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/teams","hooks_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/hooks","issue_events_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues/events{/number}","events_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/events","assignees_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/assignees{/user}","branches_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/branches{/branch}","tags_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/tags","blobs_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/languages","stargazers_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/stargazers","contributors_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/contributors","subscribers_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/subscribers","subscription_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/subscription","commits_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/contents/{+path}","compare_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/merges","archive_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/downloads","issues_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues{/number}","pulls_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/labels{/name}","releases_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/releases{/id}","deployments_url":"https://api.github.com/repos/hackshackers/hh-hugo-cli/deployments","created_at":"2016-12-27T14:30:19Z","updated_at":"2016-12-27T14:30:34Z","pushed_at":"2016-12-29T20:43:44Z","git_url":"git://github.com/hackshackers/hh-hugo-cli.git","ssh_url":"git@github.com:hackshackers/hh-hugo-cli.git","clone_url":"https://github.com/hackshackers/hh-hugo-cli.git","svn_url":"https://github.com/hackshackers/hh-hugo-cli","homepage":null,"size":110,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/4"},"html":{"href":"https://github.com/hackshackers/hh-hugo-cli/pull/4"},"issue":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues/4"},"comments":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/hackshackers/hh-hugo-cli/statuses/784cf3a988d14f6d9a55ab54bfd5aa4047663279"}}}}
{"actor":{"display_login":"GFargo"}}