ffaker 0.3.7 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -32,15 +32,6 @@ Fork it/ping me if you feel like adding more goodies to it.
32
32
 
33
33
  == Faster? does it really matter ?
34
34
 
35
- While it may seem like the speed of good'ol faker was not such a big deal, I
36
- really disliked the previous code base.
37
-
38
- Speed came as a result of having better code in place. Getting a
39
- few more cycles here and there was not bad, specially since I had fun while
40
- doing the refactoring.
41
-
42
- Here are some benchmarks (yeah everybody love benchmarks!)
43
-
44
35
  $ cat scripts/benchmark.rb
45
36
 
46
37
  # ...
@@ -67,8 +58,23 @@ $ cat scripts/benchmark.rb
67
58
  Fast Faker 0.050000 0.000000 0.050000 ( 0.052292)
68
59
 
69
60
  DISCLAIMER: I have no idea why I'm getting such bad numbers
70
- for traditional faker on 1.9, but I'm not making this up!
71
- Try it in your own machine, your mileage may vary.
61
+ for traditional faker on 1.9, but I'm not making this up.
62
+ Try it in your own machine, your mileage may vary!
63
+
64
+ == Contributors
65
+
66
+ * James Rosen ( http://github.com/jamesarosen/ffaker ).
67
+ * Rafael Souza ( http://github.com/rafaelss/ffaker ).
68
+
69
+ == Changelog
70
+
71
+ * 0.4.0
72
+
73
+ Api additions by Rafael Souza
74
+
75
+ Faker::Geolocation.lat # => 40.6609944585817
76
+ Faker::Geolocation.lng # => -73.8454648940358
77
+ Faker::Address.neighborhood # => "Renton West"
72
78
 
73
79
  == TODO
74
80
 
@@ -84,10 +90,6 @@ Try it in your own machine, your mileage may vary.
84
90
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
85
91
  * Send me a pull request. Bonus points for topic branches.
86
92
 
87
- == Contributors
88
-
89
- * James Rosen ( http://github.com/jamesarosen/ffaker ).
90
-
91
93
  == Copyright
92
94
 
93
95
  Copyright (c) 2010 Emmanuel Oga. See LICENSE for details.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  gem.description = %Q{Faker refactored}
10
10
  gem.email = "EmmanuelOga@gmail.com"
11
11
  gem.homepage = "http://github.com/EmmanuelOga/ffaker"
12
- gem.authors = ["Emmanuel Oga"]
12
+ gem.authors = ["Emmanuel Oga", "James Rosen", "Rafael Souza"]
13
13
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
14
  end
15
15
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.7
1
+ 0.4.0
data/ffaker.gemspec ADDED
@@ -0,0 +1,83 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{ffaker}
8
+ s.version = "0.4.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Emmanuel Oga", "James Rosen", "Rafael Souza"]
12
+ s.date = %q{2010-05-10}
13
+ s.description = %q{Faker refactored}
14
+ s.email = %q{EmmanuelOga@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "History.txt",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "ffaker.gemspec",
28
+ "lib/ffaker.rb",
29
+ "lib/ffaker/address.rb",
30
+ "lib/ffaker/company.rb",
31
+ "lib/ffaker/geolocation.rb",
32
+ "lib/ffaker/internet.rb",
33
+ "lib/ffaker/lorem.rb",
34
+ "lib/ffaker/name.rb",
35
+ "lib/ffaker/phone_number.rb",
36
+ "lib/ffaker/utils/array_utils.rb",
37
+ "lib/ffaker/utils/module_utils.rb",
38
+ "lib/ffaker/version.rb",
39
+ "scripts/benchmark.rb",
40
+ "scripts/profile.sh",
41
+ "scripts/profiling.rb",
42
+ "test/helper.rb",
43
+ "test/test_address.rb",
44
+ "test/test_array_utils.rb",
45
+ "test/test_company.rb",
46
+ "test/test_faker.rb",
47
+ "test/test_faker_internet.rb",
48
+ "test/test_faker_name.rb",
49
+ "test/test_geolocation.rb",
50
+ "test/test_lorem.rb",
51
+ "test/test_module_utils.rb",
52
+ "test/test_phone_number.rb"
53
+ ]
54
+ s.homepage = %q{http://github.com/EmmanuelOga/ffaker}
55
+ s.rdoc_options = ["--charset=UTF-8"]
56
+ s.require_paths = ["lib"]
57
+ s.rubygems_version = %q{1.3.6}
58
+ s.summary = %q{Faker, only cleaner and faster}
59
+ s.test_files = [
60
+ "test/test_faker_name.rb",
61
+ "test/test_lorem.rb",
62
+ "test/test_phone_number.rb",
63
+ "test/test_array_utils.rb",
64
+ "test/test_geolocation.rb",
65
+ "test/test_address.rb",
66
+ "test/test_faker_internet.rb",
67
+ "test/test_faker.rb",
68
+ "test/test_module_utils.rb",
69
+ "test/helper.rb",
70
+ "test/test_company.rb"
71
+ ]
72
+
73
+ if s.respond_to? :specification_version then
74
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
75
+ s.specification_version = 3
76
+
77
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
78
+ else
79
+ end
80
+ else
81
+ end
82
+ end
83
+
@@ -67,6 +67,10 @@ module Faker
67
67
  Faker.bothify(UK_POSTCODE.rand).upcase
68
68
  end
69
69
 
70
+ def neighborhood
71
+ NEIGHBORHOOD.rand
72
+ end
73
+
70
74
  ZIP_FORMATS = k ['#####', '#####-####']
71
75
 
72
76
  STATE = k ['Alabama', 'Alaska', 'Arizona', 'Arkansas',
@@ -134,5 +138,17 @@ module Faker
134
138
  UK_COUNTRY = k ['England', 'Scotland', 'Wales', 'Northern Ireland']
135
139
 
136
140
  UK_POSTCODE = k ['??# #??', '??## #??']
141
+
142
+ NEIGHBORHOOD = k ['East of Telegraph Road', 'North Norridge', 'Northwest Midlothian/Midlothian Country Club',
143
+ 'Mott Haven/Port Morris', 'Kingsbridge Heights', 'Bronxdale', 'Pennypack', 'Bridesburg',
144
+ 'Allegheny West', 'Bushwick South', 'Dyker Heights', 'Ocean Parkway South', 'Summerlin North',
145
+ 'Seven Hills Area', 'Greater Las Vegas National', 'phoenix', 'Central Chandler', 'South of Bell Road',
146
+ 'River Heights', 'White Plains Central', 'Mount Kisco West', 'Pound Ridge East', 'Babylon Bayside',
147
+ 'Sagaponack Seaside', 'South of Lake Ave', 'Far Rockaway/Bayswater', 'Jamaica Estates/Holliswood',
148
+ 'Murray Hill', 'East Renton', 'Renton West', 'Auburn North', 'Northwoods West', 'Florissant West',
149
+ 'Ladue South', 'Candlewood Country Club', 'West Covina East', 'North East Irwindale', 'Sunshine-Gardens',
150
+ 'Cipriani', 'Brentwood Central', 'Jupiter South/Abacoa', 'Sea Ranch Lakes', 'Schall Circle/Lakeside Green',
151
+ 'Olmsted Falls Central', 'South of Lake Shore Blvd', 'Gates Mills North', 'White Oak South of Columbia Pike',
152
+ 'Rockville East of Hungerford Dr', 'Cleveland Park']
137
153
  end
138
154
  end
@@ -0,0 +1,36 @@
1
+ module Faker
2
+ module Geolocation
3
+ extend ModuleUtils
4
+ extend self
5
+
6
+ def lat
7
+ LATLNG.rand[0]
8
+ end
9
+
10
+ def lng
11
+ LATLNG.rand[1]
12
+ end
13
+
14
+ LATLNG = k [[41.022921,-73.667595], [41.017643,-73.769264], [40.89505,-73.83582], [41.018461,-73.66616],
15
+ [40.6665875097692,-73.8830092325694], [40.6784867492198,-73.9716387729985], [40.5998084142575,-73.9385565185842],
16
+ [40.6175673160943,-74.0002511295821], [40.7451545655034,-73.971855164776], [40.7143394939935,-73.9783896644132],
17
+ [40.7916523500249,-73.9693478828185], [40.8005590858048,-73.9473684707957], [40.7292057951864,-73.7555431517841],
18
+ [40.7532199291845,-73.8842977517553], [40.7490546706085,-73.9187706945134], [40.6609944585817,-73.8454648940358],
19
+ [38.9962071932467,-77.0898681997577], [38.9614005154765,-77.0739996811784], [38.9381545320739,-77.0656875352079],
20
+ [39.0788984258721,-77.0500853418371], [40.8377346033077,-73.8618025934729], [40.8377346033077,-73.8618025934729],
21
+ [40.8831107806302,-73.9212453413708], [40.9077802515069,-73.9025768857695], [36.1936372347,-115.068968492],
22
+ [36.2345447488,-115.327274645], [36.1257785585,-115.08848819], [36.0150030591,-115.120716573], [41.5205,-81.587],
23
+ [41.491529,-81.611008], [41.4811,-81.9136], [41.5244,-81.5531], [38.5241394042969,-90.3121643066406],
24
+ [38.4685363769531,-90.3760452270508], [38.7077140808105,-90.2698593139648], [38.7953453063965,-90.2058792114258],
25
+ [33.5775667696072,-112.21954995412], [33.4136301699617,-112.605812600303], [33.3732084677927,-111.602125919385],
26
+ [33.4280828890754,-112.496547310057], [40.0677174866262,-75.0764604391247], [39.9760149034563,-75.1786003814711],
27
+ [39.9871631180866,-75.1862338204704], [39.9847861520773,-75.110396933127], [26.1180992126465,-80.149299621582],
28
+ [25.4804286236799,-80.4256357381565], [26.1793003082275,-80.1410980224609], [26.5322723388672,-80.1300048828125],
29
+ [47.685714288367,-122.340967372417], [47.6993431274679,-122.395610510952], [47.7553943974153,-122.305764516646],
30
+ [47.5173276931226,-122.275152683751], [40.78595,-73.196244], [40.927955,-73.048076], [41.022872,-72.204989],
31
+ [40.855153,-72.572405], [34.101011924908,-118.064638782714], [34.2430955947492,-118.427610513239],
32
+ [34.3823767402857,-118.550562688364], [33.8256050190507,-118.281161297494], [37.5758033375583,-122.012044535507],
33
+ [37.8768587606888,-122.078250641083], [37.6859990796181,-122.094516147761], [37.4660979087165,-121.900873639257],
34
+ [41.77117,-87.888795], [41.900425,-87.624262], [41.737173,-87.869998]]
35
+ end
36
+ end
@@ -1,8 +1,8 @@
1
1
  module Faker #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 3
5
- TINY = 7
4
+ MINOR = 4
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/ffaker.rb CHANGED
@@ -25,5 +25,6 @@ module Faker
25
25
  autoload :Lorem, 'ffaker/lorem'
26
26
  autoload :Name, 'ffaker/name'
27
27
  autoload :PhoneNumber, 'ffaker/phone_number'
28
+ autoload :Geolocation, 'ffaker/geolocation'
28
29
  autoload :VERSION, 'ffaker/version'
29
30
  end
data/test/test_address.rb CHANGED
@@ -53,4 +53,8 @@ class TestAddress < Test::Unit::TestCase
53
53
  def test_zip_code
54
54
  assert_match /[0-9]/, Faker::Address.zip_code
55
55
  end
56
+
57
+ def test_neighborhood
58
+ assert_match /[ a-z]+/, Faker::Address::neighborhood
59
+ end
56
60
  end
@@ -0,0 +1,13 @@
1
+ require 'helper'
2
+
3
+
4
+ class TestGeolocation < Test::Unit::TestCase
5
+
6
+ def test_lat
7
+ assert_match /[0-9]+/, Faker::Geolocation.lat.to_s
8
+ end
9
+
10
+ def test_lng
11
+ assert_match /[0-9]+/, Faker::Geolocation.lng.to_s
12
+ end
13
+ end
metadata CHANGED
@@ -4,17 +4,19 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
8
- - 7
9
- version: 0.3.7
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Emmanuel Oga
13
+ - James Rosen
14
+ - Rafael Souza
13
15
  autorequire:
14
16
  bindir: bin
15
17
  cert_chain: []
16
18
 
17
- date: 2010-04-23 00:00:00 -03:00
19
+ date: 2010-05-10 00:00:00 -03:00
18
20
  default_executable:
19
21
  dependencies: []
20
22
 
@@ -35,9 +37,11 @@ files:
35
37
  - README.rdoc
36
38
  - Rakefile
37
39
  - VERSION
40
+ - ffaker.gemspec
38
41
  - lib/ffaker.rb
39
42
  - lib/ffaker/address.rb
40
43
  - lib/ffaker/company.rb
44
+ - lib/ffaker/geolocation.rb
41
45
  - lib/ffaker/internet.rb
42
46
  - lib/ffaker/lorem.rb
43
47
  - lib/ffaker/name.rb
@@ -55,6 +59,7 @@ files:
55
59
  - test/test_faker.rb
56
60
  - test/test_faker_internet.rb
57
61
  - test/test_faker_name.rb
62
+ - test/test_geolocation.rb
58
63
  - test/test_lorem.rb
59
64
  - test/test_module_utils.rb
60
65
  - test/test_phone_number.rb
@@ -93,6 +98,7 @@ test_files:
93
98
  - test/test_lorem.rb
94
99
  - test/test_phone_number.rb
95
100
  - test/test_array_utils.rb
101
+ - test/test_geolocation.rb
96
102
  - test/test_address.rb
97
103
  - test/test_faker_internet.rb
98
104
  - test/test_faker.rb