{"action":"created","comment":{"url":"https://api.github.com/repos/wurde/script/pulls/comments/47189575","id":47189575,"diff_hunk":"@@ -0,0 +1,366 @@\n+require 'fileutils'\n+require 'open3'\n+\n+module Script\n+  class Handler #:nodoc:\n+    def search(regexp: nil, quiet: false)\n+      scripts = list_all\n+      scripts = filter(scripts, regexp) if regexp\n+      scripts = headers(scripts) if scripts\n+      pretty_print(scripts) unless quiet\n+      scripts\n+    end\n+\n+    def create!(script)\n+      fail \"#{script} already exists.\" if script_exist?(script)\n+      header = build_header(script)\n+      write_header(script, header)\n+      fetch(script)\n+      commit_changes\n+    end\n+\n+    def history\n+      puts \"History of recent script changes...\"\n+      out, error = Open3.capture3(%(git diff --name-status \"@{7 days ago}\" \"@{0 days ago}\"))\n+      puts out","path":"lib/script/handler.rb","position":25,"original_position":25,"commit_id":"4013842448d935a44a92ce56439de5552bb2f53e","original_commit_id":"4013842448d935a44a92ce56439de5552bb2f53e","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Do not write to stdout. Use Rails' logger if you want to log.","created_at":"2015-12-10T05:10:46Z","updated_at":"2015-12-10T05:10:46Z","html_url":"https://github.com/wurde/script/pull/46#discussion_r47189575","pull_request_url":"https://api.github.com/repos/wurde/script/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/wurde/script/pulls/comments/47189575"},"html":{"href":"https://github.com/wurde/script/pull/46#discussion_r47189575"},"pull_request":{"href":"https://api.github.com/repos/wurde/script/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/wurde/script/pulls/46","id":53214282,"html_url":"https://github.com/wurde/script/pull/46","diff_url":"https://github.com/wurde/script/pull/46.diff","patch_url":"https://github.com/wurde/script/pull/46.patch","issue_url":"https://api.github.com/repos/wurde/script/issues/46","number":46,"state":"open","locked":false,"title":"Fix#45 Bin script","user":{"login":"wurde","id":5455357,"avatar_url":"https://avatars.githubusercontent.com/u/5455357?v=3","gravatar_id":"","url":"https://api.github.com/users/wurde","html_url":"https://github.com/wurde","followers_url":"https://api.github.com/users/wurde/followers","following_url":"https://api.github.com/users/wurde/following{/other_user}","gists_url":"https://api.github.com/users/wurde/gists{/gist_id}","starred_url":"https://api.github.com/users/wurde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wurde/subscriptions","organizations_url":"https://api.github.com/users/wurde/orgs","repos_url":"https://api.github.com/users/wurde/repos","events_url":"https://api.github.com/users/wurde/events{/privacy}","received_events_url":"https://api.github.com/users/wurde/received_events","type":"User","site_admin":false},"body":"fixes #45 ","created_at":"2015-12-10T04:26:26Z","updated_at":"2015-12-10T05:10:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2529ee4dd70245d15578a0b1f6746bfe384a2c9c","assignee":{"login":"wurde","id":5455357,"avatar_url":"https://avatars.githubusercontent.com/u/5455357?v=3","gravatar_id":"","url":"https://api.github.com/users/wurde","html_url":"https://github.com/wurde","followers_url":"https://api.github.com/users/wurde/followers","following_url":"https://api.github.com/users/wurde/following{/other_user}","gists_url":"https://api.github.com/users/wurde/gists{/gist_id}","starred_url":"https://api.github.com/users/wurde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wurde/subscriptions","organizations_url":"https://api.github.com/users/wurde/orgs","repos_url":"https://api.github.com/users/wurde/repos","events_url":"https://api.github.com/users/wurde/events{/privacy}","received_events_url":"https://api.github.com/users/wurde/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/wurde/script/pulls/46/commits","review_comments_url":"https://api.github.com/repos/wurde/script/pulls/46/comments","review_comment_url":"https://api.github.com/repos/wurde/script/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wurde/script/issues/46/comments","statuses_url":"https://api.github.com/repos/wurde/script/statuses/4013842448d935a44a92ce56439de5552bb2f53e","head":{"label":"wurde:fix#45_bin_script","ref":"fix#45_bin_script","sha":"4013842448d935a44a92ce56439de5552bb2f53e","user":{"login":"wurde","id":5455357,"avatar_url":"https://avatars.githubusercontent.com/u/5455357?v=3","gravatar_id":"","url":"https://api.github.com/users/wurde","html_url":"https://github.com/wurde","followers_url":"https://api.github.com/users/wurde/followers","following_url":"https://api.github.com/users/wurde/following{/other_user}","gists_url":"https://api.github.com/users/wurde/gists{/gist_id}","starred_url":"https://api.github.com/users/wurde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wurde/subscriptions","organizations_url":"https://api.github.com/users/wurde/orgs","repos_url":"https://api.github.com/users/wurde/repos","events_url":"https://api.github.com/users/wurde/events{/privacy}","received_events_url":"https://api.github.com/users/wurde/received_events","type":"User","site_admin":false},"repo":{"id":16531196,"name":"script","full_name":"wurde/script","owner":{"login":"wurde","id":5455357,"avatar_url":"https://avatars.githubusercontent.com/u/5455357?v=3","gravatar_id":"","url":"https://api.github.com/users/wurde","html_url":"https://github.com/wurde","followers_url":"https://api.github.com/users/wurde/followers","following_url":"https://api.github.com/users/wurde/following{/other_user}","gists_url":"https://api.github.com/users/wurde/gists{/gist_id}","starred_url":"https://api.github.com/users/wurde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wurde/subscriptions","organizations_url":"https://api.github.com/users/wurde/orgs","repos_url":"https://api.github.com/users/wurde/repos","events_url":"https://api.github.com/users/wurde/events{/privacy}","received_events_url":"https://api.github.com/users/wurde/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wurde/script","description":"Collection of command-line applications.","fork":false,"url":"https://api.github.com/repos/wurde/script","forks_url":"https://api.github.com/repos/wurde/script/forks","keys_url":"https://api.github.com/repos/wurde/script/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wurde/script/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wurde/script/teams","hooks_url":"https://api.github.com/repos/wurde/script/hooks","issue_events_url":"https://api.github.com/repos/wurde/script/issues/events{/number}","events_url":"https://api.github.com/repos/wurde/script/events","assignees_url":"https://api.github.com/repos/wurde/script/assignees{/user}","branches_url":"https://api.github.com/repos/wurde/script/branches{/branch}","tags_url":"https://api.github.com/repos/wurde/script/tags","blobs_url":"https://api.github.com/repos/wurde/script/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wurde/script/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wurde/script/git/refs{/sha}","trees_url":"https://api.github.com/repos/wurde/script/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wurde/script/statuses/{sha}","languages_url":"https://api.github.com/repos/wurde/script/languages","stargazers_url":"https://api.github.com/repos/wurde/script/stargazers","contributors_url":"https://api.github.com/repos/wurde/script/contributors","subscribers_url":"https://api.github.com/repos/wurde/script/subscribers","subscription_url":"https://api.github.com/repos/wurde/script/subscription","commits_url":"https://api.github.com/repos/wurde/script/commits{/sha}","git_commits_url":"https://api.github.com/repos/wurde/script/git/commits{/sha}","comments_url":"https://api.github.com/repos/wurde/script/comments{/number}","issue_comment_url":"https://api.github.com/repos/wurde/script/issues/comments{/number}","contents_url":"https://api.github.com/repos/wurde/script/contents/{+path}","compare_url":"https://api.github.com/repos/wurde/script/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wurde/script/merges","archive_url":"https://api.github.com/repos/wurde/script/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wurde/script/downloads","issues_url":"https://api.github.com/repos/wurde/script/issues{/number}","pulls_url":"https://api.github.com/repos/wurde/script/pulls{/number}","milestones_url":"https://api.github.com/repos/wurde/script/milestones{/number}","notifications_url":"https://api.github.com/repos/wurde/script/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wurde/script/labels{/name}","releases_url":"https://api.github.com/repos/wurde/script/releases{/id}","created_at":"2014-02-05T00:57:16Z","updated_at":"2015-12-03T23:52:55Z","pushed_at":"2015-12-10T05:10:41Z","git_url":"git://github.com/wurde/script.git","ssh_url":"git@github.com:wurde/script.git","clone_url":"https://github.com/wurde/script.git","svn_url":"https://github.com/wurde/script","homepage":"","size":2228,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":16,"forks":2,"open_issues":16,"watchers":2,"default_branch":"master"}},"base":{"label":"wurde:master","ref":"master","sha":"c7ecf0616a8b696affff9aeb0f1b820729ceb422","user":{"login":"wurde","id":5455357,"avatar_url":"https://avatars.githubusercontent.com/u/5455357?v=3","gravatar_id":"","url":"https://api.github.com/users/wurde","html_url":"https://github.com/wurde","followers_url":"https://api.github.com/users/wurde/followers","following_url":"https://api.github.com/users/wurde/following{/other_user}","gists_url":"https://api.github.com/users/wurde/gists{/gist_id}","starred_url":"https://api.github.com/users/wurde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wurde/subscriptions","organizations_url":"https://api.github.com/users/wurde/orgs","repos_url":"https://api.github.com/users/wurde/repos","events_url":"https://api.github.com/users/wurde/events{/privacy}","received_events_url":"https://api.github.com/users/wurde/received_events","type":"User","site_admin":false},"repo":{"id":16531196,"name":"script","full_name":"wurde/script","owner":{"login":"wurde","id":5455357,"avatar_url":"https://avatars.githubusercontent.com/u/5455357?v=3","gravatar_id":"","url":"https://api.github.com/users/wurde","html_url":"https://github.com/wurde","followers_url":"https://api.github.com/users/wurde/followers","following_url":"https://api.github.com/users/wurde/following{/other_user}","gists_url":"https://api.github.com/users/wurde/gists{/gist_id}","starred_url":"https://api.github.com/users/wurde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wurde/subscriptions","organizations_url":"https://api.github.com/users/wurde/orgs","repos_url":"https://api.github.com/users/wurde/repos","events_url":"https://api.github.com/users/wurde/events{/privacy}","received_events_url":"https://api.github.com/users/wurde/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wurde/script","description":"Collection of command-line applications.","fork":false,"url":"https://api.github.com/repos/wurde/script","forks_url":"https://api.github.com/repos/wurde/script/forks","keys_url":"https://api.github.com/repos/wurde/script/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wurde/script/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wurde/script/teams","hooks_url":"https://api.github.com/repos/wurde/script/hooks","issue_events_url":"https://api.github.com/repos/wurde/script/issues/events{/number}","events_url":"https://api.github.com/repos/wurde/script/events","assignees_url":"https://api.github.com/repos/wurde/script/assignees{/user}","branches_url":"https://api.github.com/repos/wurde/script/branches{/branch}","tags_url":"https://api.github.com/repos/wurde/script/tags","blobs_url":"https://api.github.com/repos/wurde/script/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wurde/script/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wurde/script/git/refs{/sha}","trees_url":"https://api.github.com/repos/wurde/script/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wurde/script/statuses/{sha}","languages_url":"https://api.github.com/repos/wurde/script/languages","stargazers_url":"https://api.github.com/repos/wurde/script/stargazers","contributors_url":"https://api.github.com/repos/wurde/script/contributors","subscribers_url":"https://api.github.com/repos/wurde/script/subscribers","subscription_url":"https://api.github.com/repos/wurde/script/subscription","commits_url":"https://api.github.com/repos/wurde/script/commits{/sha}","git_commits_url":"https://api.github.com/repos/wurde/script/git/commits{/sha}","comments_url":"https://api.github.com/repos/wurde/script/comments{/number}","issue_comment_url":"https://api.github.com/repos/wurde/script/issues/comments{/number}","contents_url":"https://api.github.com/repos/wurde/script/contents/{+path}","compare_url":"https://api.github.com/repos/wurde/script/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wurde/script/merges","archive_url":"https://api.github.com/repos/wurde/script/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wurde/script/downloads","issues_url":"https://api.github.com/repos/wurde/script/issues{/number}","pulls_url":"https://api.github.com/repos/wurde/script/pulls{/number}","milestones_url":"https://api.github.com/repos/wurde/script/milestones{/number}","notifications_url":"https://api.github.com/repos/wurde/script/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wurde/script/labels{/name}","releases_url":"https://api.github.com/repos/wurde/script/releases{/id}","created_at":"2014-02-05T00:57:16Z","updated_at":"2015-12-03T23:52:55Z","pushed_at":"2015-12-10T05:10:41Z","git_url":"git://github.com/wurde/script.git","ssh_url":"git@github.com:wurde/script.git","clone_url":"https://github.com/wurde/script.git","svn_url":"https://github.com/wurde/script","homepage":"","size":2228,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":16,"forks":2,"open_issues":16,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wurde/script/pulls/46"},"html":{"href":"https://github.com/wurde/script/pull/46"},"issue":{"href":"https://api.github.com/repos/wurde/script/issues/46"},"comments":{"href":"https://api.github.com/repos/wurde/script/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/wurde/script/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/wurde/script/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wurde/script/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/wurde/script/statuses/4013842448d935a44a92ce56439de5552bb2f53e"}}}}