faker 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,11 @@
1
+ == 0.9.1 2010-12-23
2
+ * 1 bug fix:
3
+ * Stopped setting I18n default locale
4
+ * 1 major enhancement:
5
+ * Added method_missing to Address to add methods based on data in locale files
6
+ * 1 minor enhancement:
7
+ * Added Swiss locale [Lukas Westermann]
8
+
1
9
  == 0.9.0 2010-12-22
2
10
  * 1 major enhancement:
3
11
  * Moved strings and some formats to locale files
@@ -3,7 +3,6 @@ $:.unshift mydir = File.dirname(__FILE__)
3
3
  require 'i18n'
4
4
  I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
5
5
  I18n.load_path = Dir[File.join(mydir, 'locales', '*.yml')]
6
- I18n.default_locale = "en-us"
7
6
 
8
7
  require 'faker/address'
9
8
  require 'faker/company'
@@ -31,16 +31,23 @@ module Faker
31
31
  alias_method :zip, :zip_code
32
32
  alias_method :postcode, :zip_code
33
33
 
34
- # UK Variant
35
- def uk_country
36
- ['England', 'Scotland', 'Wales', 'Northern Ireland'].rand
37
- end
38
-
39
34
  %w(street_suffix city_suffix city_prefix state_abbr state country county).each do |meth|
40
35
  define_method(meth) do
41
36
  I18n.translate("address.#{meth}").rand
42
37
  end
43
- end
38
+ end
39
+
40
+ # You can add whatever you want to the locale file, and it will get
41
+ # caught here... e.g., create a country_code array in your locale,
42
+ # then you can call #country_code and it will act like #country
43
+ def method_missing(m, *args, &block)
44
+ # Use the alternate form of translate to get a nil rather than a "missing translation" string
45
+ if translation = I18n.translate(:address)[m]
46
+ translation.respond_to?(:rand) ? translation.rand : translation
47
+ else
48
+ super
49
+ end
50
+ end
44
51
 
45
52
  # Deprecated
46
53
  alias_method :earth_country, :country
@@ -1,3 +1,3 @@
1
1
  module Faker #:nodoc:
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -0,0 +1,10 @@
1
+ de-ch:
2
+ address:
3
+ country_code: [CH, CH, CH, DE, AT, US, LI, US, HK, VN]
4
+ postcode: ['1###', '2###', '3###', '4###', '5###', '6###', '7###', '8###', '9###']
5
+ company:
6
+ suffix: [AG, GmbH, und Söhne, und Partner, & Co., Gruppe, LLC, Inc.]
7
+ internet:
8
+ domain_suffix: [com, net, biz, ch, de, li, at, ch, ch]
9
+ phone_number:
10
+ formats: ['0800 ### ###', '0800 ## ## ##', '0## ### ## ##', '0## ### ## ##', '+41 ## ### ## ##', '0900 ### ###', '076 ### ## ##', '+4178 ### ## ##', '0041 79 ### ## ##']
@@ -1,4 +1,7 @@
1
1
  en-gb:
2
2
  address:
3
3
  postcode: ['??# #??', '??## #??']
4
- county: [Avon, Bedfordshire, Berkshire, Borders, Buckinghamshire, Cambridgeshire, Central, Cheshire, Cleveland, Clwyd, Cornwall, County Antrim, County Armagh, County Down, County Fermanagh, County Londonderry, County Tyrone, Cumbria, Derbyshire, Devon, Dorset, Dumfries and Galloway, Durham, Dyfed, East Sussex, Essex, Fife, Gloucestershire, Grampian, Greater Manchester, Gwent, Gwynedd County, Hampshire, Herefordshire, Hertfordshire, Highlands and Islands, Humberside, Isle of Wight, Kent, Lancashire, Leicestershire, Lincolnshire, Lothian, Merseyside, Mid Glamorgan, Norfolk, North Yorkshire, Northamptonshire, Northumberland, Nottinghamshire, Oxfordshire, Powys, Rutland, Shropshire, Somerset, South Glamorgan, South Yorkshire, Staffordshire, Strathclyde, Suffolk, Surrey, Tayside, Tyne and Wear, Warwickshire, West Glamorgan, West Midlands, West Sussex, West Yorkshire, Wiltshire, Worcestershire]
4
+ county: [Avon, Bedfordshire, Berkshire, Borders, Buckinghamshire, Cambridgeshire, Central, Cheshire, Cleveland, Clwyd, Cornwall, County Antrim, County Armagh, County Down, County Fermanagh, County Londonderry, County Tyrone, Cumbria, Derbyshire, Devon, Dorset, Dumfries and Galloway, Durham, Dyfed, East Sussex, Essex, Fife, Gloucestershire, Grampian, Greater Manchester, Gwent, Gwynedd County, Hampshire, Herefordshire, Hertfordshire, Highlands and Islands, Humberside, Isle of Wight, Kent, Lancashire, Leicestershire, Lincolnshire, Lothian, Merseyside, Mid Glamorgan, Norfolk, North Yorkshire, Northamptonshire, Northumberland, Nottinghamshire, Oxfordshire, Powys, Rutland, Shropshire, Somerset, South Glamorgan, South Yorkshire, Staffordshire, Strathclyde, Suffolk, Surrey, Tayside, Tyne and Wear, Warwickshire, West Glamorgan, West Midlands, West Sussex, West Yorkshire, Wiltshire, Worcestershire]
5
+ uk_country: [England, Scotland, Wales, Northern Ireland]
6
+ internet:
7
+ domain_suffix: [co.uk, com, biz, info, name]
@@ -1,5 +1,3 @@
1
1
  en-us:
2
- address:
3
- postcode: ['#####', '#####-####']
4
- state: [Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, Wyoming]
5
- 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]
2
+ internet:
3
+ domain_suffix: [com, us, biz, info, name, net, org]
@@ -6,11 +6,15 @@ en:
6
6
  street_address: ['#####', '####', '###']
7
7
  street_suffix: [Alley, Avenue, Branch, Bridge, Brook, Brooks, Burg, Burgs, Bypass, Camp, Canyon, Cape, Causeway, Center, Centers, Circle, Circles, Cliff, Cliffs, Club, Common, Corner, Corners, Course, Court, Courts, Cove, Coves, Creek, Crescent, Crest, Crossing, Crossroad, Curve, Dale, Dam, Divide, Drive, Drive, Drives, Estate, Estates, Expressway, Extension, Extensions, Fall, Falls, Ferry, Field, Fields, Flat, Flats, Ford, Fords, Forest, Forge, Forges, Fork, Forks, Fort, Freeway, Garden, Gardens, Gateway, Glen, Glens, Green, Greens, Grove, Groves, Harbor, Harbors, Haven, Heights, Highway, Hill, Hills, Hollow, Inlet, Inlet, Island, Island, Islands, Islands, Isle, Isle, Junction, Junctions, Key, Keys, Knoll, Knolls, Lake, Lakes, Land, Landing, Lane, Light, Lights, Loaf, Lock, Locks, Locks, Lodge, Lodge, Loop, Mall, Manor, Manors, Meadow, Meadows, Mews, Mill, Mills, Mission, Mission, Motorway, Mount, Mountain, Mountain, Mountains, Mountains, Neck, Orchard, Oval, Overpass, Park, Parks, Parkway, Parkways, Pass, Passage, Path, Pike, Pine, Pines, Place, Plain, Plains, Plains, Plaza, Plaza, Point, Points, Port, Port, Ports, Ports, Prairie, Prairie, Radial, Ramp, Ranch, Rapid, Rapids, Rest, Ridge, Ridges, River, Road, Road, Roads, Roads, Route, Row, Rue, Run, Shoal, Shoals, Shore, Shores, Skyway, Spring, Springs, Springs, Spur, Spurs, Square, Square, Squares, Squares, Station, Station, Stravenue, Stravenue, Stream, Stream, Street, Street, Streets, Summit, Summit, Terrace, Throughway, Trace, Track, Trafficway, Trail, Trail, Tunnel, Tunnel, Turnpike, Turnpike, Underpass, Union, Unions, Valley, Valleys, Via, Viaduct, View, Views, Village, Village, Villages, Ville, Vista, Vista, Walk, Walks, Wall, Way, Ways, Well, Wells]
8
8
  secondary_address: ['Apt. ###', 'Suite ###']
9
+ # Though these are US-specific, they are here (in the default locale) for backwards compatibility
10
+ postcode: ['#####', '#####-####']
11
+ state: [Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, Wyoming]
12
+ 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]
9
13
  company:
10
14
  suffix: [Inc, and Sons, LLC, Group]
11
15
  internet:
12
16
  free_email: [gmail.com, yahoo.com, hotmail.com]
13
- domain_suffix: [co.uk, com, us, ca, biz, info, name]
17
+ domain_suffix: [com, biz, info, name, net, org]
14
18
  lorem:
15
19
  words: [alias, consequatur, aut, perferendis, sit, voluptatem, accusantium, doloremque, aperiam, eaque, ipsa, quae, ab, illo, inventore, veritatis, et, quasi, architecto, beatae, vitae, dicta, sunt, explicabo, aspernatur, aut, odit, aut, fugit, sed, quia, consequuntur, magni, dolores, eos, qui, ratione, voluptatem, sequi, nesciunt, neque, dolorem, ipsum, quia, dolor, sit, amet, consectetur, adipisci, velit, sed, quia, non, numquam, eius, modi, tempora, incidunt, ut, labore, et, dolore, magnam, aliquam, quaerat, voluptatem, ut, enim, ad, minima, veniam, quis, nostrum, exercitationem, ullam, corporis, nemo, enim, ipsam, voluptatem, quia, voluptas, sit, suscipit, laboriosam, nisi, ut, aliquid, ex, ea, commodi, consequatur, quis, autem, vel, eum, iure, reprehenderit, qui, in, ea, voluptate, velit, esse, quam, nihil, molestiae, et, iusto, odio, dignissimos, ducimus, qui, blanditiis, praesentium, laudantium, totam, rem, voluptatum, deleniti, atque, corrupti, quos, dolores, et, quas, molestias, excepturi, sint, occaecati, cupiditate, non, provident, sed, ut, perspiciatis, unde, omnis, iste, natus, error, similique, sunt, in, culpa, qui, officia, deserunt, mollitia, animi, id, est, laborum, et, dolorum, fuga, et, harum, quidem, rerum, facilis, est, et, expedita, distinctio, nam, libero, tempore, cum, soluta, nobis, est, eligendi, optio, cumque, nihil, impedit, quo, porro, quisquam, est, qui, minus, id, quod, maxime, placeat, facere, possimus, omnis, voluptas, assumenda, est, omnis, dolor, repellendus, temporibus, autem, quibusdam, et, aut, consequatur, vel, illum, qui, dolorem, eum, fugiat, quo, voluptas, nulla, pariatur, at, vero, eos, et, accusamus, officiis, debitis, aut, rerum, necessitatibus, saepe, eveniet, ut, et, voluptates, repudiandae, sint, et, molestiae, non, recusandae, itaque, earum, rerum, hic, tenetur, a, sapiente, delectus, ut, aut, reiciendis, voluptatibus, maiores, doloribus, asperiores, repellat]
16
20
  name:
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faker
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 0
10
- version: 0.9.0
9
+ - 1
10
+ version: 0.9.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Curtis
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-21 00:00:00 -08:00
18
+ date: 2010-12-22 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,11 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 11
29
+ hash: 3
30
30
  segments:
31
31
  - 0
32
- - 5
33
- - 0
34
- version: 0.5.0
32
+ - 4
33
+ version: "0.4"
35
34
  type: :runtime
36
35
  version_requirements: *id001
37
36
  description: "Faker, a port of Data::Faker from Perl, is used to easily generate fake data: names, addresses, phone numbers, etc."
@@ -53,6 +52,7 @@ files:
53
52
  - lib/faker/name.rb
54
53
  - lib/faker/phone_number.rb
55
54
  - lib/faker/version.rb
55
+ - lib/locales/de-ch.yml
56
56
  - lib/locales/en-gb.yml
57
57
  - lib/locales/en-us.yml
58
58
  - lib/locales/en.yml