faker19 1.0.2 → 1.0.3
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/README.md +18 -18
- data/lib/faker/company.rb +3 -3
- data/lib/faker/internet.rb +9 -9
- data/lib/faker/name.rb +10 -1
- data/lib/faker/version.rb +1 -1
- data/lib/faker.rb +1 -0
- data/lib/locales/en.yml +9 -0
- data/test/test_faker_internet.rb +9 -1
- metadata +17 -6
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Faker
|
1
|
+
Faker [](http://travis-ci.org/TechnoGate/faker)
|
2
2
|
=====
|
3
3
|
This gem is a port of Perl's Data::Faker library that generates fake data.
|
4
4
|
|
@@ -13,6 +13,21 @@ Usage
|
|
13
13
|
* Faker::Name.name => "Christophe Bartell"
|
14
14
|
* Faker::Internet.email => "kirsten.greenholt@corkeryfisher.info"
|
15
15
|
|
16
|
+
|
17
|
+
You can also get a unique user_name and email using the suffix argument:
|
18
|
+
|
19
|
+
* Faker::Internet.user_name(nil, 3) => "kirsten.greenholt3"
|
20
|
+
* Faker::Internet.email(nil, 3) => "kirsten.greenholt3@corkeryfisher.info"
|
21
|
+
|
22
|
+
This could help you, if you're using factory_girl for example to generate your
|
23
|
+
test data, so for example, for a unique email address, you may use factory_girl's
|
24
|
+
sequence method and pass the argument to the email function, like this:
|
25
|
+
|
26
|
+
f.sequence(:email) { |n| Faker::Internet.email(nil, n) }
|
27
|
+
|
28
|
+
The first argument is actually the *name* which is provided by the user_name
|
29
|
+
function if it's empty.
|
30
|
+
|
16
31
|
Usage with Rails
|
17
32
|
----------------
|
18
33
|
|
@@ -25,21 +40,6 @@ locale). If you'd prefer to set default_locale rather than locale, then
|
|
25
40
|
you'll also need to add config.i18n.fallbacks.defaults = [:en] to your
|
26
41
|
configuration to make the fallbacks work for Faker.
|
27
42
|
|
28
|
-
Command Line Usage
|
29
|
-
----------------
|
30
|
-
Faker is also usable from the command line. All methods are available
|
31
|
-
|
32
|
-
faker address -f street_name
|
33
|
-
faker company -f name
|
34
|
-
faker internet -f email
|
35
|
-
faker lorum -f sentences -n 10
|
36
|
-
faker name -f first_name
|
37
|
-
faker phone_number
|
38
|
-
|
39
|
-
Run `faker help` for general help or there is also help for each data type. For the address type for example run `faker help address`.
|
40
|
-
|
41
|
-
Note that if you installed using bundler you may need to use `bundle exec faker` rather than just `faker`.
|
42
|
-
|
43
43
|
Customization
|
44
44
|
------------
|
45
45
|
Since you may want to make addresses and other types of data look different
|
@@ -53,12 +53,12 @@ rest.
|
|
53
53
|
Contributing
|
54
54
|
------------
|
55
55
|
If you'd like to contribute code or formats/data for another locale, fork
|
56
|
-
the project at [github](https://github.com/
|
56
|
+
the project at [github](https://github.com/TechnoGate/faker), make your changes,
|
57
57
|
then send a pull request.
|
58
58
|
|
59
59
|
Contact
|
60
60
|
-------
|
61
|
-
Comments and feedback are welcome. Send an email
|
61
|
+
Comments and feedback are welcome. Send an email via the [google group](http://groups.google.com/group/ruby-faker).
|
62
62
|
|
63
63
|
License
|
64
64
|
-------
|
data/lib/faker/company.rb
CHANGED
@@ -23,9 +23,9 @@ module Faker
|
|
23
23
|
# Wordlist from http://dack.com/web/bullshit.html
|
24
24
|
def bs
|
25
25
|
[
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
fetch('company.bs.verb'),
|
27
|
+
fetch('company.bs.adjective'),
|
28
|
+
fetch('company.bs.noun'),
|
29
29
|
].join(' ')
|
30
30
|
end
|
31
31
|
end
|
data/lib/faker/internet.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
module Faker
|
2
2
|
class Internet < Base
|
3
3
|
class << self
|
4
|
-
def email(name = nil)
|
5
|
-
[ user_name(name), domain_name ].join('@')
|
4
|
+
def email(name = nil, name_suffix = "")
|
5
|
+
[ user_name(name, name_suffix), domain_name ].join('@')
|
6
6
|
end
|
7
7
|
|
8
|
-
def free_email(name = nil)
|
9
|
-
[ user_name(name), fetch('internet.free_email') ].join('@')
|
8
|
+
def free_email(name = nil, name_suffix = "")
|
9
|
+
[ user_name(name, name_suffix), fetch('internet.free_email') ].join('@')
|
10
10
|
end
|
11
11
|
|
12
|
-
def user_name(name = nil)
|
13
|
-
return name.scan(/\w+/).shuffle.join(%w(. _).rand).downcase if name
|
12
|
+
def user_name(name = nil, name_suffix = "")
|
13
|
+
return name.scan(/\w+/).shuffle.join(%w(. _).rand).downcase + name_suffix.to_s if name
|
14
14
|
|
15
15
|
[
|
16
|
-
Proc.new { Name.first_name.gsub(/\W/, '').downcase },
|
16
|
+
Proc.new { Name.first_name.gsub(/\W/, '').downcase + name_suffix.to_s },
|
17
17
|
Proc.new {
|
18
18
|
[ Name.first_name, Name.last_name ].map {|n|
|
19
19
|
n.gsub(/\W/, '')
|
20
|
-
}.join(%w(. _).rand).downcase }
|
20
|
+
}.join(%w(. _).rand).downcase + name_suffix.to_s }
|
21
21
|
].rand.call
|
22
22
|
end
|
23
23
|
|
@@ -58,4 +58,4 @@ module Faker
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
|
-
end
|
61
|
+
end
|
data/lib/faker/name.rb
CHANGED
@@ -11,6 +11,15 @@ module Faker
|
|
11
11
|
def prefix; fetch('name.prefix'); end
|
12
12
|
def suffix; fetch('name.suffix'); end
|
13
13
|
|
14
|
+
# Generate a buzzword-laden job title
|
15
|
+
# Wordlist from http://www.bullshitjob.com/title/
|
16
|
+
def title
|
17
|
+
[
|
18
|
+
fetch('name.title.descriptor'),
|
19
|
+
fetch('name.title.level'),
|
20
|
+
fetch('name.title.job')
|
21
|
+
].join(" ")
|
22
|
+
end
|
14
23
|
end
|
15
24
|
end
|
16
|
-
end
|
25
|
+
end
|
data/lib/faker/version.rb
CHANGED
data/lib/faker.rb
CHANGED
data/lib/locales/en.yml
CHANGED
@@ -13,6 +13,10 @@ en:
|
|
13
13
|
state_abbr: [AL, AK, AS, AZ, AR, CA, CO, CT, DE, DC, FM, FL, GA, GU, HI, ID, IL, IN, IA, KS, KY, LA, ME, MH, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, MP, OH, OK, OR, PW, PA, PR, RI, SC, SD, TN, TX, UT, VT, VI, VA, WA, WV, WI, WY, AE, AA, AP]
|
14
14
|
company:
|
15
15
|
suffix: [Inc, and Sons, LLC, Group]
|
16
|
+
bs:
|
17
|
+
verb: [implement, utilize, integrate, streamline, optimize, evolve, transform, embrace, enable, orchestrate, leverage, reinvent, aggregate, architect, enhance, incentivize, morph, empower, envisioneer, monetize, harness, facilitate, seize, disintermediate, synergize, strategize, deploy, brand, grow, target, syndicate, synthesize, deliver, mesh, incubate, engage, maximize, benchmark, expedite, reintermediate, whiteboard, visualize, repurpose, innovate, scale, unleash, drive, extend, engineer, revolutionize, generate, exploit, transition, e-enable, iterate, cultivate, matrix, productize, redefine, recontextualize]
|
18
|
+
adjective: [clicks-and-mortar, value-added, vertical, proactive, robust, revolutionary, scalable, leading-edge, innovative, intuitive, strategic, e-business, mission-critical, sticky, one-to-one, 24/7, end-to-end, global, B2B, B2C, granular, frictionless, virtual, viral, dynamic, 24/365, best-of-breed, killer, magnetic, bleeding-edge, web-enabled, interactive, dot-com, sexy, back-end, real-time, efficient, front-end, distributed, seamless, extensible, turn-key, world-class, open-source, cross-platform, cross-media, synergistic, bricks-and-clicks, out-of-the-box, enterprise, integrated, impactful, wireless, transparent, next-generation, cutting-edge, user-centric, visionary, customized, ubiquitous, plug-and-play, collaborative, compelling, holistic, rich]
|
19
|
+
noun: [synergies, web-readiness, paradigms, markets, partnerships, infrastructures, platforms, initiatives, channels, eyeballs, communities, ROI, solutions, e-tailers, e-services, action-items, portals, niches, technologies, content, vortals, supply-chains, convergence, relationships, architectures, interfaces, e-markets, e-commerce, systems, bandwidth, infomediaries, models, mindshare, deliverables, users, schemas, networks, applications, metrics, e-business, functionalities, experiences, web services, methodologies]
|
16
20
|
internet:
|
17
21
|
free_email: [gmail.com, yahoo.com, hotmail.com]
|
18
22
|
domain_suffix: [com, biz, info, name, net, org]
|
@@ -24,6 +28,11 @@ en:
|
|
24
28
|
last_name: [Abbott, Abernathy, Abshire, Adams, Altenwerth, Anderson, Ankunding, Armstrong, Auer, Aufderhar, Bahringer, Bailey, Balistreri, Barrows, Bartell, Bartoletti, Barton, Bashirian, Batz, Bauch, Baumbach, Bayer, Beahan, Beatty, Bechtelar, Becker, Bednar, Beer, Beier, Berge, Bergnaum, Bergstrom, Bernhard, Bernier, Bins, Blanda, Blick, Block, Bode, Boehm, Bogan, Bogisich, Borer, Bosco, Botsford, Boyer, Boyle, Bradtke, Brakus, Braun, Breitenberg, Brekke, Brown, Bruen, Buckridge, Carroll, Carter, Cartwright, Casper, Cassin, Champlin, Christiansen, Cole, Collier, Collins, Conn, Connelly, Conroy, Considine, Corkery, Cormier, Corwin, Cremin, Crist, Crona, Cronin, Crooks, Cruickshank, Cummerata, Cummings, Dach, D'Amore, Daniel, Dare, Daugherty, Davis, Deckow, Denesik, Dibbert, Dickens, Dicki, Dickinson, Dietrich, Donnelly, Dooley, Douglas, Doyle, DuBuque, Durgan, Ebert, Effertz, Eichmann, Emard, Emmerich, Erdman, Ernser, Fadel, Fahey, Farrell, Fay, Feeney, Feest, Feil, Ferry, Fisher, Flatley, Frami, Franecki, Friesen, Fritsch, Funk, Gaylord, Gerhold, Gerlach, Gibson, Gislason, Gleason, Gleichner, Glover, Goldner, Goodwin, Gorczany, Gottlieb, Goyette, Grady, Graham, Grant, Green, Greenfelder, Greenholt, Grimes, Gulgowski, Gusikowski, Gutkowski, Gutmann, Haag, Hackett, Hagenes, Hahn, Haley, Halvorson, Hamill, Hammes, Hand, Hane, Hansen, Harber, Harris, Hartmann, Harvey, Hauck, Hayes, Heaney, Heathcote, Hegmann, Heidenreich, Heller, Herman, Hermann, Hermiston, Herzog, Hessel, Hettinger, Hickle, Hilll, Hills, Hilpert, Hintz, Hirthe, Hodkiewicz, Hoeger, Homenick, Hoppe, Howe, Howell, Hudson, Huel, Huels, Hyatt, Jacobi, Jacobs, Jacobson, Jakubowski, Jaskolski, Jast, Jenkins, Jerde, Jewess, Johns, Johnson, Johnston, Jones, Kassulke, Kautzer, Keebler, Keeling, Kemmer, Kerluke, Kertzmann, Kessler, Kiehn, Kihn, Kilback, King, Kirlin, Klein, Kling, Klocko, Koch, Koelpin, Koepp, Kohler, Konopelski, Koss, Kovacek, Kozey, Krajcik, Kreiger, Kris, Kshlerin, Kub, Kuhic, Kuhlman, Kuhn, Kulas, Kunde, Kunze, Kuphal, Kutch, Kuvalis, Labadie, Lakin, Lang, Langosh, Langworth, Larkin, Larson, Leannon, Lebsack, Ledner, Leffler, Legros, Lehner, Lemke, Lesch, Leuschke, Lind, Lindgren, Littel, Little, Lockman, Lowe, Lubowitz, Lueilwitz, Luettgen, Lynch, Macejkovic, Maggio, Mann, Mante, Marks, Marquardt, Marvin, Mayer, Mayert, McClure, McCullough, McDermott, McGlynn, McKenzie, McLaughlin, Medhurst, Mertz, Metz, Miller, Mills, Mitchell, Moen, Mohr, Monahan, Moore, Morar, Morissette, Mosciski, Mraz, Mueller, Muller, Murazik, Murphy, Murray, Nader, Nicolas, Nienow, Nikolaus, Nitzsche, Nolan, Oberbrunner, O'Connell, O'Conner, O'Hara, O'Keefe, O'Kon, Okuneva, Olson, Ondricka, O'Reilly, Orn, Ortiz, Osinski, Pacocha, Padberg, Pagac, Parisian, Parker, Paucek, Pfannerstill, Pfeffer, Pollich, Pouros, Powlowski, Predovic, Price, Prohaska, Prosacco, Purdy, Quigley, Quitzon, Rath, Ratke, Rau, Raynor, Reichel, Reichert, Reilly, Reinger, Rempel, Renner, Reynolds, Rice, Rippin, Ritchie, Robel, Roberts, Rodriguez, Rogahn, Rohan, Rolfson, Romaguera, Roob, Rosenbaum, Rowe, Ruecker, Runolfsdottir, Runolfsson, Runte, Russel, Rutherford, Ryan, Sanford, Satterfield, Sauer, Sawayn, Schaden, Schaefer, Schamberger, Schiller, Schimmel, Schinner, Schmeler, Schmidt, Schmitt, Schneider, Schoen, Schowalter, Schroeder, Schulist, Schultz, Schumm, Schuppe, Schuster, Senger, Shanahan, Shields, Simonis, Sipes, Skiles, Smith, Smitham, Spencer, Spinka, Sporer, Stamm, Stanton, Stark, Stehr, Steuber, Stiedemann, Stokes, Stoltenberg, Stracke, Streich, Stroman, Strosin, Swaniawski, Swift, Terry, Thiel, Thompson, Tillman, Torp, Torphy, Towne, Toy, Trantow, Tremblay, Treutel, Tromp, Turcotte, Turner, Ullrich, Upton, Vandervort, Veum, Volkman, Von, VonRueden, Waelchi, Walker, Walsh, Walter, Ward, Waters, Watsica, Weber, Wehner, Weimann, Weissnat, Welch, West, White, Wiegand, Wilderman, Wilkinson, Will, Williamson, Willms, Windler, Wintheiser, Wisoky, Wisozk, Witting, Wiza, Wolf, Wolff, Wuckert, Wunsch, Wyman, Yost, Yundt, Zboncak, Zemlak, Ziemann, Zieme, Zulauf]
|
25
29
|
prefix: [Mr., Mrs., Ms., Miss, Dr.]
|
26
30
|
suffix: [Jr., Sr., I, II, III, IV, V, MD, DDS, PhD, DVM]
|
31
|
+
title:
|
32
|
+
descriptor: [Lead, Senior, Direct, Corporate, Dynamic, Future, Product, National, Regional, District, Central, Global, Customer, Investor, Dynamic, International, Legacy, Forward, Internal, Human, Chief, Principal]
|
33
|
+
level: [Solutions, Program, Brand, Security, Research, Marketing, Directives, Implementation, Integration, Functionality, Response, Paradigm, Tactics, Identity, Markets, Group, Division, Applications, Optimization, Operations, Infrastructure, Intranet, Communications, Web, Branding, Quality, Assurance, Mobility, Accounts, Data, Creative, Configuration, Accountability, Interactions, Factors, Usability, Metrics]
|
34
|
+
job: [Supervisor, Associate, Executive, Liason, Officer, Manager, Engineer, Specialist, Director, Coordinator, Administrator, Architect, Analyst, Designer, Planner, Orchestrator, Technician, Developer, Producer, Consultant, Assistant, Facilitator, Agent, Representative, Strategist]
|
35
|
+
|
27
36
|
formats:
|
28
37
|
-
|
29
38
|
- :prefix
|
data/test/test_faker_internet.rb
CHANGED
@@ -7,7 +7,11 @@ class TestFakerInternet < Test::Unit::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_email
|
10
|
-
assert @tester.email.match(
|
10
|
+
assert @tester.email.match(/^.+@.+\.\w+$/)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_email_with_suffix
|
14
|
+
assert @tester.email(nil, 3).match(/^.+3@.+\.\w+$/)
|
11
15
|
end
|
12
16
|
|
13
17
|
def test_free_email
|
@@ -22,6 +26,10 @@ class TestFakerInternet < Test::Unit::TestCase
|
|
22
26
|
assert @tester.user_name('bo peep').match(/(bo(_|\.)peep|peep(_|\.)bo)/)
|
23
27
|
end
|
24
28
|
|
29
|
+
def test_user_name_with_suffix
|
30
|
+
assert @tester.user_name(nil, 3).match(/^.+3$/)
|
31
|
+
end
|
32
|
+
|
25
33
|
def test_domain_name
|
26
34
|
assert @tester.domain_name.match(/\w+\.\w+/)
|
27
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faker19
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-26 00:00:00.000000000 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|
18
|
-
requirement: &
|
18
|
+
requirement: &2160424600 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 0.6.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *2160424600
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
|
-
requirement: &
|
29
|
+
requirement: &2160424180 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,7 +34,18 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *2160424180
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rake
|
40
|
+
requirement: &2160423720 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *2160423720
|
38
49
|
description: ! 'Faker, a port of Data::Faker from Perl, is used to easily generate
|
39
50
|
fake data: names, addresses, phone numbers, etc.'
|
40
51
|
email:
|