spell_generator 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 3600a0d86743c56befe61fbe9f64e261ac799ee0
4
- data.tar.gz: eb186b091e7eb666950a62dac04e1033832ee10b
3
+ metadata.gz: 01e53af5f06c80e7b16e24e1e81b12b5c1d84dda
4
+ data.tar.gz: 8503fbd3fc9faf23fd5dbaa1577cc851f3614692
5
5
  SHA512:
6
- metadata.gz: 4b49a08f015f6af1117d66eb66f92b00b3ed34a031745b894150d0c11b01d469fcbd581a81f87cc496036080dd85344065b9ff13770bbf89cc3e29a04c675b3e
7
- data.tar.gz: 6b5271330a5ef94b34eec92b7bb4889e05df96afbdbc1ec54d3fddb9b0cc66b8c9756133249cee9bd35846e4e3d68f5ddb5e06cc899873c3bbbc52307cd7a477
6
+ metadata.gz: 55ef2ab568d38306175e1eb5d6739160f98acae9a0c9c5ae6873441437a55e9be5feb050fde24e6f37f21e38c1fee746fd982e53ee48d2b4465354ade876f28a
7
+ data.tar.gz: f04489ec7f2b0acbb7d119774ab5a106ebf4802c4d7f9f50a8a7435ae1c4a91c87f87eb38b5b0ac80d29f974fa2bc832808be1847df75a68bd9bf6fce0d2809b
data/.gitignore CHANGED
@@ -9,3 +9,7 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ # tags
14
+ .tags
15
+ .tags1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spell_generator (0.1.1)
4
+ spell_generator (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- This is a pretty useless gem I created for practice.
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 #=> "Brave fire"
27
- SpellGenerator::Generato.new.generate #=> "Symptomatic punch"
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::Generato.new.self_generate('Random' 'Fire') #=> "Random Fire"
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
- Told you it's useless.
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/[USERNAME]/spell_generator/blob/master/CODE_OF_CONDUCT.md).
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).
@@ -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
@@ -1,5 +1,5 @@
1
- require_relative "spell_generator/version.rb"
2
- require_relative "spell_generator/generator.rb"
1
+ require_relative 'spell_generator/version.rb'
2
+ require_relative 'spell_generator/generator.rb'
3
3
 
4
4
  module SpellGenerator
5
5
  end
@@ -1,24 +1,19 @@
1
1
  require_relative 'spells'
2
+ require_relative 'spell_generator_error'
2
3
 
3
4
  class SpellGenerator::Generator
4
- SPELL_SET1_NUMBER = SPELL_SET1.size
5
- SPELL_SET2_NUMBER = SPELL_SET2.size
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 = SPELL_SET1[rand(0...SPELL_SET1_NUMBER)]
17
- spell_part2 = SPELL_SET2[rand(0...SPELL_SET2_NUMBER)]
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
@@ -0,0 +1,2 @@
1
+ class SpellGeneratorError < StandardError
2
+ end
@@ -1,7 +1,12 @@
1
- SPELL_SET1 = %w[accurate sufficient ugly useful immediate entire healthy hot efficient
2
- dramatic threatening brave greedy racial regular glorious pretty alcoholic
3
- instinctive symptomatic merciful cute perpetual average astonishing shallow
4
- shallow hateful sacred divine].freeze
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
- SPELL_SET2 = %w[fire thunder attack blow smash strike smack cut poke stab punch kick kiss
7
- flame darkness storm favor jump step hunt].freeze
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
@@ -1,3 +1,3 @@
1
1
  module SpellGenerator
2
- VERSION = "0.1.1"
2
+ VERSION = '0.1.2'.freeze
3
3
  end
@@ -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.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-02-16 00:00:00.000000000 Z
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: