jpstation 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +23 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +7 -0
- data/app/models/prefecture.rb +6 -0
- data/app/models/railway_company.rb +5 -0
- data/app/models/railway_line.rb +5 -0
- data/app/models/railway_station.rb +6 -0
- data/jpstation.gemspec +30 -0
- data/lib/generators/jpstation/install_generator.rb +33 -0
- data/lib/generators/jpstation/model_generator.rb +18 -0
- data/lib/generators/jpstation/models_generator.rb +27 -0
- data/lib/generators/templates/README +24 -0
- data/lib/generators/templates/migrations/prefectures.rb +9 -0
- data/lib/generators/templates/migrations/railway_companies.rb +17 -0
- data/lib/generators/templates/migrations/railway_lines.rb +20 -0
- data/lib/generators/templates/migrations/railway_stations.rb +22 -0
- data/lib/jpstation/csv/importable.rb +23 -0
- data/lib/jpstation/csv/railway_company_header.rb +18 -0
- data/lib/jpstation/csv/railway_line_header.rb +21 -0
- data/lib/jpstation/csv/railway_station_header.rb +23 -0
- data/lib/jpstation/engine.rb +4 -0
- data/lib/jpstation/import.rb +39 -0
- data/lib/jpstation/railtie.rb +22 -0
- data/lib/jpstation/tasks.rb +14 -0
- data/lib/jpstation/version.rb +3 -0
- data/lib/jpstation.rb +15 -0
- data/seed/prefectures.yml +144 -0
- data/spec/fake_app.rb +22 -0
- data/spec/generators/jpstation/install_generator_spec.rb +44 -0
- data/spec/generators/jpstation/model_generator_spec.rb +32 -0
- data/spec/generators/jpstation/models_generator_spec.rb +34 -0
- data/spec/jpstation_spec.rb +7 -0
- data/spec/models/railway_company_spec.rb +42 -0
- data/spec/models/railway_line_spec.rb +39 -0
- data/spec/models/railway_station_spec.rb +40 -0
- data/spec/spec_helper.rb +5 -0
- metadata +229 -0
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
log
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 aonashi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Jpstation
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'jpstation'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install jpstation
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/jpstation/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/jpstation.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jpstation/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jpstation"
|
8
|
+
spec.version = Jpstation::VERSION
|
9
|
+
spec.authors = ["aonashi"]
|
10
|
+
spec.email = ["aonashi010@gmail.com"]
|
11
|
+
spec.summary = %q{A Rails plugin for railway data in Japan.}
|
12
|
+
spec.description = %q{A Rails plugin for railway data in Japan.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'activesupport', '>= 4.0.0'
|
22
|
+
spec.add_dependency 'actionpack', '>= 4.0.0'
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "rails", ">= 4.0.0"
|
28
|
+
spec.add_development_dependency "sqlite3"
|
29
|
+
spec.add_development_dependency "ammeter"
|
30
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
require 'rails/generators/active_record'
|
3
|
+
|
4
|
+
module Jpstation
|
5
|
+
module Generators
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
include Rails::Generators::Migration
|
8
|
+
|
9
|
+
source_root File.expand_path('../../templates', __FILE__)
|
10
|
+
|
11
|
+
def copy_migrations
|
12
|
+
migration_template 'migrations/prefectures.rb', 'db/migrate/create_prefectures.rb' unless prefecture_model_exist?
|
13
|
+
migration_template 'migrations/railway_companies.rb', 'db/migrate/create_railway_companies.rb'
|
14
|
+
migration_template 'migrations/railway_lines.rb', 'db/migrate/create_railway_lines.rb'
|
15
|
+
migration_template 'migrations/railway_stations.rb', 'db/migrate/create_railway_stations.rb'
|
16
|
+
end
|
17
|
+
|
18
|
+
def show_readme
|
19
|
+
readme "README"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.next_migration_number(path)
|
23
|
+
ActiveRecord::Generators::Base.next_migration_number(path)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def prefecture_model_exist?
|
29
|
+
File.exists?(File.join(destination_root, 'app/models/prefecture.rb'))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module Jpstation
|
4
|
+
module Generators
|
5
|
+
class ModelGenerator < Rails::Generators::NamedBase
|
6
|
+
Rails::Generators.hide_namespace self.namespace
|
7
|
+
|
8
|
+
source_root File.expand_path('../../../../app/models', __FILE__)
|
9
|
+
|
10
|
+
def copy_model
|
11
|
+
template "#{name}.rb", "app/models/#{name}.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
hook_for :test_framework, as: :model
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module Jpstation
|
4
|
+
module Generators
|
5
|
+
class ModelsGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('../../../../app/models', __FILE__)
|
7
|
+
|
8
|
+
def generate_model
|
9
|
+
if File.exists?(File.join(destination_root, 'app/models/prefecture.rb'))
|
10
|
+
inject_into_class "app/models/prefecture.rb", Prefecture, <<CODE
|
11
|
+
has_many :railway_stations
|
12
|
+
def railway_lines
|
13
|
+
RailwayLine.joins(:railway_stations).merge(railway_stations.reorder(nil)).distinct.order(:sort, :id)
|
14
|
+
end
|
15
|
+
CODE
|
16
|
+
else
|
17
|
+
Rails::Generators.invoke 'jpstation:model', ['prefecture']
|
18
|
+
end
|
19
|
+
|
20
|
+
%w{ railway_company railway_line railway_station }.each do |model_name|
|
21
|
+
Rails::Generators.invoke 'jpstation:model', [model_name]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
===============================================================================
|
3
|
+
|
4
|
+
Some setup you must do manually if you haven't yet:
|
5
|
+
|
6
|
+
1. Create tables
|
7
|
+
|
8
|
+
rake db:migrate
|
9
|
+
|
10
|
+
2. Download & Import data. (download site: http://www.ekidata.jp/)
|
11
|
+
|
12
|
+
rake jpstation:import FILE_DIR=/jpstation/path
|
13
|
+
|
14
|
+
Load Prefectures if prefecture data does not exist.
|
15
|
+
|
16
|
+
rake jpstation:prefecture
|
17
|
+
|
18
|
+
3. Customize models ( if need be )
|
19
|
+
|
20
|
+
Copy jpstation models to your Rails project if you want to customize.
|
21
|
+
|
22
|
+
rails generate jpstation:models
|
23
|
+
|
24
|
+
===============================================================================
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateRailwayCompanies < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :railway_companies do |t|
|
4
|
+
t.integer :railway_id, null: false
|
5
|
+
t.string :name, null: false
|
6
|
+
t.string :kana_name
|
7
|
+
t.string :official_name
|
8
|
+
t.string :abbreviated_name
|
9
|
+
t.string :url
|
10
|
+
t.integer :company_type
|
11
|
+
t.integer :sort
|
12
|
+
|
13
|
+
# t.datetime :deleted_at
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateRailwayLines < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :railway_lines do |t|
|
4
|
+
t.references :railway_company, null: false, index: true
|
5
|
+
t.string :name, null: false
|
6
|
+
t.string :kana_name
|
7
|
+
t.string :official_name
|
8
|
+
t.string :color_code
|
9
|
+
t.string :color_name
|
10
|
+
t.integer :line_type
|
11
|
+
t.decimal :longitude, precision: 17, scale: 14
|
12
|
+
t.decimal :latitude, precision: 17, scale: 14
|
13
|
+
t.integer :zoom
|
14
|
+
t.integer :sort
|
15
|
+
|
16
|
+
# t.datetime :deleted_at
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateRailwayStations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :railway_stations do |t|
|
4
|
+
t.integer :group_station_id, null: false
|
5
|
+
t.string :name, null: false
|
6
|
+
t.string :kana_name
|
7
|
+
t.string :english_name
|
8
|
+
t.references :railway_line, null: false, index: true
|
9
|
+
t.references :prefecture, null: false, index: true
|
10
|
+
t.string :zip_code
|
11
|
+
t.string :address
|
12
|
+
t.decimal :longitude, precision: 9, scale: 6
|
13
|
+
t.decimal :latitude, precision: 9, scale: 6
|
14
|
+
t.date :opened_at
|
15
|
+
t.date :closed_at
|
16
|
+
t.integer :sort
|
17
|
+
|
18
|
+
# t.datetime :deleted_at
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module Jpstation::CSV
|
4
|
+
module Importable
|
5
|
+
def paranoid?
|
6
|
+
column_names.include? "deleted_at"
|
7
|
+
end
|
8
|
+
|
9
|
+
def import(file)
|
10
|
+
current_ids = []
|
11
|
+
CSV.foreach(file, headers: true, converters: :numeric, header_converters: :symbol) do |row|
|
12
|
+
if row[:e_status] == 0 || paranoid?
|
13
|
+
model = unscoped.find_or_initialize_by(id: row.first)
|
14
|
+
model.assign_attributes(header_mapping.inject({}) { |attr, (k, v)| attr[k] = row[v]; attr })
|
15
|
+
model.deleted_at = (row[:e_status] == 0) ? nil : Time.now if paranoid?
|
16
|
+
model.save!
|
17
|
+
current_ids << model.id
|
18
|
+
end
|
19
|
+
end
|
20
|
+
unscoped.where.not(id: current_ids).destroy_all
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Jpstation::CSV
|
2
|
+
module RailwayCompanyHeader
|
3
|
+
# http://www.ekidata.jp/doc/company.php
|
4
|
+
def header_mapping
|
5
|
+
{
|
6
|
+
id: :company_cd, # 事業者コード
|
7
|
+
railway_id: :rr_cd, # 鉄道コード
|
8
|
+
name: :company_name, # 事業者名(一般)
|
9
|
+
kana_name: :company_name_k, # 事業者名(一般・カナ)
|
10
|
+
official_name: :company_name_h, # 事業者名(正式名称)
|
11
|
+
abbreviated_name: :company_name_r, # 事業者名(略称)
|
12
|
+
url: :company_url, # Webサイト
|
13
|
+
company_type: :company_type, # 事業者区分
|
14
|
+
sort: :e_sort # 並び順
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Jpstation::CSV
|
2
|
+
module RailwayLineHeader
|
3
|
+
# http://www.ekidata.jp/doc/line.php
|
4
|
+
def header_mapping
|
5
|
+
{
|
6
|
+
id: :line_cd, # 路線コード
|
7
|
+
railway_company_id: :company_cd, # 事業者コード
|
8
|
+
name: :line_name, # 路線名称(一般)
|
9
|
+
kana_name: :line_name_k, # 路線名称(一般・カナ)
|
10
|
+
official_name: :line_name_h, # 路線名称(正式名称)
|
11
|
+
color_code: :line_color_c, # 路線カラー(コード)
|
12
|
+
color_name: :line_color_t, # 路線カラー(名称)
|
13
|
+
line_type: :line_type, # 路線区分
|
14
|
+
longitude: :lon, # 路線表示時の中央経度
|
15
|
+
latitude: :lat, # 路線表示時の中央緯度
|
16
|
+
zoom: :zoom, # 路線表示時のGoogleMap倍率
|
17
|
+
sort: :e_sort # 並び順
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Jpstation::CSV
|
2
|
+
module RailwayStationHeader
|
3
|
+
# http://www.ekidata.jp/doc/station.php
|
4
|
+
def header_mapping
|
5
|
+
{
|
6
|
+
id: :station_cd, # 駅コード
|
7
|
+
group_station_id: :station_g_cd, # 駅グループコード
|
8
|
+
name: :station_name, # 駅名称
|
9
|
+
kana_name: :station_name_k, # 駅名称(カナ)
|
10
|
+
english_name: :station_namr_r, # 駅名称(ローマ字)
|
11
|
+
railway_line_id: :line_cd, # 路線コード
|
12
|
+
prefecture_id: :pref_cd, # 都道府県コード
|
13
|
+
zip_code: :post, # 郵便番号
|
14
|
+
address: :add, # 住所
|
15
|
+
longitude: :lon, # 緯度
|
16
|
+
latitude: :lat, # 経度
|
17
|
+
opened_at: :open_ymd, # 開業年月日
|
18
|
+
closed_at: :close_ymd, # 廃止年月日
|
19
|
+
sort: :e_sort, # 並び順
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Jpstation
|
2
|
+
class Import
|
3
|
+
def execute
|
4
|
+
if ENV["FILE_DIR"].blank?
|
5
|
+
puts "Specify FILE_DIR arguments."
|
6
|
+
puts "rake jpstation:import FILE_DIR=/path/to/jpstation_dir"
|
7
|
+
else
|
8
|
+
file_dir = ENV["FILE_DIR"]
|
9
|
+
|
10
|
+
company_files = Dir.glob(File.join(file_dir, 'company*.csv'))
|
11
|
+
line_files = Dir.glob(File.join(file_dir, 'line*.csv'))
|
12
|
+
station_files = Dir.glob(File.join(file_dir, 'station*.csv'))
|
13
|
+
|
14
|
+
if company_files.blank? || line_files.blank? || station_files.blank?
|
15
|
+
abort "Railway data is not found."
|
16
|
+
end
|
17
|
+
|
18
|
+
puts "== jpstation: importing ======================================================="
|
19
|
+
puts "-- Setup import files"
|
20
|
+
puts " RailwayCompany : " + company_files.first.sub("#{file_dir}/", "")
|
21
|
+
puts " RailwayLine : " + line_files.first.sub("#{file_dir}/", "")
|
22
|
+
puts " RailwayStation : " + station_files.first.sub("#{file_dir}/", "")
|
23
|
+
puts ""
|
24
|
+
|
25
|
+
import_model RailwayCompany, company_files.first
|
26
|
+
import_model RailwayLine, line_files.first
|
27
|
+
import_model RailwayStation, station_files.first
|
28
|
+
|
29
|
+
puts "== jpstation: imported ========================================================"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def import_model(klass, file)
|
34
|
+
puts "-- import #{klass.table_name}"
|
35
|
+
time = Benchmark.measure { klass.import(file) }
|
36
|
+
puts " -> (%.4fs)" % time.real
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'jpstation/csv/importable'
|
3
|
+
require 'jpstation/csv/railway_company_header'
|
4
|
+
require 'jpstation/csv/railway_line_header'
|
5
|
+
require 'jpstation/csv/railway_station_header'
|
6
|
+
|
7
|
+
module Jpstation
|
8
|
+
class Railtie < Rails::Railtie
|
9
|
+
initializer 'railway models' do
|
10
|
+
ActiveSupport.on_load :active_record do
|
11
|
+
[ RailwayCompany, RailwayLine, RailwayStation ].each do |klass|
|
12
|
+
klass.send :extend, Jpstation::CSV::const_get("#{klass}Header")
|
13
|
+
klass.send :extend, Jpstation::CSV::Importable
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
rake_tasks do
|
19
|
+
load 'jpstation/tasks.rb'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'active_record/fixtures'
|
2
|
+
|
3
|
+
namespace :jpstation do
|
4
|
+
desc "Import railway data from download file"
|
5
|
+
task import: :environment do
|
6
|
+
import = Jpstation::Import.new
|
7
|
+
import.execute
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Import prefecture data"
|
11
|
+
task prefecture: :environment do
|
12
|
+
ActiveRecord::Fixtures.create_fixtures(Jpstation::Engine.root.join('seed'), 'prefectures')
|
13
|
+
end
|
14
|
+
end
|
data/lib/jpstation.rb
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
prefecture_1:
|
2
|
+
id: 1
|
3
|
+
name: 北海道
|
4
|
+
prefecture_2:
|
5
|
+
id: 2
|
6
|
+
name: 青森県
|
7
|
+
prefecture_3:
|
8
|
+
id: 3
|
9
|
+
name: 岩手県
|
10
|
+
prefecture_4:
|
11
|
+
id: 4
|
12
|
+
name: 宮城県
|
13
|
+
prefecture_5:
|
14
|
+
id: 5
|
15
|
+
name: 秋田県
|
16
|
+
prefecture_6:
|
17
|
+
id: 6
|
18
|
+
name: 山形県
|
19
|
+
prefecture_7:
|
20
|
+
id: 7
|
21
|
+
name: 福島県
|
22
|
+
prefecture_8:
|
23
|
+
id: 8
|
24
|
+
name: 茨城県
|
25
|
+
prefecture_9:
|
26
|
+
id: 9
|
27
|
+
name: 栃木県
|
28
|
+
prefecture_10:
|
29
|
+
id: 10
|
30
|
+
name: 群馬県
|
31
|
+
prefecture_11:
|
32
|
+
id: 11
|
33
|
+
name: 埼玉県
|
34
|
+
prefecture_12:
|
35
|
+
id: 12
|
36
|
+
name: 千葉県
|
37
|
+
prefecture_13:
|
38
|
+
id: 13
|
39
|
+
name: 東京都
|
40
|
+
prefecture_14:
|
41
|
+
id: 14
|
42
|
+
name: 神奈川県
|
43
|
+
prefecture_15:
|
44
|
+
id: 15
|
45
|
+
name: 新潟県
|
46
|
+
prefecture_16:
|
47
|
+
id: 16
|
48
|
+
name: 富山県
|
49
|
+
prefecture_17:
|
50
|
+
id: 17
|
51
|
+
name: 石川県
|
52
|
+
prefecture_18:
|
53
|
+
id: 18
|
54
|
+
name: 福井県
|
55
|
+
prefecture_19:
|
56
|
+
id: 19
|
57
|
+
name: 山梨県
|
58
|
+
prefecture_20:
|
59
|
+
id: 20
|
60
|
+
name: 長野県
|
61
|
+
prefecture_21:
|
62
|
+
id: 21
|
63
|
+
name: 岐阜県
|
64
|
+
prefecture_22:
|
65
|
+
id: 22
|
66
|
+
name: 静岡県
|
67
|
+
prefecture_23:
|
68
|
+
id: 23
|
69
|
+
name: 愛知県
|
70
|
+
prefecture_24:
|
71
|
+
id: 24
|
72
|
+
name: 三重県
|
73
|
+
prefecture_25:
|
74
|
+
id: 25
|
75
|
+
name: 滋賀県
|
76
|
+
prefecture_26:
|
77
|
+
id: 26
|
78
|
+
name: 京都府
|
79
|
+
prefecture_27:
|
80
|
+
id: 27
|
81
|
+
name: 大阪府
|
82
|
+
prefecture_28:
|
83
|
+
id: 28
|
84
|
+
name: 兵庫県
|
85
|
+
prefecture_29:
|
86
|
+
id: 29
|
87
|
+
name: 奈良県
|
88
|
+
prefecture_30:
|
89
|
+
id: 30
|
90
|
+
name: 和歌山県
|
91
|
+
prefecture_31:
|
92
|
+
id: 31
|
93
|
+
name: 鳥取県
|
94
|
+
prefecture_32:
|
95
|
+
id: 32
|
96
|
+
name: 島根県
|
97
|
+
prefecture_33:
|
98
|
+
id: 33
|
99
|
+
name: 岡山県
|
100
|
+
prefecture_34:
|
101
|
+
id: 34
|
102
|
+
name: 広島県
|
103
|
+
prefecture_35:
|
104
|
+
id: 35
|
105
|
+
name: 山口県
|
106
|
+
prefecture_36:
|
107
|
+
id: 36
|
108
|
+
name: 徳島県
|
109
|
+
prefecture_37:
|
110
|
+
id: 37
|
111
|
+
name: 香川県
|
112
|
+
prefecture_38:
|
113
|
+
id: 38
|
114
|
+
name: 愛媛県
|
115
|
+
prefecture_39:
|
116
|
+
id: 39
|
117
|
+
name: 高知県
|
118
|
+
prefecture_40:
|
119
|
+
id: 40
|
120
|
+
name: 福岡県
|
121
|
+
prefecture_41:
|
122
|
+
id: 41
|
123
|
+
name: 佐賀県
|
124
|
+
prefecture_42:
|
125
|
+
id: 42
|
126
|
+
name: 長崎県
|
127
|
+
prefecture_43:
|
128
|
+
id: 43
|
129
|
+
name: 熊本県
|
130
|
+
prefecture_44:
|
131
|
+
id: 44
|
132
|
+
name: 大分県
|
133
|
+
prefecture_45:
|
134
|
+
id: 45
|
135
|
+
name: 宮崎県
|
136
|
+
prefecture_46:
|
137
|
+
id: 46
|
138
|
+
name: 鹿児島県
|
139
|
+
prefecture_47:
|
140
|
+
id: 47
|
141
|
+
name: 沖縄県
|
142
|
+
prefecture_99:
|
143
|
+
id: 99
|
144
|
+
name: 海外・他
|
data/spec/fake_app.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
# database
|
5
|
+
ActiveRecord::Base.configurations = {'test' => {adapter: 'sqlite3', database: ':memory:'}}
|
6
|
+
ActiveRecord::Base.establish_connection(:test)
|
7
|
+
|
8
|
+
# config
|
9
|
+
app = Class.new(Rails::Application)
|
10
|
+
app.config.secret_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
11
|
+
app.config.session_store :cookie_store, key: "_fakeapp_session"
|
12
|
+
app.config.active_support.deprecation = :log
|
13
|
+
app.config.eager_load = false
|
14
|
+
app.initialize!
|
15
|
+
|
16
|
+
# migrations
|
17
|
+
ActiveRecord::Migration.verbose = false
|
18
|
+
Dir[File.join(File.dirname(__FILE__), '../lib/generators/templates/migrations/*.rb')].each { |f| require f }
|
19
|
+
CreatePrefectures.migrate :up
|
20
|
+
CreateRailwayCompanies.migrate :up
|
21
|
+
CreateRailwayLines.migrate :up
|
22
|
+
CreateRailwayStations.migrate :up
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'generators/jpstation/install_generator'
|
3
|
+
|
4
|
+
describe Jpstation::Generators::InstallGenerator do
|
5
|
+
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
6
|
+
destination File.expand_path("../../../../tmp", __FILE__)
|
7
|
+
|
8
|
+
before do
|
9
|
+
prepare_destination
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should run all tasks in the generator' do
|
13
|
+
g = generator %w(install)
|
14
|
+
expect(g).to receive(:copy_migrations)
|
15
|
+
capture(:stdout) { g.invoke_all }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'db/migrate/create_prefectures.rb' do
|
19
|
+
subject { file("db/migrate/create_prefectures.rb") }
|
20
|
+
|
21
|
+
context 'when Prefecture model already exists' do
|
22
|
+
it do
|
23
|
+
pending "not work 'should_not be_a_migration' if file does not exist" do
|
24
|
+
allow(File).to receive(:exists?).with(File.join(destination_root, 'app/models/prefecture.rb')).and_return { true }
|
25
|
+
run_generator
|
26
|
+
should_not be_a_migration
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when Prefecture model does not exist' do
|
32
|
+
before { run_generator }
|
33
|
+
it { should be_a_migration }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
%w{ railway_companies railway_lines railway_stations }.each do |table_name|
|
38
|
+
describe "db/migrate/create_#{table_name}.rb" do
|
39
|
+
before { run_generator }
|
40
|
+
subject { file("db/migrate/create_#{table_name}.rb") }
|
41
|
+
it { should be_a_migration }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'generators/jpstation/model_generator'
|
3
|
+
|
4
|
+
describe Jpstation::Generators::ModelGenerator do
|
5
|
+
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
6
|
+
destination File.expand_path("../../../../tmp", __FILE__)
|
7
|
+
|
8
|
+
before do
|
9
|
+
prepare_destination
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'generate RailwayCompany model' do
|
13
|
+
before { run_generator %w{ railway_company } }
|
14
|
+
subject { file('app/models/railway_company.rb') }
|
15
|
+
it { should exist }
|
16
|
+
it { should contain "has_many :railway_lines" }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'generate RailwayLine model' do
|
20
|
+
before { run_generator %w{ railway_line } }
|
21
|
+
subject { file('app/models/railway_line.rb') }
|
22
|
+
it { should exist }
|
23
|
+
it { should contain "has_many :railway_stations" }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'generate RailwayStation model' do
|
27
|
+
before { run_generator %w{ railway_station } }
|
28
|
+
subject { file('app/models/railway_station.rb') }
|
29
|
+
it { should exist }
|
30
|
+
it { should contain "belongs_to :railway_line" }
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'generators/jpstation/models_generator'
|
3
|
+
|
4
|
+
describe Jpstation::Generators::ModelsGenerator do
|
5
|
+
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
6
|
+
destination File.expand_path("../../../../tmp", __FILE__)
|
7
|
+
|
8
|
+
before do
|
9
|
+
prepare_destination
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'when Prefecture model does not exist' do
|
13
|
+
it 'should invoke model_generator 4 times' do
|
14
|
+
g = generator %w(models)
|
15
|
+
expect(Rails::Generators).to receive(:invoke).exactly(4).times
|
16
|
+
capture(:stdout) { g.invoke_all }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when Prefecture model already exists' do
|
21
|
+
it 'should invoke model_generator 3 times (except prefecture model)' do
|
22
|
+
g = generator %w(models)
|
23
|
+
allow(File).to receive(:exists?).with(File.join(destination_root, 'app/models/prefecture.rb')).and_return { true }
|
24
|
+
expect(g).to receive(:inject_into_class).with('app/models/prefecture.rb', Prefecture, <<CODE)
|
25
|
+
has_many :railway_stations
|
26
|
+
def railway_lines
|
27
|
+
RailwayLine.joins(:railway_stations).merge(railway_stations.reorder(nil)).distinct.order(:sort, :id)
|
28
|
+
end
|
29
|
+
CODE
|
30
|
+
expect(Rails::Generators).to receive(:invoke).exactly(3).times
|
31
|
+
capture(:stdout) { g.invoke_all }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe RailwayCompany do
|
5
|
+
describe :import do
|
6
|
+
let(:file_path) do
|
7
|
+
tempfile = Tempfile.new('railway_companies.csv')
|
8
|
+
tempfile << <<EOS
|
9
|
+
company_cd,rr_cd,company_name,company_name_k,company_name_h,company_name_r,company_url,company_type,e_status,e_sort
|
10
|
+
1,11,JR北海道,ジェイアールホッカイドウ,北海道旅客鉄道株式会社,JR北海道,http://www.jrhokkaido.co.jp/,1,0,1
|
11
|
+
2,11,JR東日本,ジェイアールヒガシニホン,東日本旅客鉄道株式会社,JR東日本,http://www.jreast.co.jp/,1,0,2
|
12
|
+
3,11,JR東海,ジェイアールトウカイ,東海旅客鉄道株式会社,JR東海,http://jr-central.co.jp/,1,0,3
|
13
|
+
4,11,JR西日本,ジェイアールニシニホン,西日本旅客鉄道株式会社,JR西日本,http://www.westjr.co.jp/,1,1,4
|
14
|
+
5,11,JR四国,ジェイアールシコク,四国旅客鉄道株式会社,JR四国,http://www.jr-shikoku.co.jp/,1,2,5
|
15
|
+
6,11,JR九州,ジェイアールキュウシュウ,九州旅客鉄道株式会社,JR九州,http://www.jrkyushu.co.jp/,1,2,6
|
16
|
+
EOS
|
17
|
+
tempfile.close
|
18
|
+
return tempfile.path
|
19
|
+
end
|
20
|
+
|
21
|
+
before do
|
22
|
+
RailwayCompany.import(file_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
describe :imported_count do
|
26
|
+
subject { RailwayCompany.pluck(:id) }
|
27
|
+
it { should match_array [1, 2, 3] }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe :first_company do
|
31
|
+
subject { RailwayCompany.find(1) }
|
32
|
+
its(:name) { should eq 'JR北海道' }
|
33
|
+
its(:railway_id) { should eq 11 }
|
34
|
+
its(:kana_name) { should eq 'ジェイアールホッカイドウ' }
|
35
|
+
its(:official_name) { should eq '北海道旅客鉄道株式会社' }
|
36
|
+
its(:abbreviated_name) { should eq 'JR北海道' }
|
37
|
+
its(:url) { should eq 'http://www.jrhokkaido.co.jp/' }
|
38
|
+
its(:company_type) { should eq 1 }
|
39
|
+
its(:sort) { should eq 1 }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe RailwayLine do
|
5
|
+
describe :import do
|
6
|
+
let(:file_path) do
|
7
|
+
tempfile = Tempfile.new('railway_lines.csv')
|
8
|
+
tempfile << <<EOS
|
9
|
+
line_cd,company_cd,line_name,line_name_k,line_name_h,line_color_c,line_color_t,line_type,lon,lat,zoom,e_status,e_sort
|
10
|
+
1001,3,中央新幹線,チュウオウシンカンセン,中央新幹線,,,,137.493896484375,35.411438052435486,8,1,1001
|
11
|
+
1002,3,東海道新幹線,トウカイドウシンカンセン,東海道新幹線,,,,137.72148868198997,35.144121935482794,7,0,1002
|
12
|
+
1003,4,山陽新幹線,サンヨウシンカンセン,山陽新幹線,,,,133.14789611677998,34.41933769953404,7,0,1003
|
13
|
+
11101,1,JR函館本線(函館~長万部),ハコダテホンセン,JR函館本線(函館~長万部),,,,140.4833696755387,42.23981411231523,9,0,11101
|
14
|
+
11102,1,JR函館本線(長万部~小樽),ハコダテホンセン,JR函館本線(長万部~小樽),,,,140.64288780797756,42.919910231257624,9,0,11102
|
15
|
+
11103,1,JR函館本線(小樽~旭川),ハコダテホンセン,JR函館本線(小樽~旭川),,,,141.69791081566132,43.41509739716935,9,0,11103
|
16
|
+
EOS
|
17
|
+
tempfile.close
|
18
|
+
return tempfile.path
|
19
|
+
end
|
20
|
+
|
21
|
+
before do
|
22
|
+
RailwayLine.import(file_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
subject { RailwayLine.find(11101) }
|
26
|
+
|
27
|
+
its(:railway_company_id) { should eq 1 }
|
28
|
+
its(:name) { should eq 'JR函館本線(函館~長万部)' }
|
29
|
+
its(:kana_name) { should eq 'ハコダテホンセン' }
|
30
|
+
its(:official_name) { should eq 'JR函館本線(函館~長万部)' }
|
31
|
+
its(:color_code) { should be_nil }
|
32
|
+
its(:color_name) { should be_nil }
|
33
|
+
its(:line_type) { should be_nil }
|
34
|
+
its(:longitude) { should be_within(1.0e-12).of(140.4833696755387) }
|
35
|
+
its(:latitude) { should be_within(1.0e-12).of(42.23981411231523) }
|
36
|
+
its(:zoom) { should eq 9 }
|
37
|
+
its(:sort) { should eq 11101 }
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe RailwayStation do
|
5
|
+
describe :import do
|
6
|
+
let(:file_path) do
|
7
|
+
tempfile = Tempfile.new('railway_stations.csv')
|
8
|
+
tempfile << <<EOS
|
9
|
+
station_cd,station_g_cd,station_name,station_name_k,station_name_r,line_cd,pref_cd,post,add,lon,lat,open_ymd,close_ymd,e_status,e_sort
|
10
|
+
1110101,1110101,函館,,,11101,1,040-0063,北海道函館市若松町12-13,140.726413,41.773709,1902-12-10,,0,1110101
|
11
|
+
1110102,1110102,五稜郭,,,11101,1,041-0813,函館市亀田本町,140.733539,41.803557,,,0,1110102
|
12
|
+
1110103,1110103,桔梗,,,11101,1,041-1210,北海道函館市桔梗3丁目41-36,140.722952,41.846457,1902-12-10,,0,1110103
|
13
|
+
1110104,1110104,大中山,,,11101,1,041-1121,亀田郡七飯町大字大中山,140.71358,41.864641,,,0,1110104
|
14
|
+
1110105,1110105,七飯,,,11101,1,041-1111,亀田郡七飯町字本町,140.688556,41.886971,,,0,1110105
|
15
|
+
EOS
|
16
|
+
tempfile.close
|
17
|
+
return tempfile.path
|
18
|
+
end
|
19
|
+
|
20
|
+
before do
|
21
|
+
RailwayStation.import(file_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
subject { RailwayStation.find(1110101) }
|
25
|
+
|
26
|
+
its(:group_station_id) { should eq 1110101 }
|
27
|
+
its(:name) { should eq '函館' }
|
28
|
+
its(:kana_name) { should be_nil }
|
29
|
+
its(:english_name) { should be_nil }
|
30
|
+
its(:railway_line_id) { should eq 11101 }
|
31
|
+
its(:prefecture_id) { should eq 1 }
|
32
|
+
its(:zip_code) { should eq '040-0063' }
|
33
|
+
its(:address) { should eq '北海道函館市若松町12-13' }
|
34
|
+
its(:longitude) { should be_within(1.0e-6).of(140.726413) }
|
35
|
+
its(:latitude) { should be_within(1.0e-6).of(41.773709) }
|
36
|
+
its(:opened_at) { should eq Date.new(1902, 12, 10) }
|
37
|
+
its(:closed_at) { should be_nil }
|
38
|
+
its(:sort) { should eq 1110101 }
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jpstation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- aonashi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 4.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 4.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: actionpack
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 4.0.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 4.0.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rails
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 4.0.0
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 4.0.0
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: sqlite3
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: ammeter
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
description: A Rails plugin for railway data in Japan.
|
143
|
+
email:
|
144
|
+
- aonashi010@gmail.com
|
145
|
+
executables: []
|
146
|
+
extensions: []
|
147
|
+
extra_rdoc_files: []
|
148
|
+
files:
|
149
|
+
- .gitignore
|
150
|
+
- .rspec
|
151
|
+
- .travis.yml
|
152
|
+
- Gemfile
|
153
|
+
- LICENSE.txt
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- app/models/prefecture.rb
|
157
|
+
- app/models/railway_company.rb
|
158
|
+
- app/models/railway_line.rb
|
159
|
+
- app/models/railway_station.rb
|
160
|
+
- jpstation.gemspec
|
161
|
+
- lib/generators/jpstation/install_generator.rb
|
162
|
+
- lib/generators/jpstation/model_generator.rb
|
163
|
+
- lib/generators/jpstation/models_generator.rb
|
164
|
+
- lib/generators/templates/README
|
165
|
+
- lib/generators/templates/migrations/prefectures.rb
|
166
|
+
- lib/generators/templates/migrations/railway_companies.rb
|
167
|
+
- lib/generators/templates/migrations/railway_lines.rb
|
168
|
+
- lib/generators/templates/migrations/railway_stations.rb
|
169
|
+
- lib/jpstation.rb
|
170
|
+
- lib/jpstation/csv/importable.rb
|
171
|
+
- lib/jpstation/csv/railway_company_header.rb
|
172
|
+
- lib/jpstation/csv/railway_line_header.rb
|
173
|
+
- lib/jpstation/csv/railway_station_header.rb
|
174
|
+
- lib/jpstation/engine.rb
|
175
|
+
- lib/jpstation/import.rb
|
176
|
+
- lib/jpstation/railtie.rb
|
177
|
+
- lib/jpstation/tasks.rb
|
178
|
+
- lib/jpstation/version.rb
|
179
|
+
- seed/prefectures.yml
|
180
|
+
- spec/fake_app.rb
|
181
|
+
- spec/generators/jpstation/install_generator_spec.rb
|
182
|
+
- spec/generators/jpstation/model_generator_spec.rb
|
183
|
+
- spec/generators/jpstation/models_generator_spec.rb
|
184
|
+
- spec/jpstation_spec.rb
|
185
|
+
- spec/models/railway_company_spec.rb
|
186
|
+
- spec/models/railway_line_spec.rb
|
187
|
+
- spec/models/railway_station_spec.rb
|
188
|
+
- spec/spec_helper.rb
|
189
|
+
homepage: ''
|
190
|
+
licenses:
|
191
|
+
- MIT
|
192
|
+
post_install_message:
|
193
|
+
rdoc_options: []
|
194
|
+
require_paths:
|
195
|
+
- lib
|
196
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
197
|
+
none: false
|
198
|
+
requirements:
|
199
|
+
- - ! '>='
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
segments:
|
203
|
+
- 0
|
204
|
+
hash: 2110721757605422104
|
205
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
|
+
none: false
|
207
|
+
requirements:
|
208
|
+
- - ! '>='
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: '0'
|
211
|
+
segments:
|
212
|
+
- 0
|
213
|
+
hash: 2110721757605422104
|
214
|
+
requirements: []
|
215
|
+
rubyforge_project:
|
216
|
+
rubygems_version: 1.8.23
|
217
|
+
signing_key:
|
218
|
+
specification_version: 3
|
219
|
+
summary: A Rails plugin for railway data in Japan.
|
220
|
+
test_files:
|
221
|
+
- spec/fake_app.rb
|
222
|
+
- spec/generators/jpstation/install_generator_spec.rb
|
223
|
+
- spec/generators/jpstation/model_generator_spec.rb
|
224
|
+
- spec/generators/jpstation/models_generator_spec.rb
|
225
|
+
- spec/jpstation_spec.rb
|
226
|
+
- spec/models/railway_company_spec.rb
|
227
|
+
- spec/models/railway_line_spec.rb
|
228
|
+
- spec/models/railway_station_spec.rb
|
229
|
+
- spec/spec_helper.rb
|