at_coder_friends 0.6.8 → 0.7.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 (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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f754a47390aa40a5a92a0fa39ba99cc92904788e0d48fb7b73bc41c8be44ba0
4
- data.tar.gz: dae70f5657afd47a08731daaff6eacbe5f8a5bdf27b5b963f502f78d6cfc084a
3
+ metadata.gz: bada11ce4daaea235dde05940e0e6d75dc07c64d964b0192e3f9d789346bdc01
4
+ data.tar.gz: 4324be344fdd848ea9397fc9b21bfa542567f5d9ced110fefc188c7f787c656e
5
5
  SHA512:
6
- metadata.gz: d9bb6125db9f14b16f21e351df797a96e17ebcddd116d911507032f62fdd774b529fe1d4447d6bc699f2c7158a64603c49cba5bcf6090249967db454eb3163f0
7
- data.tar.gz: 632b7b30d878115331a465d588388cc0983c70daf5d1f1593efa42554837df7afadfaf5aad769c84e73ff358f0d4862ee374ddb5346c8e4138ecc57891d80617
6
+ metadata.gz: 2612df7b0bbdf727dc76aca694a9d02f8278eebfd2683b4e13c06cfa18a18abb4844d474df393651e04a56a07328fc5274ac79a160c7475f4ec01e97474cc305
7
+ data.tar.gz: 765962cc818da264ff9655eef7cd73e13c4579e03d1ff2c253b4934b1f84bf581484b46d925d7754a087ea916d51b89b8785fec68f4b8ec2362f85f048ec8c00
data/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ spec/mocks/** linguist-vendored
@@ -0,0 +1,70 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master ]
20
+ schedule:
21
+ - cron: '34 8 * * 0'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v2
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v1
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v1
57
+
58
+ # ℹ️ Command-line programs to run using the OS shell.
59
+ # 📚 https://git.io/JvXDl
60
+
61
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62
+ # and modify them (or add more) to build your code if your project
63
+ # uses a compiled language
64
+
65
+ #- run: |
66
+ # make bootstrap
67
+ # make release
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v1
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.7', '3.0', '3.2']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31
+ - name: Run tests
32
+ run: script -e -c "bundle exec rspec"
33
+ env:
34
+ COVERAGE: true
35
+ - name: publish code coverage
36
+ uses: paambaati/codeclimate-action@v3.0.0
37
+ env:
38
+ CC_TEST_REPORTER_ID: cb942bcc168feb78c43c506364d5344c5ec9a46a0b68dc66acb581e77c981ff1
data/.gitignore CHANGED
@@ -19,3 +19,6 @@
19
19
 
20
20
  # regression environment
21
21
  /regression
22
+
23
+ # Visual Studio Code local settings
24
+ .vscode/
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.4
4
+ TargetRubyVersion: 2.7
5
5
  Exclude:
6
6
  - 'templates/**/*'
7
7
  - 'spec/fixtures/**/*'
@@ -12,6 +12,13 @@ Lint/AmbiguousBlockAssociation:
12
12
  Exclude:
13
13
  - 'spec/**/*.rb'
14
14
 
15
+ Lint/ConstantDefinitionInBlock:
16
+ Exclude:
17
+ - 'spec/**/*.rb'
18
+
19
+ Lint/DuplicateBranch:
20
+ Enabled: false
21
+
15
22
  Metrics/BlockLength:
16
23
  Exclude:
17
24
  - 'Rakefile'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.7.0 (2023-05-12)
6
+ ### Added
7
+ - add AnyBuiltin Generator
8
+ - add file extension to generator settings
9
+ - enable multiple configuration for one generator
10
+ - add CBuiltin Generator
11
+ - add Ruby3.2 to target version.
12
+ - add C# and Java templates for AnyBuiltin Generator
13
+ ### Deleted
14
+ - drop Ruby2.6 from target version.
15
+ ### Changed
16
+ - generators : externalize code fragments to YAML
17
+
18
+ ## 0.6.9 (2021-12-25)
19
+ ### Added
20
+ - input_format.rb : \hspace{...}, \text{...} support
21
+ - input_format.rb : \rm, \textrm{...} support
22
+ - modulo.rb : \text{mod}, {\bmod}, (10^9+7) support
23
+
5
24
  ## 0.6.8 (2021-05-27)
6
25
  ### Deleted
7
26
  - drop Ruby2.4 from target version.
@@ -61,7 +80,7 @@
61
80
 
62
81
  ## 0.6.2 (2019-11-18)
63
82
  ### Added
64
- - add ```check-and-go``` command.
83
+ - add `check-and-go` command.
65
84
 
66
85
  ### Changed
67
86
  - Enhancement in input format parser.
@@ -81,7 +100,7 @@
81
100
  - Add settings about source generation.
82
101
 
83
102
  ### Changed
84
- - Treat all ```A_*.in``` format files as sample input data
103
+ - Treat all `A_*.in` format files as sample input data
85
104
 
86
105
  ## 0.5.2 (2019-10-14)
87
106
  ### Fixed
@@ -97,7 +116,7 @@
97
116
 
98
117
  ## 0.5.0 (2019-10-04)
99
118
  ### Added
100
- - User/password setting in ```.at_coder_friends.yml``` is no longer required.
119
+ - User/password setting in `.at_coder_friends.yml` is no longer required.
101
120
  - Saving and restoring session feature.
102
121
 
103
122
  ## 0.4.0 (2019-09-16)
@@ -106,4 +125,4 @@
106
125
 
107
126
  ## 0.3.3 (2019-09-01)
108
127
  ### Added
109
- - Add ```open-contest-page``` command.
128
+ - Add `open-contest-page` command.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- at_coder_friends (0.6.8)
4
+ at_coder_friends (0.7.0)
5
5
  colorize (~> 0.8.1)
6
6
  launchy (>= 2.4.3)
7
7
  mechanize (~> 2.0)
@@ -9,23 +9,24 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.7.0)
13
- public_suffix (>= 2.0.2, < 5.0)
12
+ addressable (2.8.4)
13
+ public_suffix (>= 2.0.2, < 6.0)
14
14
  colorize (0.8.1)
15
- connection_pool (2.2.5)
15
+ connection_pool (2.4.0)
16
16
  crack (0.4.5)
17
17
  rexml
18
- diff-lcs (1.4.4)
18
+ diff-lcs (1.5.0)
19
19
  docile (1.4.0)
20
20
  domain_name (0.5.20190701)
21
21
  unf (>= 0.0.5, < 1.0.0)
22
22
  hashdiff (1.0.1)
23
- http-cookie (1.0.3)
23
+ http-cookie (1.0.5)
24
24
  domain_name (~> 0.5)
25
- launchy (2.5.0)
26
- addressable (~> 2.7)
27
- mechanize (2.8.1)
28
- addressable (~> 2.7)
25
+ json (2.6.3)
26
+ launchy (2.5.2)
27
+ addressable (~> 2.8)
28
+ mechanize (2.9.1)
29
+ addressable (~> 2.8)
29
30
  domain_name (~> 0.5, >= 0.5.20190701)
30
31
  http-cookie (~> 1.0, >= 1.0.3)
31
32
  mime-types (~> 3.0)
@@ -35,61 +36,60 @@ GEM
35
36
  rubyntlm (~> 0.6, >= 0.6.3)
36
37
  webrick (~> 1.7)
37
38
  webrobots (~> 0.1.2)
38
- mime-types (3.3.1)
39
+ mime-types (3.4.1)
39
40
  mime-types-data (~> 3.2015)
40
- mime-types-data (3.2021.0225)
41
- mini_portile2 (2.5.1)
41
+ mime-types-data (3.2023.0218.1)
42
42
  net-http-digest_auth (1.4.1)
43
- net-http-persistent (4.0.1)
43
+ net-http-persistent (4.0.2)
44
44
  connection_pool (~> 2.2)
45
- nokogiri (1.11.6)
46
- mini_portile2 (~> 2.5.0)
45
+ nokogiri (1.14.3-arm64-darwin)
47
46
  racc (~> 1.4)
48
- public_suffix (4.0.6)
49
- racc (1.5.2)
50
- rake (13.0.3)
47
+ nokogiri (1.14.3-x86_64-linux)
48
+ racc (~> 1.4)
49
+ public_suffix (5.0.1)
50
+ racc (1.6.2)
51
+ rake (13.0.6)
51
52
  rexml (3.2.5)
52
- rspec (3.10.0)
53
- rspec-core (~> 3.10.0)
54
- rspec-expectations (~> 3.10.0)
55
- rspec-mocks (~> 3.10.0)
56
- rspec-core (3.10.1)
57
- rspec-support (~> 3.10.0)
58
- rspec-expectations (3.10.1)
53
+ rspec (3.12.0)
54
+ rspec-core (~> 3.12.0)
55
+ rspec-expectations (~> 3.12.0)
56
+ rspec-mocks (~> 3.12.0)
57
+ rspec-core (3.12.2)
58
+ rspec-support (~> 3.12.0)
59
+ rspec-expectations (3.12.3)
59
60
  diff-lcs (>= 1.2.0, < 2.0)
60
- rspec-support (~> 3.10.0)
61
- rspec-mocks (3.10.2)
61
+ rspec-support (~> 3.12.0)
62
+ rspec-mocks (3.12.5)
62
63
  diff-lcs (>= 1.2.0, < 2.0)
63
- rspec-support (~> 3.10.0)
64
- rspec-support (3.10.2)
64
+ rspec-support (~> 3.12.0)
65
+ rspec-support (3.12.0)
65
66
  rubyntlm (0.6.3)
66
- simplecov (0.21.2)
67
+ simplecov (0.17.1)
67
68
  docile (~> 1.1)
68
- simplecov-html (~> 0.11)
69
- simplecov_json_formatter (~> 0.1)
70
- simplecov-html (0.12.3)
71
- simplecov_json_formatter (0.1.3)
69
+ json (>= 1.8, < 3)
70
+ simplecov-html (~> 0.10.0)
71
+ simplecov-html (0.10.2)
72
72
  unf (0.1.4)
73
73
  unf_ext
74
- unf_ext (0.0.7.7)
75
- webmock (3.13.0)
76
- addressable (>= 2.3.6)
74
+ unf_ext (0.0.8.2)
75
+ webmock (3.18.1)
76
+ addressable (>= 2.8.0)
77
77
  crack (>= 0.3.2)
78
78
  hashdiff (>= 0.4.0, < 2.0.0)
79
- webrick (1.7.0)
79
+ webrick (1.8.1)
80
80
  webrobots (0.1.2)
81
81
 
82
82
  PLATFORMS
83
- ruby
84
- x64-mingw32
83
+ arm64-darwin-20
84
+ x86_64-linux
85
85
 
86
86
  DEPENDENCIES
87
87
  at_coder_friends!
88
88
  bundler (~> 2.0)
89
89
  rake (~> 13.0)
90
90
  rspec (~> 3.0)
91
- simplecov (~> 0.10)
91
+ simplecov (~> 0.10, < 0.18)
92
92
  webmock (~> 3.0)
93
93
 
94
94
  BUNDLED WITH
95
- 2.2.18
95
+ 2.4.12
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/at_coder_friends.svg)](https://badge.fury.io/rb/at_coder_friends)
2
- [![Build Status](https://travis-ci.org/nejiko96/at_coder_friends.svg?branch=master)](https://travis-ci.org/nejiko96/at_coder_friends)
2
+ ![Gem](https://img.shields.io/gem/dt/at_coder_friends)
3
+ [![Ruby](https://github.com/nejiko96/at_coder_friends/actions/workflows/ruby.yml/badge.svg)](https://github.com/nejiko96/at_coder_friends/actions/workflows/ruby.yml)
4
+ [![CodeQL](https://github.com/nejiko96/at_coder_friends/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/nejiko96/at_coder_friends/actions/workflows/codeql-analysis.yml)
3
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/dcd1ce08d11703be2f00/maintainability)](https://codeclimate.com/github/nejiko96/at_coder_friends/maintainability)
4
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/dcd1ce08d11703be2f00/test_coverage)](https://codeclimate.com/github/nejiko96/at_coder_friends/test_coverage)
7
+ ![GitHub](https://img.shields.io/github/license/nejiko96/at_coder_friends)
8
+ <!-- [![Build Status](https://travis-ci.org/nejiko96/at_coder_friends.svg?branch=master)](https://travis-ci.org/nejiko96/at_coder_friends) -->
5
9
 
6
10
  # AtCoderFriends
7
11
 
@@ -16,7 +20,7 @@ AtCoderFriends automates tasks about [AtCoder](https://atcoder.jp/) programming
16
20
 
17
21
  ## Dependencies
18
22
 
19
- - Ruby 2.4 or newer
23
+ - Ruby 2.7 or newer
20
24
  - [Mechanize](https://github.com/sparklemotion/mechanize)
21
25
 
22
26
  ## Installation
@@ -80,107 +84,26 @@ at_coder_friends check-and-go /path/to/contest/source_file
80
84
  ### Naming convention
81
85
 
82
86
  - Contest folder name will be used in the contest site URL.
83
- For example, if ```arc001``` folder is specified, AtCoderFriends will use ```https://atcoder.jp/contests/arc001/```.
84
- - Source file should be named ```[problem ID].[language specific extension]```(e.g. ```A.rb```),
87
+ For example, if `arc001` folder is specified, AtCoderFriends will use `https://atcoder.jp/contests/arc001/`.
88
+ - Source file should be named `[problem ID].[language specific extension]`(e.g. `A.rb`),
85
89
  in order to let AtCoderFriends find test cases or fill the submission form.
86
- - Suffixes (start with underscore) may be added to the file name (e.g. ```A_v2.rb```),
90
+ - Suffixes (start with underscore) may be added to the file name (e.g. `A_v2.rb`),
87
91
  so that you can try multiple codes for one problem.
88
92
 
89
93
  ## Notes
90
94
 
91
95
  - Compilation is not supported.
92
- - Source generator supports Ruby and C++ in default, and can be added by plugin.
96
+ - Source generator supports Ruby and C/C++ in default, and can be added by plugin.
93
97
  - Test runner and code submission are supported in 36 languages.
94
98
 
95
99
 
96
100
  ## Configuration
97
101
 
98
- See [CONFIGURATION.md](docs/CONFIGURATION.md) for details.
99
-
100
- ## For Sublime Text user
101
-
102
- It is convenient to use AtCoderFriends from Sublime Text plugin.
103
-
104
- - [sublime_at_coder_friends](https://github.com/nejiko96/sublime_at_coder_friends)
105
-
106
- ## For Visual Studio Code user
107
-
108
- - Run **Configure Tasks** from the global Terminal menu.
109
- - Select the **Create tasks.json file from template** entry.
110
- - Select **Others** from the list.
111
- - Add following settings to ```tasks.json```.
112
-
113
- ```JSON
114
- {
115
- "version": "2.0.0",
116
- "tasks": [
117
- {
118
- "label": "AtCoderFriends:New Contest",
119
- "type": "shell",
120
- "command": "at_coder_friends",
121
- "args": [
122
- "setup",
123
- "${input:contestName}"
124
- ],
125
- "problemMatcher": [],
126
- "group": "none"
127
- },
128
- {
129
- "label": "AtCoderFriends:Test One",
130
- "type": "shell",
131
- "command": "at_coder_friends",
132
- "args": [
133
- "test-one",
134
- "${file}"
135
- ],
136
- "problemMatcher": [],
137
- "group": "none"
138
- },
139
- {
140
- "label": "AtCoderFriends:Test All",
141
- "type": "shell",
142
- "command": "at_coder_friends",
143
- "args": [
144
- "test-all",
145
- "${file}"
146
- ],
147
- "problemMatcher": [],
148
- "group": "none"
149
- },
150
- {
151
- "label": "AtCoderFriends:Submit",
152
- "type": "shell",
153
- "command": "at_coder_friends",
154
- "args": [
155
- "submit",
156
- "${file}"
157
- ],
158
- "problemMatcher": [],
159
- "group": "none",
160
- },
161
- {
162
- "label": "AtCoderFriends:Check & Go",
163
- "type": "shell",
164
- "command": "at_coder_friends",
165
- "args": [
166
- "check-and-go",
167
- "${file}"
168
- ],
169
- "problemMatcher": [],
170
- "group": "none",
171
- },
172
- ...
173
- ],
174
- "inputs": [
175
- {
176
- "id": "contestName",
177
- "type": "promptString",
178
- "default": "",
179
- "description": "Contest Name"
180
- }
181
- ]
182
- }
183
- ```
102
+ See [Wiki](https://github.com/nejiko96/at_coder_friends/wiki/Configuration-details) for details.
103
+
104
+ ## Customizing editor
105
+
106
+ See [Wiki](https://github.com/nejiko96/at_coder_friends/wiki/Customizing-editor) for details.
184
107
 
185
108
  ## Development
186
109
 
@@ -28,12 +28,13 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ['lib']
30
30
 
31
- spec.required_ruby_version = '>= 2.5.0'
31
+ spec.required_ruby_version = '>= 2.7.0'
32
32
 
33
33
  spec.metadata = {
34
34
  'homepage_uri' => spec.homepage,
35
35
  'source_code_uri' => spec.homepage,
36
- 'changelog_uri' => spec.homepage + '/blob/master/CHANGELOG.md'
36
+ 'changelog_uri' => "#{spec.homepage}/blob/master/CHANGELOG.md",
37
+ 'rubygems_mfa_required' => 'true'
37
38
  }
38
39
 
39
40
  spec.add_dependency 'colorize', '~> 0.8.1'
@@ -43,6 +44,6 @@ Gem::Specification.new do |spec|
43
44
  spec.add_development_dependency 'bundler', '~> 2.0'
44
45
  spec.add_development_dependency 'rake', '~> 13.0'
45
46
  spec.add_development_dependency 'rspec', '~> 3.0'
46
- spec.add_development_dependency 'simplecov', '~> 0.10'
47
+ spec.add_development_dependency 'simplecov', '~> 0.10', '< 0.18'
47
48
  spec.add_development_dependency 'webmock', '~> 3.0'
48
49
  end
@@ -67,30 +67,15 @@ module AtCoderFriends
67
67
 
68
68
  def exec_command(command, path, *args)
69
69
  @ctx = Context.new(@options, path)
70
- case command
71
- when 'setup'
72
- setup
73
- when 'test-one'
74
- test_one(*args)
75
- when 'test-all'
76
- test_all
77
- when 'submit'
78
- submit
79
- when 'check-and-go'
80
- check_and_go
81
- when 'judge-one'
82
- judge_one(*args)
83
- when 'judge-all'
84
- judge_all
85
- when 'open-contest'
86
- open_contest
87
- else
88
- raise ParamError, "unknown command: #{command}"
89
- end
70
+
71
+ mtd = "command_#{command.gsub('-', '_')}"
72
+ raise ParamError, "unknown command: #{command}" unless respond_to?(mtd)
73
+
74
+ send(mtd, *args)
90
75
  ctx.post_process
91
76
  end
92
77
 
93
- def setup
78
+ def command_setup
94
79
  path = ctx.path
95
80
  raise AppError, "#{path} is not empty." \
96
81
  if Dir.exist?(path) && !Dir["#{path}/*"].empty?
@@ -102,16 +87,16 @@ module AtCoderFriends
102
87
  end
103
88
  end
104
89
 
105
- def test_one(id = '001')
90
+ def command_test_one(id = '001')
106
91
  ctx.sample_test_runner.test_one(id)
107
92
  end
108
93
 
109
- def test_all
94
+ def command_test_all
110
95
  ctx.sample_test_runner.test_all
111
96
  ctx.verifier.verify
112
97
  end
113
98
 
114
- def submit
99
+ def command_submit
115
100
  vf = ctx.verifier
116
101
  raise AppError, "#{vf.file} has not been tested." unless vf.verified?
117
102
 
@@ -120,7 +105,7 @@ module AtCoderFriends
120
105
  open_submission_list
121
106
  end
122
107
 
123
- def check_and_go
108
+ def command_check_and_go
124
109
  vf = ctx.verifier
125
110
  if ctx.sample_test_runner.test_all
126
111
  # submit automatically
@@ -133,15 +118,15 @@ module AtCoderFriends
133
118
  end
134
119
  end
135
120
 
136
- def judge_one(id = '')
121
+ def command_judge_one(id = '')
137
122
  ctx.judge_test_runner.judge_one(id)
138
123
  end
139
124
 
140
- def judge_all
125
+ def command_judge_all
141
126
  ctx.judge_test_runner.judge_all
142
127
  end
143
128
 
144
- def open_contest
129
+ def command_open_contest
145
130
  Launchy.open(ctx.scraping_agent.contest_url)
146
131
  end
147
132
 
@@ -51,19 +51,17 @@ module AtCoderFriends
51
51
  end
52
52
 
53
53
  def merge(base_hash, derived_hash)
54
- res = base_hash.merge(derived_hash) do |_, base_val, derived_val|
54
+ base_hash.merge(derived_hash) do |_, base_val, derived_val|
55
55
  if base_val.is_a?(Hash) && derived_val.is_a?(Hash)
56
56
  merge(base_val, derived_val)
57
57
  else
58
58
  derived_val
59
59
  end
60
60
  end
61
- res
62
61
  end
63
62
 
64
63
  def load_yaml(path)
65
- yaml = IO.read(path, encoding: Encoding::UTF_8)
66
- YAML.safe_load(yaml, [], [], false, path) || {}
64
+ YAML.load_file(path) || {}
67
65
  rescue Errno::ENOENT
68
66
  raise ConfigNotFoundError,
69
67
  "Configuration file not found: #{path}"
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AtCoderFriends
4
+ module Generator
5
+ # generates source from template
6
+ class AnyBuiltin < Base
7
+ include ConstFragmentMixin
8
+ include DeclFragmentMixin
9
+ include InputFragmentMixin
10
+
11
+ ACF_HOME = File.realpath(File.join(__dir__, '..', '..', '..'))
12
+ TMPL_DIR = File.join(ACF_HOME, 'templates')
13
+ TEMPLATE = File.join(TMPL_DIR, 'any_builtin.md.erb')
14
+ FRAGMENTS = File.join(TMPL_DIR, 'any_builtin_fragments.yml')
15
+ ATTRS = Attributes.new(:md, TEMPLATE, FRAGMENTS)
16
+
17
+ def attrs
18
+ ATTRS
19
+ end
20
+ end
21
+ end
22
+ end