green_day 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36a5e97dca37d3a8c3763cc0ac411b143c70a9bb9371b415a0e64828141613fb
4
- data.tar.gz: 4c3101ee0d718b79907850334211d6f92671c2817322eb22862c74077eaa8a40
3
+ metadata.gz: 06bcfc1dc4b42165710a01e2d1d4836e0ad829a4b33040d5f35613b836ce15af
4
+ data.tar.gz: 39899f57ae69c44e702b7a9a0990e332d8842867584fe97462f01d89edcae461
5
5
  SHA512:
6
- metadata.gz: ea1311da8032a5403d8fccb3e53acb74e5bd36b443d9e985b3d79a8a8dab47151151a5413b645c4ff8f98290011a970daece21f2329727b6f6511878ce75740b
7
- data.tar.gz: 65683e77ffb9e1beb340a2131ab0bd60b92e35276cafd4740f6ce1df5ca165c77b4d1ab72dbaccaba9067ef17824d2fea47ef61b500d8ec2cd75a233252aea98
6
+ metadata.gz: 54eacd28a4a76464d6a740bc6b670ecf33c8f264cc33b3e32cd8943d6df3f5e85d822c21f09712cf339e0c5d8e2f43626a9d845c8f84c31e0d8b1e818aecfc8a
7
+ data.tar.gz: 16e9b1390526d3d55ea2eeaef27f964844aaf23997236f108efecbc8bd2f781c04e04bef3b3a100248072205b075425eb09d7eb016cdbab7ddade4c3598cda2f
@@ -11,8 +11,8 @@ jobs:
11
11
  strategy:
12
12
  matrix:
13
13
  ruby:
14
- - 2.7.1
15
- - 3.0.0
14
+ - 2.7.1 # AtCoder公式が使用しているrubyは2.7.1
15
+ - 3.1.0
16
16
  steps:
17
17
  - uses: actions/checkout@v2
18
18
  - name: Set up Ruby ${{ matrix.ruby }}
data/.gitignore CHANGED
@@ -7,7 +7,6 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  .idea
10
- .env
11
10
  # rspec failure tracking
12
11
  .rspec_status
13
12
  Gemfile.lock
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # GreenDay
2
- Automatically create workspace and tests for Atcoder contest
2
+ Green Day creates workspaces and tests for Atcoder contests
3
3
  (日本語で解説した記事は[こちら](https://qiita.com/QWYNG/items/0e2e6b72bd1969d0d751))
4
4
  ## Installation
5
5
 
@@ -86,8 +86,6 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
86
86
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
87
87
 
88
88
  ## Contributing
89
- You need create `.env` and set `USER_NAME` and `PASSWORD` for spec. see `env.sample`
90
- Those env is already set as secret on CI.
91
89
  Bug reports and pull requests are welcome on GitHub at https://github.com/QWYNG/green_day. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
92
90
 
93
91
  ## License
data/green_day.gemspec CHANGED
@@ -41,4 +41,6 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency 'rubocop'
42
42
  spec.add_development_dependency 'rubocop-rake'
43
43
  spec.add_development_dependency 'rubocop-rspec'
44
+ spec.add_development_dependency 'vcr'
45
+ spec.metadata['rubygems_mfa_required'] = 'true'
44
46
  end
@@ -30,7 +30,7 @@ module GreenDay
30
30
 
31
31
  # 3問だったら<tbody>の中に<tr>が3 * 2個 </tbody> が1mh個
32
32
  tasks_size = ((body.at('tbody').children.size - 1) / 2.0).ceil
33
- ('A'..'Z').to_a.shift(tasks_size)
33
+ ('A'..'ZZ').to_a.shift(tasks_size)
34
34
  end
35
35
 
36
36
  def fetch_inputs_and_outputs(contest, task)
data/lib/green_day/cli.rb CHANGED
@@ -29,7 +29,7 @@ module GreenDay
29
29
  contest = Contest.new(contest_name, AtcoderClient.new)
30
30
  FileUtils.makedirs("#{contest.name}/spec")
31
31
 
32
- Parallel.each(contest.tasks) do |task|
32
+ Parallel.each(contest.tasks, in_threads: THREAD_COUNT) do |task|
33
33
  create_submit_file(task)
34
34
  create_spec_file(task)
35
35
  end
@@ -49,9 +49,7 @@ module GreenDay
49
49
  submit_file_path(task),
50
50
  task.sample_answers
51
51
  )
52
- File.open(spec_file_path(task), 'w') do |f|
53
- f.write(test)
54
- end
52
+ File.write(spec_file_path(task), test)
55
53
  end
56
54
 
57
55
  def submit_file_path(task)
@@ -11,9 +11,12 @@ module GreenDay
11
11
  raise GreenDay::Error 'cant find contest' unless client.contest_exist?(contest_name)
12
12
 
13
13
  @name = contest_name
14
- @tasks = Parallel.map(client.fetch_task_codes(self)) do |task_code|
15
- Task.new(self, task_code, client)
16
- end
14
+
15
+ task_codes = client.fetch_task_codes(self)
16
+ @tasks =
17
+ Parallel.map(task_codes, in_threads: THREAD_COUNT) do |task_code|
18
+ Task.new(self, task_code, client)
19
+ end
17
20
  end
18
21
  end
19
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GreenDay
4
- VERSION = '0.3.1'
4
+ VERSION = '0.4.0'
5
5
  end
data/lib/green_day.rb CHANGED
@@ -5,4 +5,5 @@ require_relative 'green_day/cli'
5
5
 
6
6
  module GreenDay
7
7
  class Error < StandardError; end
8
+ THREAD_COUNT = 6 # There are usually six questions on Atcoder.
8
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: green_day
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - qwyng
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-10 00:00:00.000000000 Z
11
+ date: 2022-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -220,6 +220,20 @@ dependencies:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: vcr
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
223
237
  description: CLI tool for AtCoder and Ruby
224
238
  email:
225
239
  - ikusawasi@gmail.com
@@ -228,7 +242,6 @@ executables:
228
242
  extensions: []
229
243
  extra_rdoc_files: []
230
244
  files:
231
- - ".env.sample"
232
245
  - ".github/workflows/ruby.yml"
233
246
  - ".gitignore"
234
247
  - ".rspec"
@@ -255,6 +268,7 @@ licenses:
255
268
  metadata:
256
269
  homepage_uri: https://github.com/QWYNG/green_day
257
270
  source_code_uri: https://github.com/QWYNG/green_day
271
+ rubygems_mfa_required: 'true'
258
272
  post_install_message:
259
273
  rdoc_options: []
260
274
  require_paths:
@@ -270,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
284
  - !ruby/object:Gem::Version
271
285
  version: '0'
272
286
  requirements: []
273
- rubygems_version: 3.2.3
287
+ rubygems_version: 3.1.6
274
288
  signing_key:
275
289
  specification_version: 4
276
290
  summary: CLI tool for AtCoder and Ruby
data/.env.sample DELETED
@@ -1,3 +0,0 @@
1
- # for spec
2
- USER_NAME=
3
- PASSWORD=