polyglot_faker 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.travis.yml +11 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +7 -0
- data/lib/polyglot_faker/version.rb +3 -0
- data/lib/polyglot_faker.rb +12 -0
- data/polyglot-faker.gemspec +25 -0
- data/spec/polyglot_faker_spec.rb +24 -0
- data/spec/spec_helper.rb +10 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3680506a83c2b2e4dee13782552d5b9313f4cd5a
|
4
|
+
data.tar.gz: 7128774c4b417164cda51308448bb4be7094efda
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89d4a52bd64798d6869b9635001e5cf12087c6f6d0e809be33bd912b406d584490bb2c5f55ebf5c1f7ad47a91356988827e1f75bcca49baea813656b4b3a4413
|
7
|
+
data.tar.gz: 7ef49e7259c1c3f7940eea5af530d2d4629ef80dc9a4ba9074dce5c370e28107444a377d8ec2990042bce13adcee5d928be1f047ea8c0da564a72e72b4343f43
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
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
|
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
rvm:
|
4
|
+
- 1.9.3-p484
|
5
|
+
- 2.0.0-p353
|
6
|
+
- 2.1.0
|
7
|
+
- 2.1.2
|
8
|
+
notifications:
|
9
|
+
email: false
|
10
|
+
slack:
|
11
|
+
secure: Qc7qj/J8Vy+/x89IZ2U2NpdHVmllak+d/Sd6czLgeGEWOvnxz0aNrxu1skp1qWkNtz3BbF5hPVHhGs3J4yt2YQoeB5jOr2bvEmFeIpMnXtx4ACtonlLSTA7e2Ol33paMIarTwh4ZPAyVnw54c/Mn5856rqGCPYgPVXHqsjXSw8s=
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Claude Tech
|
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,31 @@
|
|
1
|
+
# PolyglotFaker [![Build Status][travis-img]][travis-link]
|
2
|
+
|
3
|
+
Gem to simplify [Faker gem](https://github.com/stympy/faker)
|
4
|
+
usage with languages using non-ascii characters.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'polyglot_faker'
|
12
|
+
```
|
13
|
+
|
14
|
+
to your `Gemfile` or run
|
15
|
+
|
16
|
+
```
|
17
|
+
gem install 'polyglot_faker'
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
With this gem, you can use `with_locale` method, so for example
|
23
|
+
if you are using `:ja` as a locale and want to generate a valid
|
24
|
+
email, you can use
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Faker.with_locale(:en) { Faker::Internet.email }
|
28
|
+
```
|
29
|
+
|
30
|
+
[travis-img]: https://travis-ci.org/claudetech/polyglot-faker.svg?branch=master
|
31
|
+
[travis-link]: https://travis-ci.org/claudetech/polyglot-faker
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module PolyglotFaker
|
2
|
+
def with_locale(locale, &block)
|
3
|
+
old_locale = ::Faker::Config.locale
|
4
|
+
::Faker::Config.locale = locale
|
5
|
+
result = block.call
|
6
|
+
::Faker::Config.locale = old_locale
|
7
|
+
result
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
Faker.send(:extend, PolyglotFaker) if defined?(Faker)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'polyglot_faker/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "polyglot_faker"
|
8
|
+
spec.version = PolyglotFaker::VERSION
|
9
|
+
spec.authors = ["Daniel Perez"]
|
10
|
+
spec.email = ["tuvistavie@gmail.com"]
|
11
|
+
spec.summary = "Simplify Faker usage with languages using non-ascii characters."
|
12
|
+
spec.homepage = "https://github.com/claudetech/polyglot-faker"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "rake"
|
21
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
22
|
+
spec.add_development_dependency "coveralls", "~> 0.7"
|
23
|
+
|
24
|
+
spec.add_dependency "faker", "~> 1.4"
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
+
|
3
|
+
require 'faker'
|
4
|
+
require 'polyglot_faker'
|
5
|
+
|
6
|
+
describe PolyglotFaker do
|
7
|
+
describe '#with_locale' do
|
8
|
+
before(:each) do
|
9
|
+
Faker::Config.locale = :en
|
10
|
+
expect(Faker::Config.locale).to eq(:en)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should change the locale in passed block' do
|
14
|
+
Faker.with_locale(:ja) do
|
15
|
+
expect(Faker::Config.locale).to eq(:ja)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should restore the locale' do
|
20
|
+
Faker.with_locale(:ja) { }
|
21
|
+
expect(Faker::Config.locale).to eq(:en)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: polyglot_faker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Perez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faker
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.4'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.4'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- tuvistavie@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/polyglot_faker.rb
|
83
|
+
- lib/polyglot_faker/version.rb
|
84
|
+
- polyglot-faker.gemspec
|
85
|
+
- spec/polyglot_faker_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
homepage: https://github.com/claudetech/polyglot-faker
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.2.2
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Simplify Faker usage with languages using non-ascii characters.
|
111
|
+
test_files:
|
112
|
+
- spec/polyglot_faker_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
has_rdoc:
|