SykGenData 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c632630c77c1ec08f2360b4705b22812ac0d10e1ec46052287d69fa678b1465d
4
- data.tar.gz: 077ec03dd0a459750b1285baead8da649c09a7bcbf15e91a3f0d78106b974476
3
+ metadata.gz: ac2d9e6aae5ddc73a010e225b8c61624559e3eae0337e27b92e9f2bb632f05e8
4
+ data.tar.gz: ed1c384b3f9d94f57b8eb6471995f8b11c4daf821d32c26112a4a4b8a75488bb
5
5
  SHA512:
6
- metadata.gz: c1d8c39ed904f95b30205be4dd762c49f0527057ff8e660fd18c01bcc7991aece365a40ab9be8d821e3001cb5637a428e550219e526ec31727f8156bad6f27fa
7
- data.tar.gz: 4b959dec1de011ec080e291836c0a8ba10c884edb6243493f9ae6afde1116452663e92c748d08a1d3ff853a4bf857e5241914808134fa2e29d95df5d36e72b18
6
+ metadata.gz: 2eac52518d5d962fbee34a07e78fd3369b17f2ad846b8fe883f88b9f02f16ebfee2b8f79ddb3230a88eff3d337d2f41247f0846e580f26086089c9c38e4a9679
7
+ data.tar.gz: ca7adbb8fcb4aa43e018bdd54c7d777889da8a1c22f43c957f94907bd162fac4e207a10f0d5d9b46e6f8b43c0b1e514949732b6052f9d234156cf6983af2f92c
data/Gemfile CHANGED
@@ -4,8 +4,3 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in SykGenData.gemspec
6
6
  gemspec
7
-
8
- gem 'httparty'
9
- gem 'json'
10
- gem 'faker'
11
- gem 'rake'
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- SykGenData (0.0.3)
5
- faker
6
- httparty
7
- json
4
+ SykGenData (0.1.3)
5
+ faker (~> 1.8)
6
+ httparty (~> 0.16)
7
+ json (~> 2.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -19,7 +19,7 @@ GEM
19
19
  concurrent-ruby (~> 1.0)
20
20
  json (2.1.0)
21
21
  multi_xml (0.6.0)
22
- rake (12.3.1)
22
+ rake (10.5.0)
23
23
  rspec (3.7.0)
24
24
  rspec-core (~> 3.7.0)
25
25
  rspec-expectations (~> 3.7.0)
@@ -40,10 +40,10 @@ PLATFORMS
40
40
  DEPENDENCIES
41
41
  SykGenData!
42
42
  bundler (~> 1.16)
43
- faker
44
- httparty
45
- json
46
- rake
43
+ faker (~> 1.8)
44
+ httparty (~> 0.16)
45
+ json (~> 2.1)
46
+ rake (~> 10.0)
47
47
  rspec (~> 3.0)
48
48
 
49
49
  BUNDLED WITH
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # SykGenData
2
2
 
3
- This project was made to be a library resource for generating data.
3
+ This project was to make a ruby gem which came with a library of useful data generators.
4
+
5
+ These generators could be added to later as I find the need for different types of data. Making these generators into a gem means that I can easily include and use my generators in new projects without much hassle of copying files, making require statements etc.
6
+
7
+ The generators themselves come in a SOM model with a super module handing out appropriate generator services.
4
8
 
5
9
  ## Installation
6
10
 
@@ -26,7 +30,7 @@ require 'SykGenData'
26
30
  ```
27
31
  to your ruby file and then adding
28
32
  ```ruby
29
- include 'SykGenData'
33
+ include SykGenData
30
34
  ```
31
35
  to your Generator Super class if you have one or to any class you'd like to generate data in otherwise.
32
36
 
@@ -67,9 +71,8 @@ postcode.get_postcode # returns a random UK postcode
67
71
  ## Testing
68
72
 
69
73
  The generators are all tested using rspec, you can run the tests from the project root directory by running the command
70
- ```
71
- $ rspec
72
- ```
74
+
75
+ $ rake spec
73
76
 
74
77
 
75
78
  ## Development
@@ -1,27 +1,34 @@
1
1
  require 'faker'
2
2
 
3
3
  class GenFormData
4
+ include Faker
5
+
4
6
  def get_country
5
7
  countries = ["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo","Costa Rica","Côte d'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","East Timor","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Greenland","Grenada","Guam","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Japan","Jordan","Kazakhstan","Kenya","Kiribati","North Korea","South Korea","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","Norway","Northern Mariana Islands","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Puerto Rico","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia", "Saint Vincent and the Grenadines","Samoa","San Marino", "Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and Montenegro","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","Spain","Sri Lanka","Sudan","Sudan, South","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Virgin Islands, British","Virgin Islands, U.S.","Yemen","Zambia","Zimbabwe"]
6
8
 
7
9
  countries.sample
8
10
  end
9
11
 
12
+ def get_fake_location
13
+ location = [RickAndMorty.location, Simpsons.location, StarTrek.location, StarWars.planet, Zelda.location, Witcher.location, Lovecraft.location, HarryPotter.location, HitchhikersGuideToTheGalaxy.location, HitchhikersGuideToTheGalaxy.planet, HitchhikersGuideToTheGalaxy.starship]
14
+
15
+ location.sample
16
+ end
17
+
10
18
  def get_first_name
11
- Faker::Name.first_name
19
+ Name.first_name
12
20
  end
13
21
 
14
22
  def get_last_name
15
- Faker::Name.last_name
23
+ Name.last_name
16
24
  end
17
25
 
18
- def get_dob
19
- Faker::Date.birthday(4, 68).to_s.split('-').map {|x| x.to_i}
26
+ def get_dob min_years_old, max_years_old
27
+ Date.birthday(min_years_old, max_years_old).to_s.split('-').map {|x| x.to_i}
20
28
  end
21
29
 
22
30
  def get_marital_status
23
- status = Random.new.rand(0..2)
24
- case status
31
+ case Random.new.rand(0..2)
25
32
  when 0
26
33
  'single'
27
34
  when 1
@@ -32,8 +39,7 @@ class GenFormData
32
39
  end
33
40
 
34
41
  def get_hobby
35
- n = Random.new.rand(0..2)
36
- case n
42
+ case Random.new.rand(0..2)
37
43
  when 0
38
44
  'dance'
39
45
  when 1
@@ -52,16 +58,17 @@ class GenFormData
52
58
  end
53
59
 
54
60
  def get_username
55
- username = Faker::DragonBall.character
61
+ characters = [Ancient.god, Ancient.primordial, Ancient.titan, Ancient.hero, DragonBall.character, Artist.name, BackToTheFuture.character, Book.genre, DrWho.character, DrWho.villian, DrWho.specie, HarryPotter.character, LordOfTheRings.character, Lovecraft.deity, RickAndMorty.character, Seinfeld.character, Simpsons.character, StarTrek.character, StarTrek.villain, StarWars.character, TheFreshPrinceOfBelAir.character, Superhero.descriptor]
62
+
63
+ username = characters.sample
56
64
  username += Random.new.rand(0..9).to_s
57
65
  username += Random.new.rand(0..9).to_s
58
66
  username += Random.new.rand(0..9).to_s
59
67
  username.gsub(/\s+/, "")
60
68
  end
61
69
 
70
+ # Concatenates usernames from get_username until it has a string 64 characters long
62
71
  def get_long_username
63
-
64
- # private method only to be used in get_long_username
65
72
  def get_long_username_recursion username
66
73
  if username.length < 64
67
74
  get_long_username_recursion username += '_' + get_username
@@ -69,20 +76,20 @@ class GenFormData
69
76
  username.slice 0...64
70
77
  end
71
78
  end
72
-
73
79
  get_long_username_recursion get_username
74
80
  end
75
81
 
76
82
  def get_about_me
77
- Faker::BackToTheFuture.quote
83
+ quotes = [BackToTheFuture.quote, Friends.quote, HarryPotter.quote, GameOfThrones.quote, Lovecraft.fhtagn(3), Lovecraft.paragraph, RickAndMorty.quote, Seinfeld.quote, Simpsons.quote, StarWars.quote, StarWars.wookiee_sentence, TheFreshPrinceOfBelAir.quote, HitchhikersGuideToTheGalaxy.marvin_quote]
84
+ quotes.sample
78
85
  end
79
86
 
80
87
  def get_password
81
- Faker::Internet.password(8, 16, true, true)
88
+ Internet.password(8, 16, true, true)
82
89
  end
83
90
 
84
91
  def get_long_password
85
- Faker::Internet.password(64, 128, true)
92
+ Internet.password(64, 128, true, true)
86
93
  end
87
94
 
88
95
  def get_numeric_string
@@ -95,6 +102,6 @@ class GenFormData
95
102
  end
96
103
 
97
104
  def get_email
98
- Faker::Internet.free_email
105
+ Internet.free_email
99
106
  end
100
107
  end
@@ -1,3 +1,3 @@
1
1
  module SykGenData
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SykGenData
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sykander