alex_codebreaker 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/alex_codebreaker.rb +17 -13
  4. data/lib/alex_codebreaker/exceptions/file_does_not_exist.rb +5 -0
  5. data/lib/alex_codebreaker/exceptions/invalid_digit.rb +5 -0
  6. data/lib/alex_codebreaker/exceptions/invalid_length.rb +5 -0
  7. data/lib/alex_codebreaker/exceptions/no_attempts_left.rb +5 -0
  8. data/lib/alex_codebreaker/exceptions/no_hints_left.rb +5 -0
  9. data/lib/alex_codebreaker/exceptions/wrong_class.rb +5 -0
  10. data/lib/alex_codebreaker/exceptions/wrong_difficulty.rb +5 -0
  11. data/lib/alex_codebreaker/game.rb +80 -0
  12. data/lib/alex_codebreaker/modules/difficulty_levels.rb +22 -0
  13. data/lib/alex_codebreaker/modules/files.rb +3 -0
  14. data/lib/alex_codebreaker/modules/game_messages.rb +4 -0
  15. data/lib/alex_codebreaker/modules/validators/arguments_validation.rb +16 -0
  16. data/lib/alex_codebreaker/modules/validators/validators.rb +19 -0
  17. data/lib/alex_codebreaker/players_rating.rb +26 -0
  18. data/lib/alex_codebreaker/session.rb +32 -0
  19. data/lib/alex_codebreaker/version.rb +1 -1
  20. data/lib/config/gem.rb +5 -0
  21. data/lib/config/locales/en.yml +12 -3
  22. metadata +18 -33
  23. data/.fasterer.yml +0 -5
  24. data/.gitignore +0 -86
  25. data/.overcommit.yml +0 -40
  26. data/.rspec +0 -1
  27. data/.rubocop.yml +0 -11
  28. data/.ruby-gemset +0 -1
  29. data/.ruby-version +0 -1
  30. data/CHANGELOG.md +0 -1
  31. data/CODE_OF_CONDUCT.md +0 -74
  32. data/Gemfile +0 -4
  33. data/Gemfile.lock +0 -91
  34. data/Rakefile +0 -2
  35. data/alex_codebreaker.gemspec +0 -42
  36. data/bin/console +0 -14
  37. data/bin/setup +0 -8
  38. data/lib/alex_codebreaker/test.rb +0 -7
  39. data/lib/config/application.rb +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47ea12b306656e7c1848fe9b601e3db8ddad25a705664bf1a8c896ace3fc9b38
4
- data.tar.gz: cee4b5412e0dbec131edadbc2d5d4f212f95c1914bd9897c2975ceccd6655dd7
3
+ metadata.gz: f18cfa67f231f11172b1ba9a7d7a7b0cb1422388f19035108d2aa89f82c01efa
4
+ data.tar.gz: 37623313c45504b3946bef46091f0075fb22041f693ea95990d058081225a455
5
5
  SHA512:
6
- metadata.gz: e9f1b85c0fbc6ca5f2d6b696ae75e79e931915683853d4d119f12aee40cadd1bcba9f4fd80f41b7ac9595f6e0fc4bdbe63af227554b5f00be973b568caf31ae4
7
- data.tar.gz: b98d393c51aa1186fa4ec12c673f0505b51393de1f172c00984cd6cdc9282617841649da9b1d6966ee86ea6b01a4b1b4e64b45e0e490ab78a86c8f7481ceb396
6
+ metadata.gz: 5839469508281a0062cd4c716627a0c735056e3fd288d9ddb7a28be4947fc630346a903da1315b90a43764b5d1b52ec4fa8d123121ffcc6ac8fd7fc808706ce8
7
+ data.tar.gz: b14f877f74a5e2a2f9598c04a2a7d487082a5480570b6a5012ef9d366600ea010495005127554f5adb6109804f34c9eef4d98be1475a6481f8d26a3ea32f1f5b
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Codebreaker
2
2
 
3
- This gem contain business logic for codebreaker game.
3
+ This pearl contains the business logic for codebreaker game.
4
4
 
5
5
  ## Installation
6
6
 
@@ -1,13 +1,17 @@
1
- require 'i18n'
2
- require 'config/application.rb'
3
- require 'alex_codebreaker/version'
4
-
5
- module AlexCodebreaker
6
- class NumberChecker
7
- def self.number_check(number)
8
- return I18n.t(:guessed) if number == 1111
9
-
10
- I18n.t(:not_guessed)
11
- end
12
- end
13
- end
1
+ require_relative 'config/gem.rb'
2
+ require_relative 'alex_codebreaker/version'
3
+ require_relative 'alex_codebreaker/modules/files'
4
+ require_relative 'alex_codebreaker/modules/game_messages'
5
+ require_relative 'alex_codebreaker/modules/difficulty_levels'
6
+ require_relative 'alex_codebreaker/modules/validators/validators'
7
+ require_relative 'alex_codebreaker/modules/validators/arguments_validation'
8
+ require_relative 'alex_codebreaker/exceptions/file_does_not_exist'
9
+ require_relative 'alex_codebreaker/exceptions/invalid_digit'
10
+ require_relative 'alex_codebreaker/exceptions/invalid_length'
11
+ require_relative 'alex_codebreaker/exceptions/no_attempts_left'
12
+ require_relative 'alex_codebreaker/exceptions/no_hints_left'
13
+ require_relative 'alex_codebreaker/exceptions/wrong_class'
14
+ require_relative 'alex_codebreaker/exceptions/wrong_difficulty'
15
+ require_relative 'alex_codebreaker/game'
16
+ require_relative 'alex_codebreaker/players_rating'
17
+ require_relative 'alex_codebreaker/session'
@@ -0,0 +1,5 @@
1
+ class FileDoesNotExist < StandardError
2
+ def initialize(msg = I18n.t(:file_does_not_exist_message))
3
+ super(msg)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class InvalidDigit < StandardError
2
+ def initialize(msg = I18n.t(:invalid_digit_message))
3
+ super(msg)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class InvalidLength < StandardError
2
+ def initialize(msg = I18n.t(:invalid_length_message))
3
+ super(msg)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class NoAttemptsLeft < StandardError
2
+ def initialize(msg = I18n.t(:no_attempts_left_message))
3
+ super(msg)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class NoHintsLeft < StandardError
2
+ def initialize(msg = I18n.t(:no_hints_left_message))
3
+ super(msg)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class WrongClass < StandardError
2
+ def initialize(msg = I18n.t(:wrong_class_message))
3
+ super(msg)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class WrongDifficulty < StandardError
2
+ def initialize(msg = I18n.t(:wrong_difficulty_message))
3
+ super(msg)
4
+ end
5
+ end
@@ -0,0 +1,80 @@
1
+ class Game
2
+ include ArgumentsValidation
3
+
4
+ attr_reader :session
5
+
6
+ def start
7
+ @secret_code = Array.new(4) { rand(1..6) }
8
+ @session = Session.new
9
+ @win_status = false
10
+ end
11
+
12
+ def add_player_name(given_name)
13
+ @session.player_name = name_validation(given_name)
14
+ end
15
+
16
+ def choose_difficulty(chosen_difficulty)
17
+ @session.difficulty_manager(chosen_difficulty.to_sym)
18
+ end
19
+
20
+ def hint
21
+ raise NoHintsLeft if @session.hints_used >= @session.hints_total
22
+
23
+ @session.hints_used += 1
24
+ @secret_code_for_hint ||= @secret_code.clone.uniq
25
+ @secret_code_for_hint.delete(@secret_code_for_hint.sample)
26
+ end
27
+
28
+ def guess(user_input)
29
+ guess_validation(user_input)
30
+ raise NoAttemptsLeft if @session.attempts_used >= @session.attempts_total
31
+
32
+ @session.attempts_used += 1
33
+ @win_status = true if comparator(user_input.to_s) == GameMessages::WIN_CONDITION
34
+ comparator(user_input.to_s)
35
+ end
36
+
37
+ def save_game
38
+ @session.save_session_statistic if @win_status
39
+ end
40
+
41
+ def show_secret_code
42
+ @secret_code.join if @win_status
43
+ end
44
+
45
+ private
46
+
47
+ def comparator(user_input)
48
+ user_input = user_input.chars.map!(&:to_i)
49
+ @secret_code_for_comparison = @secret_code.clone
50
+ user_input = matching_numbers_and_indexes(user_input)
51
+ user_input = matching_only_numbers(user_input).sort
52
+ user_input.rotate(user_input.count(' ')).join
53
+ end
54
+
55
+ def matching_numbers_and_indexes(user_input)
56
+ user_input.map.with_index do |value, index|
57
+ if value == @secret_code_for_comparison[index]
58
+ @secret_code_for_comparison[index] = nil
59
+ GameMessages::MATCHING[:number_and_index]
60
+ elsif !@secret_code_for_comparison.include?(value)
61
+ GameMessages::MATCHING[:no_matching]
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def matching_only_numbers(user_input)
69
+ user_input.map do |value|
70
+ if @secret_code_for_comparison.include?(value)
71
+ @secret_code_for_comparison.delete(value)
72
+ GameMessages::MATCHING[:only_number]
73
+ elsif [GameMessages::MATCHING[:number_and_index], GameMessages::MATCHING[:no_matching]].include?(value)
74
+ value
75
+ else
76
+ GameMessages::MATCHING[:no_matching]
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,22 @@
1
+ module DifficultyLevels
2
+ DIFFICULTY_LEVELS = {
3
+ Easy: {
4
+ name: :easy,
5
+ level: 0,
6
+ attempts_total: 15,
7
+ hints_total: 2
8
+ },
9
+ Medium: {
10
+ name: :medium,
11
+ level: 1,
12
+ attempts_total: 10,
13
+ hints_total: 1
14
+ },
15
+ Hell: {
16
+ name: :hell,
17
+ level: 2,
18
+ attempts_total: 5,
19
+ hints_total: 1
20
+ }
21
+ }.freeze
22
+ end
@@ -0,0 +1,3 @@
1
+ module Files
2
+ STATS_FILE = 'stats.yml'.freeze
3
+ end
@@ -0,0 +1,4 @@
1
+ module GameMessages
2
+ WIN_CONDITION = '++++'.freeze
3
+ MATCHING = { number_and_index: '+', only_number: '-', no_matching: ' ' }.freeze
4
+ end
@@ -0,0 +1,16 @@
1
+ module ArgumentsValidation
2
+ include Validators
3
+
4
+ def name_validation(name)
5
+ argument_instance_check(name, String)
6
+ argument_length_check(name, max: 20, min: 3)
7
+ name
8
+ end
9
+
10
+ def guess_validation(guess)
11
+ argument_instance_check(guess, Integer)
12
+ argument_fixed_length_check(guess, 4)
13
+ digits_check(guess)
14
+ guess
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ module Validators
2
+ def argument_instance_check(arg, checking_class)
3
+ raise WrongClass, (I18n.t(:value_instance_of) + checking_class.to_s) unless arg.instance_of?(checking_class)
4
+ end
5
+
6
+ def argument_fixed_length_check(arg, fix_length)
7
+ message = I18n.t(:invalid_argument_length) + fix_length.to_s + I18n.t(:given) + arg.to_s.length.to_s
8
+ raise InvalidLength, message unless arg.to_s.length == fix_length
9
+ end
10
+
11
+ def argument_length_check(arg, max: nil, min: nil)
12
+ raise InvalidLength, (I18n.t(:argument_length_long) + max.to_s) if max && arg.length > max
13
+ raise InvalidLength, (I18n.t(:argument_length_short) + min.to_s) if min && arg.length < min
14
+ end
15
+
16
+ def digits_check(arg)
17
+ raise InvalidDigit unless arg.to_s.split('').map { |value| value unless value.to_i.between?(1, 6) }.compact.empty?
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ class PlayersRating
2
+ attr_accessor :stats
3
+
4
+ def initialize
5
+ stats_loader
6
+ end
7
+
8
+ private
9
+
10
+ def stats_loader
11
+ raise FileDoesNotExist unless File.exist?(Files::STATS_FILE)
12
+
13
+ load_stats
14
+ sort_players_rating
15
+ end
16
+
17
+ def load_stats
18
+ File.open(Files::STATS_FILE) do |file|
19
+ @stats = Array.new(Psych.load_stream(file))
20
+ end
21
+ end
22
+
23
+ def sort_players_rating
24
+ @stats.sort_by! { |value| [-value.difficulty_level, value.attempts_used, value.hints_used] }
25
+ end
26
+ end
@@ -0,0 +1,32 @@
1
+ class Session
2
+ attr_reader :difficulty_name, :difficulty_level, :attempts_total, :hints_total
3
+
4
+ attr_accessor :player_name, :attempts_used, :hints_used
5
+
6
+ def initialize
7
+ @attempts_used = 0
8
+ @hints_used = 0
9
+ end
10
+
11
+ def difficulty_manager(difficulty)
12
+ if DifficultyLevels::DIFFICULTY_LEVELS.include?(difficulty)
13
+ add_difficulty(DifficultyLevels::DIFFICULTY_LEVELS[difficulty])
14
+ end
15
+ raise WrongDifficulty unless DifficultyLevels::DIFFICULTY_LEVELS.include?(difficulty)
16
+ end
17
+
18
+ def save_session_statistic
19
+ File.open(Files::STATS_FILE, 'a') do |file|
20
+ file.write(to_yaml)
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def add_difficulty(difficulty)
27
+ @difficulty_name = difficulty[:name]
28
+ @difficulty_level = difficulty[:level]
29
+ @attempts_total = difficulty[:attempts_total]
30
+ @hints_total = difficulty[:hints_total]
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module AlexCodebreaker
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
@@ -0,0 +1,5 @@
1
+ require 'yaml'
2
+ require 'i18n'
3
+
4
+ I18n.load_path << Dir[File.expand_path('locales', __dir__) + '/*.yml']
5
+ I18n.default_locale = :en
@@ -1,4 +1,13 @@
1
1
  en:
2
- guessed: 'Guessed!'
3
- not_guessed: 'Not guessed!'
4
- test_message: 'This is a test!'
2
+ file_does_not_exist_message: "Stats file doesn't exist."
3
+ invalid_digit_message: "All digits must be in the range 1-6."
4
+ invalid_length_message: "Invalid argument length."
5
+ no_attempts_left_message: "No attempts left."
6
+ no_hints_left_message: "No hints left."
7
+ wrong_class_message: "Wrong Class of argument."
8
+ wrong_difficulty_message: "Chosen difficulty doesn't exist"
9
+ value_instance_of: "Value must be instance of "
10
+ invalid_argument_length: "Invalid argument length. Expected: "
11
+ given: ". Given: "
12
+ argument_length_long: "Argument length must be less than "
13
+ argument_length_short: "Argument length must be more than "
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alex_codebreaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksandr Loza
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-22 00:00:00.000000000 Z
11
+ date: 2019-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.0'
41
- - !ruby/object:Gem::Dependency
42
- name: bundler-audit
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.6.1
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.6.1
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: fasterer
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -171,27 +157,26 @@ executables: []
171
157
  extensions: []
172
158
  extra_rdoc_files: []
173
159
  files:
174
- - ".fasterer.yml"
175
- - ".gitignore"
176
- - ".overcommit.yml"
177
- - ".rspec"
178
- - ".rubocop.yml"
179
- - ".ruby-gemset"
180
- - ".ruby-version"
181
- - CHANGELOG.md
182
- - CODE_OF_CONDUCT.md
183
- - Gemfile
184
- - Gemfile.lock
185
160
  - LICENSE.txt
186
161
  - README.md
187
- - Rakefile
188
- - alex_codebreaker.gemspec
189
- - bin/console
190
- - bin/setup
191
162
  - lib/alex_codebreaker.rb
192
- - lib/alex_codebreaker/test.rb
163
+ - lib/alex_codebreaker/exceptions/file_does_not_exist.rb
164
+ - lib/alex_codebreaker/exceptions/invalid_digit.rb
165
+ - lib/alex_codebreaker/exceptions/invalid_length.rb
166
+ - lib/alex_codebreaker/exceptions/no_attempts_left.rb
167
+ - lib/alex_codebreaker/exceptions/no_hints_left.rb
168
+ - lib/alex_codebreaker/exceptions/wrong_class.rb
169
+ - lib/alex_codebreaker/exceptions/wrong_difficulty.rb
170
+ - lib/alex_codebreaker/game.rb
171
+ - lib/alex_codebreaker/modules/difficulty_levels.rb
172
+ - lib/alex_codebreaker/modules/files.rb
173
+ - lib/alex_codebreaker/modules/game_messages.rb
174
+ - lib/alex_codebreaker/modules/validators/arguments_validation.rb
175
+ - lib/alex_codebreaker/modules/validators/validators.rb
176
+ - lib/alex_codebreaker/players_rating.rb
177
+ - lib/alex_codebreaker/session.rb
193
178
  - lib/alex_codebreaker/version.rb
194
- - lib/config/application.rb
179
+ - lib/config/gem.rb
195
180
  - lib/config/locales/en.yml
196
181
  homepage: https://github.com/Alexwell/codebreaker/tree/feature/initial-gem-settings
197
182
  licenses:
@@ -1,5 +0,0 @@
1
- speedups:
2
- each_with_index_vs_while: false
3
-
4
- exclude_paths:
5
- - spec/**/*.rb
data/.gitignore DELETED
@@ -1,86 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- *.gem
11
- *.rbc
12
- /.config
13
- /coverage/
14
- /InstalledFiles
15
- /pkg/
16
- /spec/reports/
17
- /spec/examples.txt
18
- /test/tmp/
19
- /test/version_tmp/
20
- /tmp/
21
-
22
- # Used by dotenv library to load environment variables.
23
- # .env
24
-
25
- # Ignore Byebug command history file.
26
- .byebug_history
27
-
28
- ## Specific to RubyMotion:
29
- .dat*
30
- .repl_history
31
- build/
32
- *.bridgesupport
33
- build-iPhoneOS/
34
- build-iPhoneSimulator/
35
-
36
- ## Specific to RubyMotion (use of CocoaPods):
37
- #
38
- # We recommend against adding the Pods directory to your .gitignore. However
39
- # you should judge for yourself, the pros and cons are mentioned at:
40
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
41
- #
42
- # vendor/Pods/
43
-
44
- ## Documentation cache and generated files:
45
- /.yardoc/
46
- /_yardoc/
47
- /doc/
48
- /rdoc/
49
-
50
- ## Environment normalization:
51
- /.bundle/
52
- /vendor/bundle
53
- /lib/bundler/man/
54
-
55
- # for a library or gem, you might want to ignore these files since the code is
56
- # intended to run in multiple environments; otherwise, check them in:
57
- # Gemfile.lock
58
- # .ruby-version
59
- # .ruby-gemset
60
-
61
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
62
- .rvmrc
63
-
64
- # Used by RuboCop. Remote config files pulled in from inherit_from directive.
65
- # .rubocop-https?--*
66
-
67
- *~
68
-
69
- # temporary files which can be created if a process still has a handle open of a deleted file
70
- .fuse_hidden*
71
-
72
- # KDE directory preferences
73
- .directory
74
-
75
- # Linux trash folder which might appear on any partition or disk
76
- .Trash-*
77
-
78
- # .nfs files are created when an open file is removed but is still being accessed
79
- .nfs*
80
-
81
- .vscode/*
82
- !.vscode/settings.json
83
- !.vscode/tasks.json
84
- !.vscode/launch.json
85
- !.vscode/extensions.json
86
- *.code-workspace
@@ -1,40 +0,0 @@
1
- CommitMsg:
2
- CapitalizedSubject:
3
- enabled: false
4
-
5
- EmptyMessage:
6
- enabled: false
7
-
8
- TrailingPeriod:
9
- enabled: true
10
-
11
- TextWidth:
12
- enabled: false
13
-
14
- PreCommit:
15
- ALL:
16
- on_warn: fail
17
-
18
- AuthorEmail:
19
- enabled: true
20
-
21
- AuthorName:
22
- enabled: true
23
-
24
- MergeConflicts:
25
- enabled: true
26
-
27
- YamlSyntax:
28
- enabled: true
29
-
30
- BundleCheck:
31
- enabled: true
32
-
33
- RuboCop:
34
- enabled: true
35
-
36
- Fasterer:
37
- enabled: true
38
-
39
- BundlerAudit:
40
- enabled: true
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --require spec_helper
@@ -1,11 +0,0 @@
1
- require:
2
- - rubocop-rspec
3
-
4
- Style/Documentation:
5
- Enabled: false
6
-
7
- Style/FrozenStringLiteralComment:
8
- Enabled: false
9
-
10
- Metrics/LineLength:
11
- Max: 120
@@ -1 +0,0 @@
1
- alex_codebreaker
@@ -1 +0,0 @@
1
- 2.6.5
@@ -1 +0,0 @@
1
- version 0.1.0
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at alexwebq@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in alex_codebreaker.gemspec
4
- gemspec
@@ -1,91 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- alex_codebreaker (0.1.3)
5
- i18n (~> 1.7)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- ast (2.4.0)
11
- bundler-audit (0.6.1)
12
- bundler (>= 1.2.0, < 3)
13
- thor (~> 0.18)
14
- childprocess (3.0.0)
15
- coderay (1.1.2)
16
- colorize (0.8.1)
17
- concurrent-ruby (1.1.5)
18
- diff-lcs (1.3)
19
- docile (1.3.2)
20
- fasterer (0.8.0)
21
- colorize (~> 0.7)
22
- ruby_parser (>= 3.14.1)
23
- i18n (1.7.0)
24
- concurrent-ruby (~> 1.0)
25
- iniparse (1.4.4)
26
- jaro_winkler (1.5.4)
27
- json (2.2.0)
28
- method_source (0.9.2)
29
- overcommit (0.51.0)
30
- childprocess (>= 0.6.3, < 4)
31
- iniparse (~> 1.4)
32
- parallel (1.19.0)
33
- parser (2.6.5.0)
34
- ast (~> 2.4.0)
35
- pry (0.12.2)
36
- coderay (~> 1.1.0)
37
- method_source (~> 0.9.0)
38
- rainbow (3.0.0)
39
- rake (10.5.0)
40
- rspec (3.9.0)
41
- rspec-core (~> 3.9.0)
42
- rspec-expectations (~> 3.9.0)
43
- rspec-mocks (~> 3.9.0)
44
- rspec-core (3.9.0)
45
- rspec-support (~> 3.9.0)
46
- rspec-expectations (3.9.0)
47
- diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.9.0)
49
- rspec-mocks (3.9.0)
50
- diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.9.0)
52
- rspec-support (3.9.0)
53
- rubocop (0.76.0)
54
- jaro_winkler (~> 1.5.1)
55
- parallel (~> 1.10)
56
- parser (>= 2.6)
57
- rainbow (>= 2.2.2, < 4.0)
58
- ruby-progressbar (~> 1.7)
59
- unicode-display_width (>= 1.4.0, < 1.7)
60
- rubocop-rspec (1.36.0)
61
- rubocop (>= 0.68.1)
62
- ruby-progressbar (1.10.1)
63
- ruby_parser (3.14.1)
64
- sexp_processor (~> 4.9)
65
- sexp_processor (4.13.0)
66
- simplecov (0.17.1)
67
- docile (~> 1.1)
68
- json (>= 1.8, < 3)
69
- simplecov-html (~> 0.10.0)
70
- simplecov-html (0.10.2)
71
- thor (0.20.3)
72
- unicode-display_width (1.6.0)
73
-
74
- PLATFORMS
75
- ruby
76
-
77
- DEPENDENCIES
78
- alex_codebreaker!
79
- bundler (~> 2.0)
80
- bundler-audit (~> 0.6.1)
81
- fasterer (~> 0.8.0)
82
- overcommit (~> 0.51.0)
83
- pry (~> 0.12.2)
84
- rake (~> 10.0)
85
- rspec (~> 3.9)
86
- rubocop (~> 0.76.0)
87
- rubocop-rspec (~> 1.36)
88
- simplecov (~> 0.17.1)
89
-
90
- BUNDLED WITH
91
- 2.0.2
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- task default: :spec
@@ -1,42 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'alex_codebreaker/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'alex_codebreaker'
7
- spec.version = AlexCodebreaker::VERSION
8
- spec.authors = ['Oleksandr Loza']
9
- spec.email = ['alexwebq@gmail.com']
10
-
11
- spec.summary = 'Codebreaker, fourth home task'
12
- spec.description = 'Codebreaker game business logic'
13
- spec.homepage = 'https://github.com/Alexwell/codebreaker/tree/feature/initial-gem-settings'
14
- spec.license = 'MIT'
15
-
16
- spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
17
-
18
- spec.metadata['homepage_uri'] = spec.homepage
19
- spec.metadata['source_code_uri'] = 'https://github.com/Alexwell/codebreaker/tree/feature/initial-gem-settings'
20
- spec.metadata['changelog_uri'] = 'https://github.com/Alexwell/codebreaker/tree/feature/initial-gem-settings/CHANGELOG.md'
21
-
22
- # Specify which files should be added to the gem when it is released.
23
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- end
27
- spec.bindir = 'exe'
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
- spec.require_paths = ['lib']
30
-
31
- spec.add_dependency 'i18n', '~> 1.7'
32
- spec.add_development_dependency 'bundler', '~> 2.0'
33
- spec.add_development_dependency 'bundler-audit', '~> 0.6.1'
34
- spec.add_development_dependency 'fasterer', '~> 0.8.0'
35
- spec.add_development_dependency 'overcommit', '~> 0.51.0'
36
- spec.add_development_dependency 'pry', '~> 0.12.2'
37
- spec.add_development_dependency 'rake', '~> 10.0'
38
- spec.add_development_dependency 'rspec', '~> 3.9'
39
- spec.add_development_dependency 'rubocop', '~> 0.76.0'
40
- spec.add_development_dependency 'rubocop-rspec', '~> 1.36'
41
- spec.add_development_dependency 'simplecov', '~> 0.17.1'
42
- end
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'alex_codebreaker'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,7 +0,0 @@
1
- module AlexCodebreaker
2
- class Test
3
- def self.test_method
4
- I18n.t(:test_message)
5
- end
6
- end
7
- end
@@ -1,2 +0,0 @@
1
- I18n.load_path << Dir[File.expand_path('lib/config/locales') + '/*.yml']
2
- I18n.default_locale = :en