MonkeyEngine 1.1.0 → 2.0.1

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.
Files changed (72) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +19 -16
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +192 -0
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +10 -2
  7. data/Gemfile +3 -1
  8. data/Gemfile.lock +70 -0
  9. data/Rakefile +3 -2
  10. data/dictionaries/en-US.txt +466554 -0
  11. data/lib/Action/action.rb +5 -6
  12. data/lib/Monkey/monkey.rb +17 -13
  13. data/lib/Monkey.rb +3 -1
  14. data/lib/MonkeyAction/monkey_action.rb +3 -3
  15. data/lib/MonkeyAction/monkey_action_dead.rb +8 -8
  16. data/lib/MonkeyAction/monkey_action_eat.rb +6 -6
  17. data/lib/MonkeyAction/monkey_action_pause.rb +6 -7
  18. data/lib/MonkeyAction/monkey_action_sleep.rb +6 -6
  19. data/lib/MonkeyAction/monkey_action_type.rb +15 -12
  20. data/lib/MonkeyAction/monkey_action_wake.rb +8 -8
  21. data/lib/MonkeyAction/monkey_timed_action.rb +6 -6
  22. data/lib/MonkeyActions.rb +2 -0
  23. data/lib/MonkeyEngine/action_rules.rb +20 -18
  24. data/lib/MonkeyEngine/exceptions.rb +7 -7
  25. data/lib/MonkeyEngine/monkey_engine.rb +11 -14
  26. data/lib/MonkeyEngine/version.rb +3 -1
  27. data/lib/MonkeyEngine.rb +3 -1
  28. data/lib/MonkeyFactory/monkey_factory.rb +3 -4
  29. data/lib/MonkeyFactory.rb +3 -1
  30. data/lib/MonkeyKeyboard/keyboard_char.rb +3 -3
  31. data/lib/MonkeyKeyboard/keyboard_input.rb +4 -3
  32. data/lib/MonkeyKeyboard/keyboard_key.rb +12 -10
  33. data/lib/MonkeyKeyboard/keyboard_key_evaluator.rb +6 -8
  34. data/lib/MonkeyKeyboard/monkey_keyboard_en_us.rb +100 -80
  35. data/lib/MonkeyKeyboardEnUs.rb +3 -1
  36. data/lib/MonkeyManager/monkey_manager.rb +17 -15
  37. data/lib/MonkeyManager.rb +3 -1
  38. data/lib/MonkeyService/monkey_service.rb +8 -9
  39. data/lib/MonkeyService.rb +3 -1
  40. data/lib/tasks/engine.rb +63 -54
  41. data/monkeyengine.gemspec +26 -20
  42. data/spec/action_rules_spec.rb +17 -23
  43. data/spec/engine_spec.rb +15 -20
  44. data/spec/keyboard_char_spec.rb +4 -5
  45. data/spec/keyboard_key_spec.rb +8 -9
  46. data/spec/monkey_action_eat_spec.rb +17 -18
  47. data/spec/monkey_action_pause_spec.rb +19 -20
  48. data/spec/monkey_action_sleep_spec.rb +19 -20
  49. data/spec/monkey_action_type_spec.rb +25 -24
  50. data/spec/monkey_action_wake_spec.rb +10 -11
  51. data/spec/monkey_factory_spec.rb +7 -15
  52. data/spec/monkey_keyboard_en_us_spec.rb +10 -19
  53. data/spec/monkey_manager_spec.rb +3 -2
  54. data/spec/monkey_service_spec.rb +26 -29
  55. data/spec/monkey_spec.rb +3 -2
  56. data/spec/{spec_helpers.rb → spec_helper.rb} +7 -5
  57. data/spec/support/shared_examples.rb +16 -16
  58. metadata +69 -55
  59. data/.idea/.name +0 -1
  60. data/.idea/.rakeTasks +0 -7
  61. data/.idea/MonkeyEngine.iml +0 -133
  62. data/.idea/codeStyleSettings.xml +0 -13
  63. data/.idea/encodings.xml +0 -5
  64. data/.idea/misc.xml +0 -5
  65. data/.idea/modules.xml +0 -9
  66. data/.idea/runConfigurations/All_specs_in_test__MonkeyEngine.xml +0 -38
  67. data/.idea/runConfigurations/IRB_console.xml +0 -25
  68. data/.idea/runConfigurations/Start_Yard_Server.xml +0 -26
  69. data/.idea/runConfigurations/monkey_run.xml +0 -26
  70. data/.idea/scopes/scope_settings.xml +0 -5
  71. data/.idea/vcs.xml +0 -7
  72. data/.idea/workspace.xml +0 -886
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e0924ae5fddd5e3930bc413874379031b2602b6b
4
- data.tar.gz: 093a6b9fa64beb733d917ca59bcfbf14bd38acdb
2
+ SHA256:
3
+ metadata.gz: 1fdf0a5f0ea4f5c0f273c39861ecba684ce0946e7d79e3614b02b21a31f9297d
4
+ data.tar.gz: 7fb57980b14f6997f3dbc0f3318098e8a88d378643d14f8082462169d9557c98
5
5
  SHA512:
6
- metadata.gz: 3ba12279435ef01bcfc4bfb96a3ae7a7cd61c30a823dd6ef2f83ecc1758365e278e038f3a323ee97c930b72b32b4754988c181ffe94331fc44c7238a59e30d0f
7
- data.tar.gz: 3cbbab73c83c2d064cdb4de4409275238a0257609b8fb760626aa39913802c309e3f452e30e9a19bc859b1e8ab4787a34a7d43ef1733bbe1d018596a99fa7b39
6
+ metadata.gz: c8d7d05635c56b4576cc2661cfd57926d421dda2282002f0b85c4769e5b6f0d49afbf61cd245f85be427d9f1b348d8ea651bfd4cf50319a7bb2192f8dabe0cda
7
+ data.tar.gz: 765db556503e17d6a1d048cb21727e614a8902cd01e1ca0484d1871478d83e3affc56b156a3b81c99f303bd08fbc1eb9d75cb71479b28bf3298a5e5c1009b4d7
data/.gitignore CHANGED
@@ -1,17 +1,20 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ /rdoc/
1
11
  *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
15
+
16
+ /.vscode/
17
+ *.code-workspace
18
+
19
+ scratch.rb
20
+ readme.txt
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,192 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.0.1
7
+ NewCops: enable
8
+ Exclude:
9
+ - '.git/**/*'
10
+ - '.idea/**/*'
11
+ - 'init/*'
12
+ - 'Rakefile'
13
+ - '*.gemspec'
14
+ # - 'spec/**/*'
15
+ - 'vendor/**/*'
16
+ - 'scratch*.rb'
17
+ - 'snippets*.rb'
18
+
19
+ # Align the elements of a hash literal if they span more than one line.
20
+ Layout/HashAlignment:
21
+ EnforcedLastArgumentHashStyle: always_ignore
22
+
23
+ # Alignment of parameters in multi-line method definition.
24
+ # The `with_fixed_indentation` style aligns the following lines with one
25
+ # level of indentation relative to the start of the line with the method
26
+ # definition.
27
+ #
28
+ # def my_method(a,
29
+ # b)
30
+ Layout/ParameterAlignment:
31
+ EnforcedStyle: with_fixed_indentation
32
+
33
+ # Alignment of parameters in multi-line method call.
34
+ # The `with_fixed_indentation` style aligns the following lines with one
35
+ # level of indentation relative to the start of the line with the method call.
36
+ #
37
+ # my_method(a,
38
+ # b)
39
+ Layout/ArgumentAlignment:
40
+ EnforcedStyle: with_fixed_indentation
41
+
42
+ # a = case n
43
+ # when 0
44
+ # x * 2
45
+ # else
46
+ # y / 3
47
+ # end
48
+ Layout/CaseIndentation:
49
+ EnforcedStyle: end
50
+
51
+ # Enforces a configured order of definitions within a class body
52
+ Layout/ClassStructure:
53
+ Enabled: true
54
+
55
+ # Align `end` with the matching keyword or starting expression except for
56
+ # assignments, where it should be aligned with the LHS.
57
+ Layout/EndAlignment:
58
+ EnforcedStyleAlignWith: variable
59
+ AutoCorrect: true
60
+
61
+ # The `consistent` style enforces that the first element in an array
62
+ # literal where the opening bracket and the first element are on
63
+ # seprate lines is indented the same as an array literal which is not
64
+ # defined inside a method call.
65
+ Layout/FirstArrayElementIndentation:
66
+ EnforcedStyle: consistent
67
+
68
+ # The `consistent` style enforces that the first key in a hash
69
+ # literal where the opening brace and the first key are on
70
+ # seprate lines is indented the same as a hash literal which is not
71
+ # defined inside a method call.
72
+ Layout/FirstHashElementIndentation:
73
+ EnforcedStyle: consistent
74
+
75
+ # Indent multi-line methods instead of aligning with periods
76
+ Layout/MultilineMethodCallIndentation:
77
+ EnforcedStyle: indented
78
+
79
+ # Allow `debug` in tasks for now
80
+ Lint/Debugger:
81
+ Exclude:
82
+ - 'RakeFile'
83
+
84
+ # A calculated magnitude based on number of assignments, branches, and
85
+ # conditions.
86
+ # NOTE: This is temporarily disabled until we can eliminate existing Rubocop
87
+ # complaints
88
+ Metrics/AbcSize:
89
+ Enabled: false
90
+
91
+ # Avoid long blocks with many lines.
92
+ Metrics/BlockLength:
93
+ Exclude:
94
+ - 'RakeFile'
95
+ - 'db/seeds.rb'
96
+ - 'spec/**/*.rb'
97
+
98
+ # Avoid classes longer than 100 lines of code.
99
+ # NOTE: This is temporarily disabled until we can eliminate existing Rubocop
100
+ # complaints
101
+ Metrics/ClassLength:
102
+ Max: 200
103
+ Exclude:
104
+ - 'spec/**/*.rb'
105
+
106
+ # A complexity metric that is strongly correlated to the number of test cases
107
+ # needed to validate a method.
108
+ Metrics/CyclomaticComplexity:
109
+ Max: 9
110
+
111
+ # Limit lines to 80 characters
112
+ Layout/LineLength:
113
+ Exclude:
114
+ - 'RakeFile'
115
+ - 'spec/**/*.rb'
116
+
117
+ # Avoid methods longer than 15 lines of code.
118
+ Metrics/MethodLength:
119
+ Max: 20
120
+ AllowedMethods:
121
+ - swagger_path
122
+ - operation
123
+
124
+
125
+ # A complexity metric geared towards measuring complexity for a human reader.
126
+ Metrics/PerceivedComplexity:
127
+ Max: 10
128
+
129
+ NestedGroups:
130
+ Max: 4
131
+
132
+ # Naming/FileName:
133
+ # Exclude:
134
+ # - 'lib/file.rb'
135
+
136
+ # Allow `downcase == ` instead of forcing `casecmp`
137
+ Performance/Casecmp:
138
+ Enabled: false
139
+
140
+ # Require children definitions to be nested or compact in classes and modules
141
+ Style/ClassAndModuleChildren:
142
+ Enabled: false
143
+
144
+ # Document classes and non-namespace modules.
145
+ # (Disabled for now, may revisit later)
146
+ Style/Documentation:
147
+ Enabled: false
148
+
149
+ # Checks the formatting of empty method definitions.
150
+ Style/EmptyMethod:
151
+ EnforcedStyle: expanded
152
+
153
+ # Add the frozen_string_literal comment to the top of files to help transition
154
+ # to frozen string literals by default.
155
+ Style/FrozenStringLiteralComment:
156
+ EnforcedStyle: always
157
+
158
+ # Check for conditionals that can be replaced with guard clauses
159
+ Style/GuardClause:
160
+ Enabled: false
161
+
162
+ Style/MixinUsage:
163
+ Exclude:
164
+ - 'RakeFile'
165
+
166
+ # Avoid multi-line method signatures.
167
+ Style/MultilineMethodSignature:
168
+ Enabled: true
169
+
170
+ # Don't use option hashes when you can use keyword arguments.
171
+ Style/OptionHash:
172
+ Enabled: true
173
+
174
+ # Use return instead of return nil.
175
+ Style/ReturnNil:
176
+ Enabled: true
177
+
178
+ # Allow code like `return x, y` as it's occasionally handy.
179
+ Style/RedundantReturn:
180
+ AllowMultipleReturnValues: true
181
+
182
+ # Prefer symbols instead of strings as hash keys.
183
+ Style/StringHashKeys:
184
+ Enabled: true
185
+
186
+ # Checks if configured preferred methods are used over non-preferred.
187
+ Style/StringMethods:
188
+ Enabled: true
189
+
190
+ # Checks for use of parentheses around ternary conditions.
191
+ Style/TernaryParentheses:
192
+ EnforcedStyle: require_parentheses_when_complex
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 3.0.1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### Version 2.0.1
2
+ - Update ruby gems.
3
+ - Various refactors.
4
+
5
+ ### Version 2.0.0
6
+ - Use LittleWeasel gem for dictionary.
7
+ - Gem update to patch CVEs.
8
+
1
9
  ### Version 1.1.0
2
- * Made some changes to the sample rake task $ bundle exec rake engine:run
3
- * Added this CHANGELOG.md file
10
+ - Made some changes to the sample rake task $ bundle exec rake engine:run
11
+ - Added this CHANGELOG.md file
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in monkeyengine.gemspec
4
- gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ MonkeyEngine (2.0.1)
5
+ LittleWeasel (~> 5.0, >= 5.0.3)
6
+ ProtectedConstructor (~> 2.0, >= 2.0.3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ LittleWeasel (5.0.6)
12
+ activesupport (~> 6.1, >= 6.1.3.2)
13
+ ProtectedConstructor (2.1.4)
14
+ activesupport (6.1.7.6)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ tzinfo (~> 2.0)
19
+ zeitwerk (~> 2.3)
20
+ byebug (11.1.3)
21
+ coderay (1.1.3)
22
+ colorize (0.8.1)
23
+ concurrent-ruby (1.2.2)
24
+ diff-lcs (1.5.0)
25
+ i18n (1.14.1)
26
+ concurrent-ruby (~> 1.0)
27
+ method_source (1.0.0)
28
+ minitest (5.19.0)
29
+ pry (0.14.2)
30
+ coderay (~> 1.1)
31
+ method_source (~> 1.0)
32
+ pry-byebug (3.10.1)
33
+ byebug (~> 11.0)
34
+ pry (>= 0.13, < 0.15)
35
+ rake (13.0.6)
36
+ redcarpet (2.3.0)
37
+ rspec (3.12.0)
38
+ rspec-core (~> 3.12.0)
39
+ rspec-expectations (~> 3.12.0)
40
+ rspec-mocks (~> 3.12.0)
41
+ rspec-core (3.12.2)
42
+ rspec-support (~> 3.12.0)
43
+ rspec-expectations (3.12.3)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.12.0)
46
+ rspec-mocks (3.12.6)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-support (3.12.1)
50
+ tzinfo (2.0.6)
51
+ concurrent-ruby (~> 1.0)
52
+ yard (0.9.34)
53
+ zeitwerk (2.6.11)
54
+
55
+ PLATFORMS
56
+ x86_64-darwin-19
57
+ x86_64-darwin-21
58
+
59
+ DEPENDENCIES
60
+ MonkeyEngine!
61
+ bundler (~> 2.3, >= 2.3.20)
62
+ colorize (~> 0.8.1)
63
+ pry-byebug (~> 3.9)
64
+ rake (~> 13.0, >= 13.0.6)
65
+ redcarpet (~> 2.3, >= 2.3.0)
66
+ rspec (~> 3.10)
67
+ yard (~> 0.9.28)
68
+
69
+ BUNDLED WITH
70
+ 2.3.22
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
- require "bundler/gem_tasks"
2
- require File.expand_path('../lib/tasks/engine.rb', __FILE__)
1
+ # frozen_string_literal: true
3
2
 
3
+ require 'bundler/gem_tasks'
4
+ require File.expand_path('lib/tasks/engine.rb', __dir__)