{"action":"opened","number":76,"pull_request":{"url":"https://api.github.com/repos/benbalter/licensee/pulls/76","id":51948428,"html_url":"https://github.com/benbalter/licensee/pull/76","diff_url":"https://github.com/benbalter/licensee/pull/76.diff","patch_url":"https://github.com/benbalter/licensee/pull/76.patch","issue_url":"https://api.github.com/repos/benbalter/licensee/issues/76","number":76,"state":"open","locked":false,"title":"Expose license hash","user":{"login":"benbalter","id":282759,"avatar_url":"https://avatars.githubusercontent.com/u/282759?v=3","gravatar_id":"","url":"https://api.github.com/users/benbalter","html_url":"https://github.com/benbalter","followers_url":"https://api.github.com/users/benbalter/followers","following_url":"https://api.github.com/users/benbalter/following{/other_user}","gists_url":"https://api.github.com/users/benbalter/gists{/gist_id}","starred_url":"https://api.github.com/users/benbalter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbalter/subscriptions","organizations_url":"https://api.github.com/users/benbalter/orgs","repos_url":"https://api.github.com/users/benbalter/repos","events_url":"https://api.github.com/users/benbalter/events{/privacy}","received_events_url":"https://api.github.com/users/benbalter/received_events","type":"User","site_admin":true},"body":"This pull request exposes `License#hash` and `LicenseFile#hash` methods for identifying and comparing non-standard licenses.\r\n\r\nThis is implemented by adding `hash` and `content_normalized` methods to `ContentHelper`, which simply strip whitespace and calculates the SHA256 hash of the file's content. I'm not beholden to SHA256, if folks like @vmg have strong opinions for one hashing algorithm over another. Given the use case, it doesn't need to be cryptographic, but we'd want it to be fast and unique.\r\n\r\nThis isn't used for the built in license detection. The use case in mind here is the one described in #67. Where Licensee fails to detect a license, the hash could be used by end users to identify identical (once normalized, including removing copyright information) but unknown licenses.\r\n\r\nI also moved `LicenseFile` and `ProjectInfo` into their own files, to make it a bit easier to test things more granularly, and standardized `License` and `LicenseFile` to use `#content` (rather than `License` using `#body` before) to describe the contents of the license (but aliased to `#body` to preserve backwards compatibility).\r\n\r\nFixes #67","created_at":"2015-11-26T22:25:39Z","updated_at":"2015-11-26T22:25:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"benbalter","id":282759,"avatar_url":"https://avatars.githubusercontent.com/u/282759?v=3","gravatar_id":"","url":"https://api.github.com/users/benbalter","html_url":"https://github.com/benbalter","followers_url":"https://api.github.com/users/benbalter/followers","following_url":"https://api.github.com/users/benbalter/following{/other_user}","gists_url":"https://api.github.com/users/benbalter/gists{/gist_id}","starred_url":"https://api.github.com/users/benbalter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbalter/subscriptions","organizations_url":"https://api.github.com/users/benbalter/orgs","repos_url":"https://api.github.com/users/benbalter/repos","events_url":"https://api.github.com/users/benbalter/events{/privacy}","received_events_url":"https://api.github.com/users/benbalter/received_events","type":"User","site_admin":true},"milestone":null,"commits_url":"https://api.github.com/repos/benbalter/licensee/pulls/76/commits","review_comments_url":"https://api.github.com/repos/benbalter/licensee/pulls/76/comments","review_comment_url":"https://api.github.com/repos/benbalter/licensee/pulls/comments{/number}","comments_url":"https://api.github.com/repos/benbalter/licensee/issues/76/comments","statuses_url":"https://api.github.com/repos/benbalter/licensee/statuses/a5954aa42b923050806c78c266e652f89dc6c234","head":{"label":"benbalter:license-hash","ref":"license-hash","sha":"a5954aa42b923050806c78c266e652f89dc6c234","user":{"login":"benbalter","id":282759,"avatar_url":"https://avatars.githubusercontent.com/u/282759?v=3","gravatar_id":"","url":"https://api.github.com/users/benbalter","html_url":"https://github.com/benbalter","followers_url":"https://api.github.com/users/benbalter/followers","following_url":"https://api.github.com/users/benbalter/following{/other_user}","gists_url":"https://api.github.com/users/benbalter/gists{/gist_id}","starred_url":"https://api.github.com/users/benbalter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbalter/subscriptions","organizations_url":"https://api.github.com/users/benbalter/orgs","repos_url":"https://api.github.com/users/benbalter/repos","events_url":"https://api.github.com/users/benbalter/events{/privacy}","received_events_url":"https://api.github.com/users/benbalter/received_events","type":"User","site_admin":true},"repo":{"id":23022377,"name":"licensee","full_name":"benbalter/licensee","owner":{"login":"benbalter","id":282759,"avatar_url":"https://avatars.githubusercontent.com/u/282759?v=3","gravatar_id":"","url":"https://api.github.com/users/benbalter","html_url":"https://github.com/benbalter","followers_url":"https://api.github.com/users/benbalter/followers","following_url":"https://api.github.com/users/benbalter/following{/other_user}","gists_url":"https://api.github.com/users/benbalter/gists{/gist_id}","starred_url":"https://api.github.com/users/benbalter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbalter/subscriptions","organizations_url":"https://api.github.com/users/benbalter/orgs","repos_url":"https://api.github.com/users/benbalter/repos","events_url":"https://api.github.com/users/benbalter/events{/privacy}","received_events_url":"https://api.github.com/users/benbalter/received_events","type":"User","site_admin":true},"private":false,"html_url":"https://github.com/benbalter/licensee","description":"A Ruby Gem to detect under what license a project is distributed.","fork":false,"url":"https://api.github.com/repos/benbalter/licensee","forks_url":"https://api.github.com/repos/benbalter/licensee/forks","keys_url":"https://api.github.com/repos/benbalter/licensee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benbalter/licensee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benbalter/licensee/teams","hooks_url":"https://api.github.com/repos/benbalter/licensee/hooks","issue_events_url":"https://api.github.com/repos/benbalter/licensee/issues/events{/number}","events_url":"https://api.github.com/repos/benbalter/licensee/events","assignees_url":"https://api.github.com/repos/benbalter/licensee/assignees{/user}","branches_url":"https://api.github.com/repos/benbalter/licensee/branches{/branch}","tags_url":"https://api.github.com/repos/benbalter/licensee/tags","blobs_url":"https://api.github.com/repos/benbalter/licensee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benbalter/licensee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benbalter/licensee/git/refs{/sha}","trees_url":"https://api.github.com/repos/benbalter/licensee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benbalter/licensee/statuses/{sha}","languages_url":"https://api.github.com/repos/benbalter/licensee/languages","stargazers_url":"https://api.github.com/repos/benbalter/licensee/stargazers","contributors_url":"https://api.github.com/repos/benbalter/licensee/contributors","subscribers_url":"https://api.github.com/repos/benbalter/licensee/subscribers","subscription_url":"https://api.github.com/repos/benbalter/licensee/subscription","commits_url":"https://api.github.com/repos/benbalter/licensee/commits{/sha}","git_commits_url":"https://api.github.com/repos/benbalter/licensee/git/commits{/sha}","comments_url":"https://api.github.com/repos/benbalter/licensee/comments{/number}","issue_comment_url":"https://api.github.com/repos/benbalter/licensee/issues/comments{/number}","contents_url":"https://api.github.com/repos/benbalter/licensee/contents/{+path}","compare_url":"https://api.github.com/repos/benbalter/licensee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benbalter/licensee/merges","archive_url":"https://api.github.com/repos/benbalter/licensee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benbalter/licensee/downloads","issues_url":"https://api.github.com/repos/benbalter/licensee/issues{/number}","pulls_url":"https://api.github.com/repos/benbalter/licensee/pulls{/number}","milestones_url":"https://api.github.com/repos/benbalter/licensee/milestones{/number}","notifications_url":"https://api.github.com/repos/benbalter/licensee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benbalter/licensee/labels{/name}","releases_url":"https://api.github.com/repos/benbalter/licensee/releases{/id}","created_at":"2014-08-16T16:39:56Z","updated_at":"2015-11-08T11:02:51Z","pushed_at":"2015-11-26T22:23:02Z","git_url":"git://github.com/benbalter/licensee.git","ssh_url":"git@github.com:benbalter/licensee.git","clone_url":"https://github.com/benbalter/licensee.git","svn_url":"https://github.com/benbalter/licensee","homepage":"","size":339,"stargazers_count":56,"watchers_count":56,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":8,"forks":15,"open_issues":8,"watchers":56,"default_branch":"master"}},"base":{"label":"benbalter:master","ref":"master","sha":"cf5894391c0ad163fbbc9ddc2ad1813e5eb8f4fb","user":{"login":"benbalter","id":282759,"avatar_url":"https://avatars.githubusercontent.com/u/282759?v=3","gravatar_id":"","url":"https://api.github.com/users/benbalter","html_url":"https://github.com/benbalter","followers_url":"https://api.github.com/users/benbalter/followers","following_url":"https://api.github.com/users/benbalter/following{/other_user}","gists_url":"https://api.github.com/users/benbalter/gists{/gist_id}","starred_url":"https://api.github.com/users/benbalter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbalter/subscriptions","organizations_url":"https://api.github.com/users/benbalter/orgs","repos_url":"https://api.github.com/users/benbalter/repos","events_url":"https://api.github.com/users/benbalter/events{/privacy}","received_events_url":"https://api.github.com/users/benbalter/received_events","type":"User","site_admin":true},"repo":{"id":23022377,"name":"licensee","full_name":"benbalter/licensee","owner":{"login":"benbalter","id":282759,"avatar_url":"https://avatars.githubusercontent.com/u/282759?v=3","gravatar_id":"","url":"https://api.github.com/users/benbalter","html_url":"https://github.com/benbalter","followers_url":"https://api.github.com/users/benbalter/followers","following_url":"https://api.github.com/users/benbalter/following{/other_user}","gists_url":"https://api.github.com/users/benbalter/gists{/gist_id}","starred_url":"https://api.github.com/users/benbalter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbalter/subscriptions","organizations_url":"https://api.github.com/users/benbalter/orgs","repos_url":"https://api.github.com/users/benbalter/repos","events_url":"https://api.github.com/users/benbalter/events{/privacy}","received_events_url":"https://api.github.com/users/benbalter/received_events","type":"User","site_admin":true},"private":false,"html_url":"https://github.com/benbalter/licensee","description":"A Ruby Gem to detect under what license a project is distributed.","fork":false,"url":"https://api.github.com/repos/benbalter/licensee","forks_url":"https://api.github.com/repos/benbalter/licensee/forks","keys_url":"https://api.github.com/repos/benbalter/licensee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benbalter/licensee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benbalter/licensee/teams","hooks_url":"https://api.github.com/repos/benbalter/licensee/hooks","issue_events_url":"https://api.github.com/repos/benbalter/licensee/issues/events{/number}","events_url":"https://api.github.com/repos/benbalter/licensee/events","assignees_url":"https://api.github.com/repos/benbalter/licensee/assignees{/user}","branches_url":"https://api.github.com/repos/benbalter/licensee/branches{/branch}","tags_url":"https://api.github.com/repos/benbalter/licensee/tags","blobs_url":"https://api.github.com/repos/benbalter/licensee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benbalter/licensee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benbalter/licensee/git/refs{/sha}","trees_url":"https://api.github.com/repos/benbalter/licensee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benbalter/licensee/statuses/{sha}","languages_url":"https://api.github.com/repos/benbalter/licensee/languages","stargazers_url":"https://api.github.com/repos/benbalter/licensee/stargazers","contributors_url":"https://api.github.com/repos/benbalter/licensee/contributors","subscribers_url":"https://api.github.com/repos/benbalter/licensee/subscribers","subscription_url":"https://api.github.com/repos/benbalter/licensee/subscription","commits_url":"https://api.github.com/repos/benbalter/licensee/commits{/sha}","git_commits_url":"https://api.github.com/repos/benbalter/licensee/git/commits{/sha}","comments_url":"https://api.github.com/repos/benbalter/licensee/comments{/number}","issue_comment_url":"https://api.github.com/repos/benbalter/licensee/issues/comments{/number}","contents_url":"https://api.github.com/repos/benbalter/licensee/contents/{+path}","compare_url":"https://api.github.com/repos/benbalter/licensee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benbalter/licensee/merges","archive_url":"https://api.github.com/repos/benbalter/licensee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benbalter/licensee/downloads","issues_url":"https://api.github.com/repos/benbalter/licensee/issues{/number}","pulls_url":"https://api.github.com/repos/benbalter/licensee/pulls{/number}","milestones_url":"https://api.github.com/repos/benbalter/licensee/milestones{/number}","notifications_url":"https://api.github.com/repos/benbalter/licensee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benbalter/licensee/labels{/name}","releases_url":"https://api.github.com/repos/benbalter/licensee/releases{/id}","created_at":"2014-08-16T16:39:56Z","updated_at":"2015-11-08T11:02:51Z","pushed_at":"2015-11-26T22:23:02Z","git_url":"git://github.com/benbalter/licensee.git","ssh_url":"git@github.com:benbalter/licensee.git","clone_url":"https://github.com/benbalter/licensee.git","svn_url":"https://github.com/benbalter/licensee","homepage":"","size":339,"stargazers_count":56,"watchers_count":56,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":8,"forks":15,"open_issues":8,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/benbalter/licensee/pulls/76"},"html":{"href":"https://github.com/benbalter/licensee/pull/76"},"issue":{"href":"https://api.github.com/repos/benbalter/licensee/issues/76"},"comments":{"href":"https://api.github.com/repos/benbalter/licensee/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/benbalter/licensee/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/benbalter/licensee/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/benbalter/licensee/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/benbalter/licensee/statuses/a5954aa42b923050806c78c266e652f89dc6c234"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":169,"deletions":110,"changed_files":10}}