iarea 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
File without changes
data/.travis.yml ADDED
@@ -0,0 +1,2 @@
1
+ rvm:
2
+ - 1.9.2
data/Gemfile.lock CHANGED
@@ -28,6 +28,7 @@ PLATFORMS
28
28
  ruby
29
29
 
30
30
  DEPENDENCIES
31
+ bundler
31
32
  iarea!
32
33
  rake
33
34
  rdoc
data/Rakefile CHANGED
@@ -17,3 +17,4 @@ end
17
17
  task :default => :test
18
18
 
19
19
  require 'bundler/gem_tasks'
20
+ load './lib/tasks/iarea.rake'
data/db/iareadata.sqlite3 CHANGED
Binary file
data/iarea.gemspec CHANGED
@@ -23,4 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency 'rspec'
24
24
  s.add_development_dependency 'rdoc'
25
25
  s.add_development_dependency 'rake'
26
+ s.add_development_dependency 'bundler'
26
27
  end
data/lib/iarea/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iarea
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/iarea/zone.rb CHANGED
@@ -2,12 +2,14 @@ module Iarea
2
2
  class Zone < OpenStruct
3
3
  @@zones = []
4
4
 
5
+ # Prefectures in the zone
5
6
  def prefectures
6
7
  DB[:prefectures].where(:zone_id => self.id).select(:id).order(:id).map do |prefecture|
7
8
  Prefecture.find(prefecture[:id])
8
9
  end
9
10
  end
10
11
 
12
+ # Areas in the zone
11
13
  def areas
12
14
  DB[:areas].where(:zone_id => self.id).select(:areacode).order(:areacode).map do |area|
13
15
  Area.find(area[:areacode])
@@ -15,10 +17,12 @@ module Iarea
15
17
  end
16
18
 
17
19
  class << self
20
+ # Find a zone by <tt>id</tt>
18
21
  def find(id)
19
22
  @@zones[id] ||= new DB[:zones].where(:id => id).first
20
23
  end
21
24
 
25
+ # All zones
22
26
  def all
23
27
  DB[:zones].select(:id).order(:id).all.map{ |z| find(z[:id]) }
24
28
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe Iarea::Prefecture do
5
5
  describe 'Tokyo' do
6
- subject { Iarea::Prefecture.find(12) }
6
+ subject { Iarea::Prefecture.find(13) }
7
7
  its(:name) { should == "東京" }
8
8
  it do
9
9
  subject.zone.name.should == "関東甲信越"
@@ -11,7 +11,7 @@ describe Iarea::Prefecture do
11
11
  end
12
12
 
13
13
  describe 'Okinawa' do
14
- subject { Iarea::Prefecture.find(46) }
14
+ subject { Iarea::Prefecture.find(47) }
15
15
  its(:name) { should == "沖縄" }
16
16
  it do
17
17
  subject.areas.map(&:name).should == ["那覇/浦添", "沖縄/名護", "宮古/石垣"]
@@ -20,9 +20,9 @@ describe Iarea::Prefecture do
20
20
 
21
21
  describe 'equivalence' do
22
22
  before do
23
- @a = Iarea::Prefecture.find(0)
24
- @b = Iarea::Prefecture.find(0)
25
- @c = Iarea::Prefecture.find(1)
23
+ @a = Iarea::Prefecture.find(1)
24
+ @b = Iarea::Prefecture.find(1)
25
+ @c = Iarea::Prefecture.find(2)
26
26
  end
27
27
  it do
28
28
  @a.should == @b
@@ -33,6 +33,6 @@ describe Iarea::Prefecture do
33
33
  end
34
34
 
35
35
  it '#all' do
36
- Iarea::Prefecture.all.should == (0..46).map {|i| Iarea::Prefecture.find(i)}
36
+ Iarea::Prefecture.all.should == (1..47).map {|i| Iarea::Prefecture.find(i)}
37
37
  end
38
38
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe Iarea::Zone do
5
5
  describe 'Tokyo' do
6
- subject { Iarea::Zone.find(2) }
6
+ subject { Iarea::Zone.find(3) }
7
7
  its(:name) { should == "関東甲信越" }
8
8
 
9
9
  it '#prefectures' do
@@ -12,7 +12,7 @@ describe Iarea::Zone do
12
12
  end
13
13
 
14
14
  describe 'Shikoku' do
15
- subject { Iarea::Zone.find(7) }
15
+ subject { Iarea::Zone.find(8) }
16
16
  it '#areas' do
17
17
  subject.areas.map(&:name).should == ["高松市周辺", "東讃", "中讃", "西讃", "徳島市", "徳島県北部", "徳島県西部", "徳島県南部", "中予", "東予", "南予北部", "南予南部", "高知市", "高知県中部", "高知県東部", "高知県西部"]
18
18
  end
@@ -20,9 +20,9 @@ describe Iarea::Zone do
20
20
 
21
21
  describe 'equivalence' do
22
22
  before do
23
- @a = Iarea::Zone.find(0)
24
- @b = Iarea::Zone.find(0)
25
- @c = Iarea::Zone.find(1)
23
+ @a = Iarea::Zone.find(1)
24
+ @b = Iarea::Zone.find(1)
25
+ @c = Iarea::Zone.find(2)
26
26
  end
27
27
  it do
28
28
  @a.should == @b
@@ -33,6 +33,6 @@ describe Iarea::Zone do
33
33
  end
34
34
 
35
35
  it '#all' do
36
- Iarea::Zone.all.should == (0..8).map {|i| Iarea::Zone.find(i)}
36
+ Iarea::Zone.all.should == (1..9).map {|i| Iarea::Zone.find(i)}
37
37
  end
38
38
  end
@@ -64,13 +64,15 @@ db.transaction do
64
64
  end
65
65
  # zones
66
66
  data['zones'].each_with_index do |zone, i|
67
- $stderr.puts " importing zone %d %s" % [i, zone['name']]
68
- db[:zones].insert(:id => i, :name => zone['name'])
67
+ id = i + 1
68
+ $stderr.puts " importing zone %d %s" % [id, zone['name']]
69
+ db[:zones].insert(:id => id, :name => zone['name'])
69
70
  end
70
71
  # prefs
71
72
  data['prefs'].each_with_index do |pref, i|
72
- $stderr.puts " importing prefecture %d %s" % [i, pref['name']]
73
- db[:prefectures].insert(:id => i, :name => pref['name'], :zone_id => pref['zone'])
73
+ id = i + 1
74
+ $stderr.puts " importing prefecture %d %s" % [id, pref['name']]
75
+ db[:prefectures].insert(:id => id, :name => pref['name'], :zone_id => pref['zone'] + 1)
74
76
  end
75
77
  # areas
76
78
  data['areas'].each do |areacode, area|
@@ -85,8 +87,8 @@ db.transaction do
85
87
  :south => area['msSouth'],
86
88
  :east => area['msEast'],
87
89
  :north => area['msNorth'],
88
- :zone_id => area['zone'],
89
- :prefecture_id => area['pref']
90
+ :zone_id => area['zone'] + 1,
91
+ :prefecture_id => area['pref'] + 1
90
92
  }
91
93
  # fix .js problem
92
94
  if hash[:name] == '新宿1?2丁目'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iarea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-21 00:00:00.000000000 Z
12
+ date: 2011-08-01 00:00:00.000000000 +09:00
13
+ default_executable:
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: sequel
16
- requirement: &2152073560 !ruby/object:Gem::Requirement
17
+ requirement: &2158352220 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ! '>='
@@ -21,10 +22,10 @@ dependencies:
21
22
  version: '0'
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *2152073560
25
+ version_requirements: *2158352220
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: sqlite3-ruby
27
- requirement: &2152072320 !ruby/object:Gem::Requirement
28
+ requirement: &2158351740 !ruby/object:Gem::Requirement
28
29
  none: false
29
30
  requirements:
30
31
  - - ! '>='
@@ -32,10 +33,10 @@ dependencies:
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *2152072320
36
+ version_requirements: *2158351740
36
37
  - !ruby/object:Gem::Dependency
37
38
  name: rspec
38
- requirement: &2152071540 !ruby/object:Gem::Requirement
39
+ requirement: &2158351260 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
42
  - - ! '>='
@@ -43,10 +44,10 @@ dependencies:
43
44
  version: '0'
44
45
  type: :development
45
46
  prerelease: false
46
- version_requirements: *2152071540
47
+ version_requirements: *2158351260
47
48
  - !ruby/object:Gem::Dependency
48
49
  name: rdoc
49
- requirement: &2152066340 !ruby/object:Gem::Requirement
50
+ requirement: &2158350760 !ruby/object:Gem::Requirement
50
51
  none: false
51
52
  requirements:
52
53
  - - ! '>='
@@ -54,10 +55,10 @@ dependencies:
54
55
  version: '0'
55
56
  type: :development
56
57
  prerelease: false
57
- version_requirements: *2152066340
58
+ version_requirements: *2158350760
58
59
  - !ruby/object:Gem::Dependency
59
60
  name: rake
60
- requirement: &2152065540 !ruby/object:Gem::Requirement
61
+ requirement: &2158350300 !ruby/object:Gem::Requirement
61
62
  none: false
62
63
  requirements:
63
64
  - - ! '>='
@@ -65,7 +66,18 @@ dependencies:
65
66
  version: '0'
66
67
  type: :development
67
68
  prerelease: false
68
- version_requirements: *2152065540
69
+ version_requirements: *2158350300
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: &2158349800 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *2158349800
69
81
  description: A library for DoCoMo Open Iarea.
70
82
  email:
71
83
  - dara@shidara.net
@@ -74,6 +86,8 @@ extensions: []
74
86
  extra_rdoc_files: []
75
87
  files:
76
88
  - .gitignore
89
+ - .rspec
90
+ - .travis.yml
77
91
  - Gemfile
78
92
  - Gemfile.lock
79
93
  - MIT-LICENSE
@@ -96,6 +110,7 @@ files:
96
110
  - spec/spec_helper.rb
97
111
  - tools/import_areas.rb
98
112
  - tools/import_meshes.rb
113
+ has_rdoc: true
99
114
  homepage: http://github.com/darashi/iarea
100
115
  licenses: []
101
116
  post_install_message:
@@ -108,21 +123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
123
  - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
- segments:
112
- - 0
113
- hash: 2329483377850070231
114
126
  required_rubygems_version: !ruby/object:Gem::Requirement
115
127
  none: false
116
128
  requirements:
117
129
  - - ! '>='
118
130
  - !ruby/object:Gem::Version
119
131
  version: '0'
120
- segments:
121
- - 0
122
- hash: 2329483377850070231
123
132
  requirements: []
124
133
  rubyforge_project: iarea
125
- rubygems_version: 1.8.3
134
+ rubygems_version: 1.6.1
126
135
  signing_key:
127
136
  specification_version: 3
128
137
  summary: A library for DoCoMo Open Iarea.