thrones_faker 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +1 -0
- data/lib/data.rb +49 -0
- data/lib/thrones_faker.rb +20 -0
- data/lib/thrones_faker/version.rb +3 -0
- data/spec/thrones_spec.rb +64 -0
- data/thrones_faker.gemspec +23 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ad3853ef929451b084a2041a37b7896c918efb81
|
4
|
+
data.tar.gz: 12617da496fa111029c137d6e8cbb6b3d9c72b52
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0cd7021127fd54e917c7d4bdbfec58c85eb076524c70ad5a03ef840ba8f56f6e750c4f81648a3f287bed6b15ed176b5c4e0e7d9fd9a26a4bfd0ea43994d4471b
|
7
|
+
data.tar.gz: 0467b47d273111c2bb88d5a5ab53f3d6c5059527b30813ecb611849fa6dba499fab0ac0aded4a663d794ccb2e63dd21819a7378ec8cd71b89883b0e177d34ed4
|
data/.DS_Store
ADDED
Binary file
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 David Goodman
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# ThronesFaker
|
2
|
+
|
3
|
+
Welcome to ThronesFaker, the first ever Game of Thrones based faker gem. Faker is great, Game of Thrones is great, the combination is even greater than the sum of its parts. Download, share, contribute, enjoy.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'thrones_faker'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install thrones_faker
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
For a name:
|
22
|
+
|
23
|
+
ThronesFaker.name
|
24
|
+
|
25
|
+
Example return: "Jorah Mormont"
|
26
|
+
|
27
|
+
For a city:
|
28
|
+
|
29
|
+
ThronesFaker.city
|
30
|
+
|
31
|
+
Example return: "Sunspear"
|
32
|
+
|
33
|
+
For a Dothraki string:
|
34
|
+
|
35
|
+
ThronesFaker.words(number)
|
36
|
+
|
37
|
+
Example return: "Sekke anha yera anha zhorase chek sek atthirarideshor yer ahilee dothrak thirat"
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
1. Fork it ( http://github.com/<my-github-username>/thrones_faker/fork )
|
42
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/data.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
##This was used to originally get a large amount of dotrhak words
|
5
|
+
# I then hardcoded the results into the array within the dothrak method below
|
6
|
+
def get_words
|
7
|
+
page = Nokogiri::HTML(open("http://wiki.dothraki.org/Idioms_and_Phrases"))
|
8
|
+
dictionary = page.css("li b").text
|
9
|
+
words = dictionary.split(/\b/)
|
10
|
+
words.delete_if {|element| element == " " || element == "'" || element == "!" || element == "?" || element == "."}
|
11
|
+
words.pop
|
12
|
+
words.delete("vikeesichomakvichomerakyershafkaShekhikhiGweholatMe")
|
13
|
+
words
|
14
|
+
end
|
15
|
+
|
16
|
+
def names
|
17
|
+
["Joffrey Baratheon", "Cersei Lannister", "Tywin Lannister", "Tyrion Lannister",
|
18
|
+
"Brienne Tarth", "Bran Stark", "Arya Stark", "Rob Stark", "Theon Greyjoy", "Peter Baelish", "Stannis Baratheon",
|
19
|
+
"Daenerys Targaryen", "Jorah Mormont", "Mance Raydar", "Jamie Lannister", "Davos Seaworth",
|
20
|
+
"Stannis Baratheon", "Margaery Tyrell", "Bran Stark", "Sansa Stark", "Arya Stark", "Viserys Targaryen",
|
21
|
+
"Khal Drago", "Aerys Targaryen", "Aegon Targaryen", "Gregor Clegane", "Sandor Clegane", "Mace Tyrell", "Willas Tyrell",
|
22
|
+
"Loras Tyrell", "Renly Baratheon", "Eddard Stark", "Osney Kettleblack", "Tommen Lannister",
|
23
|
+
"Doran Martell", "Arianne Martell", "Quentyn Martell", "Trystane Martell", "Jaqen H'ghar", "Yorko Terys",
|
24
|
+
"Pyat Pree", "Xaro Xhoan Daxos" ]
|
25
|
+
end
|
26
|
+
|
27
|
+
def cities
|
28
|
+
["Winterfell", "Braavos", "Meereen", "Volantis", "King's Landing", "Asshai",
|
29
|
+
"Qarth", "Astapor", "Vaes Dothrak", "Yunkai", "Pentos", "Valyria", "Lorath", "Sunspear", "Lys",
|
30
|
+
"Myr", "Qohor", "Tyrosh", "White Harbor", "Lannisport", "Old Ghis", "Norvos", "Elyria",
|
31
|
+
"New Ghis", "Tolos", "Mantarys", "The Vale", "Iron Islands", "Highgarden", "Dorne", "Harrenhal", "Dragonstone",
|
32
|
+
"Casterly Rock", "Castle Black", "The Dreadfort", "The Eyrie",
|
33
|
+
"Riverrun", "Storm's End", "Oldtown", "Pyke" ]
|
34
|
+
end
|
35
|
+
|
36
|
+
def dothrak
|
37
|
+
["jalan", "qoyishierak", "qiyathirat", "atthirarideshor", "tawakofr", "haggat", "evethtorga", "essheyishekh", "ma", "shieraki",
|
38
|
+
"annijalan", "atthirari", "anniAnha", "dothrak", "adakhataan", "Anha", "dothrak", "adakhatoon", "mra", "qoramra",
|
39
|
+
"zhorAse", "shafki", "athdrivarnorethaanShieraki", "gori", "ha", "yeraan", "Fichas", "jahakes", "moon", "Ki", "fin", "yeni", "Sek",
|
40
|
+
"athjilari", "Vos", ". ", "Vosecchi", "Me", "nem", "nesa", "Yer", "chomoe", "anna", "San", "athchomari", "yeraan", "Hazi", "davrae",
|
41
|
+
"Yer", "zheanae", "sekke", "Anha", "vazhak", "yeraan", "thirat", "Hash", "yer", "asti", "athijilari", "Hash", "yer", "dothrae",
|
42
|
+
"chek", "asshekh", "Hash", "anha", "atihak", "yera", "save", "Fini", "hazi", "Yer", "ojila", "Anha", "efichisak",
|
43
|
+
"haz", "yeroon", "Anha", "dothrak", "chek", "asshekh", "Athdavrazar", "Anha", "zalak", "asshekhqoyi", "vezhvena",
|
44
|
+
"yeraan", "Asshekhqoyi", "vezhvena", "Varanno", "Vod", "chafaanM", "athchomaroon", "ath", "ach",
|
45
|
+
"athchomaroon", "Athchomar", "chomakaan", "Athchomar", "chomakea", "Aena", "shekhikhi", "Hash", "yer",
|
46
|
+
"dothrae", "chek", "Fonas", "chek", "Hajas", "Dothras", "chek", "chiftikchoyoEs", "havazhaan", "Graddakh",
|
47
|
+
"graddakhifakYer", "affesi", "anniIfas", "maisi", "yeri", "Ezas", "eshna", "gech", "ahilee", "nem", "hol",
|
48
|
+
"anhoon", "ki", "rek"]
|
49
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "thrones_faker/version"
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
require_relative 'data'
|
5
|
+
|
6
|
+
class ThronesFaker
|
7
|
+
|
8
|
+
def self.name
|
9
|
+
names.sample
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.city
|
13
|
+
cities.sample
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.words(number)
|
17
|
+
dothrak.sample(number).join(' ').downcase.capitalize
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require_relative '../lib/thrones_faker'
|
3
|
+
|
4
|
+
|
5
|
+
describe ThronesFaker do
|
6
|
+
context "#name method"
|
7
|
+
it "returns a string" do
|
8
|
+
expect(ThronesFaker.name.class).to eq String
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be a name" do
|
12
|
+
expect(ThronesFaker.name.match(/w.+/))
|
13
|
+
end
|
14
|
+
|
15
|
+
it "#name should return a different name each time" do
|
16
|
+
names = Array.new
|
17
|
+
5.times do
|
18
|
+
names << ThronesFaker.name
|
19
|
+
end
|
20
|
+
expect(names.uniq.count).to eq 5
|
21
|
+
end
|
22
|
+
context "#cities method"
|
23
|
+
it "returns a string" do
|
24
|
+
expect(ThronesFaker.city.class).to eq String
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should be a city" do
|
28
|
+
expect(ThronesFaker.city.match(/w.+/))
|
29
|
+
end
|
30
|
+
|
31
|
+
it "#city should return a different city each time" do
|
32
|
+
cities = Array.new
|
33
|
+
5.times do
|
34
|
+
cities << ThronesFaker.city
|
35
|
+
end
|
36
|
+
expect(cities.uniq.count).to eq 5
|
37
|
+
end
|
38
|
+
context "#words method"
|
39
|
+
it "returns a string" do
|
40
|
+
expect(ThronesFaker.words(3).class).to eq String
|
41
|
+
end
|
42
|
+
|
43
|
+
it "returns a series of words" do
|
44
|
+
expect(ThronesFaker.words(3).match(/w.+/))
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns different words" do
|
48
|
+
cities = Array.new
|
49
|
+
5.times do
|
50
|
+
cities << ThronesFaker.words(3)
|
51
|
+
end
|
52
|
+
expect(cities.uniq.count).to eq 5
|
53
|
+
end
|
54
|
+
|
55
|
+
it "returns the right amount fo words" do
|
56
|
+
sentance = ThronesFaker.words(10)
|
57
|
+
expect(sentance.split(" ").count).to eq 10
|
58
|
+
end
|
59
|
+
|
60
|
+
it "capitalizes the first letter" do
|
61
|
+
sentance = ThronesFaker.words(5)
|
62
|
+
expect(sentance[0]).not_to eq sentance[0].downcase
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'thrones_faker/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "thrones_faker"
|
8
|
+
spec.version = ThronesFaker::VERSION
|
9
|
+
spec.authors = ["David Goodman"]
|
10
|
+
spec.email = ["goodman.david.h@gmail.com"]
|
11
|
+
spec.summary = "Creates fake information based on the Game of Thrones Saga"
|
12
|
+
spec.description = "Allows user to epicly create fake names, cities, and Dothraki sentances."
|
13
|
+
spec.homepage = "https://github.com/dgoodman1224"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thrones_faker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Goodman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Allows user to epicly create fake names, cities, and Dothraki sentances.
|
42
|
+
email:
|
43
|
+
- goodman.david.h@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .DS_Store
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/data.rb
|
55
|
+
- lib/thrones_faker.rb
|
56
|
+
- lib/thrones_faker/version.rb
|
57
|
+
- spec/thrones_spec.rb
|
58
|
+
- thrones_faker.gemspec
|
59
|
+
homepage: https://github.com/dgoodman1224
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Creates fake information based on the Game of Thrones Saga
|
83
|
+
test_files:
|
84
|
+
- spec/thrones_spec.rb
|