ffaker 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.3.3 2010-01-14
2
+ * removed library file and directory "faker".
3
+ now you only can load the gem using require 'ffaker'
4
+
1
5
  == 0.3.2 2010-01-14
2
6
  * Several Optimizations, renamed gem packege to ffaker.
3
7
 
data/README.rdoc CHANGED
@@ -8,9 +8,11 @@ A port of Perl's Data::Faker library that generates fake data.
8
8
 
9
9
  == Usage
10
10
 
11
- * Faker::Name.name => "Christophe Bartell"
11
+ require 'ffaker'
12
12
 
13
- * Faker::Internet.email => "kirsten.greenholt@corkeryfisher.info"
13
+ Faker::Name.name => "Christophe Bartell"
14
+
15
+ Faker::Internet.email => "kirsten.greenholt@corkeryfisher.info"
14
16
 
15
17
  == Ffaker / Faker ==
16
18
 
@@ -21,6 +23,53 @@ And because I coult not find the original author on github (and I
21
23
  don't feel like working with the arcane rubyforge+svn tools) I
22
24
  just realised this gem using a different name.
23
25
 
26
+ The only difference in usage is that you need to gem install ffaker,
27
+ and require 'ffaker', instead of the previous "faker" with one f.
28
+
29
+ The API is pretty much the same. Fork/ping me if you feel like adding
30
+ more goodies to it.
31
+
32
+ == Faster??? does it really matter ??? ==
33
+
34
+ While it may seem like the speed of good'ol faker is not such a big deal, I
35
+ really disliked the previous code base.
36
+
37
+ Speed came as a result of having better code in place. In any case getting a
38
+ few more cycles here and there is not bad, specially since I had fun while
39
+ doing the refactoring :).
40
+
41
+ Here are some benchmarks (yeah everybody love benchmarks!)
42
+
43
+ $ cat scripts/benchmark.rb
44
+
45
+ # ...
46
+ N = 10_000
47
+
48
+ Benchmark.bm do |rep|
49
+ rep.report("generating #{ N } names") do
50
+ N.times do
51
+ Faker::Name.name
52
+ end
53
+ end
54
+ end
55
+
56
+ * ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux],
57
+ MBARI 0x6770, Ruby Enterprise Edition 2009.10
58
+
59
+ user system total real
60
+ Faker 9.240000 0.020000 9.260000 ( 9.297381)
61
+ Fast Faker 0.060000 0.000000 0.060000 ( 0.109047)
62
+
63
+ * ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]
64
+
65
+ user system total real
66
+ Faker 74.980000 0.110000 75.090000 ( 75.881142)
67
+ Fast Faker 0.050000 0.000000 0.050000 ( 0.052292)
68
+
69
+ DISCLAIMER: I have no idea why I'm getting such bad numbers
70
+ for traditional faker on 1.9, but I'm not making up this!!!
71
+ Try it in your own machine, your milage may vary.
72
+
24
73
  == Note on Patches/Pull Requests
25
74
 
26
75
  * Fork the project.
@@ -33,5 +82,5 @@ just realised this gem using a different name.
33
82
 
34
83
  == Copyright
35
84
 
36
- Copyright (c) 2007 Benjamin Curtis
37
85
  Copyright (c) 2010 Emmanuel Oga. See LICENSE for details.
86
+ Copyright (c) 2007 Benjamin Curtis
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
data/lib/ffaker.rb CHANGED
@@ -1 +1,29 @@
1
- require 'faker'
1
+ module Faker
2
+ require 'ffaker/utils/module_utils'
3
+
4
+ extend ModuleUtils
5
+
6
+ LETTERS = k('a'..'z')
7
+
8
+ def self.numerify(number_string)
9
+ number_string.gsub!(/#/) { rand(10).to_s }
10
+ number_string
11
+ end
12
+
13
+ def self.letterify(letter_string)
14
+ letter_string.gsub!(/\?/) { LETTERS.rand }
15
+ letter_string
16
+ end
17
+
18
+ def self.bothify(string)
19
+ letterify(numerify(string))
20
+ end
21
+
22
+ autoload :Address, 'ffaker/address'
23
+ autoload :Company, 'ffaker/company'
24
+ autoload :Internet, 'ffaker/internet'
25
+ autoload :Lorem, 'ffaker/lorem'
26
+ autoload :Name, 'ffaker/name'
27
+ autoload :PhoneNumber, 'ffaker/phone_number'
28
+ autoload :VERSION, 'ffaker/version'
29
+ end
File without changes
File without changes
File without changes
File without changes
@@ -5,9 +5,9 @@ module Faker
5
5
 
6
6
  def name
7
7
  case rand(10)
8
- when 0 then "#{prefix}#{first_name}#{last_name}"
9
- when 1 then "#{first_name}#{last_name}#{suffix}"
10
- else "#{first_name}#{last_name}"
8
+ when 0 then "#{prefix} #{first_name} #{last_name}"
9
+ when 1 then "#{first_name} #{last_name} #{suffix}"
10
+ else "#{first_name} #{last_name}"
11
11
  end
12
12
  end
13
13
 
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- require 'faker/utils/array_utils'
1
+ require 'ffaker/utils/array_utils'
2
2
 
3
3
  module Faker
4
4
  module ModuleUtils
@@ -2,7 +2,7 @@ module Faker #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/scripts/benchmark.rb CHANGED
@@ -1,7 +1,22 @@
1
- require File.dirname(__FILE__) + '/../lib/faker'
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'ffaker'
5
+ rescue LoadError
6
+ begin
7
+ require 'faker'
8
+ rescue LoadError
9
+ puts "You need to install either faker or ffaker to run this."
10
+ else
11
+ puts "Using Faker"
12
+ end
13
+ else
14
+ puts "Using Fast Faker"
15
+ end
16
+
2
17
  require 'benchmark'
3
18
 
4
- N = 1_000_000
19
+ N = 10_000
5
20
 
6
21
  Benchmark.bm do |rep|
7
22
  rep.report("generating #{ N } names") do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Oga
@@ -22,27 +22,24 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - LICENSE
24
24
  - README.rdoc
25
- - README.txt
26
25
  files:
27
26
  - .document
28
27
  - .gitignore
29
28
  - History.txt
30
29
  - LICENSE
31
30
  - README.rdoc
32
- - README.txt
33
31
  - Rakefile
34
32
  - VERSION
35
- - lib/faker.rb
36
- - lib/faker/address.rb
37
- - lib/faker/company.rb
38
- - lib/faker/internet.rb
39
- - lib/faker/lorem.rb
40
- - lib/faker/name.rb
41
- - lib/faker/phone_number.rb
42
- - lib/faker/utils/array_utils.rb
43
- - lib/faker/utils/module_utils.rb
44
- - lib/faker/version.rb
45
33
  - lib/ffaker.rb
34
+ - lib/ffaker/address.rb
35
+ - lib/ffaker/company.rb
36
+ - lib/ffaker/internet.rb
37
+ - lib/ffaker/lorem.rb
38
+ - lib/ffaker/name.rb
39
+ - lib/ffaker/phone_number.rb
40
+ - lib/ffaker/utils/array_utils.rb
41
+ - lib/ffaker/utils/module_utils.rb
42
+ - lib/ffaker/version.rb
46
43
  - scripts/benchmark.rb
47
44
  - scripts/profile.sh
48
45
  - scripts/profiling.rb
data/README.txt DELETED
File without changes
data/lib/faker.rb DELETED
@@ -1,29 +0,0 @@
1
- module Faker
2
- require 'faker/utils/module_utils'
3
-
4
- extend ModuleUtils
5
-
6
- LETTERS = k('a'..'z')
7
-
8
- def self.numerify(number_string)
9
- number_string.gsub!(/#/) { rand(10).to_s }
10
- number_string
11
- end
12
-
13
- def self.letterify(letter_string)
14
- letter_string.gsub!(/\?/) { LETTERS.rand }
15
- letter_string
16
- end
17
-
18
- def self.bothify(string)
19
- letterify(numerify(string))
20
- end
21
-
22
- autoload :Address, 'faker/address'
23
- autoload :Company, 'faker/company'
24
- autoload :Internet, 'faker/internet'
25
- autoload :Lorem, 'faker/lorem'
26
- autoload :Name, 'faker/name'
27
- autoload :PhoneNumber, 'faker/phone_number'
28
- autoload :VERSION, 'faker/version'
29
- end