aoc_cli 0.2.2 → 1.0.0

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 (152) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +88 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile +8 -0
  7. data/Gemfile.lock +187 -0
  8. data/README.md +88 -282
  9. data/Rakefile +9 -2
  10. data/Steepfile +13 -0
  11. data/aoc_cli.gemspec +36 -26
  12. data/db/migrate/1_create_events.rb +14 -0
  13. data/db/migrate/2_create_puzzles.rb +21 -0
  14. data/db/migrate/3_create_stats.rb +19 -0
  15. data/db/migrate/4_create_attempts.rb +19 -0
  16. data/db/migrate/5_create_locations.rb +17 -0
  17. data/db/migrate/6_create_puzzle_dir_sync_logs.rb +18 -0
  18. data/exe/aoc +5 -0
  19. data/lib/aoc_cli/components/attempts_table.erb +5 -0
  20. data/lib/aoc_cli/components/attempts_table.rb +58 -0
  21. data/lib/aoc_cli/components/docs_component.erb +19 -0
  22. data/lib/aoc_cli/components/docs_component.rb +41 -0
  23. data/lib/aoc_cli/components/errors_component.erb +8 -0
  24. data/lib/aoc_cli/components/errors_component.rb +36 -0
  25. data/lib/aoc_cli/components/progress_table.erb +1 -0
  26. data/lib/aoc_cli/components/progress_table.rb +43 -0
  27. data/lib/aoc_cli/components/puzzle_sync_component.erb +2 -0
  28. data/lib/aoc_cli/components/puzzle_sync_component.rb +26 -0
  29. data/lib/aoc_cli/configurators/session_configurator.rb +7 -0
  30. data/lib/aoc_cli/controllers/application_controller.rb +27 -0
  31. data/lib/aoc_cli/controllers/concerns/error_concern.rb +17 -0
  32. data/lib/aoc_cli/controllers/concerns/location_concern.rb +79 -0
  33. data/lib/aoc_cli/controllers/default_controller.rb +9 -0
  34. data/lib/aoc_cli/controllers/event_controller.rb +35 -0
  35. data/lib/aoc_cli/controllers/help/event_controller.rb +11 -0
  36. data/lib/aoc_cli/controllers/help/puzzle_controller.rb +13 -0
  37. data/lib/aoc_cli/controllers/puzzle_controller.rb +39 -0
  38. data/lib/aoc_cli/core/attempt_parser.rb +69 -0
  39. data/lib/aoc_cli/core/processor.rb +32 -0
  40. data/lib/aoc_cli/core/repository.rb +74 -0
  41. data/lib/aoc_cli/core/request.rb +37 -0
  42. data/lib/aoc_cli/core/resource.rb +39 -0
  43. data/lib/aoc_cli/core/stats_parser.rb +43 -0
  44. data/lib/aoc_cli/helpers/table_generator.rb +64 -0
  45. data/lib/aoc_cli/helpers/view_helper.rb +35 -0
  46. data/lib/aoc_cli/models/attempt.rb +67 -0
  47. data/lib/aoc_cli/models/event.rb +9 -0
  48. data/lib/aoc_cli/models/location.rb +24 -0
  49. data/lib/aoc_cli/models/puzzle.rb +28 -0
  50. data/lib/aoc_cli/models/puzzle_dir_sync_log.rb +14 -0
  51. data/lib/aoc_cli/models/stats.rb +43 -0
  52. data/lib/aoc_cli/presenters/attempt_presenter.rb +29 -0
  53. data/lib/aoc_cli/presenters/puzzle_presenter.rb +29 -0
  54. data/lib/aoc_cli/presenters/stats_presenter.rb +32 -0
  55. data/lib/aoc_cli/processors/event_initialiser.rb +64 -0
  56. data/lib/aoc_cli/processors/puzzle_dir_synchroniser.rb +80 -0
  57. data/lib/aoc_cli/processors/puzzle_initialiser.rb +91 -0
  58. data/lib/aoc_cli/processors/puzzle_refresher.rb +27 -0
  59. data/lib/aoc_cli/processors/resource_attacher.rb +22 -0
  60. data/lib/aoc_cli/processors/solution_poster.rb +72 -0
  61. data/lib/aoc_cli/processors/stats_initialiser.rb +36 -0
  62. data/lib/aoc_cli/processors/stats_refresher.rb +23 -0
  63. data/lib/aoc_cli/validators/collection_type_validator.rb +57 -0
  64. data/lib/aoc_cli/validators/event_year_validator.rb +42 -0
  65. data/lib/aoc_cli/validators/included_validator.rb +21 -0
  66. data/lib/aoc_cli/validators/integer_validator.rb +32 -0
  67. data/lib/aoc_cli/validators/path_validator.rb +39 -0
  68. data/lib/aoc_cli/validators/type_validator.rb +54 -0
  69. data/lib/aoc_cli/version.rb +1 -1
  70. data/lib/aoc_cli/views/event/attach.erb +3 -0
  71. data/lib/aoc_cli/views/event/init.erb +3 -0
  72. data/lib/aoc_cli/views/help/event/attach.erb +32 -0
  73. data/lib/aoc_cli/views/help/event/init.erb +38 -0
  74. data/lib/aoc_cli/views/help/event/progress.erb +12 -0
  75. data/lib/aoc_cli/views/help/puzzle/attempts.erb +12 -0
  76. data/lib/aoc_cli/views/help/puzzle/init.erb +31 -0
  77. data/lib/aoc_cli/views/help/puzzle/solve.erb +33 -0
  78. data/lib/aoc_cli/views/help/puzzle/sync.erb +32 -0
  79. data/lib/aoc_cli/views/puzzle/init.erb +3 -0
  80. data/lib/aoc_cli/views/puzzle/solve.erb +10 -0
  81. data/lib/aoc_cli.rb +32 -16
  82. data/rbs_collection.lock.yaml +168 -0
  83. data/rbs_collection.yaml +28 -0
  84. data/sig/aoc_cli/components/attempts_table.rbs +29 -0
  85. data/sig/aoc_cli/components/docs_component.rbs +15 -0
  86. data/sig/aoc_cli/components/errors_component.rbs +19 -0
  87. data/sig/aoc_cli/components/progress_table.rbs +28 -0
  88. data/sig/aoc_cli/components/puzzle_sync_component.rbs +19 -0
  89. data/sig/aoc_cli/configurators/session_configurator.rbs +7 -0
  90. data/sig/aoc_cli/controllers/application_controller.rbs +12 -0
  91. data/sig/aoc_cli/controllers/concerns/error_concern.rbs +9 -0
  92. data/sig/aoc_cli/controllers/concerns/location_concern.rbs +35 -0
  93. data/sig/aoc_cli/controllers/default_controller.rbs +7 -0
  94. data/sig/aoc_cli/controllers/event_controller.rbs +18 -0
  95. data/sig/aoc_cli/controllers/help/event_controller.rbs +11 -0
  96. data/sig/aoc_cli/controllers/help/puzzle_controller.rbs +13 -0
  97. data/sig/aoc_cli/controllers/puzzle_controller.rbs +15 -0
  98. data/sig/aoc_cli/core/attempt_parser.rbs +41 -0
  99. data/sig/aoc_cli/core/processor.rbs +25 -0
  100. data/sig/aoc_cli/core/repository.rbs +25 -0
  101. data/sig/aoc_cli/core/request.rbs +29 -0
  102. data/sig/aoc_cli/core/resource.rbs +25 -0
  103. data/sig/aoc_cli/core/stats_parser.rbs +23 -0
  104. data/sig/aoc_cli/helpers/table_generator.rbs +36 -0
  105. data/sig/aoc_cli/helpers/view_helper.rbs +15 -0
  106. data/sig/aoc_cli/models/attempt.rbs +35 -0
  107. data/sig/aoc_cli/models/event.rbs +17 -0
  108. data/sig/aoc_cli/models/location.rbs +19 -0
  109. data/sig/aoc_cli/models/puzzle.rbs +28 -0
  110. data/sig/aoc_cli/models/puzzle_dir_sync_log.rbs +11 -0
  111. data/sig/aoc_cli/models/stats.rbs +53 -0
  112. data/sig/aoc_cli/presenters/attempt_presenter.rbs +13 -0
  113. data/sig/aoc_cli/presenters/puzzle_presenter.rbs +19 -0
  114. data/sig/aoc_cli/presenters/stats_presenter.rbs +19 -0
  115. data/sig/aoc_cli/processors/event_initialiser.rbs +26 -0
  116. data/sig/aoc_cli/processors/puzzle_dir_synchroniser.rbs +40 -0
  117. data/sig/aoc_cli/processors/puzzle_initialiser.rbs +37 -0
  118. data/sig/aoc_cli/processors/puzzle_refresher.rbs +21 -0
  119. data/sig/aoc_cli/processors/resource_attacher.rbs +16 -0
  120. data/sig/aoc_cli/processors/solution_poster.rbs +34 -0
  121. data/sig/aoc_cli/processors/stats_initialiser.rbs +15 -0
  122. data/sig/aoc_cli/processors/stats_refresher.rbs +19 -0
  123. data/sig/aoc_cli/validators/collection_type_validator.rbs +24 -0
  124. data/sig/aoc_cli/validators/event_year_validator.rbs +19 -0
  125. data/sig/aoc_cli/validators/included_validator.rbs +11 -0
  126. data/sig/aoc_cli/validators/integer_validator.rbs +15 -0
  127. data/sig/aoc_cli/validators/path_validator.rbs +17 -0
  128. data/sig/aoc_cli/validators/type_validator.rbs +22 -0
  129. data/sig/aoc_cli.rbs +6 -0
  130. data/sig/http.rbs +3 -0
  131. data/sig/kangaru.rbs +5 -0
  132. data/sig/nokogiri.rbs +3 -0
  133. data/sig/reverse_markdown.rbs +3 -0
  134. metadata +142 -34
  135. data/.gitignore +0 -5
  136. data/bin/aoc +0 -4
  137. data/bin/console +0 -15
  138. data/bin/setup +0 -7
  139. data/lib/aoc_cli/commands.rb +0 -232
  140. data/lib/aoc_cli/database.rb +0 -224
  141. data/lib/aoc_cli/day.rb +0 -124
  142. data/lib/aoc_cli/db/reddit.db +0 -0
  143. data/lib/aoc_cli/errors.rb +0 -275
  144. data/lib/aoc_cli/files.rb +0 -163
  145. data/lib/aoc_cli/help.rb +0 -77
  146. data/lib/aoc_cli/interface.rb +0 -81
  147. data/lib/aoc_cli/paths.rb +0 -101
  148. data/lib/aoc_cli/solve.rb +0 -104
  149. data/lib/aoc_cli/tables.rb +0 -138
  150. data/lib/aoc_cli/tools.rb +0 -120
  151. data/lib/aoc_cli/year.rb +0 -116
  152. data/sample/aoc.rc +0 -21
@@ -0,0 +1,15 @@
1
+ module AocCli
2
+ module Validators
3
+ class IntegerValidator < Kangaru::Validator
4
+ def validate: -> void
5
+
6
+ private
7
+
8
+ ERRORS: Hash[Symbol, String]
9
+
10
+ def range: -> Range[Integer]
11
+
12
+ def validate_range!: -> void
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module AocCli
2
+ module Validators
3
+ class PathValidator < Kangaru::Validator
4
+ def validate: -> void
5
+
6
+ private
7
+
8
+ ERRORS: Hash[Symbol, String]
9
+
10
+ def path_exists?: -> bool
11
+
12
+ def validate_path_does_not_exist!: -> void
13
+
14
+ def validate_path_exists!: -> void
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ module AocCli
2
+ module Validators
3
+ class TypeValidator < Kangaru::Validator
4
+
5
+ private
6
+
7
+ ERRORS: Hash[Symbol, String]
8
+
9
+ def valid_type: -> Class?
10
+
11
+ def valid_types: -> Array[Class]?
12
+
13
+ def error: -> String
14
+
15
+ def validate_target_type_set!: -> void
16
+
17
+ def validate_type!: -> void
18
+
19
+ def validate_type_from_list!: -> void
20
+ end
21
+ end
22
+ end
data/sig/aoc_cli.rbs ADDED
@@ -0,0 +1,6 @@
1
+ module AocCli
2
+ VERSION: String
3
+
4
+ extend Kangaru::Initialiser
5
+ extend Kangaru::Interface
6
+ end
data/sig/http.rbs ADDED
@@ -0,0 +1,3 @@
1
+ module HTTP
2
+ def self.headers: (**untyped) -> Client
3
+ end
data/sig/kangaru.rbs ADDED
@@ -0,0 +1,5 @@
1
+ module Kangaru
2
+ class Config
3
+ attr_reader session: AocCli::Configurators::SessionConfigurator
4
+ end
5
+ end
data/sig/nokogiri.rbs ADDED
@@ -0,0 +1,3 @@
1
+ module Nokogiri
2
+ def self.HTML5: (String) -> HTML::Document
3
+ end
@@ -0,0 +1,3 @@
1
+ module ReverseMarkdown
2
+ def self.convert: (String, **untyped) -> String
3
+ end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aoc_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Welham
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2024-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: colorize
14
+ name: http
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: curb
28
+ name: kangaru
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: git
42
+ name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: pandoc-ruby
56
+ name: reverse_markdown
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: sqlite3
70
+ name: sequel_polymorphic
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -84,19 +84,21 @@ dependencies:
84
84
  name: terminal-table
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 3.0.0
89
+ version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 3.0.0
97
- description: A command-line interface for the Advent of Code puzzles. Features include
96
+ version: '0'
97
+ description: 'A command-line interface for the Advent of Code puzzles. Features include
98
98
  downloading puzzles and inputs, solving puzzles and tracking year progress from
99
99
  within the terminal
100
+
101
+ '
100
102
  email:
101
103
  - welhamm@gmail.com
102
104
  executables:
@@ -104,39 +106,145 @@ executables:
104
106
  extensions: []
105
107
  extra_rdoc_files: []
106
108
  files:
107
- - ".gitignore"
109
+ - ".rspec"
110
+ - ".rubocop.yml"
111
+ - ".ruby-version"
108
112
  - CHANGELOG.md
109
113
  - Gemfile
114
+ - Gemfile.lock
110
115
  - LICENSE.txt
111
116
  - README.md
112
117
  - Rakefile
118
+ - Steepfile
113
119
  - aoc_cli.gemspec
114
- - bin/aoc
115
- - bin/console
116
- - bin/setup
120
+ - db/migrate/1_create_events.rb
121
+ - db/migrate/2_create_puzzles.rb
122
+ - db/migrate/3_create_stats.rb
123
+ - db/migrate/4_create_attempts.rb
124
+ - db/migrate/5_create_locations.rb
125
+ - db/migrate/6_create_puzzle_dir_sync_logs.rb
126
+ - exe/aoc
117
127
  - lib/aoc_cli.rb
118
- - lib/aoc_cli/commands.rb
119
- - lib/aoc_cli/database.rb
120
- - lib/aoc_cli/day.rb
121
- - lib/aoc_cli/db/reddit.db
122
- - lib/aoc_cli/errors.rb
123
- - lib/aoc_cli/files.rb
124
- - lib/aoc_cli/help.rb
125
- - lib/aoc_cli/interface.rb
126
- - lib/aoc_cli/paths.rb
127
- - lib/aoc_cli/solve.rb
128
- - lib/aoc_cli/tables.rb
129
- - lib/aoc_cli/tools.rb
128
+ - lib/aoc_cli/components/attempts_table.erb
129
+ - lib/aoc_cli/components/attempts_table.rb
130
+ - lib/aoc_cli/components/docs_component.erb
131
+ - lib/aoc_cli/components/docs_component.rb
132
+ - lib/aoc_cli/components/errors_component.erb
133
+ - lib/aoc_cli/components/errors_component.rb
134
+ - lib/aoc_cli/components/progress_table.erb
135
+ - lib/aoc_cli/components/progress_table.rb
136
+ - lib/aoc_cli/components/puzzle_sync_component.erb
137
+ - lib/aoc_cli/components/puzzle_sync_component.rb
138
+ - lib/aoc_cli/configurators/session_configurator.rb
139
+ - lib/aoc_cli/controllers/application_controller.rb
140
+ - lib/aoc_cli/controllers/concerns/error_concern.rb
141
+ - lib/aoc_cli/controllers/concerns/location_concern.rb
142
+ - lib/aoc_cli/controllers/default_controller.rb
143
+ - lib/aoc_cli/controllers/event_controller.rb
144
+ - lib/aoc_cli/controllers/help/event_controller.rb
145
+ - lib/aoc_cli/controllers/help/puzzle_controller.rb
146
+ - lib/aoc_cli/controllers/puzzle_controller.rb
147
+ - lib/aoc_cli/core/attempt_parser.rb
148
+ - lib/aoc_cli/core/processor.rb
149
+ - lib/aoc_cli/core/repository.rb
150
+ - lib/aoc_cli/core/request.rb
151
+ - lib/aoc_cli/core/resource.rb
152
+ - lib/aoc_cli/core/stats_parser.rb
153
+ - lib/aoc_cli/helpers/table_generator.rb
154
+ - lib/aoc_cli/helpers/view_helper.rb
155
+ - lib/aoc_cli/models/attempt.rb
156
+ - lib/aoc_cli/models/event.rb
157
+ - lib/aoc_cli/models/location.rb
158
+ - lib/aoc_cli/models/puzzle.rb
159
+ - lib/aoc_cli/models/puzzle_dir_sync_log.rb
160
+ - lib/aoc_cli/models/stats.rb
161
+ - lib/aoc_cli/presenters/attempt_presenter.rb
162
+ - lib/aoc_cli/presenters/puzzle_presenter.rb
163
+ - lib/aoc_cli/presenters/stats_presenter.rb
164
+ - lib/aoc_cli/processors/event_initialiser.rb
165
+ - lib/aoc_cli/processors/puzzle_dir_synchroniser.rb
166
+ - lib/aoc_cli/processors/puzzle_initialiser.rb
167
+ - lib/aoc_cli/processors/puzzle_refresher.rb
168
+ - lib/aoc_cli/processors/resource_attacher.rb
169
+ - lib/aoc_cli/processors/solution_poster.rb
170
+ - lib/aoc_cli/processors/stats_initialiser.rb
171
+ - lib/aoc_cli/processors/stats_refresher.rb
172
+ - lib/aoc_cli/validators/collection_type_validator.rb
173
+ - lib/aoc_cli/validators/event_year_validator.rb
174
+ - lib/aoc_cli/validators/included_validator.rb
175
+ - lib/aoc_cli/validators/integer_validator.rb
176
+ - lib/aoc_cli/validators/path_validator.rb
177
+ - lib/aoc_cli/validators/type_validator.rb
130
178
  - lib/aoc_cli/version.rb
131
- - lib/aoc_cli/year.rb
132
- - sample/aoc.rc
179
+ - lib/aoc_cli/views/event/attach.erb
180
+ - lib/aoc_cli/views/event/init.erb
181
+ - lib/aoc_cli/views/help/event/attach.erb
182
+ - lib/aoc_cli/views/help/event/init.erb
183
+ - lib/aoc_cli/views/help/event/progress.erb
184
+ - lib/aoc_cli/views/help/puzzle/attempts.erb
185
+ - lib/aoc_cli/views/help/puzzle/init.erb
186
+ - lib/aoc_cli/views/help/puzzle/solve.erb
187
+ - lib/aoc_cli/views/help/puzzle/sync.erb
188
+ - lib/aoc_cli/views/puzzle/init.erb
189
+ - lib/aoc_cli/views/puzzle/solve.erb
190
+ - rbs_collection.lock.yaml
191
+ - rbs_collection.yaml
192
+ - sig/aoc_cli.rbs
193
+ - sig/aoc_cli/components/attempts_table.rbs
194
+ - sig/aoc_cli/components/docs_component.rbs
195
+ - sig/aoc_cli/components/errors_component.rbs
196
+ - sig/aoc_cli/components/progress_table.rbs
197
+ - sig/aoc_cli/components/puzzle_sync_component.rbs
198
+ - sig/aoc_cli/configurators/session_configurator.rbs
199
+ - sig/aoc_cli/controllers/application_controller.rbs
200
+ - sig/aoc_cli/controllers/concerns/error_concern.rbs
201
+ - sig/aoc_cli/controllers/concerns/location_concern.rbs
202
+ - sig/aoc_cli/controllers/default_controller.rbs
203
+ - sig/aoc_cli/controllers/event_controller.rbs
204
+ - sig/aoc_cli/controllers/help/event_controller.rbs
205
+ - sig/aoc_cli/controllers/help/puzzle_controller.rbs
206
+ - sig/aoc_cli/controllers/puzzle_controller.rbs
207
+ - sig/aoc_cli/core/attempt_parser.rbs
208
+ - sig/aoc_cli/core/processor.rbs
209
+ - sig/aoc_cli/core/repository.rbs
210
+ - sig/aoc_cli/core/request.rbs
211
+ - sig/aoc_cli/core/resource.rbs
212
+ - sig/aoc_cli/core/stats_parser.rbs
213
+ - sig/aoc_cli/helpers/table_generator.rbs
214
+ - sig/aoc_cli/helpers/view_helper.rbs
215
+ - sig/aoc_cli/models/attempt.rbs
216
+ - sig/aoc_cli/models/event.rbs
217
+ - sig/aoc_cli/models/location.rbs
218
+ - sig/aoc_cli/models/puzzle.rbs
219
+ - sig/aoc_cli/models/puzzle_dir_sync_log.rbs
220
+ - sig/aoc_cli/models/stats.rbs
221
+ - sig/aoc_cli/presenters/attempt_presenter.rbs
222
+ - sig/aoc_cli/presenters/puzzle_presenter.rbs
223
+ - sig/aoc_cli/presenters/stats_presenter.rbs
224
+ - sig/aoc_cli/processors/event_initialiser.rbs
225
+ - sig/aoc_cli/processors/puzzle_dir_synchroniser.rbs
226
+ - sig/aoc_cli/processors/puzzle_initialiser.rbs
227
+ - sig/aoc_cli/processors/puzzle_refresher.rbs
228
+ - sig/aoc_cli/processors/resource_attacher.rbs
229
+ - sig/aoc_cli/processors/solution_poster.rbs
230
+ - sig/aoc_cli/processors/stats_initialiser.rbs
231
+ - sig/aoc_cli/processors/stats_refresher.rbs
232
+ - sig/aoc_cli/validators/collection_type_validator.rbs
233
+ - sig/aoc_cli/validators/event_year_validator.rbs
234
+ - sig/aoc_cli/validators/included_validator.rbs
235
+ - sig/aoc_cli/validators/integer_validator.rbs
236
+ - sig/aoc_cli/validators/path_validator.rbs
237
+ - sig/aoc_cli/validators/type_validator.rbs
238
+ - sig/http.rbs
239
+ - sig/kangaru.rbs
240
+ - sig/nokogiri.rbs
241
+ - sig/reverse_markdown.rbs
133
242
  homepage: https://github.com/apexatoll/aoc-cli
134
243
  licenses:
135
244
  - MIT
136
245
  metadata:
137
246
  homepage_uri: https://github.com/apexatoll/aoc-cli
138
247
  source_code_uri: https://github.com/apexatoll/aoc-cli
139
- changelog_uri: https://github.com/apexatoll/aoc-cli/CHANGELOG.md
140
248
  post_install_message:
141
249
  rdoc_options: []
142
250
  require_paths:
@@ -145,14 +253,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
253
  requirements:
146
254
  - - ">="
147
255
  - !ruby/object:Gem::Version
148
- version: 2.3.0
256
+ version: 3.2.0
149
257
  required_rubygems_version: !ruby/object:Gem::Requirement
150
258
  requirements:
151
259
  - - ">="
152
260
  - !ruby/object:Gem::Version
153
261
  version: '0'
154
262
  requirements: []
155
- rubygems_version: 3.2.3
263
+ rubygems_version: 3.4.1
156
264
  signing_key:
157
265
  specification_version: 4
158
266
  summary: A command-line interface for the Advent of Code puzzles
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- tags
2
- pkg/**
3
- tests/**
4
- tests
5
- pkg
data/bin/aoc DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '../lib/aoc_cli.rb'
4
- AocCli::Interface::Query.new
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "aoc_cli"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
-
7
- bundle install
@@ -1,232 +0,0 @@
1
- module AocCli
2
- module Commands
3
- class KeyStore
4
- attr_reader :user, :key
5
- def initialize(args)
6
- args = defaults.merge(args).compact
7
- @user, @key = args[:user], args[:key]
8
- end
9
- def exec
10
- Files::Config::Cookie.store(user:user, key:key)
11
- self
12
- end
13
- def respond
14
- puts "Key added successfully"
15
- end
16
- def defaults
17
- { user:"main" }
18
- end
19
- end
20
- class YearInit
21
- attr_reader :user, :year, :git
22
- def initialize(args)
23
- args = defaults.merge(args).compact
24
- @user, @year, @git = args[:user], args[:year], args[:git]
25
- end
26
- def exec
27
- Year::Meta.new(u:user, y:year).write
28
- Year::Progress.new(u:user, y:year).write.init_calendar_db
29
- Year::GitWrap.new if git
30
- self
31
- end
32
- def respond
33
- puts "Year #{year} initialised"
34
- end
35
- def defaults
36
- { user:Prefs.default_alias,
37
- git:Prefs.bool(key:"init_git") }
38
- end
39
- end
40
- class DayInit
41
- attr_reader :user, :year, :day
42
- def initialize(args)
43
- args = defaults.merge(args).compact
44
- @user = args[:user]
45
- @year = args[:year]
46
- @day = args[:day]
47
- end
48
- def exec
49
- Day::Init.new(u:user, y:year, d:day).mkdir.meta
50
- Day::Pages.new(u:user, y:year, d:day).load
51
- self
52
- end
53
- def defaults
54
- { user:Metafile.get(:user),
55
- year:Metafile.get(:year) }
56
- end
57
- def respond
58
- puts "Day #{day} initialised"
59
- end
60
- end
61
- class DaySolve
62
- attr_reader :user, :year, :day, :part, :ans
63
- def initialize(args)
64
- args = defaults.merge(args).compact
65
- @user = args[:user]
66
- @year = args[:year]
67
- @day = args[:day]
68
- @part = args[:part]
69
- @ans = args[:ans]
70
- end
71
- def exec
72
- Solve::Attempt
73
- .new(u:user, y:year, d:day, p:part, a:ans)
74
- .respond
75
- self
76
- end
77
- def defaults
78
- {user:Metafile.get(:user),
79
- year:Metafile.get(:year),
80
- day:Metafile.get(:day),
81
- part:Metafile.get(:part)}
82
- end
83
- end
84
- class OpenReddit
85
- attr_reader :year, :day, :browser
86
- def initialize(args)
87
- args = defaults.merge(args).compact
88
- @year = Validate.year(args[:year])
89
- @day = Validate.day(args[:day])
90
- @browser = args[:browser]
91
- end
92
- def exec
93
- Tools::Reddit.new(y:year, d:day, b:browser).open
94
- self
95
- end
96
- def defaults
97
- { year:Metafile.get(:year),
98
- day:Metafile.get(:day),
99
- browser:Prefs.bool(key:"reddit_in_browser") }
100
- end
101
- end
102
- class DefaultAlias
103
- attr_reader :user, :mode
104
- def initialize(args)
105
- @user = args[:user]
106
- @mode = user.nil? ? :get : :set
107
- end
108
- def exec
109
- set if mode == :set && alias_valid
110
- self
111
- end
112
- def respond
113
- case mode
114
- when :get then current
115
- when :set then update end
116
- end
117
- private
118
- def set
119
- Files::Config::Tools
120
- .mod_line(key:"default", val:Validate.user(user))
121
- end
122
- def current
123
- puts <<~aliases
124
- Default alias: #{Prefs.default_alias.yellow}
125
- All aliases: #{Prefs.list_aliases.map{|a| a.blue}
126
- .join(", ")}
127
- aliases
128
- end
129
- def alias_valid
130
- Validate.key(Files::Config::Cookie.key(user:user))
131
- end
132
- def update
133
- puts "Default alias changed to: #{user.yellow}"
134
- end
135
- end
136
- class Refresh
137
- def initialize(args)
138
- end
139
- def exec
140
- case Metafile.type
141
- when :DAY then Day.refresh
142
- when :ROOT then Year.refresh end
143
- self
144
- end
145
- end
146
- class AttemptsTable
147
- attr_reader :user, :year, :day, :part
148
- def initialize(args)
149
- args = defaults.merge(args).compact
150
- @user = args[:user]
151
- @year = args[:year]
152
- @day = args[:day]
153
- @part = args[:part]
154
- end
155
- def exec
156
- Tables::Attempts.new(u:user, y:year, d:day, p:part).print
157
- self
158
- end
159
- def defaults
160
- {user:Metafile.get(:user),
161
- year:Metafile.get(:year),
162
- day:Metafile.get(:day),
163
- part:Metafile.get(:part)}
164
- end
165
- end
166
- class StatsTable
167
- attr_reader :user, :year, :day
168
- def initialize(args)
169
- args = defaults.merge(args).compact
170
- @user = args[:user]
171
- @year = args[:year]
172
- @day = args[:day]
173
- end
174
- def exec
175
- day.nil? ?
176
- Tables::Stats::Year.new(u:user, y:year).print :
177
- Tables::Stats::Day.new(u:user, y:year, d:day).print
178
- end
179
- def defaults
180
- { user:Metafile.get(:user),
181
- year:Metafile.get(:year),
182
- day:Metafile.get(:day) }
183
- end
184
- end
185
- class CalendarTable
186
- attr_reader :user, :year
187
- def initialize(args)
188
- args = defaults.merge(args).compact
189
- @user = Validate.user(args[:user])
190
- @year = Validate.year(args[:year])
191
- end
192
- def exec
193
- Tables::Calendar.new(u:user, y:year).print
194
- end
195
- def defaults
196
- { user:Metafile.get(:user),
197
- year:Metafile.get(:year) }
198
- end
199
- end
200
- class PrintCal
201
- attr_reader :path, :year
202
- def initialize(args)
203
- args = defaults.merge(args).compact
204
- @year = Validate.year(args[:year])
205
- end
206
- def path
207
- case Metafile.type
208
- when :DAY then "../#{year}.md"
209
- when :ROOT then "#{year}.md"
210
- end
211
- end
212
- def exec
213
- Prefs.bool(key:"calendar_file") ?
214
- system("cat #{path} | less") :
215
- puts("You have disabled calendar files")
216
- end
217
- def defaults
218
- {year:Metafile.get(:year)}
219
- end
220
- end
221
- class GenerateConfig
222
- def initialize(args) end
223
- def exec
224
- Files::Config::Example.write
225
- self
226
- end
227
- def respond
228
- puts "Default config written to #{Paths::Config.path.blue}"
229
- end
230
- end
231
- end
232
- end