{"action":"created","comment":{"url":"https://api.github.com/repos/xcodeswift/xcproj/pulls/comments/150794987","pull_request_review_id":76395595,"id":150794987,"diff_hunk":"@@ -26,6 +26,7 @@ public class XcodeProj {\n         let pbxProjData = try Data(contentsOf: pbxprojPaths.first!.url)\n         let plistDecoder = PropertyListDecoder()\n         pbxproj = try plistDecoder.decode(PBXProj.self, from: pbxProjData)\n+        pbxproj.updateProjectName(path: pbxprojPaths.first!)","path":"Sources/xcproj/XcodeProj.swift","position":4,"original_position":4,"commit_id":"15bd83a1794242f4ddc37d3ce0880c9c7207b914","original_commit_id":"15bd83a1794242f4ddc37d3ce0880c9c7207b914","user":{"login":"pepibumur","id":663605,"avatar_url":"https://avatars3.githubusercontent.com/u/663605?v=4","gravatar_id":"","url":"https://api.github.com/users/pepibumur","html_url":"https://github.com/pepibumur","followers_url":"https://api.github.com/users/pepibumur/followers","following_url":"https://api.github.com/users/pepibumur/following{/other_user}","gists_url":"https://api.github.com/users/pepibumur/gists{/gist_id}","starred_url":"https://api.github.com/users/pepibumur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pepibumur/subscriptions","organizations_url":"https://api.github.com/users/pepibumur/orgs","repos_url":"https://api.github.com/users/pepibumur/repos","events_url":"https://api.github.com/users/pepibumur/events{/privacy}","received_events_url":"https://api.github.com/users/pepibumur/received_events","type":"User","site_admin":false},"body":"```swift\r\npbxproj.updateProjectName(path: pbxprojPaths.first!.parent().lastComponentWithoutExtension)\r\n```","created_at":"2017-11-14T10:36:36Z","updated_at":"2017-11-14T10:36:37Z","html_url":"https://github.com/xcodeswift/xcproj/pull/152#discussion_r150794987","pull_request_url":"https://api.github.com/repos/xcodeswift/xcproj/pulls/152","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/xcodeswift/xcproj/pulls/comments/150794987"},"html":{"href":"https://github.com/xcodeswift/xcproj/pull/152#discussion_r150794987"},"pull_request":{"href":"https://api.github.com/repos/xcodeswift/xcproj/pulls/152"}}},"pull_request":{"url":"https://api.github.com/repos/xcodeswift/xcproj/pulls/152","id":151629574,"html_url":"https://github.com/xcodeswift/xcproj/pull/152","diff_url":"https://github.com/xcodeswift/xcproj/pull/152.diff","patch_url":"https://github.com/xcodeswift/xcproj/pull/152.patch","issue_url":"https://api.github.com/repos/xcodeswift/xcproj/issues/152","number":152,"state":"open","locked":false,"title":"Add PBXProject name to comments","user":{"login":"allu22","id":482293,"avatar_url":"https://avatars1.githubusercontent.com/u/482293?v=4","gravatar_id":"","url":"https://api.github.com/users/allu22","html_url":"https://github.com/allu22","followers_url":"https://api.github.com/users/allu22/followers","following_url":"https://api.github.com/users/allu22/following{/other_user}","gists_url":"https://api.github.com/users/allu22/gists{/gist_id}","starred_url":"https://api.github.com/users/allu22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allu22/subscriptions","organizations_url":"https://api.github.com/users/allu22/orgs","repos_url":"https://api.github.com/users/allu22/repos","events_url":"https://api.github.com/users/allu22/events{/privacy}","received_events_url":"https://api.github.com/users/allu22/received_events","type":"User","site_admin":false},"body":"Resolves https://github.com/xcodeswift/xcproj/issues/144\r\n\r\n### Short description 📝\r\nAdds PBXProject name to comments.\r\n\r\n### Solution 📦\r\nAs PBXProject name is determined by its filename:\r\n- When decoding from path, use it to find project name and assign it to root project.\r\n- When encoding to path, use the path to overwrite the project name.\r\n\r\n### Alternatives considered\r\nWe could use regex to determine current project name:\r\n```` swift\r\nlet prefix = \"Build configuration list for PBXProject \\\"\"\r\nlet suffix = \"\\\"\"\r\n\r\nlet projectName = String(data: data, encoding: .utf8).flatMap { project in\r\n    project.range(of: \"\\(prefix).*\\(suffix)\", options: .regularExpression)\r\n        .map({ range in\r\n            String(project[range]\r\n                .dropFirst(prefix.count)\r\n                .dropLast(suffix.count)\r\n            )\r\n        })\r\n}\r\n````\r\nThis would help in situations where file name is not available, for example: when parsing from `Data`. But as `XcodeProj` does not at the moment directly support initialising with `Data`, I believe using file name approach is better.\r\n\r\n### GIF\r\n![gif](https://media.giphy.com/media/VKtsOAHDx1Luo/giphy.gif)\r\n","created_at":"2017-11-09T11:42:46Z","updated_at":"2017-11-14T10:36:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"240f2dc3bfb89521d771355e875378e89fe470ed","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/xcodeswift/xcproj/pulls/152/commits","review_comments_url":"https://api.github.com/repos/xcodeswift/xcproj/pulls/152/comments","review_comment_url":"https://api.github.com/repos/xcodeswift/xcproj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xcodeswift/xcproj/issues/152/comments","statuses_url":"https://api.github.com/repos/xcodeswift/xcproj/statuses/15bd83a1794242f4ddc37d3ce0880c9c7207b914","head":{"label":"RepositoryFork:project-name-comments","ref":"project-name-comments","sha":"15bd83a1794242f4ddc37d3ce0880c9c7207b914","user":{"login":"RepositoryFork","id":32290754,"avatar_url":"https://avatars2.githubusercontent.com/u/32290754?v=4","gravatar_id":"","url":"https://api.github.com/users/RepositoryFork","html_url":"https://github.com/RepositoryFork","followers_url":"https://api.github.com/users/RepositoryFork/followers","following_url":"https://api.github.com/users/RepositoryFork/following{/other_user}","gists_url":"https://api.github.com/users/RepositoryFork/gists{/gist_id}","starred_url":"https://api.github.com/users/RepositoryFork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RepositoryFork/subscriptions","organizations_url":"https://api.github.com/users/RepositoryFork/orgs","repos_url":"https://api.github.com/users/RepositoryFork/repos","events_url":"https://api.github.com/users/RepositoryFork/events{/privacy}","received_events_url":"https://api.github.com/users/RepositoryFork/received_events","type":"Organization","site_admin":false},"repo":{"id":109959608,"name":"xcproj","full_name":"RepositoryFork/xcproj","owner":{"login":"RepositoryFork","id":32290754,"avatar_url":"https://avatars2.githubusercontent.com/u/32290754?v=4","gravatar_id":"","url":"https://api.github.com/users/RepositoryFork","html_url":"https://github.com/RepositoryFork","followers_url":"https://api.github.com/users/RepositoryFork/followers","following_url":"https://api.github.com/users/RepositoryFork/following{/other_user}","gists_url":"https://api.github.com/users/RepositoryFork/gists{/gist_id}","starred_url":"https://api.github.com/users/RepositoryFork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RepositoryFork/subscriptions","organizations_url":"https://api.github.com/users/RepositoryFork/orgs","repos_url":"https://api.github.com/users/RepositoryFork/repos","events_url":"https://api.github.com/users/RepositoryFork/events{/privacy}","received_events_url":"https://api.github.com/users/RepositoryFork/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RepositoryFork/xcproj","description":"Swift library for parsing Xcode projects","fork":true,"url":"https://api.github.com/repos/RepositoryFork/xcproj","forks_url":"https://api.github.com/repos/RepositoryFork/xcproj/forks","keys_url":"https://api.github.com/repos/RepositoryFork/xcproj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RepositoryFork/xcproj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RepositoryFork/xcproj/teams","hooks_url":"https://api.github.com/repos/RepositoryFork/xcproj/hooks","issue_events_url":"https://api.github.com/repos/RepositoryFork/xcproj/issues/events{/number}","events_url":"https://api.github.com/repos/RepositoryFork/xcproj/events","assignees_url":"https://api.github.com/repos/RepositoryFork/xcproj/assignees{/user}","branches_url":"https://api.github.com/repos/RepositoryFork/xcproj/branches{/branch}","tags_url":"https://api.github.com/repos/RepositoryFork/xcproj/tags","blobs_url":"https://api.github.com/repos/RepositoryFork/xcproj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RepositoryFork/xcproj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RepositoryFork/xcproj/git/refs{/sha}","trees_url":"https://api.github.com/repos/RepositoryFork/xcproj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RepositoryFork/xcproj/statuses/{sha}","languages_url":"https://api.github.com/repos/RepositoryFork/xcproj/languages","stargazers_url":"https://api.github.com/repos/RepositoryFork/xcproj/stargazers","contributors_url":"https://api.github.com/repos/RepositoryFork/xcproj/contributors","subscribers_url":"https://api.github.com/repos/RepositoryFork/xcproj/subscribers","subscription_url":"https://api.github.com/repos/RepositoryFork/xcproj/subscription","commits_url":"https://api.github.com/repos/RepositoryFork/xcproj/commits{/sha}","git_commits_url":"https://api.github.com/repos/RepositoryFork/xcproj/git/commits{/sha}","comments_url":"https://api.github.com/repos/RepositoryFork/xcproj/comments{/number}","issue_comment_url":"https://api.github.com/repos/RepositoryFork/xcproj/issues/comments{/number}","contents_url":"https://api.github.com/repos/RepositoryFork/xcproj/contents/{+path}","compare_url":"https://api.github.com/repos/RepositoryFork/xcproj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RepositoryFork/xcproj/merges","archive_url":"https://api.github.com/repos/RepositoryFork/xcproj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RepositoryFork/xcproj/downloads","issues_url":"https://api.github.com/repos/RepositoryFork/xcproj/issues{/number}","pulls_url":"https://api.github.com/repos/RepositoryFork/xcproj/pulls{/number}","milestones_url":"https://api.github.com/repos/RepositoryFork/xcproj/milestones{/number}","notifications_url":"https://api.github.com/repos/RepositoryFork/xcproj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RepositoryFork/xcproj/labels{/name}","releases_url":"https://api.github.com/repos/RepositoryFork/xcproj/releases{/id}","deployments_url":"https://api.github.com/repos/RepositoryFork/xcproj/deployments","created_at":"2017-11-08T10:10:22Z","updated_at":"2017-11-08T10:10:24Z","pushed_at":"2017-11-13T11:12:30Z","git_url":"git://github.com/RepositoryFork/xcproj.git","ssh_url":"git@github.com:RepositoryFork/xcproj.git","clone_url":"https://github.com/RepositoryFork/xcproj.git","svn_url":"https://github.com/RepositoryFork/xcproj","homepage":null,"size":4346,"stargazers_count":0,"watchers_count":0,"language":"Swift","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,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"xcodeswift:master","ref":"master","sha":"b8d8bd95d6c4375405ab7ecb0b9d02e1974b1f1a","user":{"login":"xcodeswift","id":31348849,"avatar_url":"https://avatars2.githubusercontent.com/u/31348849?v=4","gravatar_id":"","url":"https://api.github.com/users/xcodeswift","html_url":"https://github.com/xcodeswift","followers_url":"https://api.github.com/users/xcodeswift/followers","following_url":"https://api.github.com/users/xcodeswift/following{/other_user}","gists_url":"https://api.github.com/users/xcodeswift/gists{/gist_id}","starred_url":"https://api.github.com/users/xcodeswift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcodeswift/subscriptions","organizations_url":"https://api.github.com/users/xcodeswift/orgs","repos_url":"https://api.github.com/users/xcodeswift/repos","events_url":"https://api.github.com/users/xcodeswift/events{/privacy}","received_events_url":"https://api.github.com/users/xcodeswift/received_events","type":"Organization","site_admin":false},"repo":{"id":93763457,"name":"xcproj","full_name":"xcodeswift/xcproj","owner":{"login":"xcodeswift","id":31348849,"avatar_url":"https://avatars2.githubusercontent.com/u/31348849?v=4","gravatar_id":"","url":"https://api.github.com/users/xcodeswift","html_url":"https://github.com/xcodeswift","followers_url":"https://api.github.com/users/xcodeswift/followers","following_url":"https://api.github.com/users/xcodeswift/following{/other_user}","gists_url":"https://api.github.com/users/xcodeswift/gists{/gist_id}","starred_url":"https://api.github.com/users/xcodeswift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcodeswift/subscriptions","organizations_url":"https://api.github.com/users/xcodeswift/orgs","repos_url":"https://api.github.com/users/xcodeswift/repos","events_url":"https://api.github.com/users/xcodeswift/events{/privacy}","received_events_url":"https://api.github.com/users/xcodeswift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xcodeswift/xcproj","description":"Swift library for parsing Xcode projects","fork":false,"url":"https://api.github.com/repos/xcodeswift/xcproj","forks_url":"https://api.github.com/repos/xcodeswift/xcproj/forks","keys_url":"https://api.github.com/repos/xcodeswift/xcproj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xcodeswift/xcproj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xcodeswift/xcproj/teams","hooks_url":"https://api.github.com/repos/xcodeswift/xcproj/hooks","issue_events_url":"https://api.github.com/repos/xcodeswift/xcproj/issues/events{/number}","events_url":"https://api.github.com/repos/xcodeswift/xcproj/events","assignees_url":"https://api.github.com/repos/xcodeswift/xcproj/assignees{/user}","branches_url":"https://api.github.com/repos/xcodeswift/xcproj/branches{/branch}","tags_url":"https://api.github.com/repos/xcodeswift/xcproj/tags","blobs_url":"https://api.github.com/repos/xcodeswift/xcproj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xcodeswift/xcproj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xcodeswift/xcproj/git/refs{/sha}","trees_url":"https://api.github.com/repos/xcodeswift/xcproj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xcodeswift/xcproj/statuses/{sha}","languages_url":"https://api.github.com/repos/xcodeswift/xcproj/languages","stargazers_url":"https://api.github.com/repos/xcodeswift/xcproj/stargazers","contributors_url":"https://api.github.com/repos/xcodeswift/xcproj/contributors","subscribers_url":"https://api.github.com/repos/xcodeswift/xcproj/subscribers","subscription_url":"https://api.github.com/repos/xcodeswift/xcproj/subscription","commits_url":"https://api.github.com/repos/xcodeswift/xcproj/commits{/sha}","git_commits_url":"https://api.github.com/repos/xcodeswift/xcproj/git/commits{/sha}","comments_url":"https://api.github.com/repos/xcodeswift/xcproj/comments{/number}","issue_comment_url":"https://api.github.com/repos/xcodeswift/xcproj/issues/comments{/number}","contents_url":"https://api.github.com/repos/xcodeswift/xcproj/contents/{+path}","compare_url":"https://api.github.com/repos/xcodeswift/xcproj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xcodeswift/xcproj/merges","archive_url":"https://api.github.com/repos/xcodeswift/xcproj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xcodeswift/xcproj/downloads","issues_url":"https://api.github.com/repos/xcodeswift/xcproj/issues{/number}","pulls_url":"https://api.github.com/repos/xcodeswift/xcproj/pulls{/number}","milestones_url":"https://api.github.com/repos/xcodeswift/xcproj/milestones{/number}","notifications_url":"https://api.github.com/repos/xcodeswift/xcproj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xcodeswift/xcproj/labels{/name}","releases_url":"https://api.github.com/repos/xcodeswift/xcproj/releases{/id}","deployments_url":"https://api.github.com/repos/xcodeswift/xcproj/deployments","created_at":"2017-06-08T15:12:40Z","updated_at":"2017-11-14T10:11:47Z","pushed_at":"2017-11-13T07:38:25Z","git_url":"git://github.com/xcodeswift/xcproj.git","ssh_url":"git@github.com:xcodeswift/xcproj.git","clone_url":"https://github.com/xcodeswift/xcproj.git","svn_url":"https://github.com/xcodeswift/xcproj","homepage":null,"size":4341,"stargazers_count":400,"watchers_count":400,"language":"Swift","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":26,"mirror_url":null,"archived":false,"open_issues_count":23,"forks":26,"open_issues":23,"watchers":400,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xcodeswift/xcproj/pulls/152"},"html":{"href":"https://github.com/xcodeswift/xcproj/pull/152"},"issue":{"href":"https://api.github.com/repos/xcodeswift/xcproj/issues/152"},"comments":{"href":"https://api.github.com/repos/xcodeswift/xcproj/issues/152/comments"},"review_comments":{"href":"https://api.github.com/repos/xcodeswift/xcproj/pulls/152/comments"},"review_comment":{"href":"https://api.github.com/repos/xcodeswift/xcproj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xcodeswift/xcproj/pulls/152/commits"},"statuses":{"href":"https://api.github.com/repos/xcodeswift/xcproj/statuses/15bd83a1794242f4ddc37d3ce0880c9c7207b914"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pepibumur"}}