faker19 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/faker/version.rb +1 -1
- data/lib/faker.rb +0 -1
- data/test/test_faker_lorem.rb +2 -2
- metadata +7 -38
- data/bin/faker +0 -7
- data/features/address.feature +0 -13
- data/features/internet.feature +0 -45
- data/features/support/env.rb +0 -2
- data/lib/faker/cli.rb +0 -130
data/lib/faker/version.rb
CHANGED
data/lib/faker.rb
CHANGED
data/test/test_faker_lorem.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
2
|
|
3
3
|
class TestFakerLorem < Test::Unit::TestCase
|
4
4
|
|
@@ -27,4 +27,4 @@ class TestFakerLorem < Test::Unit::TestCase
|
|
27
27
|
assert @tester.words(3..5).size <= 5
|
28
28
|
end
|
29
29
|
end
|
30
|
-
end
|
30
|
+
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.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -15,7 +15,7 @@ default_executable:
|
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|
18
|
-
requirement: &
|
18
|
+
requirement: &2157034380 !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: *2157034380
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
|
-
requirement: &
|
29
|
+
requirement: &2157033960 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,43 +34,19 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: cucumber
|
40
|
-
requirement: &2160341040 !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: *2160341040
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: aruba
|
51
|
-
requirement: &2160340520 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ! '>='
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0'
|
57
|
-
type: :development
|
58
|
-
prerelease: false
|
59
|
-
version_requirements: *2160340520
|
37
|
+
version_requirements: *2157033960
|
60
38
|
description: ! 'Faker, a port of Data::Faker from Perl, is used to easily generate
|
61
39
|
fake data: names, addresses, phone numbers, etc.'
|
62
40
|
email:
|
63
41
|
- wael.nasreddine@gmail.com
|
64
42
|
- benjamin.curtis@gmail.com
|
65
|
-
executables:
|
66
|
-
- faker
|
43
|
+
executables: []
|
67
44
|
extensions: []
|
68
45
|
extra_rdoc_files: []
|
69
46
|
files:
|
70
47
|
- lib/extensions/array.rb
|
71
48
|
- lib/faker.rb
|
72
49
|
- lib/faker/address.rb
|
73
|
-
- lib/faker/cli.rb
|
74
50
|
- lib/faker/company.rb
|
75
51
|
- lib/faker/internet.rb
|
76
52
|
- lib/faker/lorem.rb
|
@@ -85,17 +61,13 @@ files:
|
|
85
61
|
- History.txt
|
86
62
|
- License.txt
|
87
63
|
- README.md
|
88
|
-
- features/address.feature
|
89
|
-
- features/internet.feature
|
90
|
-
- features/support/env.rb
|
91
64
|
- test/test_faker.rb
|
92
65
|
- test/test_faker_internet.rb
|
93
66
|
- test/test_faker_lorem.rb
|
94
67
|
- test/test_faker_name.rb
|
95
68
|
- test/test_helper.rb
|
96
|
-
- bin/faker
|
97
69
|
has_rdoc: true
|
98
|
-
homepage:
|
70
|
+
homepage: https://github.com/TechnoGate/faker
|
99
71
|
licenses: []
|
100
72
|
post_install_message:
|
101
73
|
rdoc_options: []
|
@@ -120,9 +92,6 @@ signing_key:
|
|
120
92
|
specification_version: 3
|
121
93
|
summary: Easily generate fake data
|
122
94
|
test_files:
|
123
|
-
- features/address.feature
|
124
|
-
- features/internet.feature
|
125
|
-
- features/support/env.rb
|
126
95
|
- test/test_faker.rb
|
127
96
|
- test/test_faker_internet.rb
|
128
97
|
- test/test_faker_lorem.rb
|
data/bin/faker
DELETED
data/features/address.feature
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: Address
|
2
|
-
In order to generate fake data
|
3
|
-
As a CLI
|
4
|
-
I want to be able to get fake address data
|
5
|
-
|
6
|
-
Scenario: No options
|
7
|
-
When I run "faker address"
|
8
|
-
Then the output should contain "Run `faker help address` for a list of valid types"
|
9
|
-
|
10
|
-
Scenario: Help
|
11
|
-
When I run "faker help address"
|
12
|
-
Then the output should contain "Usage:"
|
13
|
-
|
data/features/internet.feature
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
Feature: Internet
|
2
|
-
In order to generate fake data
|
3
|
-
As a CLI
|
4
|
-
I want to be able to get fake internet data
|
5
|
-
|
6
|
-
Scenario: No options
|
7
|
-
When I run "faker internet"
|
8
|
-
Then the output should contain "Run `faker help internet` for a list of valid types"
|
9
|
-
|
10
|
-
Scenario: Help
|
11
|
-
When I run "faker help internet"
|
12
|
-
Then the output should contain "Usage:"
|
13
|
-
|
14
|
-
Scenario: Email
|
15
|
-
When I run "faker internet -f email"
|
16
|
-
Then the output should match /.+@.+\.\w+/
|
17
|
-
|
18
|
-
Scenario: Free Email
|
19
|
-
When I run "faker internet -f free_email"
|
20
|
-
Then the output should match /.+@(gmail|hotmail|yahoo)\.com/
|
21
|
-
|
22
|
-
Scenario: Username
|
23
|
-
When I run "faker internet -f user_name"
|
24
|
-
Then the output should match /[a-z]+((_|\.)[a-z]+)?/
|
25
|
-
|
26
|
-
Scenario: Domain Name
|
27
|
-
When I run "faker internet -f domain_name"
|
28
|
-
Then the output should match /\w+\.\w+/
|
29
|
-
|
30
|
-
Scenario: Domain Word
|
31
|
-
When I run "faker internet -f domain_word"
|
32
|
-
Then the output should match /^\w+$/
|
33
|
-
|
34
|
-
Scenario: Domain Suffix
|
35
|
-
When I run "faker internet -f domain_suffix"
|
36
|
-
Then the output should match /^\w+(\.\w+)?/
|
37
|
-
|
38
|
-
Scenario: IP4 Address
|
39
|
-
When I run "faker internet -f ip_v4_address"
|
40
|
-
Then the output should match /^\d+\.\d+\.\d+\.\d+$/
|
41
|
-
|
42
|
-
Scenario: IP6 Address
|
43
|
-
When I run "faker internet -f ip_v6_address"
|
44
|
-
Then the output should match /^(((([1]?\d)?\d|2[0-4]\d|25[0-5])\.){3}(([1]?\d)?\d|2[0-4]\d|25[0-5]))|([\da-fA-F]{1,4}(\:[\da-fA-F]{1,4}){7})|(([\da-fA-F]{1,4}:){0,5}::([\da-fA-F]{1,4}:){0,5}[\da-fA-F]{1,4})$/
|
45
|
-
|
data/features/support/env.rb
DELETED
data/lib/faker/cli.rb
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
|
3
|
-
module Faker
|
4
|
-
class CLI < Thor
|
5
|
-
|
6
|
-
desc "address [-f street_name|street_address|secondary_address|zip_code|street_suffix|city_suffix|state_abbr|state|country]",
|
7
|
-
"Returns fake address data"
|
8
|
-
method_option :faker_type, :aliases => "-f", :desc => "the faker data type"
|
9
|
-
def address
|
10
|
-
case options.faker_type
|
11
|
-
when 'street_name'
|
12
|
-
puts Faker::Address.street_name
|
13
|
-
when 'street_address'
|
14
|
-
puts Faker::Address.street_address
|
15
|
-
when 'secondary_address'
|
16
|
-
puts Faker::Address.secondary_address
|
17
|
-
when 'zip_code'
|
18
|
-
puts Faker::Address.zip_code
|
19
|
-
when 'street_suffix'
|
20
|
-
puts Faker::Address.street_suffix
|
21
|
-
when 'city_suffix'
|
22
|
-
puts Faker::Address.city_suffix
|
23
|
-
when 'state_abbr'
|
24
|
-
puts Faker::Address.state_abbr
|
25
|
-
when 'state'
|
26
|
-
puts Faker::Address.state
|
27
|
-
when 'country'
|
28
|
-
puts Faker::Address.country
|
29
|
-
else
|
30
|
-
puts "Usage: `faker address -f=street_address`"
|
31
|
-
puts "Run `faker help address` for a list of valid types"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
desc "company [-f name|suffix|catch_phrase|bs]",
|
36
|
-
"Returns fake company data"
|
37
|
-
method_option :faker_type, :aliases => "-f", :desc => "the faker data type"
|
38
|
-
def company
|
39
|
-
case options.faker_type
|
40
|
-
when 'name'
|
41
|
-
puts Faker::Company.name
|
42
|
-
when 'suffix'
|
43
|
-
puts Faker::Company.suffix
|
44
|
-
when 'catch_phrase'
|
45
|
-
puts Faker::Company.catch_phrase
|
46
|
-
when 'bs'
|
47
|
-
puts Faker::Company.bs
|
48
|
-
else
|
49
|
-
puts "Usage: `faker company -f=name`"
|
50
|
-
puts "Run `faker help company` for a list of valid types"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
desc "internet [-f email|free_email|user_name|domain_name|ip_v4_address|ip_v6_address]",
|
55
|
-
"Returns fake internet data"
|
56
|
-
method_option :faker_type, :aliases => "-f", :desc => "the faker data type"
|
57
|
-
def internet
|
58
|
-
case options.faker_type
|
59
|
-
when 'email'
|
60
|
-
puts Faker::Internet.email
|
61
|
-
when 'free_email'
|
62
|
-
puts Faker::Internet.free_email
|
63
|
-
when 'user_name'
|
64
|
-
puts Faker::Internet.user_name
|
65
|
-
when 'domain_name'
|
66
|
-
puts Faker::Internet.domain_name
|
67
|
-
when 'domain_word'
|
68
|
-
puts Faker::Internet.domain_word
|
69
|
-
when 'domain_suffix'
|
70
|
-
puts Faker::Internet.domain_suffix
|
71
|
-
when 'ip_v4_address'
|
72
|
-
puts Faker::Internet.ip_v4_address
|
73
|
-
when 'ip_v6_address'
|
74
|
-
puts Faker::Internet.ip_v6_address
|
75
|
-
else
|
76
|
-
puts "Usage: `faker internet -f=email`"
|
77
|
-
puts "Run `faker help internet` for a list of valid types"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
desc "lorem [-f words|sentence|sentences|paragraph|paragraphs -c 5]",
|
82
|
-
"Returns fake lorem data"
|
83
|
-
method_option :faker_type, :aliases => "-f", :desc => "the faker data type"
|
84
|
-
method_option :number, :type => :numeric, :aliases => "-n", :desc => "the number to return"
|
85
|
-
def lorem
|
86
|
-
case options.faker_type
|
87
|
-
when 'words'
|
88
|
-
puts options.number ? Faker::Lorem.words(options.number) : Faker::Lorem.words
|
89
|
-
when 'sentence'
|
90
|
-
puts options.number ? Faker::Lorem.sentence(options.number) : Faker::Lorem.sentence
|
91
|
-
when 'sentences'
|
92
|
-
puts options.number ? Faker::Lorem.sentences(options.number) : Faker::Lorem.sentences
|
93
|
-
when 'paragraph'
|
94
|
-
puts options.number ? Faker::Lorem.paragraph(options.number) : Faker::Lorem.paragraph
|
95
|
-
when 'paragraphs'
|
96
|
-
puts options.number ? Faker::Lorem.paragraphs(options.number) : Faker::Lorem.paragraphs
|
97
|
-
else
|
98
|
-
puts "Usage: `faker lorem -f words -n 5`"
|
99
|
-
puts "Run `faker help lorem` for a list of valid types"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
desc "name [-f name|first_name|last_name|prefix|suffix]",
|
104
|
-
"Returns fake name data"
|
105
|
-
method_option :faker_type, :aliases => "-f", :desc => "the faker data type"
|
106
|
-
def name
|
107
|
-
case options.faker_type
|
108
|
-
when 'name'
|
109
|
-
puts Faker::Name.name
|
110
|
-
when 'first_name'
|
111
|
-
puts Faker::Name.first_name
|
112
|
-
when 'last_name'
|
113
|
-
puts Faker::Name.last_name
|
114
|
-
when 'prefix'
|
115
|
-
puts Faker::Name.prefix
|
116
|
-
when 'suffix'
|
117
|
-
puts Faker::Name.suffix
|
118
|
-
else
|
119
|
-
puts "Usage: `faker name -f name`"
|
120
|
-
puts "Run `faker help name` for a list of valid types"
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
desc "phone_number",
|
125
|
-
"Returns fake phone number data"
|
126
|
-
def phone_number
|
127
|
-
puts Faker::PhoneNumber.phone_number
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|