china_regions 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a41ea2a6df5c180fcae8b4196721e6923d6404652c01952646b406986d6dfbb5
4
- data.tar.gz: ab7679782a12f7e54cd4575d40bef3788b254080d683335942f45b065ce2f6bd
3
+ metadata.gz: fc32c13b4a0595a59e167d71b409a6c3798a0d1e60559583bd7d36632ef51d96
4
+ data.tar.gz: b7800a8a8c059fc7c4d596ccf576cb92379f336012275008371e810f3956ffef
5
5
  SHA512:
6
- metadata.gz: de1e99b860db09eba4a5be416c519cfbbed6ad64e1ed916e088aab22eb1eb10c011e53dbf8db02a487661aae8c275586f835d0a1176db8cfb5618beaaaadfb64
7
- data.tar.gz: 5c495307768bceb1b04f5f25c1960d1d380e9a7d55b1c83a7c0065dd9d7dc46ca55b078a6549ed4cd2d70aa65f2c0b27c7e1d35afd8d37a7d97600380c2cabeb
6
+ metadata.gz: e729654e0c592fee2f8ddee5ab8241876eb076d86aa8d46d925d4984e82b141be0f449ce7cd86fd6debe55349f0eff47b007a261ce75242b66aa8f6b1ae882ff
7
+ data.tar.gz: a455db27261039b7f2f7c72e1644467110856cb03376bfae8d087557ced0f6e6523c8d160e49e191ed43e026325e02696f508b9cede6a51a20838b699af9f115
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -1,15 +1,16 @@
1
1
  language: ruby
2
- sudo: required
3
- dist: trusty
4
2
  rvm:
5
3
  - 1.9.3
6
- - 2.3.1
7
- - 2.4.1
8
- - 2.5.1
9
- - 2.6.3
4
+ - 2.0.0
5
+ - 2.1.0
10
6
 
11
7
  before_install:
12
8
  - gem install bundler
13
9
 
14
- after_success:
15
- - coveralls --verbose
10
+ branches:
11
+ only:
12
+ - master
13
+ - /^deploy-.*$/
14
+
15
+ gemfile:
16
+ - Gemfile
data/README.md CHANGED
@@ -4,22 +4,22 @@
4
4
  [![Build Status](https://travis-ci.org/encoreshao/crunchbase-ruby-library.svg?branch=master)](https://travis-ci.org/encoreshao/crunchbase-ruby-library)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/encoreshao/crunchbase-ruby-library/badge.svg)](https://coveralls.io/github/encoreshao/crunchbase-ruby-library)
6
6
 
7
- ChinaRegions provides Ruby on Rails code for provinces, cities, and districts [prefecture-level cities] in China. The code version requires Ruby (> 1.9.x) and Rails (> 4.0).
7
+ ChinaRegions provides Ruby on Rails code for provinces, cities, and districts [prefecture-level cities] in China. The code need to requires Ruby (> 1.9.x) and Rails (> 4.0).
8
8
 
9
9
  ### Data Sources
10
10
 
11
11
  * Ministry of Civil Affairs, National Bureau of Statistics:
12
-      * [State Statistics Bureau of the People's Republic of China-Statistical Divisions and Urban-Rural Division Codes](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/)
13
-      * [State Statistics Bureau of the People's Republic of China-Statistical Division Codes and Urban-rural Division Codes Compilation Rules](http://www.stats.gov.cn/tjsj/tjbz/200911/t20091125_8667.html)
12
+ * [State Statistics Bureau of the People's Republic of China-Statistical Divisions and Urban-Rural Division Codes](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/)
13
+ * [State Statistics Bureau of the People's Republic of China-Statistical Division Codes and Urban-rural Division Codes Compilation Rules](http://www.stats.gov.cn/tjsj/tjbz/200911/t20091125_8667.html)
14
14
  * This item has been updated to:
15
-      * [2018 zoning code and urban-rural division code for statistics (cut-off time: 2018-10-31, release time: 2019-01-31)](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2018/index.html)
15
+ * [2018 zoning code and urban-rural division code for statistics (cut-off time: 2018-10-31, release time: 2019-01-31)](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2018/index.html)
16
16
 
17
17
  ### How to update data
18
18
 
19
19
  If you are using ChinaRegions version 0.1.x be sure to run:
20
20
 
21
21
  ```
22
- rails g china_regions:regions
22
+ rails g china_regions:regions
23
23
  ```
24
24
 
25
25
  to have the javascript file copied over into your project.
@@ -28,52 +28,54 @@ to have the javascript file copied over into your project.
28
28
 
29
29
  Add it to your Gemfile:
30
30
 
31
- gem 'china_regions'
31
+ ```
32
+ gem 'china_regions'
33
+ ```
32
34
 
33
35
  Run the following command to install it:
34
36
 
35
37
  ```
36
- bundle install
38
+ bundle install
37
39
  ```
38
40
 
39
41
  Run the generator:
40
42
 
41
43
  ```
42
- rails g china_regions:install
44
+ rails g china_regions:install
43
45
  ```
44
46
 
45
47
  Then you can see the changes that happened to the console:
46
48
 
47
- - Copy `db/migrate/xxxxxxxxxxx_create_china_regions_tables.rb` to `db/migrate` folder.
48
- - Copy `regions.en.yml` and `regions.zh.yml` files to `config/locales` folders
49
+ - Copy `db/migrate/xxxxxxxxxxx_create_china_regions_tables.rb` to `db/migrate` folder.
50
+ - Copy `regions.en.yml` and `regions.zh.yml` files to `config/locales` folders
49
51
 
50
52
  Create tables (provinces, cities, districts):
51
53
 
52
54
  ```
53
- rake db:migrate
55
+ rake db:migrate
54
56
  ```
55
57
 
56
58
  Copy Models [`Province`, `City`, `District`] into your project:
57
59
 
58
60
  ```
59
- rails g china_regions:regions
61
+ rails g china_regions:regions
60
62
  ```
61
63
 
62
64
  Newly added models:
63
65
 
64
- - create app/models/province.rb
65
- - create app/models/city.rb
66
- - create app/models/district.rb
66
+ - create app/models/province.rb
67
+ - create app/models/city.rb
68
+ - create app/models/district.rb
67
69
 
68
70
  Download and import the latest regions to your project:
69
71
 
70
72
  ```
71
- rake china_regions:all
73
+ rake china_regions:all
72
74
 
73
- OR
75
+ OR
74
76
 
75
- rake china_regions:download
76
- rake china_regions:import
77
+ rake china_regions:download
78
+ rake china_regions:import
77
79
  ```
78
80
 
79
81
  - 1. Downloading regions from `Administrative-divisions-of-China` to `db/regions` folder.
@@ -85,61 +87,63 @@ Download and import the latest regions to your project:
85
87
  Example:
86
88
 
87
89
  ```
88
- = form_for @article do |f|
90
+ = form_for @article do |f|
89
91
 
90
- = f.region_select [:province, :city, :district]
92
+ = f.region_select [:province, :city, :district]
91
93
 
92
- # form_tag
93
- = region_select :article, :province_id
94
- = region_select :article, :city_id
95
- = region_select :article, :district_id
94
+ # form_tag
95
+ = region_select :article, :province_id
96
+ = region_select :article, :city_id
97
+ = region_select :article, :district_id
96
98
 
97
- OR
99
+ OR
98
100
 
99
- = region_select :article, :province
100
- = region_select :article, :city
101
- = region_select :article, :district
101
+ = region_select :article, :province
102
+ = region_select :article, :city
103
+ = region_select :article, :district
102
104
 
103
- = f.submit class: 'btn'
105
+ = f.submit class: 'btn'
104
106
  ```
105
107
 
106
108
  Add prefix name:
107
109
 
108
110
  ```
109
- = form_for @article do |f|
111
+ = form_for @article do |f|
110
112
 
111
- = f.region_select [:province, :city, :district], :prefix => "home"
112
- = f.region_select [:province, :city, :district], :prefix => "work"
113
+ = f.region_select [:province, :city, :district], :prefix => "home"
114
+ = f.region_select [:province, :city, :district], :prefix => "work"
113
115
  ```
114
116
 
115
117
  Pre-selected province:
116
118
 
117
119
  ```
118
- = form_for @article do |f|
119
- = f.region_select [:province, :city, :district], province: "chongqing"
120
+ = form_for @article do |f|
121
+ = f.region_select [:province, :city, :district], province: "chongqing"
120
122
 
121
- OR
123
+ OR
122
124
 
123
- = f.region_select [:province, :city, :district], province: "重庆市"
125
+ = f.region_select [:province, :city, :district], province: "重庆市"
124
126
  ```
125
127
 
126
128
  Prior choice:
127
129
 
128
130
  ```
129
- = form_for @article do |f|
130
- = f.region_select [:province, :city, :district], priority: { province: ["重庆市"], district: %w(巴南区 北碚区 渝北区) }
131
+ = form_for @article do |f|
132
+ = f.region_select [:province, :city, :district],
133
+ priority: {
134
+ province: ["重庆市"],
135
+ district: %w(巴南区 北碚区 渝北区)
136
+ }
131
137
  ```
132
138
 
133
139
 
134
140
  ### Other languages
135
141
 
136
- [Chinese](https://github.com/encoreshao/china_regions/blob/master/README.zh.md)
142
+ - [Chinese](https://github.com/encoreshao/china_regions/blob/master/README.zh.md)
137
143
 
138
144
  ### Contributing
139
145
 
140
- We have a list of valued contributors. Check them all at:
141
-
142
- https://github.com/encoreshao/china_regions/graphs/contributors
146
+ We have a list of valued contributors. Check them all at: https://github.com/encoreshao/china_regions/graphs/contributors
143
147
 
144
148
 
145
149
  ### License
@@ -19,19 +19,21 @@ ChinaRegions 提供中国的省,市,区[地级市]的 Ruby on Rails的程式
19
19
  复制所需文件到你的项目中:
20
20
 
21
21
  ```
22
- rails g china_regions:regions
22
+ rails g china_regions:regions
23
23
  ```
24
24
 
25
25
  ### 如何引入china_regions到你的项目
26
26
 
27
27
  添加以下代码到你的 Gemfile:
28
28
 
29
- gem 'china_regions'
29
+ ```
30
+ gem 'china_regions'
31
+ ```
30
32
 
31
33
  安装:
32
34
 
33
35
  ```
34
- bundle install
36
+ bundle install
35
37
  ```
36
38
 
37
39
  #### 开始构建城市数据
@@ -39,40 +41,41 @@ ChinaRegions 提供中国的省,市,区[地级市]的 Ruby on Rails的程式
39
41
  复制所需文件到你的项目中:
40
42
 
41
43
  ```
42
- rails g china_regions:install
44
+ rails g china_regions:install
43
45
  ```
44
46
 
45
47
  随后你可以看到控制台发生的变化:
46
- - 复制 `db/migrate/xxxxxxxxxxx_create_china_regions_tables.rb` 文件到 `db/migrate` 目录中
47
- - 复制 `regions.en.yml` `regions.zh.yml` 配置文件到 `config/locales` 目录中
48
+
49
+ - 复制 `db/migrate/xxxxxxxxxxx_create_china_regions_tables.rb` 文件到 `db/migrate` 目录中
50
+ - 复制 `regions.en.yml` 和 `regions.zh.yml` 配置文件到 `config/locales` 目录中
48
51
 
49
52
  创建所需的表 (provinces, cities, districts):
50
53
 
51
54
  ```
52
- rake db:migrate
55
+ rake db:migrate
53
56
  ```
54
57
 
55
58
  将所需的模型(Models) [`Province`, `City`, `District`] 到您的应用程式中:
56
59
 
57
60
  ```
58
- rails g china_regions:regions
61
+ rails g china_regions:regions
59
62
  ```
60
63
 
61
64
  查看 app/models:
62
65
 
63
- - create app/models/province.rb
64
- - create app/models/city.rb
65
- - create app/models/district.rb
66
+ - create app/models/province.rb
67
+ - create app/models/city.rb
68
+ - create app/models/district.rb
66
69
 
67
70
  下载并导入最新数据到你的项目中:
68
71
 
69
72
  ```
70
- rake china_regions:all
73
+ rake china_regions:all
71
74
 
72
- OR
75
+ OR
73
76
 
74
- rake china_regions:download
75
- rake china_regions:import
77
+ rake china_regions:download
78
+ rake china_regions:import
76
79
  ```
77
80
 
78
81
  - 1. 从 `Administrative-divisions-of-China` 下载最新的地区信息到 `db/regions` 目录中.
@@ -84,49 +87,51 @@ ChinaRegions 提供中国的省,市,区[地级市]的 Ruby on Rails的程式
84
87
  范例:
85
88
 
86
89
  ```
87
- = form_for @article do |f|
88
-
89
- = f.region_select [:province, :city, :district]
90
+ = form_for @article do |f|
91
+ = f.region_select [:province, :city, :district]
90
92
 
91
- # form_tag
92
- = region_select :article, :province_id
93
- = region_select :article, :city_id
94
- = region_select :article, :district_id
93
+ # form_tag
94
+ = region_select :article, :province_id
95
+ = region_select :article, :city_id
96
+ = region_select :article, :district_id
95
97
 
96
- OR
98
+ OR
97
99
 
98
- = region_select :article, :province
99
- = region_select :article, :city
100
- = region_select :article, :district
100
+ = region_select :article, :province
101
+ = region_select :article, :city
102
+ = region_select :article, :district
101
103
 
102
- = f.submit class: 'btn'
104
+ = f.submit class: 'btn'
103
105
  ```
104
106
 
105
107
  添加前缀名:
106
108
 
107
109
  ```
108
- = form_for @article do |f|
109
- = f.region_select [:province, :city, :district], :prefix => "home"
110
- = f.region_select [:province, :city, :district], :prefix => "work"
110
+ = form_for @article do |f|
111
+ = f.region_select [:province, :city, :district], :prefix => "home"
112
+ = f.region_select [:province, :city, :district], :prefix => "work"
111
113
  ```
112
114
 
113
115
  预选则省份:
114
116
 
115
117
  ```
116
- = form_for @article do |f|
117
-
118
- = f.region_select [:province, :city, :district], province: "chongqing"
118
+ = form_for @article do |f|
119
+ = f.region_select [:province, :city, :district], province: "chongqing"
119
120
 
120
- OR
121
+ OR
121
122
 
122
- = f.region_select [:province, :city, :district], province: "重庆市"
123
+ = f.region_select [:province, :city, :district], province: "重庆市"
123
124
  ```
124
125
 
125
126
  优先选择:
126
127
 
127
128
  ```
128
- = form_for @article do |f|
129
- = f.region_select [:province, :city, :district], priority: { province: ["重庆市"], district: %w(巴南区 北碚区 渝北区) }
129
+ = form_for @article do |f|
130
+ = f.region_select [:province, :city, :district],
131
+ priority: {
132
+ province: ["重庆市"],
133
+ district: %w(巴南区 北碚区 渝北区)
134
+ }
130
135
  ```
131
136
 
132
137
  ### 其它语言
@@ -135,10 +140,7 @@ ChinaRegions 提供中国的省,市,区[地级市]的 Ruby on Rails的程式
135
140
 
136
141
  ### 贡献者
137
142
 
138
- 你可以在这里查看到所有的代码贡献者:
139
-
140
- https://github.com/encoreshao/china_regions/graphs/contributors
141
-
143
+ 你可以在这里查看到所有的代码贡献者: https://github.com/encoreshao/china_regions/graphs/contributors
142
144
 
143
145
  ### 许可
144
146
 
@@ -4,23 +4,25 @@
4
4
  require File.expand_path('lib/china_regions/version', __dir__)
5
5
 
6
6
  Gem::Specification.new do |gem|
7
+ gem.name = 'china_regions'
7
8
  gem.authors = ['Encore Shao']
8
9
  gem.email = ['encore.shao@gmail.com']
9
10
  gem.description = 'China Regions is a Ruby on rails interface'
10
11
  gem.summary = 'Rails 4+ version of dropdowns for all provinces, cities,
11
12
  and districts in China.'
12
- gem.homepage = 'http://github.com/encoreshao'
13
+ gem.homepage = 'https://github.com/encoreshao/china_regions'
14
+ gem.license = 'MIT'
13
15
 
14
16
  gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
15
17
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
16
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
- gem.name = 'china_regions'
18
19
  gem.require_paths = ['lib']
19
20
  gem.version = ChinaRegions::VERSION
20
21
 
21
22
  gem.add_dependency 'down'
22
23
  gem.add_dependency 'jquery-rails'
23
24
  gem.add_dependency 'ruby-pinyin'
25
+ gem.add_development_dependency 'coveralls'
24
26
  gem.add_development_dependency 'pry'
25
27
  gem.add_development_dependency 'rubocop'
26
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChinaRegions
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: china_regions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Encore Shao
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: pry
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +103,7 @@ executables:
89
103
  extensions: []
90
104
  extra_rdoc_files: []
91
105
  files:
106
+ - ".coveralls.yml"
92
107
  - ".gitignore"
93
108
  - ".rubocop.yml"
94
109
  - ".travis.yml"
@@ -116,8 +131,9 @@ files:
116
131
  - lib/generators/china_regions/regions_generator.rb
117
132
  - lib/generators/china_regions/templates/migration.rb
118
133
  - lib/tasks/china_regions.rake
119
- homepage: http://github.com/encoreshao
120
- licenses: []
134
+ homepage: https://github.com/encoreshao/china_regions
135
+ licenses:
136
+ - MIT
121
137
  metadata: {}
122
138
  post_install_message:
123
139
  rdoc_options: []