spell_generator 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +65 -6
- data/examples/spells.rb +10 -0
- data/lib/spell_generator.rb +2 -2
- data/lib/spell_generator/generator.rb +6 -11
- data/lib/spell_generator/spell_generator_error.rb +2 -0
- data/lib/spell_generator/spells.rb +11 -6
- data/lib/spell_generator/version.rb +1 -1
- data/rubocop.yml +59 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01e53af5f06c80e7b16e24e1e81b12b5c1d84dda
|
4
|
+
data.tar.gz: 8503fbd3fc9faf23fd5dbaa1577cc851f3614692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55ef2ab568d38306175e1eb5d6739160f98acae9a0c9c5ae6873441437a55e9be5feb050fde24e6f37f21e38c1fee746fd982e53ee48d2b4465354ade876f28a
|
7
|
+
data.tar.gz: f04489ec7f2b0acbb7d119774ab5a106ebf4802c4d7f9f50a8a7435ae1c4a91c87f87eb38b5b0ac80d29f974fa2bc832808be1847df75a68bd9bf6fce0d2809b
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/K-Sato1995/spell_generator.svg?branch=master)](https://travis-ci.org/K-Sato1995/spell_generator)
|
2
|
+
|
1
3
|
# SpellGenerator
|
2
|
-
|
4
|
+
|
5
|
+
It generates a random spell.
|
6
|
+
|
7
|
+
## Why I created this project
|
8
|
+
|
9
|
+
Welcome!! I created this project specifically for helping people take the first step of their OSS journeys⭐️⭐️.
|
10
|
+
|
11
|
+
Contributing to an OSS project can be intimidating if you don't know how to do to it or have never experienced it. But if you know the process of making a PR and have already done it before, it can be very simple and fun.
|
12
|
+
That's why I want you to contribute to this project by opening an issue or making a PR to practice/start contributing to other OSS projects✨✨!!
|
13
|
+
|
14
|
+
Originally I started this project with [this post](https://dev.to/ksato1995/anybody-who-wants-to-start-practice-contributing-to-oss-projects-59np) on [dev.to](https://dev.to/).
|
15
|
+
|
16
|
+
## If you are not a begginer
|
17
|
+
|
18
|
+
You can contribute to the project and the whole dev community by opening an issue here or helping new devs to complete their PRs😊.
|
19
|
+
Some wonderful people have already opened some issues and also created PRs.
|
20
|
+
I wholeheartedly appreciate them🙏🙏.
|
21
|
+
|
22
|
+
Or you are always very welcome to tackle any issue, even if you are not a begginer,
|
3
23
|
|
4
24
|
## Installation
|
5
25
|
|
@@ -18,22 +38,61 @@ Or install it yourself as:
|
|
18
38
|
$ gem install spell_generator
|
19
39
|
|
20
40
|
## Usage
|
41
|
+
|
21
42
|
You can do two things with this gem.
|
22
43
|
|
23
44
|
(1) Create a random spell.
|
24
45
|
|
25
46
|
```ruby
|
26
|
-
SpellGenerator::Generator.generate #=> "
|
27
|
-
SpellGenerator::
|
47
|
+
SpellGenerator::Generator.generate #=> "brave fire"
|
48
|
+
SpellGenerator::Generator.new.generate #=> "symptomatic punch"
|
28
49
|
```
|
29
50
|
|
30
51
|
(2) Create a spell.
|
31
52
|
|
32
53
|
```ruby
|
33
|
-
SpellGenerator::
|
54
|
+
SpellGenerator::Generator.new.self_generate('Random' 'Fire') #=> "Random Fire"
|
55
|
+
```
|
56
|
+
|
57
|
+
## How to run examples
|
58
|
+
|
59
|
+
First, you have to move to the directory of this project in your terminal.
|
60
|
+
|
61
|
+
```
|
62
|
+
$ cd spell_generator
|
63
|
+
```
|
64
|
+
|
65
|
+
Second, run the command below.
|
66
|
+
|
67
|
+
```
|
68
|
+
$ ruby examples/spells.rb
|
69
|
+
```
|
70
|
+
|
71
|
+
That's it☀️!
|
72
|
+
|
73
|
+
It would output some random spells for ya.
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
"efficient blow"
|
77
|
+
"entire stab"
|
78
|
+
"Random Fire"
|
79
|
+
```
|
80
|
+
|
81
|
+
## How to run the test
|
82
|
+
|
83
|
+
First, you have to move to the directory of this project in your terminal.
|
84
|
+
|
85
|
+
```
|
86
|
+
$ cd spell_generator
|
87
|
+
```
|
88
|
+
|
89
|
+
Second, run the command below.
|
90
|
+
|
91
|
+
```
|
92
|
+
$ rake spec
|
34
93
|
```
|
35
94
|
|
36
|
-
|
95
|
+
That's it☀️!
|
37
96
|
|
38
97
|
## License
|
39
98
|
|
@@ -41,4 +100,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
41
100
|
|
42
101
|
## Code of Conduct
|
43
102
|
|
44
|
-
Everyone interacting in the SpellGenerator project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
103
|
+
Everyone interacting in the SpellGenerator project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/K-Sato1995/spell_generator/blob/master/CODE_OF_CONDUCT.md).
|
data/examples/spells.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require_relative '../lib/spell_generator'
|
2
|
+
|
3
|
+
# Generate.generate (Class method)
|
4
|
+
p SpellGenerator::Generator.generate
|
5
|
+
|
6
|
+
# Generator#generate (Instance method)
|
7
|
+
p SpellGenerator::Generator.new.generate
|
8
|
+
|
9
|
+
# Generator#self_generate (Instance method)
|
10
|
+
p SpellGenerator::Generator.new.self_generate('Random', 'Fire') #=> Random Fire
|
data/lib/spell_generator.rb
CHANGED
@@ -1,24 +1,19 @@
|
|
1
1
|
require_relative 'spells'
|
2
|
+
require_relative 'spell_generator_error'
|
2
3
|
|
3
4
|
class SpellGenerator::Generator
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def generate
|
9
|
-
spell_part1 = SPELL_SET1[rand(0...SPELL_SET1_NUMBER)]
|
10
|
-
spell_part2 = SPELL_SET2[rand(0...SPELL_SET2_NUMBER)]
|
11
|
-
"#{spell_part1} #{spell_part2}"
|
12
|
-
end
|
5
|
+
def self.generate
|
6
|
+
new.generate
|
13
7
|
end
|
14
8
|
|
15
9
|
def generate
|
16
|
-
spell_part1 =
|
17
|
-
spell_part2 =
|
10
|
+
spell_part1 = SPELL_ADJECTIVES[rand(0...SPELL_ADJECTIVES.size)]
|
11
|
+
spell_part2 = SPELL_VERBS[rand(0...SPELL_VERBS.size)]
|
18
12
|
"#{spell_part1} #{spell_part2}"
|
19
13
|
end
|
20
14
|
|
21
15
|
def self_generate(*spell_parts)
|
16
|
+
raise SpellGeneratorError, 'Require more than 2 values' if spell_parts.size == 1
|
22
17
|
spell_parts.join(' ')
|
23
18
|
end
|
24
19
|
end
|
@@ -1,7 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
SPELL_ADJECTIVES = %w[abandoned accurate adorable alcoholic amazing astonishing average awesome better
|
2
|
+
brave burning cautious cute divine dramatic efficient entire freezing friendly
|
3
|
+
glorious greedy hateful healthy hot immediate instinctive lame magnificent
|
4
|
+
marvelous merciful perpetual poisonous pretty quirky racial regular sacred
|
5
|
+
shallow sickening sufficient symptomatic terrific threatening tyrannical ugly
|
6
|
+
useful zany malevolent outrageous].freeze
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
SPELL_VERBS = %w[accept attach attack bet bind blow burn buy carry choose chop commit curse cut
|
9
|
+
decide doubt explain favor feed fire flame flood frost get give hunt improve
|
10
|
+
include inform invest jump kick kiss lift love maintain manage organize overcome
|
11
|
+
paint peel plan poke possess pounce pretend pull punch read realize slap smack
|
12
|
+
smash stab step storm strike thunder typhoon wish write].freeze
|
data/rubocop.yml
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- bin/*
|
4
|
+
- db/schema.rb
|
5
|
+
- db/migrate/*
|
6
|
+
- db/seeds/original.rb
|
7
|
+
- vendor/**/*
|
8
|
+
- node_modules/**/*
|
9
|
+
- tmp/*
|
10
|
+
- Guardfile
|
11
|
+
- Gemfile
|
12
|
+
- config/puma.rb
|
13
|
+
- config/spring.rb
|
14
|
+
- config/initializers/devise.rb
|
15
|
+
- db/data.rb
|
16
|
+
- spec/rails_helper.rb
|
17
|
+
|
18
|
+
DisplayCopNames: true
|
19
|
+
|
20
|
+
# Missing magic comment # frozen_string_literal: true.
|
21
|
+
Style/FrozenStringLiteralComment:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
# Missing top-level class documentation comment.
|
25
|
+
Style/Documentation:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/BlockComments:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Layout/TrailingBlankLines:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/NumericLiterals:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/SymbolArray:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Style/Lambda:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Metrics/BlockLength:
|
44
|
+
Exclude:
|
45
|
+
- spec/**/*
|
46
|
+
- config/environments/*
|
47
|
+
|
48
|
+
# Use only ascii symbols in comments.
|
49
|
+
AsciiComments:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Metrics/AbcSize:
|
53
|
+
Max: 33
|
54
|
+
|
55
|
+
Metrics/MethodLength:
|
56
|
+
Max: 22
|
57
|
+
|
58
|
+
Metrics/LineLength:
|
59
|
+
Max: 200
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spell_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- K-Sato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,10 +70,13 @@ files:
|
|
70
70
|
- Rakefile
|
71
71
|
- bin/console
|
72
72
|
- bin/setup
|
73
|
+
- examples/spells.rb
|
73
74
|
- lib/spell_generator.rb
|
74
75
|
- lib/spell_generator/generator.rb
|
76
|
+
- lib/spell_generator/spell_generator_error.rb
|
75
77
|
- lib/spell_generator/spells.rb
|
76
78
|
- lib/spell_generator/version.rb
|
79
|
+
- rubocop.yml
|
77
80
|
- spell_generator.gemspec
|
78
81
|
homepage: https://github.com/K-Sato1995/hola_sato/blob/master/spell_generator.gemspec
|
79
82
|
licenses:
|