{"id":16940334,"url":"https://github.com/joho/geonames-rails","last_synced_at":"2025-04-11T19:21:49.591Z","repository":{"id":684445,"uuid":"328353","full_name":"joho/geonames-rails","owner":"joho","description":"a lightweight plugin to map to imported geonames data with a repeatable import","archived":false,"fork":false,"pushed_at":"2011-03-31T04:34:50.000Z","size":170,"stargazers_count":18,"open_issues_count":1,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T15:15:15.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-10-06T10:56:24.000Z","updated_at":"2016-12-20T17:22:28.000Z","dependencies_parsed_at":"2022-08-16T10:40:43.461Z","dependency_job_id":null,"html_url":"https://github.com/joho/geonames-rails","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho%2Fgeonames-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho%2Fgeonames-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho%2Fgeonames-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho%2Fgeonames-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joho","download_url":"https://codeload.github.com/joho/geonames-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248465350,"owners_count":21108244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T21:06:50.938Z","updated_at":"2025-04-11T19:21:49.560Z","avatar_url":"https://github.com/joho.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Geonames-Rails\n===\n\nGetting Started\n---\n\nI need a decent plugin that can do the following things with [the geonames database](http://www.geonames.org/)\n\n  * generate a standard db migration\n  * pull down the required geonames files from the web\n  * load those geonames files in the db (assuming a schema from the migration)\n  * generate me my models for free (but leave them in models so i can hack them up later)\n\nInstall the plugin by doing the following in your rails app root dir\n\n  script/plugin install git://github.com/joho/geonames-rails.git\n\nYou next step is to run the generators to give you the bare bones country/city models and the db migration\n\n  script/generate geonames_migration\n  script/generate geonames_models\n\nOnce you've run that migration and got your models set up how you like you're right to pull down the data straight from the geonames server and into your database. It's as easy as one little command\n\n  rake geonames_rails:pull_and_load_data\n\nAdvanced Usage\n---\n\nOK, so you've had a bit of a play and decided one of a couple of things\n\n  * the default fields i've chosen suck and you want more/less of them\n  * you don't like the storage method i've chosen. maybe you want to use a document store - or something else\n\nWell, you're covered. The method for writing out the country/city data is fully pluggable. All you need is a class that implements the following two methods\n\n  class MyCustomGeonamesWriter\n    def write_country(country_mapping)\n    end\n  \n    def write_cities(country_code, city_mappings)\n    end\n  end\n\nand then you can pass an instance of that class as the second argument to the geonames loader. See the rake task for an example.\n\n---\n\nOutstanding Tasks\n---\n\nTODO\n\n  * add regions? (maybe, i'm not sure they're worth it)\n\nDONE\n\n  * rake task that will pull the latest geonames data into temp files\n  * generators for the db migration and models\n  * actually put something in the db migrations\n  * allow you to declare which fields you're using from geonames\n    - currently store the mappings between field names and column of data in classing in the Mappings module\n    - pulled out the writing of the records into a class\n    - changed the loader so you can plug in whatever writer you want \n  * write the text to AR converter\n\n---\n\nCopyright John Barton 2009","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoho%2Fgeonames-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoho%2Fgeonames-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoho%2Fgeonames-rails/lists"}