at_coder_friends 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/.github/workflows/codeql-analysis.yml +70 -0
  4. data/.github/workflows/ruby.yml +38 -0
  5. data/.gitignore +3 -0
  6. data/.rubocop.yml +8 -1
  7. data/CHANGELOG.md +23 -4
  8. data/Gemfile.lock +43 -43
  9. data/README.md +15 -92
  10. data/at_coder_friends.gemspec +4 -3
  11. data/lib/at_coder_friends/cli.rb +13 -28
  12. data/lib/at_coder_friends/config_loader.rb +2 -4
  13. data/lib/at_coder_friends/generator/any_builtin.rb +22 -0
  14. data/lib/at_coder_friends/generator/base.rb +55 -6
  15. data/lib/at_coder_friends/generator/c_builtin.rb +22 -0
  16. data/lib/at_coder_friends/generator/cxx_builtin.rb +9 -241
  17. data/lib/at_coder_friends/generator/fragment.rb +106 -0
  18. data/lib/at_coder_friends/generator/main.rb +20 -14
  19. data/lib/at_coder_friends/generator/ruby_builtin.rb +13 -166
  20. data/lib/at_coder_friends/parser/binary.rb +12 -5
  21. data/lib/at_coder_friends/parser/constraints.rb +8 -8
  22. data/lib/at_coder_friends/parser/input_format.rb +19 -15
  23. data/lib/at_coder_friends/parser/modulo.rb +5 -7
  24. data/lib/at_coder_friends/parser/section_wrapper.rb +3 -5
  25. data/lib/at_coder_friends/parser/sections.rb +2 -2
  26. data/lib/at_coder_friends/path_util.rb +1 -1
  27. data/lib/at_coder_friends/problem.rb +5 -5
  28. data/lib/at_coder_friends/scraping/agent.rb +1 -1
  29. data/lib/at_coder_friends/scraping/authentication.rb +3 -3
  30. data/lib/at_coder_friends/scraping/session.rb +1 -1
  31. data/lib/at_coder_friends/scraping/tasks.rb +6 -8
  32. data/lib/at_coder_friends/test_runner/base.rb +1 -2
  33. data/lib/at_coder_friends/test_runner/judge.rb +3 -3
  34. data/lib/at_coder_friends/version.rb +1 -1
  35. data/lib/at_coder_friends.rb +3 -0
  36. data/templates/any_builtin.md.erb +30 -0
  37. data/templates/any_builtin_fragments.yml +5 -0
  38. data/templates/c_builtin.c.erb +36 -0
  39. data/templates/c_builtin_fragments.yml +127 -0
  40. data/templates/csharp_sample.cs.erb +29 -0
  41. data/templates/csharp_sample_fragments.yml +159 -0
  42. data/templates/java_sample.java.erb +25 -0
  43. data/templates/java_sample_fragments.yml +98 -0
  44. data/templates/ruby_builtin_fragments.yml +93 -0
  45. metadata +26 -6
  46. data/.travis.yml +0 -16
  47. data/docs/CONFIGURATION.md +0 -421
data/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.8
5
- env:
6
- global:
7
- - CC_TEST_REPORTER_ID=cb942bcc168feb78c43c506364d5344c5ec9a46a0b68dc66acb581e77c981ff1
8
- - COVERAGE=true
9
- before_script:
10
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
11
- - chmod +x ./cc-test-reporter
12
- - ./cc-test-reporter before-build
13
- script:
14
- - bundle exec rake spec
15
- after_script:
16
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -1,421 +0,0 @@
1
- # Configuration details
2
-
3
- ## Configuration file
4
-
5
- You can specify AtCoderFriends settings
6
- in the configuration file ```.at_coder_friends.yml```.
7
- Place it in your working directory (or higher).
8
-
9
- AtCoderFriends の動作に関する設定は
10
- 設定ファイル ```.at_coder_friends.yml``` に記述します。
11
- このファイルは作業ディレクトリ(またはその上位ディレクトリ)に配置します。
12
-
13
- ## Default settings
14
-
15
- The default settings are as follows.
16
- If you add new settings or change existing settings in ```.at_coder_friends.yml```,
17
- Its contents are merged with the default settings.
18
-
19
- デフォルトの設定は以下のようになっています。
20
- ```.at_coder_friends.yml```で新しい設定項目の追加や、既存の設定項目の変更をすると、
21
- その内容がデフォルト設定にマージされます。
22
-
23
- [/config/default.yml](/config/default.yml)
24
-
25
- ```YAML
26
- user: ~
27
- password: ~
28
- generators:
29
- - RubyBuiltin
30
- - CxxBuiltin
31
- ext_settings:
32
- 'awk': # Awk (mawk)
33
- submit_lang:
34
- - '4009'
35
- - '3506'
36
- 'bf': # Brainfuck
37
- submit_lang:
38
- - '4062'
39
- - '3507'
40
- 'c': # C (GCC)
41
- submit_lang:
42
- - '4001'
43
- - '3002'
44
- test_cmd:
45
- default: '"{dir}/{base}"'
46
- windows: '"{dir}/{base}.exe"'
47
- 'cbl': # COBOL - Free
48
- submit_lang:
49
- - '4061'
50
- - '3526'
51
- 'clj': # Clojure
52
- submit_lang:
53
- - '4013'
54
- - '3007'
55
- 'cr': # Crystal
56
- submit_lang:
57
- - '4014'
58
- - '3511'
59
- 'cs': # C# (Mono-mcs)
60
- submit_lang:
61
- - '4011'
62
- - '3006'
63
- test_cmd:
64
- default: 'mono "{dir}/{base}.exe"'
65
- windows: '"{dir}/{base}.exe"'
66
- 'cxx': # C++ (GCC)
67
- submit_lang:
68
- - '4003'
69
- - '3003'
70
- test_cmd:
71
- default: '"{dir}/{base}"'
72
- windows: '"{dir}/{base}.exe"'
73
- 'd': # D (DMD64)
74
- submit_lang:
75
- - '4015'
76
- - '3009'
77
- 'dart': # Dart
78
- submit_lang: '4018'
79
- 'f90': # Fortran (gfortran)
80
- submit_lang:
81
- - '4025'
82
- - '3012'
83
- 'fs': # F# (Mono)
84
- submit_lang:
85
- - '4023'
86
- - '3512'
87
- 'go': # Go
88
- submit_lang:
89
- - '4026'
90
- - '3013'
91
- 'hs': # Haskell (GHC)
92
- submit_lang:
93
- - '4027'
94
- - '3014'
95
- 'java': # Java (OpenJDK)
96
- submit_lang:
97
- - '4005'
98
- - '3016'
99
- test_cmd:
100
- default: 'java -cp "{dir}" Main'
101
- 'jl': # Julia
102
- submit_lang:
103
- - '4031'
104
- - '3518'
105
- 'js': # JavaScript (node.js)
106
- submit_lang:
107
- - '4030'
108
- - '3017'
109
- 'kt': # Kotlin
110
- submit_lang:
111
- - '4032'
112
- - '3523'
113
- 'lisp': # Common Lisp
114
- submit_lang:
115
- - '4038'
116
- - '3008'
117
- 'lua': # LuaJIT
118
- submit_lang:
119
- - '4034'
120
- - '3515'
121
- 'm': # Octave
122
- submit_lang:
123
- - '4040'
124
- - '3519'
125
- 'ml': # OCaml
126
- submit_lang:
127
- - '4039'
128
- - '3018'
129
- 'nim': # Nim
130
- submit_lang:
131
- - '4036'
132
- - '3520'
133
- 'pas': # Pascal (FPC)
134
- submit_lang:
135
- - '4041'
136
- - '3019'
137
- 'php': # PHP7
138
- submit_lang:
139
- - '4044'
140
- - '3524'
141
- 'pl': # Perl
142
- submit_lang:
143
- - '4042'
144
- - '3020'
145
- 'py': # Python3
146
- submit_lang:
147
- - '4006'
148
- - '3023'
149
- 'rb': # Ruby
150
- submit_lang:
151
- - '4049'
152
- - '3024'
153
- test_cmd:
154
- default: 'ruby "{dir}/{base}.rb"'
155
- 'rs': # Rust
156
- submit_lang:
157
- - '4050'
158
- - '3504'
159
- 'scala': # Scala
160
- submit_lang:
161
- - '4051'
162
- - '3025'
163
- 'scm': # Scheme (Gauche)
164
- submit_lang:
165
- - '4053'
166
- - '3026'
167
- 'sed': # Sed (GNU sed)
168
- submit_lang:
169
- - '4066'
170
- - '3505'
171
- 'sh': # Bash (GNU bash)
172
- submit_lang:
173
- - '4007'
174
- - '3001'
175
- 'swift': # Swift
176
- submit_lang:
177
- - '4055'
178
- - '3503'
179
- 'ts': # TypeScript
180
- submit_lang:
181
- - '4057'
182
- - '3521'
183
- 'txt': # Text (cat)
184
- submit_lang:
185
- - '4056'
186
- - '3027'
187
- 'vb': # Visual Basic (Mono)
188
- submit_lang:
189
- - '4058'
190
- - '3028'
191
- ```
192
-
193
- ## Configuration options
194
-
195
- - user
196
- AtCoder username
197
- If omitted, you are prompted to enter it on the first login.
198
- AtCoderのユーザ名
199
- 省略した場合、初回のログイン時に入力を求められます
200
-
201
- - password
202
- AtCoder password
203
- If omitted, you are prompted to enter it on the first login.
204
- AtCoderのパスワード
205
- 省略した場合、初回のログイン時に入力を求められます
206
-
207
- - generators
208
- List of source generator class names
209
- In default, ```RubyBuiltin``` and ```CxxBuiltin``` are available.
210
- For other generators, corresponding plugin will be used
211
- if it has been installed.
212
- ソースジェネレータのクラス名(リスト形式)
213
- 既定の状態では「RubyBuiltin」と「CxxBuiltin」が利用でき、
214
- その他のジェネレータは、対応するプラグインがインストールされていれば
215
- 利用できます
216
-
217
- For example, if ```RubyAlt``` is specified as generator name,
218
- following plugin will be used:
219
-
220
- | | |
221
- |-----------------|---------------------------------------------------|
222
- |Gem Name |```at_coder_friends-generator-ruby_alt``` |
223
- |Require Statement|```require 'at_coder_friends/generator/ruby_alt'```|
224
- |Main Class Name |```AtCoderFriends::Generator::RubyAlt``` |
225
-
226
- [search generator in GitHub](https://github.com/search?q=at_coder_friends-generator)
227
-
228
- - generator_settings
229
- - _(generator name)_
230
- Settings for each generator
231
- For details, see the manual of each generator.
232
- [Settings for built-in generators](#builtin-generator-settings)
233
- ジェネレータ毎の設定
234
- 詳細は各ジェネレータのマニュアルを参照してください
235
- [組込ジェネレータの設定](#builtin-generator-settings)
236
-
237
- - ext_settings
238
- Extension specific settings
239
- 拡張子ごとの設定
240
-
241
- - _'ext'_
242
- Target extension name
243
- 対象となる拡張子
244
-
245
- - submit_lang
246
- Language ID of submission language
247
- 提出言語の言語ID
248
-
249
- - test_cmd
250
- Execution command for test
251
- If not set, the test will run using AtCoder "Custom Test" page.
252
- テストで使用する実行コマンドの設定
253
- 未設定の場合、テストはAtCoderの「コードテスト」ページを使用して行われます
254
-
255
- - default
256
- Default execution command
257
- デフォルトの実行コマンド
258
-
259
- - wndows
260
- Execution command for Windows(optional)
261
- Windows専用実行コマンド(あれば設定)
262
-
263
- - macosx
264
- Execution command for MacOS(optional)
265
- MacOS専用実行コマンド(あれば設定)
266
-
267
- - linux
268
- Execution command for Linux(optional)
269
- Linux専用実行コマンド(あれば設定)
270
-
271
- <a id="builtin-generator-settings"></a>
272
- ### Settings for RubyBuiltin generator
273
- | Setting | Description | Default |
274
- |---------|-------------|---------|
275
- |default_template|Source template file path|[/templates/ruby_builtin.rb.erb](/templates/ruby_builtin.rb.erb)|
276
-
277
- ### Settings for CxxBuiltin generator
278
- | Setting | Description | Default |
279
- |---------|-------------|---------|
280
- |default_template|Source template file path|[/templates/cxx_builtin.cxx.erb](/templates/cxx_builtin.cxx.erb)|
281
-
282
- ### Language ID list (2020/06/21)
283
-
284
- | Language ID | Description |
285
- |-------------|-------------|
286
- |4001|C (GCC 9.2.1)|
287
- |4002|C (Clang 10.0.0)|
288
- |4003|C++ (GCC 9.2.1)|
289
- |4004|C++ (Clang 10.0.0)|
290
- |4005|Java (OpenJDK 11.0.6)|
291
- |4006|Python (3.8.2)|
292
- |4007|Bash (5.0.11)|
293
- |4008|bc (1.07.1)|
294
- |4009|Awk (GNU Awk 4.1.4)|
295
- |4010|C# (.NET Core 3.1.201)|
296
- |4011|C# (Mono-mcs 6.8.0.105)|
297
- |4012|C# (Mono-csc 3.5.0)|
298
- |4013|Clojure (1.10.1.536)|
299
- |4014|Crystal (0.33.0)|
300
- |4015|D (DMD 2.091.0)|
301
- |4016|D (GDC 9.2.1)|
302
- |4017|D (LDC 1.20.1)|
303
- |4018|Dart (2.7.2)|
304
- |4019|dc (1.4.1)|
305
- |4020|Erlang (22.3)|
306
- |4021|Elixir (1.10.2)|
307
- |4022|F# (.NET Core 3.1.201)|
308
- |4023|F# (Mono 10.2.3)|
309
- |4024|Forth (gforth 0.7.3)|
310
- |4025|Fortran(GNU Fortran 9.2.1)|
311
- |4026|Go (1.14.1)|
312
- |4027|Haskell (GHC 8.8.3)|
313
- |4028|Haxe (4.0.3); js|
314
- |4029|Haxe (4.0.3); Java|
315
- |4030|JavaScript (Node.js 12.16.1)|
316
- |4031|Julia (1.4.0)|
317
- |4032|Kotlin (1.3.71)|
318
- |4033|Lua (Lua 5.3.5)|
319
- |4034|Lua (LuaJIT 2.1.0)|
320
- |4035|Dash (0.5.8)|
321
- |4036|Nim (1.0.6)|
322
- |4037|Objective-C (Clang 10.0.0)|
323
- |4038|Common Lisp (SBCL 2.0.3)|
324
- |4039|OCaml (4.10.0)|
325
- |4040|Octave (5.2.0)|
326
- |4041|Pascal (FPC 3.0.4)|
327
- |4042|Perl (5.26.1)|
328
- |4043|Raku (Rakudo 2020.02.1)|
329
- |4044|PHP (7.4.4)|
330
- |4045|Prolog (SWI-Prolog 8.0.3)|
331
- |4046|PyPy2 (7.3.0)|
332
- |4047|PyPy3 (7.3.0)|
333
- |4048|Racket (7.6)|
334
- |4049|Ruby (2.7.1)|
335
- |4050|Rust (1.42.0)|
336
- |4051|Scala (2.13.1)|
337
- |4052|Java (OpenJDK 1.8.0)|
338
- |4053|Scheme (Gauche 0.9.9)|
339
- |4054|Standard ML (MLton 20130715)|
340
- |4055|Swift (5.2.1)|
341
- |4056|Text (cat 8.28)|
342
- |4057|TypeScript (3.8)|
343
- |4058|Visual Basic (.NET Core 3.1.101)|
344
- |4059|Zsh (5.4.2)|
345
- |4060|COBOL - Fixed (OpenCOBOL 1.1.0)|
346
- |4061|COBOL - Free (OpenCOBOL 1.1.0)|
347
- |4062|Brainfuck (bf 20041219)|
348
- |4063|Ada2012 (GNAT 9.2.1)|
349
- |4064|Unlambda (2.0.0)|
350
- |4065|Cython (0.29.16)|
351
- |4066|Sed (4.4)|
352
- |4067|Vim (8.2.0460)|
353
-
354
-
355
- ### Variables in test_cmd string
356
-
357
- The following variables in test_cmd string
358
- is substituted with the path information of the target file
359
- during execution.
360
-
361
- test_cmd 文字列中の以下の変数には、
362
- 実行時に対象ファイルのパス情報が展開されます。
363
-
364
- | Variable | Descripton |
365
- |----------|----------------------------------------------------------------|
366
- |{dir} |the directory name of the file<br>ファイルの置かれているディレクトリ名|
367
- |{base} |the file name excluding the extension<br>拡張子を除いたファイル名 |
368
-
369
- ## Examples of overwriting settings
370
-
371
- - Use only Ruby source generator
372
- Rubyのソースジェネレータのみ使用
373
- ```YAML
374
- generators:
375
- - RubyBuiltin
376
- ```
377
- - Do not use source generator
378
- ソースジェネレータを使用しない
379
- ```YAML
380
- generators: ~
381
- ```
382
- - change C++ source template
383
- C++のソース雛型を変更
384
- ```YAML
385
- generator_settings:
386
- CxxBuiltin:
387
- default_template: /path/to/template
388
- ```
389
-
390
- - Test .py with local Python
391
- .pyをローカル環境のPythonでテスト
392
- ```YAML
393
- ext_settings:
394
- 'py':
395
- test_cmd:
396
- default: 'python "{dir}/{base}.py"'
397
- ```
398
-
399
- - Test .rb with "Custom Test" page
400
- .rb を「コードテスト」ページでテスト
401
- ```YAML
402
- ext_settings:
403
- 'rb':
404
- test_cmd: ~
405
- ```
406
-
407
- - Add .raku(Raku) settings
408
- .raku(Raku)の設定を追加
409
- ```YAML
410
- ext_settings:
411
- 'raku':
412
- submit_lang: '4043' # Raku
413
- ```
414
-
415
- - Change submission language of .cxx to C++(Clang)
416
- .cxxの提出言語をC++(Clang)に変更
417
- ```YAML
418
- ext_settings:
419
- 'cxx':
420
- submit_lang: '4004' # C++(Clang)
421
- ```