forgery 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
+ require 'rubygems'
1
2
  require 'rake'
3
+ require 'rspec/core'
4
+ require 'rspec/core/rake_task'
2
5
  require 'rake/rdoctask'
3
- require 'spec/rake/spectask'
4
6
  require File.expand_path('./lib/forgery/file_writer')
5
7
 
6
8
  begin
@@ -13,15 +15,15 @@ desc 'Default: run specs with rcov.'
13
15
  task :default => :rcov_spec
14
16
 
15
17
  desc 'Run the specs'
16
- Spec::Rake::SpecTask.new(:spec) do |t|
17
- t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
18
- t.spec_files = FileList['spec/**/*_spec.rb']
18
+ RSpec::Core::RakeTask.new(:spec) do |t|
19
+ t.rspec_opts = ['--colour --format progress']
20
+ t.pattern = FileList['spec/**/*_spec.rb']
19
21
  end
20
22
 
21
23
  desc 'Run the specs with rcov'
22
- Spec::Rake::SpecTask.new("rcov_spec") do |t|
23
- t.spec_files = FileList['spec/**/*_spec.rb']
24
- t.spec_opts = ['--color']
24
+ RSpec::Core::RakeTask.new("rcov_spec") do |t|
25
+ t.pattern = FileList['spec/**/*_spec.rb']
26
+ t.rspec_opts = ['--color']
25
27
  t.rcov = true
26
28
  t.rcov_opts = ['--exclude', '^spec,/gems/']
27
29
  end
@@ -0,0 +1,222 @@
1
+ Basic Materials
2
+ Agricultural Chemicals
3
+ Aluminum
4
+ Chemicals - Major Diversified
5
+ Copper
6
+ Gold
7
+ Independent Oil & Gas
8
+ Industrial Metals & Minerals
9
+ Major Integrated Oil & Gas
10
+ Nonmetallic Mineral Mining
11
+ Oil & Gas Drilling & Exploration
12
+ Oil & Gas Equipment & Services
13
+ Oil & Gas Pipelines
14
+ Oil & Gas Refining & Marketing
15
+ Silver
16
+ Specialty Chemicals
17
+ Steel & Iron
18
+ Synthetics
19
+ Conglomerates
20
+ Conglomerates
21
+ Consumer Goods
22
+ Appliances
23
+ Auto Manufacturers - Major
24
+ Auto Parts
25
+ Beverages - Brewers
26
+ Beverages - Soft Drinks
27
+ Beverages - Wineries & Distillers
28
+ Business Equipment
29
+ Cigarettes
30
+ Cleaning Products
31
+ Confectioners
32
+ Dairy Products
33
+ Electronic Equipment
34
+ Farm Products
35
+ Food - Major Diversified
36
+ Home Furnishings & Fixtures
37
+ Housewares & Accessories
38
+ Meat Products
39
+ Office Supplies
40
+ Packaging & Containers
41
+ Paper & Paper Products
42
+ Personal Products
43
+ Photographic Equipment & Supplies
44
+ Processed & Packaged Goods
45
+ Recreational Goods, Other
46
+ Recreational Vehicles
47
+ Rubber & Plastics
48
+ Sporting Goods
49
+ Textile - Apparel Clothing
50
+ Textile - Apparel Footwear & Accessories
51
+ Tobacco Products, Other
52
+ Toys & Games
53
+ Trucks & Other Vehicles
54
+ Financial
55
+ Accident & Health Insurance
56
+ Asset Management
57
+ Closed-End Fund - Debt
58
+ Closed-End Fund - Equity
59
+ Closed-End Fund - Foreign
60
+ Credit Services
61
+ Diversified Investments
62
+ Foreign Money Center Banks
63
+ Foreign Regional Banks
64
+ Insurance Brokers
65
+ Investment Brokerage - National
66
+ Investment Brokerage - Regional
67
+ Life Insurance
68
+ Money Center Banks
69
+ Mortgage Investment
70
+ Property & Casualty Insurance
71
+ Property Management
72
+ REIT - Diversified
73
+ REIT - Healthcare Facilities
74
+ REIT - Hotel/Motel
75
+ REIT - Industrial
76
+ REIT - Office
77
+ REIT - Residential
78
+ REIT - Retail
79
+ Real Estate Development
80
+ Regional - Mid-Atlantic Banks
81
+ Regional - Midwest Banks
82
+ Regional - Northeast Banks
83
+ Regional - Pacific Banks
84
+ Regional - Southeast Banks
85
+ Regional - Southwest Banks
86
+ Savings & Loans
87
+ Surety & Title Insurance
88
+ Healthcare
89
+ Biotechnology
90
+ Diagnostic Substances
91
+ Drug Delivery
92
+ Drug Manufacturers - Major
93
+ Drug Manufacturers - Other
94
+ Drug Related Products
95
+ Drugs - Generic
96
+ Health Care Plans
97
+ Home Health Care
98
+ Hospitals
99
+ Long-Term Care Facilities
100
+ Medical Appliances & Equipment
101
+ Medical Instruments & Supplies
102
+ Medical Laboratories & Research
103
+ Medical Practitioners
104
+ Specialized Health Services
105
+ Industrial Goods
106
+ Aerospace/Defense - Major Diversified
107
+ Aerospace/Defense Products & Services
108
+ Cement
109
+ Diversified Machinery
110
+ Farm & Construction Machinery
111
+ General Building Materials
112
+ General Contractors
113
+ Heavy Construction
114
+ Industrial Electrical Equipment
115
+ Industrial Equipment & Components
116
+ Lumber, Wood Production
117
+ Machine Tools & Accessories
118
+ Manufactured Housing
119
+ Metal Fabrication
120
+ Pollution & Treatment Controls
121
+ Residential Construction
122
+ Small Tools & Accessories
123
+ Textile Industrial
124
+ Waste Management
125
+ Advertising Agencies
126
+ Air Delivery & Freight Services
127
+ Air Services, Other
128
+ Apparel Stores
129
+ Auto Dealerships
130
+ Auto Parts Stores
131
+ Auto Parts Wholesale
132
+ Basic Materials Wholesale
133
+ Broadcasting - Radio
134
+ Broadcasting - TV
135
+ Building Materials Wholesale
136
+ Business Services
137
+ CATV Systems
138
+ Catalog & Mail Order Houses
139
+ Computers Wholesale
140
+ Consumer Services
141
+ Department Stores
142
+ Discount, Variety Stores
143
+ Drug Stores
144
+ Drugs Wholesale
145
+ Education & Training Services
146
+ Electronics Stores
147
+ Electronics Wholesale
148
+ Entertainment - Diversified
149
+ Food Wholesale
150
+ Gaming Activities
151
+ General Entertainment
152
+ Grocery Stores
153
+ Home Furnishing Stores
154
+ Home Improvement Stores
155
+ Industrial Equipment Wholesale
156
+ Jewelry Stores
157
+ Lodging
158
+ Major Airlines
159
+ Management Services
160
+ Marketing Services
161
+ Medical Equipment Wholesale
162
+ Movie Production, Theaters
163
+ Music & Video Stores
164
+ Personal Services
165
+ Publishing - Books
166
+ Publishing - Newspapers
167
+ Publishing - Periodicals
168
+ Railroads
169
+ Regional Airlines
170
+ Rental & Leasing Services
171
+ Research Services
172
+ Resorts & Casinos
173
+ Restaurants
174
+ Security & Protection Services
175
+ Shipping
176
+ Specialty Eateries
177
+ Specialty Retail, Other
178
+ Sporting Activities
179
+ Sporting Goods Stores
180
+ Staffing & Outsourcing Services
181
+ Technical Services
182
+ Toy & Hobby Stores
183
+ Trucking
184
+ Wholesale, Other
185
+ Technology
186
+ Application Software
187
+ Business Software & Services
188
+ Communication Equipment
189
+ Computer Based Systems
190
+ Computer Peripherals
191
+ Data Storage Devices
192
+ Diversified Communication Services
193
+ Diversified Computer Systems
194
+ Diversified Electronics
195
+ Healthcare Information Services
196
+ Information & Delivery Services
197
+ Information Technology Services
198
+ Internet Information Providers
199
+ Internet Service Providers
200
+ Internet Software & Services
201
+ Long Distance Carriers
202
+ Multimedia & Graphics Software
203
+ Networking & Communication Devices
204
+ Personal Computers
205
+ Printed Circuit Boards
206
+ Processing Systems & Products
207
+ Scientific & Technical Instruments
208
+ Security Software & Services
209
+ Semiconductor - Broad Line
210
+ Semiconductor - Integrated Circuits
211
+ Semiconductor - Specialized
212
+ Semiconductor Equipment & Materials
213
+ Semiconductor- Memory Chips
214
+ Technical & System Software
215
+ Telecom Services - Domestic
216
+ Telecom Services - Foreign
217
+ Wireless Communications
218
+ Diversified Utilities
219
+ Electric Utilities
220
+ Foreign Utilities
221
+ Gas Utilities
222
+ Water Utilities
@@ -32,20 +32,10 @@ class Forgery::Date < Forgery
32
32
  end
33
33
 
34
34
  def self.year(options={})
35
- options.reverse_merge!(:future => false, :min_delta => 0, :max_delta => 20)
36
-
37
- #Calculate our delta
38
- delta = options[:min_delta] + rand(options[:max_delta] + 1 - options[:min_delta]).to_i
39
-
40
- #Potentially negate our delta if future is false
41
- unless (options[:future])
42
- if rand(2).zero?
43
- delta *= -1
44
- end
45
- end
35
+ options.reverse_merge!(:future => false, :past => false, :min_delta => 0, :max_delta => 20)
46
36
 
47
37
  #Apply our delta to this year
48
- DateTime.now.year + delta
38
+ DateTime.now.year + delta(options)
49
39
  end
50
40
 
51
41
  def self.day
@@ -53,19 +43,23 @@ class Forgery::Date < Forgery
53
43
  end
54
44
 
55
45
  def self.date(options={})
56
- options.reverse_merge!(:future => false, :min_delta => 0, :max_delta => 7300)
46
+ options.reverse_merge!(:future => false, :past => false, :min_delta => 0, :max_delta => 7300)
47
+
48
+ #Apply our delta to today
49
+ ::Date.today + delta(options)
50
+ end
57
51
 
58
- #Calculate our delta
52
+ private
53
+ #Calculate our delta
54
+ def self.delta(options)
59
55
  delta = options[:min_delta] + rand(options[:max_delta] + 1 - options[:min_delta]).to_i
60
56
 
61
57
  #Potentially negate our delta if future is false
62
58
  unless (options[:future])
63
- if rand(2).zero?
59
+ if options[:past] || rand(2).zero?
64
60
  delta *= -1
65
61
  end
66
62
  end
67
-
68
- #Apply our delta to today
69
- DateTime.now.to_date + delta
63
+ delta
70
64
  end
71
- end
65
+ end
@@ -0,0 +1,16 @@
1
+ class Forgery::Email < Forgery
2
+
3
+ def self.address
4
+ Forgery::Internet.email_address
5
+ end
6
+
7
+ def self.subject(options={})
8
+ Forgery::LoremIpsum.title(options)
9
+ end
10
+
11
+ def self.body(options={})
12
+ quantity = options[:quantity] || (1 + rand(10))
13
+ Forgery::LoremIpsum.paragraphs(quantity, options)
14
+ end
15
+
16
+ end
@@ -16,6 +16,10 @@ class Forgery::Internet < Forgery
16
16
  user_name + '@' + domain_name
17
17
  end
18
18
 
19
+ def self.email_subject(options={})
20
+ Forgery::LoremIpsum.title(options)
21
+ end
22
+
19
23
  def self.cctld
20
24
  dictionaries[:country_code_top_level_domains].random
21
25
  end
@@ -18,6 +18,8 @@ class Forgery::LoremIpsum < Forgery
18
18
  paragraph(options)
19
19
  when :paragraphs
20
20
  paragraphs(quantity, options)
21
+ when :title
22
+ title(options)
21
23
  end
22
24
  end
23
25
 
@@ -86,6 +88,9 @@ class Forgery::LoremIpsum < Forgery
86
88
  paragraphs.join(options[:separator])
87
89
  end
88
90
 
91
+ def self.title(options={})
92
+ sentence(options).chop.gsub(/\b./){$&.upcase}
93
+ end
89
94
 
90
95
  protected
91
96
 
@@ -44,4 +44,7 @@ class Forgery::Name < Forgery
44
44
  dictionaries[:locations].random
45
45
  end
46
46
 
47
+ def self.industry
48
+ dictionaries[:industries].random
49
+ end
47
50
  end
@@ -1,3 +1,3 @@
1
1
  class Forgery
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forgery
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
4
+ hash: 3
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 7
10
- version: 0.3.7
9
+ - 8
10
+ version: 0.3.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan Sutton
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-10 00:00:00 -06:00
19
+ date: 2011-04-26 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -72,6 +72,7 @@ files:
72
72
  - lib/forgery/dictionaries/female_first_names
73
73
  - lib/forgery/dictionaries/frequencies
74
74
  - lib/forgery/dictionaries/genders
75
+ - lib/forgery/dictionaries/industries
75
76
  - lib/forgery/dictionaries/job_title_suffixes
76
77
  - lib/forgery/dictionaries/job_titles
77
78
  - lib/forgery/dictionaries/languages
@@ -102,6 +103,7 @@ files:
102
103
  - lib/forgery/forgery/basic.rb
103
104
  - lib/forgery/forgery/currency.rb
104
105
  - lib/forgery/forgery/date.rb
106
+ - lib/forgery/forgery/email.rb
105
107
  - lib/forgery/forgery/internet.rb
106
108
  - lib/forgery/forgery/lorem_ipsum.rb
107
109
  - lib/forgery/forgery/monetary.rb
@@ -151,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
153
  requirements: []
152
154
 
153
155
  rubyforge_project: forgery
154
- rubygems_version: 1.3.7
156
+ rubygems_version: 1.5.0
155
157
  signing_key:
156
158
  specification_version: 3
157
159
  summary: Easy and customizable generation of forged data.