{"action":"created","comment":{"url":"https://api.github.com/repos/oppia/oppia/pulls/comments/47746879","id":47746879,"diff_hunk":"@@ -165,56 +190,117 @@ def return_json(source_url):\n     return json.loads(response)\n \n \n+def test_manifest_syntax(dependency_type, dependency_dict):\n+    \"\"\"This checks syntax of the manifest.json dependencies.\n+\n+    Display warning message when there is an error and terminate the program.\n+    Args:\n+      dependency_type: dependency download format.\n+      dependency_dict: manifest.json dependency dict\n+    \"\"\"\n+    keys = dependency_dict.keys()\n+    mandatory_keys = DOWNLOAD_FORMATS_TO_MANIFEST_KEYS[\n+        dependency_type]['mandatory_keys']\n+    # Optional keys requires atleast one member of the pair\n+    # to be available as a key in the dependency_dict\n+    optional_key_pairs= DOWNLOAD_FORMATS_TO_MANIFEST_KEYS[\n+        dependency_type]['optional_key_pairs']\n+    for key in mandatory_keys:\n+        if key not in keys:\n+            print '------------------------------------------'\n+            print 'There is syntax error in this dependency'\n+            print dependency_dict\n+            print 'This key is missing or misspelled: \"%s\".' % key\n+            print 'Exiting'\n+            sys.exit()\n+    if optional_key_pairs:\n+        for optional_keys in optional_key_pairs:\n+            if not any([True for key in optional_keys if key in keys]):\n+                print '------------------------------------------'\n+                print 'There is syntax error in this dependency'\n+                print dependency_dict\n+                print 'This key is missing or misspelled: \"%s\".' % key\n+                print 'Exiting'\n+                sys.exit()\n+\n+    # Checks the validity of the URL corresponding to the file format.\n+    dependency_url = dependency_dict['url']\n+    if '#' in dependency_url:\n+        dependency_url = dependency_url.rpartition('#')[0]\n+    is_zip_file_format = dependency_type == _DOWNLOAD_FORMAT_ZIP\n+    is_tar_file_format = dependency_type == _DOWNLOAD_FORMAT_TAR\n+    if (dependency_url.endswith('.zip') and not is_zip_file_format or\n+        is_zip_file_format and not dependency_url.endswith('.zip') or\n+        dependency_url.endswith('.tar.gz') and not is_tar_file_format or\n+        is_tar_file_format and not dependency_url.endswith('.tar.gz')):\n+            print '------------------------------------------'\n+            print 'There is syntax error in this dependency'\n+            print dependency_dict\n+            print 'This url  %s is invalid for %s file format.' % (\n+                dependency_url, dependency_type)\n+            print 'Exiting.'\n+\n+\n+\n+def validate_manifest(source_url):\n+    \"\"\"This validates syntax of the manifest.json\n+    Args:\n+      source_url: the URL to the json file.\n+    \"\"\"\n+    manifest_data = return_json(source_url)\n+    dependencies = manifest_data['dependencies']\n+    for _, dependency in dependencies.items():\n+        for dependency_id,dependency_contents in dependency.items():","path":"scripts/install_third_party.py","position":103,"original_position":103,"commit_id":"2683aed62791df2f67416a07c4f2b11bf53d10da","original_commit_id":"2683aed62791df2f67416a07c4f2b11bf53d10da","user":{"login":"seanlip","id":10575562,"avatar_url":"https://avatars.githubusercontent.com/u/10575562?v=3","gravatar_id":"","url":"https://api.github.com/users/seanlip","html_url":"https://github.com/seanlip","followers_url":"https://api.github.com/users/seanlip/followers","following_url":"https://api.github.com/users/seanlip/following{/other_user}","gists_url":"https://api.github.com/users/seanlip/gists{/gist_id}","starred_url":"https://api.github.com/users/seanlip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanlip/subscriptions","organizations_url":"https://api.github.com/users/seanlip/orgs","repos_url":"https://api.github.com/users/seanlip/repos","events_url":"https://api.github.com/users/seanlip/events{/privacy}","received_events_url":"https://api.github.com/users/seanlip/received_events","type":"User","site_admin":false},"body":"add space after comma","created_at":"2015-12-16T08:19:48Z","updated_at":"2015-12-16T08:19:48Z","html_url":"https://github.com/oppia/oppia/pull/1261#discussion_r47746879","pull_request_url":"https://api.github.com/repos/oppia/oppia/pulls/1261","_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments/47746879"},"html":{"href":"https://github.com/oppia/oppia/pull/1261#discussion_r47746879"},"pull_request":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1261"}}},"pull_request":{"url":"https://api.github.com/repos/oppia/oppia/pulls/1261","id":53665945,"html_url":"https://github.com/oppia/oppia/pull/1261","diff_url":"https://github.com/oppia/oppia/pull/1261.diff","patch_url":"https://github.com/oppia/oppia/pull/1261.patch","issue_url":"https://api.github.com/repos/oppia/oppia/issues/1261","number":1261,"state":"open","locked":false,"title":"Manifest.json refinement and syntax tests","user":{"login":"MAKOSCAFEE","id":6409210,"avatar_url":"https://avatars.githubusercontent.com/u/6409210?v=3","gravatar_id":"","url":"https://api.github.com/users/MAKOSCAFEE","html_url":"https://github.com/MAKOSCAFEE","followers_url":"https://api.github.com/users/MAKOSCAFEE/followers","following_url":"https://api.github.com/users/MAKOSCAFEE/following{/other_user}","gists_url":"https://api.github.com/users/MAKOSCAFEE/gists{/gist_id}","starred_url":"https://api.github.com/users/MAKOSCAFEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MAKOSCAFEE/subscriptions","organizations_url":"https://api.github.com/users/MAKOSCAFEE/orgs","repos_url":"https://api.github.com/users/MAKOSCAFEE/repos","events_url":"https://api.github.com/users/MAKOSCAFEE/events{/privacy}","received_events_url":"https://api.github.com/users/MAKOSCAFEE/received_events","type":"User","site_admin":false},"body":"Hi @seanlip!,\r\nSo i have managed to refine the manifest to have the following structure\r\n```\r\n front/backend/oppiaTools: {\r\n                   \" zip\": {some zip dependency},\r\n                   \"tar\": {some tar dependency},\r\n                   \"files\": {some files dependency}\r\n                   }\r\n```\r\nfollowing this structure I made it easy to test it has certain download_format(zip,files,tar) it must have certain set of keys.\r\nAny suggestion to make it better are welcome. Thanks","created_at":"2015-12-15T06:39:40Z","updated_at":"2015-12-16T08:19:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"98e031fcfb5c925c8622aede22670584a557047b","assignee":{"login":"seanlip","id":10575562,"avatar_url":"https://avatars.githubusercontent.com/u/10575562?v=3","gravatar_id":"","url":"https://api.github.com/users/seanlip","html_url":"https://github.com/seanlip","followers_url":"https://api.github.com/users/seanlip/followers","following_url":"https://api.github.com/users/seanlip/following{/other_user}","gists_url":"https://api.github.com/users/seanlip/gists{/gist_id}","starred_url":"https://api.github.com/users/seanlip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanlip/subscriptions","organizations_url":"https://api.github.com/users/seanlip/orgs","repos_url":"https://api.github.com/users/seanlip/repos","events_url":"https://api.github.com/users/seanlip/events{/privacy}","received_events_url":"https://api.github.com/users/seanlip/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/oppia/oppia/pulls/1261/commits","review_comments_url":"https://api.github.com/repos/oppia/oppia/pulls/1261/comments","review_comment_url":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/1261/comments","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/2683aed62791df2f67416a07c4f2b11bf53d10da","head":{"label":"MAKOSCAFEE:mnifest-refinement-and-test","ref":"mnifest-refinement-and-test","sha":"2683aed62791df2f67416a07c4f2b11bf53d10da","user":{"login":"MAKOSCAFEE","id":6409210,"avatar_url":"https://avatars.githubusercontent.com/u/6409210?v=3","gravatar_id":"","url":"https://api.github.com/users/MAKOSCAFEE","html_url":"https://github.com/MAKOSCAFEE","followers_url":"https://api.github.com/users/MAKOSCAFEE/followers","following_url":"https://api.github.com/users/MAKOSCAFEE/following{/other_user}","gists_url":"https://api.github.com/users/MAKOSCAFEE/gists{/gist_id}","starred_url":"https://api.github.com/users/MAKOSCAFEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MAKOSCAFEE/subscriptions","organizations_url":"https://api.github.com/users/MAKOSCAFEE/orgs","repos_url":"https://api.github.com/users/MAKOSCAFEE/repos","events_url":"https://api.github.com/users/MAKOSCAFEE/events{/privacy}","received_events_url":"https://api.github.com/users/MAKOSCAFEE/received_events","type":"User","site_admin":false},"repo":{"id":40843161,"name":"oppia","full_name":"MAKOSCAFEE/oppia","owner":{"login":"MAKOSCAFEE","id":6409210,"avatar_url":"https://avatars.githubusercontent.com/u/6409210?v=3","gravatar_id":"","url":"https://api.github.com/users/MAKOSCAFEE","html_url":"https://github.com/MAKOSCAFEE","followers_url":"https://api.github.com/users/MAKOSCAFEE/followers","following_url":"https://api.github.com/users/MAKOSCAFEE/following{/other_user}","gists_url":"https://api.github.com/users/MAKOSCAFEE/gists{/gist_id}","starred_url":"https://api.github.com/users/MAKOSCAFEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MAKOSCAFEE/subscriptions","organizations_url":"https://api.github.com/users/MAKOSCAFEE/orgs","repos_url":"https://api.github.com/users/MAKOSCAFEE/repos","events_url":"https://api.github.com/users/MAKOSCAFEE/events{/privacy}","received_events_url":"https://api.github.com/users/MAKOSCAFEE/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MAKOSCAFEE/oppia","description":"Tool for creating interactive tutors.","fork":true,"url":"https://api.github.com/repos/MAKOSCAFEE/oppia","forks_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/forks","keys_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/teams","hooks_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/hooks","issue_events_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/events","assignees_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/tags","blobs_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/languages","stargazers_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/stargazers","contributors_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/contributors","subscribers_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/subscribers","subscription_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/subscription","commits_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/merges","archive_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/downloads","issues_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/labels{/name}","releases_url":"https://api.github.com/repos/MAKOSCAFEE/oppia/releases{/id}","created_at":"2015-08-16T21:49:10Z","updated_at":"2015-08-16T21:49:11Z","pushed_at":"2015-12-16T06:24:13Z","git_url":"git://github.com/MAKOSCAFEE/oppia.git","ssh_url":"git@github.com:MAKOSCAFEE/oppia.git","clone_url":"https://github.com/MAKOSCAFEE/oppia.git","svn_url":"https://github.com/MAKOSCAFEE/oppia","homepage":"https://www.oppia.org","size":43380,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"oppia:develop","ref":"develop","sha":"955409bdb1b30db4e5df40157d7cbaf3cc1229fc","user":{"login":"oppia","id":11620230,"avatar_url":"https://avatars.githubusercontent.com/u/11620230?v=3","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"repo":{"id":40687563,"name":"oppia","full_name":"oppia/oppia","owner":{"login":"oppia","id":11620230,"avatar_url":"https://avatars.githubusercontent.com/u/11620230?v=3","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/oppia/oppia","description":"Tool for collaboratively building interactive tutors.","fork":false,"url":"https://api.github.com/repos/oppia/oppia","forks_url":"https://api.github.com/repos/oppia/oppia/forks","keys_url":"https://api.github.com/repos/oppia/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oppia/oppia/teams","hooks_url":"https://api.github.com/repos/oppia/oppia/hooks","issue_events_url":"https://api.github.com/repos/oppia/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/oppia/oppia/events","assignees_url":"https://api.github.com/repos/oppia/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/oppia/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/oppia/oppia/tags","blobs_url":"https://api.github.com/repos/oppia/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oppia/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oppia/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/oppia/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/oppia/oppia/languages","stargazers_url":"https://api.github.com/repos/oppia/oppia/stargazers","contributors_url":"https://api.github.com/repos/oppia/oppia/contributors","subscribers_url":"https://api.github.com/repos/oppia/oppia/subscribers","subscription_url":"https://api.github.com/repos/oppia/oppia/subscription","commits_url":"https://api.github.com/repos/oppia/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/oppia/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/oppia/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/oppia/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/oppia/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/oppia/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oppia/oppia/merges","archive_url":"https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oppia/oppia/downloads","issues_url":"https://api.github.com/repos/oppia/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/oppia/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/oppia/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oppia/oppia/labels{/name}","releases_url":"https://api.github.com/repos/oppia/oppia/releases{/id}","created_at":"2015-08-14T00:16:14Z","updated_at":"2015-12-16T01:52:07Z","pushed_at":"2015-12-16T06:24:13Z","git_url":"git://github.com/oppia/oppia.git","ssh_url":"git@github.com:oppia/oppia.git","clone_url":"https://github.com/oppia/oppia.git","svn_url":"https://github.com/oppia/oppia","homepage":"https://www.oppia.org","size":44500,"stargazers_count":64,"watchers_count":64,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":235,"forks":85,"open_issues":235,"watchers":64,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1261"},"html":{"href":"https://github.com/oppia/oppia/pull/1261"},"issue":{"href":"https://api.github.com/repos/oppia/oppia/issues/1261"},"comments":{"href":"https://api.github.com/repos/oppia/oppia/issues/1261/comments"},"review_comments":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1261/comments"},"review_comment":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1261/commits"},"statuses":{"href":"https://api.github.com/repos/oppia/oppia/statuses/2683aed62791df2f67416a07c4f2b11bf53d10da"}}}}