{"action":"created","comment":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments/46024332","id":46024332,"diff_hunk":"@@ -392,6 +393,50 @@ def configure_extension_org_metadata_api_endpoint\n         end\n       end\n \n+      def configure_geocoder_extension(organization=nil)\n+        config = Cartodb.config[:geocoder]['api']\n+        raise(\"Geocoder API config missing\") if config.blank?\n+        host = config['host']\n+        port = config['port']\n+        user = config['user']\n+        dbname = config['dbname']\n+        raise(\"Geocoder API config incomplete, some fields are missing\") if host.blank? || port.blank? || user.blank? || dbname.blank?\n+\n+        geocoder_server_config_sql = %{\n+          SELECT cartodb.CDB_Conf_SetConf('geocoder_server_config',\n+            '{ \\\"connection_str\\\": \\\"host=#{host} port=#{port} dbname=#{dbname} user=#{user}\\\"}'::json\n+          );\n+        }\n+\n+        @user.in_database(as: :superuser) do |db|\n+          db.transaction do\n+            db.run('CREATE EXTENSION IF NOT EXISTS plproxy SCHEMA public')\n+            db.run('CREATE EXTENSION IF NOT EXISTS cdb_geocoder_client')\n+            db.run(geocoder_server_config_sql)\n+          end\n+        end\n+\n+        if !organization.nil?\n+          org_users = organization.users\n+          org_users.each do |u|\n+            # TODO This part is a copy of the build_search_path method to avoid put the geocoder schema path\n+            # until we open this to all the users\n+            quote_char = quote_user_schema ? \"\\\"\" : \"\"\n+            search_path = \"#{quote_char}#{user_schema}#{quote_char}, #{SCHEMA_CARTODB}, #{SCHEMA_CDB_GEOCODER}, #{SCHEMA_PUBLIC}\"","path":"app/models/user/db_service.rb","position":41,"original_position":41,"commit_id":"51205aa6a34b8c2544d7b7818a43a1069484c313","original_commit_id":"51205aa6a34b8c2544d7b7818a43a1069484c313","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":"Line is too long. [129/120]","created_at":"2015-11-27T08:04:20Z","updated_at":"2015-11-27T08:04:20Z","html_url":"https://github.com/CartoDB/cartodb/pull/6186#discussion_r46024332","pull_request_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/6186","_links":{"self":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments/46024332"},"html":{"href":"https://github.com/CartoDB/cartodb/pull/6186#discussion_r46024332"},"pull_request":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/6186"}}},"pull_request":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/6186","id":51940367,"html_url":"https://github.com/CartoDB/cartodb/pull/6186","diff_url":"https://github.com/CartoDB/cartodb/pull/6186.diff","patch_url":"https://github.com/CartoDB/cartodb/pull/6186.patch","issue_url":"https://api.github.com/repos/CartoDB/cartodb/issues/6186","number":6186,"state":"open","locked":false,"title":"Rake to install geocoder client extension","user":{"login":"ethervoid","id":741240,"avatar_url":"https://avatars.githubusercontent.com/u/741240?v=3","gravatar_id":"","url":"https://api.github.com/users/ethervoid","html_url":"https://github.com/ethervoid","followers_url":"https://api.github.com/users/ethervoid/followers","following_url":"https://api.github.com/users/ethervoid/following{/other_user}","gists_url":"https://api.github.com/users/ethervoid/gists{/gist_id}","starred_url":"https://api.github.com/users/ethervoid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethervoid/subscriptions","organizations_url":"https://api.github.com/users/ethervoid/orgs","repos_url":"https://api.github.com/users/ethervoid/repos","events_url":"https://api.github.com/users/ethervoid/events{/privacy}","received_events_url":"https://api.github.com/users/ethervoid/received_events","type":"User","site_admin":false},"body":"Added rake and model logic to install the geocoder extension to the passed user or organization:\r\n\r\n- [x] Add `cdb_geocoder_client` schema to the search path\r\n- [x] Install `plproxy` and `cdb_geocoder_extensions`\r\n- [x] Add required geocoder server config\r\n\r\n@rafatower pls check this out","created_at":"2015-11-26T18:58:08Z","updated_at":"2015-11-27T08:04:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5253add89a22989f5cfa5318e460590351dd501","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/6186/commits","review_comments_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/6186/comments","review_comment_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/issues/6186/comments","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/51205aa6a34b8c2544d7b7818a43a1069484c313","head":{"label":"CartoDB:geocoder_api_extention_install","ref":"geocoder_api_extention_install","sha":"51205aa6a34b8c2544d7b7818a43a1069484c313","user":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"repo":{"id":4909355,"name":"cartodb","full_name":"CartoDB/cartodb","owner":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CartoDB/cartodb","description":"Location Intelligence & Data Visualization tool","fork":false,"url":"https://api.github.com/repos/CartoDB/cartodb","forks_url":"https://api.github.com/repos/CartoDB/cartodb/forks","keys_url":"https://api.github.com/repos/CartoDB/cartodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CartoDB/cartodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CartoDB/cartodb/teams","hooks_url":"https://api.github.com/repos/CartoDB/cartodb/hooks","issue_events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/events{/number}","events_url":"https://api.github.com/repos/CartoDB/cartodb/events","assignees_url":"https://api.github.com/repos/CartoDB/cartodb/assignees{/user}","branches_url":"https://api.github.com/repos/CartoDB/cartodb/branches{/branch}","tags_url":"https://api.github.com/repos/CartoDB/cartodb/tags","blobs_url":"https://api.github.com/repos/CartoDB/cartodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CartoDB/cartodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CartoDB/cartodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/CartoDB/cartodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/{sha}","languages_url":"https://api.github.com/repos/CartoDB/cartodb/languages","stargazers_url":"https://api.github.com/repos/CartoDB/cartodb/stargazers","contributors_url":"https://api.github.com/repos/CartoDB/cartodb/contributors","subscribers_url":"https://api.github.com/repos/CartoDB/cartodb/subscribers","subscription_url":"https://api.github.com/repos/CartoDB/cartodb/subscription","commits_url":"https://api.github.com/repos/CartoDB/cartodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/CartoDB/cartodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/CartoDB/cartodb/contents/{+path}","compare_url":"https://api.github.com/repos/CartoDB/cartodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CartoDB/cartodb/merges","archive_url":"https://api.github.com/repos/CartoDB/cartodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CartoDB/cartodb/downloads","issues_url":"https://api.github.com/repos/CartoDB/cartodb/issues{/number}","pulls_url":"https://api.github.com/repos/CartoDB/cartodb/pulls{/number}","milestones_url":"https://api.github.com/repos/CartoDB/cartodb/milestones{/number}","notifications_url":"https://api.github.com/repos/CartoDB/cartodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CartoDB/cartodb/labels{/name}","releases_url":"https://api.github.com/repos/CartoDB/cartodb/releases{/id}","created_at":"2012-07-05T15:23:45Z","updated_at":"2015-11-26T16:23:59Z","pushed_at":"2015-11-27T08:04:14Z","git_url":"git://github.com/CartoDB/cartodb.git","ssh_url":"git@github.com:CartoDB/cartodb.git","clone_url":"https://github.com/CartoDB/cartodb.git","svn_url":"https://github.com/CartoDB/cartodb","homepage":"http://cartodb.com","size":314915,"stargazers_count":991,"watchers_count":991,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":236,"mirror_url":null,"open_issues_count":817,"forks":236,"open_issues":817,"watchers":991,"default_branch":"master"}},"base":{"label":"CartoDB:master","ref":"master","sha":"9d185cd3569bd000a19859f5ce916a616ee8d886","user":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"repo":{"id":4909355,"name":"cartodb","full_name":"CartoDB/cartodb","owner":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CartoDB/cartodb","description":"Location Intelligence & Data Visualization tool","fork":false,"url":"https://api.github.com/repos/CartoDB/cartodb","forks_url":"https://api.github.com/repos/CartoDB/cartodb/forks","keys_url":"https://api.github.com/repos/CartoDB/cartodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CartoDB/cartodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CartoDB/cartodb/teams","hooks_url":"https://api.github.com/repos/CartoDB/cartodb/hooks","issue_events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/events{/number}","events_url":"https://api.github.com/repos/CartoDB/cartodb/events","assignees_url":"https://api.github.com/repos/CartoDB/cartodb/assignees{/user}","branches_url":"https://api.github.com/repos/CartoDB/cartodb/branches{/branch}","tags_url":"https://api.github.com/repos/CartoDB/cartodb/tags","blobs_url":"https://api.github.com/repos/CartoDB/cartodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CartoDB/cartodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CartoDB/cartodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/CartoDB/cartodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/{sha}","languages_url":"https://api.github.com/repos/CartoDB/cartodb/languages","stargazers_url":"https://api.github.com/repos/CartoDB/cartodb/stargazers","contributors_url":"https://api.github.com/repos/CartoDB/cartodb/contributors","subscribers_url":"https://api.github.com/repos/CartoDB/cartodb/subscribers","subscription_url":"https://api.github.com/repos/CartoDB/cartodb/subscription","commits_url":"https://api.github.com/repos/CartoDB/cartodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/CartoDB/cartodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/CartoDB/cartodb/contents/{+path}","compare_url":"https://api.github.com/repos/CartoDB/cartodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CartoDB/cartodb/merges","archive_url":"https://api.github.com/repos/CartoDB/cartodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CartoDB/cartodb/downloads","issues_url":"https://api.github.com/repos/CartoDB/cartodb/issues{/number}","pulls_url":"https://api.github.com/repos/CartoDB/cartodb/pulls{/number}","milestones_url":"https://api.github.com/repos/CartoDB/cartodb/milestones{/number}","notifications_url":"https://api.github.com/repos/CartoDB/cartodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CartoDB/cartodb/labels{/name}","releases_url":"https://api.github.com/repos/CartoDB/cartodb/releases{/id}","created_at":"2012-07-05T15:23:45Z","updated_at":"2015-11-26T16:23:59Z","pushed_at":"2015-11-27T08:04:14Z","git_url":"git://github.com/CartoDB/cartodb.git","ssh_url":"git@github.com:CartoDB/cartodb.git","clone_url":"https://github.com/CartoDB/cartodb.git","svn_url":"https://github.com/CartoDB/cartodb","homepage":"http://cartodb.com","size":314915,"stargazers_count":991,"watchers_count":991,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":236,"mirror_url":null,"open_issues_count":817,"forks":236,"open_issues":817,"watchers":991,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/6186"},"html":{"href":"https://github.com/CartoDB/cartodb/pull/6186"},"issue":{"href":"https://api.github.com/repos/CartoDB/cartodb/issues/6186"},"comments":{"href":"https://api.github.com/repos/CartoDB/cartodb/issues/6186/comments"},"review_comments":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/6186/comments"},"review_comment":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/6186/commits"},"statuses":{"href":"https://api.github.com/repos/CartoDB/cartodb/statuses/51205aa6a34b8c2544d7b7818a43a1069484c313"}}}}