Skip to content

Commit 3ff0ff9

Browse files
committed
Add new 'avatar' and 'chess' data providers
1 parent 74dfa8b commit 3ff0ff9

File tree

12 files changed

+302
-2
lines changed

12 files changed

+302
-2
lines changed

CHANGELOG.adoc

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
[discrete]
55
=== Added
66

7-
* https://github.com/serpro69/kotlin-faker/pull/176[#176] [core] Update dictionary files, including:
7+
* https://github.com/serpro69/kotlin-faker/pull/176[#176], https://github.com/serpro69/kotlin-faker/pull/182[#182], https://github.com/serpro69/kotlin-faker/pull/183[#183], [core] Update dictionary files, including:
88
** Data and functions in existing data providers
9+
*** `Faker().food.allergens()`
910
** Updates to existing localized dictionaries
1011

1112
* https://github.com/serpro69/kotlin-faker/pull/179[#179] [core] Add parameter info context to user defined generators
@@ -15,6 +16,8 @@
1516
<p>
1617
++++
1718
* `airport`
19+
* `avatar`
20+
* `chess`
1821
* `cowboy_bebop`
1922
* `spongebob`
2023
++++

cli-bot/src/main/resources/META-INF/native-image/io.github.serpro69/cli-bot/reflect-config.json

+46
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
"name": "getAustralia",
5555
"parameterTypes": []
5656
},
57+
{
58+
"name": "getAvatar",
59+
"parameterTypes": []
60+
},
5761
{
5862
"name": "getBackToTheFuture",
5963
"parameterTypes": []
@@ -130,6 +134,10 @@
130134
"name": "getCat",
131135
"parameterTypes": []
132136
},
137+
{
138+
"name": "getChess",
139+
"parameterTypes": []
140+
},
133141
{
134142
"name": "getChiquito",
135143
"parameterTypes": []
@@ -1010,6 +1018,23 @@
10101018
}
10111019
]
10121020
},
1021+
{
1022+
"name": "io.github.serpro69.kfaker.provider.Avatar",
1023+
"methods": [
1024+
{
1025+
"name": "characters",
1026+
"parameterTypes": []
1027+
},
1028+
{
1029+
"name": "dates",
1030+
"parameterTypes": []
1031+
},
1032+
{
1033+
"name": "quotes",
1034+
"parameterTypes": []
1035+
}
1036+
]
1037+
},
10131038
{
10141039
"name": "io.github.serpro69.kfaker.provider.BackToTheFuture",
10151040
"methods": [
@@ -1402,6 +1427,27 @@
14021427
{
14031428
"name": "io.github.serpro69.kfaker.provider.CellPhone"
14041429
},
1430+
{
1431+
"name": "io.github.serpro69.kfaker.provider.Chess",
1432+
"methods": [
1433+
{
1434+
"name": "players",
1435+
"parameterTypes": []
1436+
},
1437+
{
1438+
"name": "tournaments",
1439+
"parameterTypes": []
1440+
},
1441+
{
1442+
"name": "openings",
1443+
"parameterTypes": []
1444+
},
1445+
{
1446+
"name": "titles",
1447+
"parameterTypes": []
1448+
}
1449+
]
1450+
},
14051451
{
14061452
"name": "io.github.serpro69.kfaker.provider.Chiquito",
14071453
"methods": [

cli-bot/src/test/kotlin/io/github/serpro69/kfaker/app/cli/IntrospectorTest.kt

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class IntrospectorTest : DescribeSpec() {
3232
"AquaTeenHungerForce",
3333
"Artist",
3434
"Australia",
35+
"Avatar",
3536
"BackToTheFuture",
3637
"Bank",
3738
"Barcode",
@@ -51,6 +52,7 @@ class IntrospectorTest : DescribeSpec() {
5152
"Camera",
5253
"Cannabis",
5354
"Cat",
55+
"Chess",
5456
"Chiquito",
5557
"ChuckNorris",
5658
"ClashOfClans",
@@ -248,6 +250,7 @@ class IntrospectorTest : DescribeSpec() {
248250
"aquaTeenHungerForce",
249251
"artist",
250252
"australia",
253+
"avatar",
251254
"backToTheFuture",
252255
"bank",
253256
"barcode",
@@ -267,6 +270,7 @@ class IntrospectorTest : DescribeSpec() {
267270
"camera",
268271
"cannabis",
269272
"cat",
273+
"chess",
270274
"chiquito",
271275
"chuckNorris",
272276
"clashOfClans",

core/src/main/kotlin/io/github/serpro69/kfaker/Faker.kt

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
4545
val aquaTeenHungerForce: AquaTeenHungerForce by lazy { AquaTeenHungerForce(fakerService) }
4646
val artist: Artist by lazy { Artist(fakerService) }
4747
val australia: Australia by lazy { Australia(fakerService) }
48+
val avatar: Avatar by lazy { Avatar(fakerService) }
4849
val backToTheFuture: BackToTheFuture by lazy { BackToTheFuture(fakerService) }
4950
val bank: Bank by lazy { Bank(fakerService) }
5051
val barcode: Barcode by lazy { Barcode(fakerService) }
@@ -65,6 +66,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
6566
val cannabis: Cannabis by lazy { Cannabis(fakerService) }
6667
val cat: Cat by lazy { Cat(fakerService) }
6768
val chiquito: Chiquito by lazy { Chiquito(fakerService) }
69+
val chess: Chess by lazy { Chess(fakerService) }
6870
val chuckNorris: ChuckNorris by lazy { ChuckNorris(fakerService) }
6971
val clashOfClans: ClashOfClans by lazy { ClashOfClans(fakerService) }
7072
val code: Code by lazy { Code(fakerService) }

core/src/main/kotlin/io/github/serpro69/kfaker/dictionary/YamlCategory.kt

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ internal enum class YamlCategory : Category {
2121
AQUA_TEEN_HUNGER_FORCE,
2222
ARTIST,
2323
AUSTRALIA,
24+
AVATAR,
2425
BACK_TO_THE_FUTURE,
2526
BANK,
2627
BARCODE,
@@ -40,6 +41,7 @@ internal enum class YamlCategory : Category {
4041
CAMERA,
4142
CANNABIS,
4243
CELL_PHONE,
44+
CHESS,
4345
CHIQUITO,
4446
CHUCK_NORRIS,
4547
CODE,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@file:Suppress("unused")
2+
3+
package io.github.serpro69.kfaker.provider
4+
5+
import io.github.serpro69.kfaker.*
6+
import io.github.serpro69.kfaker.dictionary.*
7+
import io.github.serpro69.kfaker.provider.unique.LocalUniqueDataProvider
8+
import io.github.serpro69.kfaker.provider.unique.UniqueProviderDelegate
9+
10+
/**
11+
* [FakeDataProvider] implementation for [YamlCategory.AVATAR]
12+
*/
13+
class Avatar internal constructor(fakerService: FakerService) : YamlFakeDataProvider<Avatar>(fakerService) {
14+
override val yamlCategory = YamlCategory.AVATAR
15+
override val localUniqueDataProvider = LocalUniqueDataProvider<Avatar>()
16+
override val unique by UniqueProviderDelegate(localUniqueDataProvider)
17+
18+
init {
19+
fakerService.load(yamlCategory)
20+
}
21+
22+
fun characters() = resolve("characters")
23+
fun dates() = resolve("dates")
24+
fun quotes() = resolve("quotes")
25+
}
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.github.serpro69.kfaker.provider
2+
3+
import io.github.serpro69.kfaker.*
4+
import io.github.serpro69.kfaker.dictionary.*
5+
import io.github.serpro69.kfaker.provider.unique.LocalUniqueDataProvider
6+
import io.github.serpro69.kfaker.provider.unique.UniqueProviderDelegate
7+
8+
/**
9+
* [FakeDataProvider] implementation for [YamlCategory.CHESS] category.
10+
*/
11+
@Suppress("unused")
12+
class Chess internal constructor(fakerService: FakerService) : YamlFakeDataProvider<Chess>(fakerService) {
13+
override val yamlCategory = YamlCategory.CHESS
14+
override val localUniqueDataProvider = LocalUniqueDataProvider<Chess>()
15+
override val unique by UniqueProviderDelegate(localUniqueDataProvider)
16+
17+
init {
18+
fakerService.load(yamlCategory)
19+
}
20+
21+
fun players() = resolve("players")
22+
fun tournaments() = resolve("tournaments")
23+
fun openings() = resolve("openings")
24+
fun titles() = resolve("titles")
25+
}

core/src/main/kotlin/io/github/serpro69/kfaker/provider/Chiquito.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import io.github.serpro69.kfaker.provider.unique.LocalUniqueDataProvider
66
import io.github.serpro69.kfaker.provider.unique.UniqueProviderDelegate
77

88
/**
9-
* [FakeDataProvider] implementation for [YamlCategory.ANCIENT] category.
9+
* [FakeDataProvider] implementation for [YamlCategory.CHIQUITO] category.
1010
*/
1111
@Suppress("unused")
1212
class Chiquito internal constructor(fakerService: FakerService) : YamlFakeDataProvider<Chiquito>(fakerService) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# START avatar_provider_dict
2+
en:
3+
faker:
4+
avatar:
5+
characters: ['Neytiri', 'Jake Sully, Tommy', 'Doctora Grace Augustine', 'Ronal', 'Trudy Chacon', 'Miles Quaritch', 'Dr. Karina Mogue', 'Parker Selfridge', 'Mo at', 'Eytukan', 'Dragon Gunship Pilot', 'Neteyam', 'Varang', 'Otamu', 'Bilano', 'Deyshana', 'Entok', 'Eywaftia', 'Frapohu', 'Ronal', 'Saeyla', 'Sevineyo', 'Ian Garvin', 'Hukato']
6+
dates: ['December 18, 2009', 'December 15, 2022', 'December 20, 2024']
7+
quotes: [
8+
"I'm a warrior of the Jarhead clan.",
9+
"I was a warrior who dreamed he could bring peace. Sooner or later though, you always have to wake up.",
10+
"You want a fair deal, you're on the wrong planet. The strong prey on the weak.",
11+
"Sometimes your whole life boils down to one insane move.",
12+
"The Sky People have sent us a message: that they can take whatever they want. That no one can stop them. Well, we will send them a message: that they cannot take whatever they want! And that this...this is our land!",
13+
"All I ever wanted was a single thing worth fighting for.",
14+
"You don't choose your Avatar... your Avatar chooses you.",
15+
"The Na'vi say, that every person is born twice. The second time, is when you earn your place among the people...forever.",
16+
"Your spirit goes with Eywa. Your body stays behind to become part of The People.",
17+
"If it ain't raining, we ain't training.",
18+
"I became a Marine for the hardship. To be hammered on the anvil of life. I told myself I could pass any test a man can pass.",
19+
"If Grace is there with you - look in her memories - she can show you the world we come from. There's no green there. They killed their mother, and they're gonna do the same here.",
20+
"Sooner or later, though, you always have to wake up.",
21+
"Everything is backwards now, like out there is the true world, and in here is the dream.",
22+
"I'm with you now, Jake. We are mated for life.",
23+
"To become 'taronyu' hunter, you must choose your own Ikran and he must choose you.",
24+
"Toruk chose him, it has only happened five times since the time of first songs.",
25+
"You have a strong heart. No fear. But stupid! Ignorant like a child!",
26+
"Our great mother does not take sides, Jake; she protects the balance of life.",
27+
"Hey Sully... how does it feel to betray your own race? You think you're one of them? Time to wake up!",
28+
"Everyone on this base, every one of you, is fighting for survival, and that's a fact.",
29+
"And when we destroy it, we will blast a crater in their racial memory so deep, that they won't come within 1,000 klicks of this place ever again. And that too, is a fact.",
30+
"So you just figured you'd come here, to the most hostile environment known to men, with no training of any kind, and see how it went? What was going through your head?",
31+
"It is hard to fill a cup that is already full."
32+
]
33+
# END avatar_provider_dict
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# START chess_provider_dict
2+
en:
3+
faker:
4+
chess:
5+
players:
6+
- Alexander Alekhine
7+
- Alexei Shirov
8+
- Alexis Vargas
9+
- Anatoly Karpov
10+
- Bobby Fischer
11+
- Emanuel Lasker
12+
- Fabiano Caruana
13+
- Garry Kasparov
14+
- Hikaru Nakamura
15+
- Jose Raul Capablanca
16+
- Levon Aronian
17+
- Magnus Carlsen
18+
- Mikhail Botvinnik
19+
- Radjabov Teimour
20+
- Sergey Karjakin
21+
- Tigran Petrosian
22+
- Viswanathan Anand
23+
- Vladimir Kramnik
24+
- Wesley So
25+
- Paul Morphy
26+
tournaments:
27+
- Wijk aan Zee
28+
- Linares
29+
- Astrakhan
30+
- Dortmund
31+
- Shanghai
32+
- Bilbao
33+
- Nanjing
34+
- Moscow
35+
- London
36+
- Moscow
37+
- Tromsø (Chess World Cup)
38+
- Paris (Grand Prix 2012–2013)
39+
- Bucharest
40+
- Nizhny Novgorod (Russian Championship)
41+
- Zurich
42+
- Khanty-Mansisyk (Candidates Tournament)
43+
- Tbilisi (Grand Prix 2014–2015)
44+
- Khanty-Mansisyk (Grand Prix 2014–2015)
45+
- Baku (Chess World Cup)
46+
- London (Grand Chess Tour)
47+
- Gibraltar
48+
openings:
49+
- Alekhine’s Defense
50+
- Benko Gambit
51+
- Benoni Defense
52+
- Bird’s Opening
53+
- Bogo-Indian Defense
54+
- Budapest Gambit
55+
- Catalan Opening
56+
- Caro-Kann Defense
57+
- Colle System
58+
- Dutch Defense
59+
- Giuoco Piano
60+
- English Opening
61+
- Evans Gambit
62+
- Four Knights Game
63+
- French Defense
64+
- Grünfeld Defense
65+
- Italian Game
66+
- King’s Gambit
67+
- King’s Indian Attack
68+
- King’s Indian Defense
69+
- King’s Pawn Game
70+
- London System
71+
- Modern Defense
72+
- Nimzo-Indian Defense
73+
- Nimzowitsch Defense
74+
- Petrov’s Defense
75+
- Philidor’s Defense
76+
- Pirc Defense
77+
- Queen’s Pawn Game
78+
- Queen’s Gambit Accepted
79+
- Queen’s Gambit Declined
80+
- Queen’s Indian Defense
81+
- Réti Opening
82+
- Ruy Lopez
83+
- Scandinavian Defense
84+
- Scotch Game
85+
- Sicilian Defense
86+
- Slav Defense
87+
- Torre Attack
88+
- Two Knights Defense
89+
- Vienna Game
90+
- Wade Defense
91+
titles:
92+
- GM
93+
- IM
94+
- FM
95+
- CM
96+
- WGM
97+
- WIM
98+
- WFM
99+
- WCM
100+
- AGM
101+
- AIM
102+
- AFM
103+
- ACM
104+
105+
# END chess_provider_dict
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
---
3+
4+
== `Faker().avatar`
5+
6+
.Dictionary file
7+
[%collapsible]
8+
====
9+
[source,yaml]
10+
----
11+
{% snippet 'avatar_provider_dict' %}
12+
----
13+
====
14+
15+
.Available Functions
16+
[%collapsible]
17+
====
18+
[source,kotlin]
19+
----
20+
Faker().avatar.characters() // => Neytiri
21+
22+
Faker().avatar.dates() // => December 18, 2009
23+
24+
Faker().avatar.quotes() // => I'm a warrior of the Jarhead clan.
25+
----
26+
====

0 commit comments

Comments
 (0)