{"action":"created","comment":{"url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/comments/54453154","id":54453154,"diff_hunk":"@@ -0,0 +1,51 @@\n+require 'open-uri'\n+\n+namespace :sumofus do\n+  desc 'Import legacy actions into your database from a specified file'\n+  task seed_legacy_actions: :environment do\n+    if ARGV[1].nil?\n+      abort('Requires a valid url to a file containing the legacy actions to seed.')\n+    end\n+\n+    if ARGV[2].nil?\n+      abort('Requires a valid url to a file containing a default header image to attach to the page.')\n+    end\n+\n+    file_handle = open(ARGV[1])\n+    data = file_handle.read\n+    file_handle.close\n+\n+    image_handle = open(ARGV[2])\n+\n+    parsed_data = JSON.load data\n+    count = 0\n+    layout_id = LiquidLayout.where(title: 'Petition With Small Image').first.id\n+    parsed_data.each_pair do |k, entry|","path":"lib/tasks/sumofus.rake","position":23,"original_position":23,"commit_id":"d6fac5e605a35df0797e7c3aa9446a4d804d715d","original_commit_id":"d6fac5e605a35df0797e7c3aa9446a4d804d715d","user":{"login":"Tuuleh","id":6524052,"avatar_url":"https://avatars.githubusercontent.com/u/6524052?v=3","gravatar_id":"","url":"https://api.github.com/users/Tuuleh","html_url":"https://github.com/Tuuleh","followers_url":"https://api.github.com/users/Tuuleh/followers","following_url":"https://api.github.com/users/Tuuleh/following{/other_user}","gists_url":"https://api.github.com/users/Tuuleh/gists{/gist_id}","starred_url":"https://api.github.com/users/Tuuleh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tuuleh/subscriptions","organizations_url":"https://api.github.com/users/Tuuleh/orgs","repos_url":"https://api.github.com/users/Tuuleh/repos","events_url":"https://api.github.com/users/Tuuleh/events{/privacy}","received_events_url":"https://api.github.com/users/Tuuleh/received_events","type":"User","site_admin":false},"body":"You could do this without the `count` as an accumulator with `parsed_data.each_with_index { |(k,entry),index| ... }`","created_at":"2016-02-29T18:26:16Z","updated_at":"2016-02-29T18:26:16Z","html_url":"https://github.com/SumOfUs/Champaign/pull/404#discussion_r54453154","pull_request_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/404","_links":{"self":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/comments/54453154"},"html":{"href":"https://github.com/SumOfUs/Champaign/pull/404#discussion_r54453154"},"pull_request":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/404"}}},"pull_request":{"url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/404","id":61106067,"html_url":"https://github.com/SumOfUs/Champaign/pull/404","diff_url":"https://github.com/SumOfUs/Champaign/pull/404.diff","patch_url":"https://github.com/SumOfUs/Champaign/pull/404.patch","issue_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/404","number":404,"state":"open","locked":false,"title":"Legacy page preserve","user":{"login":"EricBoersma","id":1594316,"avatar_url":"https://avatars.githubusercontent.com/u/1594316?v=3","gravatar_id":"","url":"https://api.github.com/users/EricBoersma","html_url":"https://github.com/EricBoersma","followers_url":"https://api.github.com/users/EricBoersma/followers","following_url":"https://api.github.com/users/EricBoersma/following{/other_user}","gists_url":"https://api.github.com/users/EricBoersma/gists{/gist_id}","starred_url":"https://api.github.com/users/EricBoersma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricBoersma/subscriptions","organizations_url":"https://api.github.com/users/EricBoersma/orgs","repos_url":"https://api.github.com/users/EricBoersma/repos","events_url":"https://api.github.com/users/EricBoersma/events{/privacy}","received_events_url":"https://api.github.com/users/EricBoersma/received_events","type":"User","site_admin":false},"body":"Goal for this PR is to get this code into development so that we can run it on staging and @edubsky can approve or note major flaws which require code updates. \r\n\r\nThe ported legacy pages look like this:\r\n\r\n![screen shot 2016-02-29 at 11 35 57 am](https://cloud.githubusercontent.com/assets/1594316/13401185/2598587c-ded9-11e5-860a-193caa7b8b01.png)\r\n\r\nThe files needed for doing this processing can be pulled in off the web. I've got working public URLs, when we're ready to run the script, ping me and I'll hand them off.\r\n\r\nOnce we've run this on production and are happy with the results we can delete this importer.\r\n\r\n","created_at":"2016-02-29T16:40:56Z","updated_at":"2016-02-29T18:26:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fc844a5fa65e58378bb0c8c1956677d60d2a087","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/404/commits","review_comments_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/404/comments","review_comment_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/404/comments","statuses_url":"https://api.github.com/repos/SumOfUs/Champaign/statuses/d6fac5e605a35df0797e7c3aa9446a4d804d715d","head":{"label":"SumOfUs:legacy-page-preserve","ref":"legacy-page-preserve","sha":"d6fac5e605a35df0797e7c3aa9446a4d804d715d","user":{"login":"SumOfUs","id":7574652,"avatar_url":"https://avatars.githubusercontent.com/u/7574652?v=3","gravatar_id":"","url":"https://api.github.com/users/SumOfUs","html_url":"https://github.com/SumOfUs","followers_url":"https://api.github.com/users/SumOfUs/followers","following_url":"https://api.github.com/users/SumOfUs/following{/other_user}","gists_url":"https://api.github.com/users/SumOfUs/gists{/gist_id}","starred_url":"https://api.github.com/users/SumOfUs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SumOfUs/subscriptions","organizations_url":"https://api.github.com/users/SumOfUs/orgs","repos_url":"https://api.github.com/users/SumOfUs/repos","events_url":"https://api.github.com/users/SumOfUs/events{/privacy}","received_events_url":"https://api.github.com/users/SumOfUs/received_events","type":"Organization","site_admin":false},"repo":{"id":33684818,"name":"Champaign","full_name":"SumOfUs/Champaign","owner":{"login":"SumOfUs","id":7574652,"avatar_url":"https://avatars.githubusercontent.com/u/7574652?v=3","gravatar_id":"","url":"https://api.github.com/users/SumOfUs","html_url":"https://github.com/SumOfUs","followers_url":"https://api.github.com/users/SumOfUs/followers","following_url":"https://api.github.com/users/SumOfUs/following{/other_user}","gists_url":"https://api.github.com/users/SumOfUs/gists{/gist_id}","starred_url":"https://api.github.com/users/SumOfUs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SumOfUs/subscriptions","organizations_url":"https://api.github.com/users/SumOfUs/orgs","repos_url":"https://api.github.com/users/SumOfUs/repos","events_url":"https://api.github.com/users/SumOfUs/events{/privacy}","received_events_url":"https://api.github.com/users/SumOfUs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SumOfUs/Champaign","description":"SumOfUs Online Campaign Platform.","fork":false,"url":"https://api.github.com/repos/SumOfUs/Champaign","forks_url":"https://api.github.com/repos/SumOfUs/Champaign/forks","keys_url":"https://api.github.com/repos/SumOfUs/Champaign/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SumOfUs/Champaign/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SumOfUs/Champaign/teams","hooks_url":"https://api.github.com/repos/SumOfUs/Champaign/hooks","issue_events_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/events{/number}","events_url":"https://api.github.com/repos/SumOfUs/Champaign/events","assignees_url":"https://api.github.com/repos/SumOfUs/Champaign/assignees{/user}","branches_url":"https://api.github.com/repos/SumOfUs/Champaign/branches{/branch}","tags_url":"https://api.github.com/repos/SumOfUs/Champaign/tags","blobs_url":"https://api.github.com/repos/SumOfUs/Champaign/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SumOfUs/Champaign/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SumOfUs/Champaign/git/refs{/sha}","trees_url":"https://api.github.com/repos/SumOfUs/Champaign/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SumOfUs/Champaign/statuses/{sha}","languages_url":"https://api.github.com/repos/SumOfUs/Champaign/languages","stargazers_url":"https://api.github.com/repos/SumOfUs/Champaign/stargazers","contributors_url":"https://api.github.com/repos/SumOfUs/Champaign/contributors","subscribers_url":"https://api.github.com/repos/SumOfUs/Champaign/subscribers","subscription_url":"https://api.github.com/repos/SumOfUs/Champaign/subscription","commits_url":"https://api.github.com/repos/SumOfUs/Champaign/commits{/sha}","git_commits_url":"https://api.github.com/repos/SumOfUs/Champaign/git/commits{/sha}","comments_url":"https://api.github.com/repos/SumOfUs/Champaign/comments{/number}","issue_comment_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/comments{/number}","contents_url":"https://api.github.com/repos/SumOfUs/Champaign/contents/{+path}","compare_url":"https://api.github.com/repos/SumOfUs/Champaign/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SumOfUs/Champaign/merges","archive_url":"https://api.github.com/repos/SumOfUs/Champaign/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SumOfUs/Champaign/downloads","issues_url":"https://api.github.com/repos/SumOfUs/Champaign/issues{/number}","pulls_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls{/number}","milestones_url":"https://api.github.com/repos/SumOfUs/Champaign/milestones{/number}","notifications_url":"https://api.github.com/repos/SumOfUs/Champaign/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SumOfUs/Champaign/labels{/name}","releases_url":"https://api.github.com/repos/SumOfUs/Champaign/releases{/id}","deployments_url":"https://api.github.com/repos/SumOfUs/Champaign/deployments","created_at":"2015-04-09T18:16:20Z","updated_at":"2016-01-26T22:39:57Z","pushed_at":"2016-02-29T16:40:56Z","git_url":"git://github.com/SumOfUs/Champaign.git","ssh_url":"git@github.com:SumOfUs/Champaign.git","clone_url":"https://github.com/SumOfUs/Champaign.git","svn_url":"https://github.com/SumOfUs/Champaign","homepage":null,"size":7543,"stargazers_count":11,"watchers_count":11,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":14,"forks":1,"open_issues":14,"watchers":11,"default_branch":"development"}},"base":{"label":"SumOfUs:development","ref":"development","sha":"5e8763a6e268f732c102f24ea36d3fe45d74d483","user":{"login":"SumOfUs","id":7574652,"avatar_url":"https://avatars.githubusercontent.com/u/7574652?v=3","gravatar_id":"","url":"https://api.github.com/users/SumOfUs","html_url":"https://github.com/SumOfUs","followers_url":"https://api.github.com/users/SumOfUs/followers","following_url":"https://api.github.com/users/SumOfUs/following{/other_user}","gists_url":"https://api.github.com/users/SumOfUs/gists{/gist_id}","starred_url":"https://api.github.com/users/SumOfUs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SumOfUs/subscriptions","organizations_url":"https://api.github.com/users/SumOfUs/orgs","repos_url":"https://api.github.com/users/SumOfUs/repos","events_url":"https://api.github.com/users/SumOfUs/events{/privacy}","received_events_url":"https://api.github.com/users/SumOfUs/received_events","type":"Organization","site_admin":false},"repo":{"id":33684818,"name":"Champaign","full_name":"SumOfUs/Champaign","owner":{"login":"SumOfUs","id":7574652,"avatar_url":"https://avatars.githubusercontent.com/u/7574652?v=3","gravatar_id":"","url":"https://api.github.com/users/SumOfUs","html_url":"https://github.com/SumOfUs","followers_url":"https://api.github.com/users/SumOfUs/followers","following_url":"https://api.github.com/users/SumOfUs/following{/other_user}","gists_url":"https://api.github.com/users/SumOfUs/gists{/gist_id}","starred_url":"https://api.github.com/users/SumOfUs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SumOfUs/subscriptions","organizations_url":"https://api.github.com/users/SumOfUs/orgs","repos_url":"https://api.github.com/users/SumOfUs/repos","events_url":"https://api.github.com/users/SumOfUs/events{/privacy}","received_events_url":"https://api.github.com/users/SumOfUs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SumOfUs/Champaign","description":"SumOfUs Online Campaign Platform.","fork":false,"url":"https://api.github.com/repos/SumOfUs/Champaign","forks_url":"https://api.github.com/repos/SumOfUs/Champaign/forks","keys_url":"https://api.github.com/repos/SumOfUs/Champaign/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SumOfUs/Champaign/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SumOfUs/Champaign/teams","hooks_url":"https://api.github.com/repos/SumOfUs/Champaign/hooks","issue_events_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/events{/number}","events_url":"https://api.github.com/repos/SumOfUs/Champaign/events","assignees_url":"https://api.github.com/repos/SumOfUs/Champaign/assignees{/user}","branches_url":"https://api.github.com/repos/SumOfUs/Champaign/branches{/branch}","tags_url":"https://api.github.com/repos/SumOfUs/Champaign/tags","blobs_url":"https://api.github.com/repos/SumOfUs/Champaign/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SumOfUs/Champaign/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SumOfUs/Champaign/git/refs{/sha}","trees_url":"https://api.github.com/repos/SumOfUs/Champaign/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SumOfUs/Champaign/statuses/{sha}","languages_url":"https://api.github.com/repos/SumOfUs/Champaign/languages","stargazers_url":"https://api.github.com/repos/SumOfUs/Champaign/stargazers","contributors_url":"https://api.github.com/repos/SumOfUs/Champaign/contributors","subscribers_url":"https://api.github.com/repos/SumOfUs/Champaign/subscribers","subscription_url":"https://api.github.com/repos/SumOfUs/Champaign/subscription","commits_url":"https://api.github.com/repos/SumOfUs/Champaign/commits{/sha}","git_commits_url":"https://api.github.com/repos/SumOfUs/Champaign/git/commits{/sha}","comments_url":"https://api.github.com/repos/SumOfUs/Champaign/comments{/number}","issue_comment_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/comments{/number}","contents_url":"https://api.github.com/repos/SumOfUs/Champaign/contents/{+path}","compare_url":"https://api.github.com/repos/SumOfUs/Champaign/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SumOfUs/Champaign/merges","archive_url":"https://api.github.com/repos/SumOfUs/Champaign/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SumOfUs/Champaign/downloads","issues_url":"https://api.github.com/repos/SumOfUs/Champaign/issues{/number}","pulls_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls{/number}","milestones_url":"https://api.github.com/repos/SumOfUs/Champaign/milestones{/number}","notifications_url":"https://api.github.com/repos/SumOfUs/Champaign/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SumOfUs/Champaign/labels{/name}","releases_url":"https://api.github.com/repos/SumOfUs/Champaign/releases{/id}","deployments_url":"https://api.github.com/repos/SumOfUs/Champaign/deployments","created_at":"2015-04-09T18:16:20Z","updated_at":"2016-01-26T22:39:57Z","pushed_at":"2016-02-29T16:40:56Z","git_url":"git://github.com/SumOfUs/Champaign.git","ssh_url":"git@github.com:SumOfUs/Champaign.git","clone_url":"https://github.com/SumOfUs/Champaign.git","svn_url":"https://github.com/SumOfUs/Champaign","homepage":null,"size":7543,"stargazers_count":11,"watchers_count":11,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":14,"forks":1,"open_issues":14,"watchers":11,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/404"},"html":{"href":"https://github.com/SumOfUs/Champaign/pull/404"},"issue":{"href":"https://api.github.com/repos/SumOfUs/Champaign/issues/404"},"comments":{"href":"https://api.github.com/repos/SumOfUs/Champaign/issues/404/comments"},"review_comments":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/404/comments"},"review_comment":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/404/commits"},"statuses":{"href":"https://api.github.com/repos/SumOfUs/Champaign/statuses/d6fac5e605a35df0797e7c3aa9446a4d804d715d"}}}}