ffaker 1.3.0 → 1.4.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.
- data/README.rdoc +5 -0
- data/ffaker.gemspec +4 -2
- data/lib/ffaker.rb +3 -1
- data/lib/ffaker/company.rb +12 -0
- data/lib/ffaker/education.rb +49 -0
- data/lib/ffaker/product.rb +48 -0
- metadata +5 -3
data/README.rdoc
CHANGED
@@ -76,9 +76,14 @@ Try it in your own machine, your mileage may vary!
|
|
76
76
|
* Robert Berry ( https://github.com/bdigital ).
|
77
77
|
* qichunren ( http://github.com/qichunren ).
|
78
78
|
* Kristján Pétursson ( https://github.com/kristjan )
|
79
|
+
* Rico Sta. Cruz ( https://github.com/rstacruz )
|
79
80
|
|
80
81
|
== Changelog
|
81
82
|
|
83
|
+
* 1.4.0
|
84
|
+
|
85
|
+
Added Faker::Product and Faker::Education ( Thanks Rico Sta. Cruz, https://github.com/EmmanuelOga/ffaker/pull/12 )
|
86
|
+
|
82
87
|
* 1.3.0
|
83
88
|
|
84
89
|
Faker::Lorem.word as a convenience method, instead of Faker::Lorem.words(1).first.
|
data/ffaker.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.rubygems_version = '1.3.5'
|
6
6
|
|
7
7
|
s.name = 'ffaker'
|
8
|
-
s.version = '1.
|
9
|
-
s.date = '2011-
|
8
|
+
s.version = '1.4.0'
|
9
|
+
s.date = '2011-03-01'
|
10
10
|
s.rubyforge_project = 'ffaker'
|
11
11
|
|
12
12
|
s.summary = "Faster Faker, generates dummy data."
|
@@ -31,12 +31,14 @@ Gem::Specification.new do |s|
|
|
31
31
|
lib/ffaker.rb
|
32
32
|
lib/ffaker/address.rb
|
33
33
|
lib/ffaker/company.rb
|
34
|
+
lib/ffaker/education.rb
|
34
35
|
lib/ffaker/geolocation.rb
|
35
36
|
lib/ffaker/internet.rb
|
36
37
|
lib/ffaker/lorem.rb
|
37
38
|
lib/ffaker/name.rb
|
38
39
|
lib/ffaker/name_cn.rb
|
39
40
|
lib/ffaker/phone_number.rb
|
41
|
+
lib/ffaker/product.rb
|
40
42
|
lib/ffaker/utils/array_utils.rb
|
41
43
|
lib/ffaker/utils/module_utils.rb
|
42
44
|
scripts/benchmark.rb
|
data/lib/ffaker.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Faker
|
2
|
-
VERSION = "1.
|
2
|
+
VERSION = "1.4.0"
|
3
3
|
|
4
4
|
require 'ffaker/utils/module_utils'
|
5
5
|
|
@@ -23,11 +23,13 @@ module Faker
|
|
23
23
|
|
24
24
|
autoload :Address, 'ffaker/address'
|
25
25
|
autoload :Company, 'ffaker/company'
|
26
|
+
autoload :Education, 'ffaker/education'
|
26
27
|
autoload :Internet, 'ffaker/internet'
|
27
28
|
autoload :Lorem, 'ffaker/lorem'
|
28
29
|
autoload :Name, 'ffaker/name'
|
29
30
|
autoload :NameCN, 'ffaker/name_cn'
|
30
31
|
autoload :PhoneNumber, 'ffaker/phone_number'
|
32
|
+
autoload :Product, 'ffaker/product'
|
31
33
|
autoload :Geolocation, 'ffaker/geolocation'
|
32
34
|
autoload :VERSION, 'ffaker/version'
|
33
35
|
end
|
data/lib/ffaker/company.rb
CHANGED
@@ -27,6 +27,14 @@ module Faker
|
|
27
27
|
"#{BS_PRE.rand} #{BS_MID.rand} #{BS_POS.rand}"
|
28
28
|
end
|
29
29
|
|
30
|
+
def position
|
31
|
+
case rand(3)
|
32
|
+
when 0 then [POSITION_PREFIXES.rand, POSITIONS.rand]
|
33
|
+
when 1 then [POSITION_AREAS.rand, POSITIONS.rand]
|
34
|
+
when 2 then [POSITION_PREFIXES.rand, POSITION_AREAS.rand, POSITIONS.rand]
|
35
|
+
end.join(' ')
|
36
|
+
end
|
37
|
+
|
30
38
|
SUFFIXES = k %w(Inc and\ Sons LLC Group)
|
31
39
|
|
32
40
|
CATCH_PRE = k ["Adaptive", "Advanced", "Ameliorated", "Assimilated",
|
@@ -136,5 +144,9 @@ module Faker
|
|
136
144
|
"users", "schemas", "networks", "applications", "metrics",
|
137
145
|
"e-business", "functionalities", "experiences", "web services",
|
138
146
|
"methodologies"]
|
147
|
+
|
148
|
+
POSITION_PREFIXES = k %w[Executive Assistant General Associate]
|
149
|
+
POSITION_AREAS = k %w[Finance IT Operations Information Vice Sales Marketing Corporate Department Regional Division]
|
150
|
+
POSITIONS = k %w[President Manager Director Secretary Consultant]
|
139
151
|
end
|
140
152
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Faker
|
2
|
+
module Education
|
3
|
+
extend ModuleUtils
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def degree_short
|
7
|
+
"#{DEGREE_SHORT_PREFIX.rand} in #{major}"
|
8
|
+
end
|
9
|
+
|
10
|
+
def degree
|
11
|
+
"#{DEGREE_PREFIX.rand} in #{major}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def major
|
15
|
+
"#{MAJOR_ADJ.rand} #{MAJOR_NOUN.rand}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def school_name
|
19
|
+
SCHOOL_PREFIX.rand + SCHOOL_SUFFIX.rand
|
20
|
+
end
|
21
|
+
|
22
|
+
def school_generic_name
|
23
|
+
case rand(2)
|
24
|
+
when 0 then Address::STATE.rand
|
25
|
+
when 1 then school_name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def school
|
30
|
+
case rand(5)
|
31
|
+
when (0..1) then "#{school_name} #{SCHOOL_TYPE.rand}"
|
32
|
+
when 2 then "#{school_generic_name} #{SCHOOL_ADJ.rand} #{SCHOOL_TYPE.rand}"
|
33
|
+
when 3 then "#{SCHOOL_UNI.rand} of #{school_generic_name}"
|
34
|
+
when 4 then "#{school_generic_name} #{SCHOOL_TYPE.rand} of #{MAJOR_NOUN.rand}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
DEGREE_SHORT_PREFIX = k %w(AB BS BSc MA MD DMus DPhil)
|
39
|
+
DEGREE_PREFIX = k ['Bachelor of Science', 'Bachelor of Arts', 'Master of Arts', 'Doctor of Medicine', 'Bachelor of Music', 'Doctor of Philosophy']
|
40
|
+
MAJOR_ADJ = k (%w(Business Systems Industrial Medical Financial Marketing Political Social) + ['Human Resource'])
|
41
|
+
MAJOR_NOUN = k %w(Science Arts Administration Engineering Management Production Economics Architecture Accountancy Education Development Philosophy Studies)
|
42
|
+
|
43
|
+
SCHOOL_PREFIX = k %w(Green South North Wind Lake Hill Lark River Red White)
|
44
|
+
SCHOOL_SUFFIX = k %w(wood dale ridge ville point field shire shore crest spur well side coast)
|
45
|
+
SCHOOL_ADJ = k %w(International Global Polytechnic National)
|
46
|
+
SCHOOL_TYPE = k %w(School University College Institution Academy)
|
47
|
+
SCHOOL_UNI = k %w(University College)
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Faker
|
2
|
+
module Product
|
3
|
+
extend ModuleUtils
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def brand
|
7
|
+
case rand(12)
|
8
|
+
when (0..4) then B1.rand + B2.rand
|
9
|
+
when (5..10) then "#{START.rand}#{VOWELS.rand}#{SUFFIX.rand}#{ADDON.rand if rand(2)==0}".capitalize
|
10
|
+
when 11 then "#{letters(2..3)}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def product_name
|
15
|
+
case rand(2)
|
16
|
+
when 0 then "#{ADJ.rand} #{NOUN.rand}"
|
17
|
+
when 1 then "#{[ADJ.rand, ADJ.rand].uniq.join(" ")} #{NOUN.rand}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def product
|
22
|
+
"#{brand} #{product_name}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def letters(n)
|
26
|
+
max = n.is_a?(Range) ? n.to_a.shuffle.first : n
|
27
|
+
(0...max).map { LETTERS.rand.upcase }.join
|
28
|
+
end
|
29
|
+
|
30
|
+
def model
|
31
|
+
case rand(2)
|
32
|
+
when 0 then "#{LETTERS.rand.upcase}#{rand(90)}" # N90
|
33
|
+
when 1 then "#{letters(0..rand(2))}-#{rand(9900)}" # N-9400
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
B1 = k %w(So Lu Sir Bri Reu Gen Fin Pana Sine Co Aqua Am Ca Cyg Tech After Sub One Tri)
|
38
|
+
B2 = k %w(nix cell sync func balt sche pod)
|
39
|
+
|
40
|
+
VOWELS = k %w(a e i o u ou ie y io)
|
41
|
+
START = k %w(tr br p ph)
|
42
|
+
SUFFIX = k %w(ck ns nce nt st ne re ffe ph)
|
43
|
+
ADDON = k %w(wood forge func)
|
44
|
+
|
45
|
+
ADJ = k %w(Air Gel Auto Power Tag Audible HD GPS Portable Disc Electric Performance Side Video Input Output Direct Remote Digital)
|
46
|
+
NOUN = k %w(Filter Compressor System Viewer Mount Case Adapter Amplifier Bridge Bracket Kit Transmitter Receiver Tuner Controller Component)
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 4
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Emmanuel Oga
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-03-01 00:00:00 -03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -36,12 +36,14 @@ files:
|
|
36
36
|
- lib/ffaker.rb
|
37
37
|
- lib/ffaker/address.rb
|
38
38
|
- lib/ffaker/company.rb
|
39
|
+
- lib/ffaker/education.rb
|
39
40
|
- lib/ffaker/geolocation.rb
|
40
41
|
- lib/ffaker/internet.rb
|
41
42
|
- lib/ffaker/lorem.rb
|
42
43
|
- lib/ffaker/name.rb
|
43
44
|
- lib/ffaker/name_cn.rb
|
44
45
|
- lib/ffaker/phone_number.rb
|
46
|
+
- lib/ffaker/product.rb
|
45
47
|
- lib/ffaker/utils/array_utils.rb
|
46
48
|
- lib/ffaker/utils/module_utils.rb
|
47
49
|
- scripts/benchmark.rb
|