This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gitlab' # install by Gemfile | |
require 'pry' # install by Gemfile | |
require 'csv' | |
Gitlab.configure do |config| | |
config.endpoint = 'YOUR_GITLAB_URL' | |
config.private_token = 'YOUR_GITLAB_PRIVATE_TOKEN' | |
end | |
Gitlab.projects.auto_paginate do |project| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# thanks to http://swiftfox.blog6.fc2.com/blog-entry-301.html | |
require 'net/http' | |
require 'uri' | |
require 'nokogiri' | |
require 'open-uri' | |
def get_parser(url) | |
uri = URI.parse(url) | |
html = Net::HTTP.get(uri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
# data to write | |
cities_data = [] | |
# download CSV from http://www.soumu.go.jp/main_content/000323625.csv as tmp/cities_jp.csv, | |
# convert charset to UTF-8, and rename headers as below | |
# ken-code => prefecture_id | |
# sityouson-code => city_code |