faker-jp_prefecture 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: eeb409761706ea9bca8d08c50b7f0af285b236f652379feec3d623468b512239
4
+ data.tar.gz: 382f51df7234b58a42d6ab6104b5f6ff5a293723e83b5e6357cdddc693e1ad61
5
+ SHA512:
6
+ metadata.gz: 4521d5f7f75241c3ef5c42f7fa892986296459e4216419beec18bd905436dabedca77606901476a99d8d4bd6c503e77f0b016691c66ed40bcabc4cd9a5cd1626
7
+ data.tar.gz: df6b1e61eb6d1d5bbc1f26d8cf33f48ec7d0f3a2823ec0416a6e0bac4cc526eea97ef5081bba021f8677f75350e71ef580b630fdccf1ab6476cda1c7d4f9367e
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ /vendor/
14
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at okkun.sh@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in faker-jp_prefecture.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 okkun_sh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ __Release beta version, Sorry, in development!__
2
+
3
+ # Faker::JpPrefecture
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/faker/jp_prefecture`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Description
8
+ Random generate fake data for japanese prefectures.
9
+ Inspired [faker](https://github.com/stympy/faker).
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'faker-jp_prefecture'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle install --path=vendor/bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install faker-jp_prefecture
26
+
27
+ ## Usage
28
+ ```
29
+ Faker::JpPrefecture::Prefecture.all
30
+ # => {:code=>13, :name=>"東京都", :name_e=>"tokyo"}
31
+ ```
32
+
33
+ TODO: Write usage instructions here
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/faker-jp_prefecture. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
48
+
49
+ ## Code of Conduct
50
+
51
+ Everyone interacting in the Faker::JpPrefecture project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/faker-jp_prefecture/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "faker/jp_prefecture"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,40 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "faker/jp_prefecture/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "faker-jp_prefecture"
8
+ spec.version = Faker::JpPrefecture::VERSION
9
+ spec.authors = ["okkun_sh"]
10
+ spec.email = ["okkun.sh@gmail.com"]
11
+
12
+ spec.summary = %q{This gem can generate fake data for Japanese prefectures.}
13
+ spec.description = %q{Generate fake data for Japanese prefectures.}
14
+ spec.homepage = "https://github.com/okkun-sh/faker-jp_prefecture"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = spec.homepage
22
+ spec.metadata["changelog_uri"] = "https://github.com/okkun-sh/faker-jp_prefecture/releases"
23
+ else
24
+ raise "RubyGems 2.0 or newer is required to protect against " \
25
+ "public gem pushes."
26
+ end
27
+
28
+ # Specify which files should be added to the gem when it is released.
29
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
30
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
31
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
32
+ end
33
+ spec.bindir = "exe"
34
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
35
+ spec.require_paths = ["lib"]
36
+
37
+ spec.add_development_dependency "bundler", "~> 1.17"
38
+ spec.add_development_dependency "rake", "~> 10.0"
39
+ spec.add_development_dependency "rspec", "~> 3.0"
40
+ end
@@ -0,0 +1,237 @@
1
+ PREFECTURES = [
2
+ {
3
+ code: 1,
4
+ name: "北海道",
5
+ name_e: "hokkaido"
6
+ },
7
+ {
8
+ code: 2,
9
+ name: "青森県",
10
+ name_e: "aomori"
11
+ },
12
+ {
13
+ code: 3,
14
+ name: "岩手県",
15
+ name_e: "iwate"
16
+ },
17
+ {
18
+ code: 4,
19
+ name: "宮城県",
20
+ name_e: "miyagi"
21
+ },
22
+ {
23
+ code: 5,
24
+ name: "秋田県",
25
+ name_e: "akita"
26
+ },
27
+ {
28
+ code: 6,
29
+ name: "山形県",
30
+ name_e: "yamagata"
31
+ },
32
+ {
33
+ code: 7,
34
+ name: "福島県",
35
+ name_e: "fukushima"
36
+ },
37
+ {
38
+ code: 8,
39
+ name: "茨城県",
40
+ name_e: "ibaraki"
41
+ },
42
+ {
43
+ code: 9,
44
+ name: "栃木県",
45
+ name_e: "tochigi"
46
+ },
47
+ {
48
+ code: 10,
49
+ name: "群馬県",
50
+ name_e: "gunma"
51
+ },
52
+ {
53
+ code: 11,
54
+ name: "埼玉県",
55
+ name_e: "saitama"
56
+ },
57
+ {
58
+ code: 12,
59
+ name: "千葉県",
60
+ name_e: "chiba"
61
+ },
62
+ {
63
+ code: 13,
64
+ name: "東京都",
65
+ name_e: "tokyo"
66
+ },
67
+ {
68
+ code: 14,
69
+ name: "神奈川県",
70
+ name_e: "kanagawa"
71
+ },
72
+ {
73
+ code: 15,
74
+ name: "新潟県",
75
+ name_e: "niigata"
76
+ },
77
+ {
78
+ code: 16,
79
+ name: "富山県",
80
+ name_e: "toyama"
81
+ },
82
+ {
83
+ code: 17,
84
+ name: "石川県",
85
+ name_e: "ishikawa"
86
+ },
87
+ {
88
+ code: 18,
89
+ name: "福井県",
90
+ name_e: "fukui"
91
+ },
92
+ {
93
+ code: 19,
94
+ name: "山梨県",
95
+ name_e: "yamanashi"
96
+ },
97
+ {
98
+ code: 20,
99
+ name: "長野県",
100
+ name_e: "nagano"
101
+ },
102
+ {
103
+ code: 21,
104
+ name: "岐阜県",
105
+ name_e: "gifu"
106
+ },
107
+ {
108
+ code: 22,
109
+ name: "静岡県",
110
+ name_e: "shizuoka"
111
+ },
112
+ {
113
+ code: 23,
114
+ name: "愛知県",
115
+ name_e: "aichi"
116
+ },
117
+ {
118
+ code: 24,
119
+ name: "三重県",
120
+ name_e: "mie"
121
+ },
122
+ {
123
+ code: 25,
124
+ name: "滋賀県",
125
+ name_e: "shiga"
126
+ },
127
+ {
128
+ code: 26,
129
+ name: "京都府",
130
+ name_e: "kyoto"
131
+ },
132
+ {
133
+ code: 27,
134
+ name: "大阪府",
135
+ name_e: "osaka"
136
+ },
137
+ {
138
+ code: 28,
139
+ name: "兵庫県",
140
+ name_e: "hyogo"
141
+ },
142
+ {
143
+ code: 29,
144
+ name: "奈良県",
145
+ name_e: "nara"
146
+ },
147
+ {
148
+ code: 30,
149
+ name: "和歌山県",
150
+ name_e: "wakayama"
151
+ },
152
+ {
153
+ code: 31,
154
+ name: "鳥取県",
155
+ name_e: "tottori"
156
+ },
157
+ {
158
+ code: 32,
159
+ name: "島根県",
160
+ name_e: "shimane"
161
+ },
162
+ {
163
+ code: 33,
164
+ name: "岡山県",
165
+ name_e: "okayama"
166
+ },
167
+ {
168
+ code: 34,
169
+ name: "広島県",
170
+ name_e: "hiroshima"
171
+ },
172
+ {
173
+ code: 35,
174
+ name: "山口県",
175
+ name_e: "yamaguchi"
176
+ },
177
+ {
178
+ code: 36,
179
+ name: "徳島県",
180
+ name_e: "tokushima"
181
+ },
182
+ {
183
+ code: 37,
184
+ name: "香川県",
185
+ name_e: "kagawa"
186
+ },
187
+ {
188
+ code: 38,
189
+ name: "愛媛県",
190
+ name_e: "ehime"
191
+ },
192
+ {
193
+ code: 39,
194
+ name: "高知県",
195
+ name_e: "kochi"
196
+ },
197
+ {
198
+ code: 40,
199
+ name: "福岡県",
200
+ name_e: "fukuoka"
201
+ },
202
+ {
203
+ code: 41,
204
+ name: "佐賀県",
205
+ name_e: "saga"
206
+ },
207
+ {
208
+ code: 42,
209
+ name: "長崎県",
210
+ name_e: "nagasaki"
211
+ },
212
+ {
213
+ code: 43,
214
+ name: "熊本県",
215
+ name_e: "kumamoto"
216
+ },
217
+ {
218
+ code: 44,
219
+ name: "大分県",
220
+ name_e: "oita"
221
+ },
222
+ {
223
+ code: 45,
224
+ name: "宮崎県",
225
+ name_e: "miyazaki"
226
+ },
227
+ {
228
+ code: 46,
229
+ name: "鹿児島県",
230
+ name_e: "kagoshima"
231
+ },
232
+ {
233
+ code: 47,
234
+ name: "沖縄県",
235
+ name_e: "okinawa"
236
+ }
237
+ ]
@@ -0,0 +1,7 @@
1
+ require "faker/jp_prefecture/constant"
2
+
3
+ class Faker::JpPrefecture::Prefecture
4
+ def self.all
5
+ PREFECTURES.sample
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Faker
2
+ module JpPrefecture
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require "faker/jp_prefecture/version"
2
+ require "faker/jp_prefecture/prefecture"
3
+
4
+ module Faker
5
+ module JpPrefecture
6
+ class Error < StandardError; end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: faker-jp_prefecture
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - okkun_sh
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Generate fake data for Japanese prefectures.
56
+ email:
57
+ - okkun.sh@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - CODE_OF_CONDUCT.md
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - faker-jp_prefecture.gemspec
72
+ - lib/faker/jp_prefecture.rb
73
+ - lib/faker/jp_prefecture/constant.rb
74
+ - lib/faker/jp_prefecture/prefecture.rb
75
+ - lib/faker/jp_prefecture/version.rb
76
+ homepage: https://github.com/okkun-sh/faker-jp_prefecture
77
+ licenses:
78
+ - MIT
79
+ metadata:
80
+ homepage_uri: https://github.com/okkun-sh/faker-jp_prefecture
81
+ source_code_uri: https://github.com/okkun-sh/faker-jp_prefecture
82
+ changelog_uri: https://github.com/okkun-sh/faker-jp_prefecture/releases
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubygems_version: 3.0.1
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: This gem can generate fake data for Japanese prefectures.
102
+ test_files: []