green_day 0.1.9 → 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: aa59fb5ccbedf8faf233f5519d89b260b6885161754a96744a28e5419b689aa7
4
- data.tar.gz: 89c55070f70ac636b94c5259c979d5b3ea1571d68cb0dbb381177ae003558bd8
3
+ metadata.gz: 06bcfc1dc4b42165710a01e2d1d4836e0ad829a4b33040d5f35613b836ce15af
4
+ data.tar.gz: 39899f57ae69c44e702b7a9a0990e332d8842867584fe97462f01d89edcae461
5
5
  SHA512:
6
- metadata.gz: 383b488e31d8b09339485ff01551e6b3fa9a940eb6ceb55991048cf64adfeb6bfacdd9af24e5be69ee1794ccd8af9fedfbe3f775d4ddb7e5fc4575b5625070d1
7
- data.tar.gz: 74d9dc5ae1b1a1a0147cfb91918e4b85ed203cca1a21a764977e23c70da2e68ea051df8c01d1706c7424c3500bc7bde62dec1cd9cdc4313e780ad9c3b8b40506
6
+ metadata.gz: 54eacd28a4a76464d6a740bc6b670ecf33c8f264cc33b3e32cd8943d6df3f5e85d822c21f09712cf339e0c5d8e2f43626a9d845c8f84c31e0d8b1e818aecfc8a
7
+ data.tar.gz: 16e9b1390526d3d55ea2eeaef27f964844aaf23997236f108efecbc8bd2f781c04e04bef3b3a100248072205b075425eb09d7eb016cdbab7ddade4c3598cda2f
@@ -1,60 +1,34 @@
1
1
  name: Ruby
2
2
 
3
- on: [push]
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [ master ]
4
7
 
5
8
  jobs:
6
- build:
7
-
8
- runs-on: ${{ matrix.runner }}
9
-
9
+ rspec:
10
+ runs-on: ubuntu-latest
10
11
  strategy:
11
- fail-fast: false
12
-
13
12
  matrix:
14
13
  ruby:
15
- - 2.3.3
16
- - 2.7.0
17
- include:
18
- - ruby: 2.3.3
19
- runner: ubuntu-16.04
20
- - ruby: 2.7.0
21
- runner: ubuntu-latest
22
-
14
+ - 2.7.1 # AtCoder公式が使用しているrubyは2.7.1
15
+ - 3.1.0
23
16
  steps:
24
17
  - uses: actions/checkout@v2
25
-
26
- - name: Set up rbenv
27
- uses: masa-iwasaki/setup-rbenv@1.1.0
28
-
29
- - name: Cache RBENV_ROOT
30
- uses: actions/cache@v1
31
- id: cache_rbenv
18
+ - name: Set up Ruby ${{ matrix.ruby }}
19
+ uses: ruby/setup-ruby@v1
32
20
  with:
33
- path: ~/.rbenv/versions
34
- key: v1-rbenv-${{ runner.os }}-${{ matrix.ruby }}
35
-
36
- - name: Reinstall libssl-dev
37
- run: |
38
- set -xe
39
- sudo apt-get remove -y libssl-dev
40
- sudo apt-get install -y libssl-dev=1.0.2g-1ubuntu4.15
41
- if: matrix.runner == 'ubuntu-16.04'
42
-
43
- - name: Install Ruby
44
- env:
45
- RBENV_VERSION: ${{ matrix.ruby }}
46
- run: |
47
- set -xe
48
- eval "$(rbenv init -)"
49
- rbenv install -s $RBENV_VERSION
50
- gem install bundler || true
51
-
52
- - name: test with Rake
21
+ ruby-version: ${{ matrix.ruby }}
22
+ - name: bundle install
23
+ run: bundle install
24
+ - name: Rubocop
25
+ run: bundle exec rubocop
26
+ - name: Rspec
53
27
  env:
54
28
  USER_NAME: ${{ secrets.USER_NAME }}
55
29
  PASSWORD: ${{ secrets.PASSWORD }}
56
- RBENV_VERSION: ${{ matrix.ruby }}
57
- run: |
58
- eval "$(rbenv init -)"
59
- bundle install --jobs 4 --retry 3
60
- bundle exec rake
30
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
31
+ run: script -e -c "rake spec"
32
+
33
+
34
+
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/.rubocop.yml CHANGED
@@ -1,4 +1,9 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
1
5
  AllCops:
6
+ NewCops: enable
2
7
  Exclude:
3
8
  - 'spec/spec_helper.rb'
4
9
  Style/Documentation:
@@ -9,5 +14,11 @@ Layout/LineLength:
9
14
  Max: 90
10
15
  Metrics/BlockLength:
11
16
  Exclude:
12
- - 'spec/*'
13
-
17
+ - 'spec/*/**'
18
+ - 'green_day.gemspec'
19
+ RSpec/NamedSubject:
20
+ Enabled: false
21
+ RSpec/NestedGroups:
22
+ Max: 4
23
+ RSpec/ExampleLength:
24
+ Enabled: false
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # GreenDay
2
- Automatically create workspace and tests for Atcoder contests
2
+ Green Day creates workspaces and tests for Atcoder contests
3
3
  (日本語で解説した記事は[こちら](https://qiita.com/QWYNG/items/0e2e6b72bd1969d0d751))
4
4
  ## Installation
5
5
 
@@ -18,11 +18,11 @@ Or install it yourself as:
18
18
  $ gem install green_day
19
19
 
20
20
  ## Usage
21
- login(this command stores your cookie as `cookie-store` in current directory)
21
+ login(this command stores your cookie as `.cookie-store` in current directory)
22
22
 
23
23
  $ bundle exec green_day login
24
24
 
25
- If you want to delete session, remove `cookie-store`
25
+ If you want to delete session, remove `.cookie-store`
26
26
 
27
27
  This command creates directory and spec.
28
28
 
@@ -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
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'green_day/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
+ spec.required_ruby_version = '>= 2.7.1'
8
9
  spec.name = 'green_day'
9
10
  spec.executables = ['green_day']
10
11
  spec.version = GreenDay::VERSION
@@ -25,13 +26,21 @@ Gem::Specification.new do |spec|
25
26
  spec.bindir = 'exe'
26
27
  spec.require_paths = ['lib']
27
28
 
29
+ spec.add_dependency 'colorize'
28
30
  spec.add_dependency 'faraday', '< 1.0'
29
31
  spec.add_dependency 'faraday-cookie_jar'
30
32
  spec.add_dependency 'nokogiri'
31
- spec.add_dependency 'rspec', '~> 3.0'
33
+ spec.add_dependency 'parallel'
32
34
  spec.add_dependency 'thor'
35
+ spec.add_dependency 'webrick'
33
36
  spec.add_development_dependency 'bundler', '~> 2.0'
37
+ spec.add_development_dependency 'codecov'
34
38
  spec.add_development_dependency 'dotenv'
35
39
  spec.add_development_dependency 'rake', '>= 12.3.3'
40
+ spec.add_development_dependency 'rspec', '~> 3.0'
36
41
  spec.add_development_dependency 'rubocop'
42
+ spec.add_development_dependency 'rubocop-rake'
43
+ spec.add_development_dependency 'rubocop-rspec'
44
+ spec.add_development_dependency 'vcr'
45
+ spec.metadata['rubygems_mfa_required'] = 'true'
37
46
  end
@@ -8,7 +8,7 @@ require 'nokogiri'
8
8
  module GreenDay
9
9
  class AtcoderClient
10
10
  ATCODER_ENDPOINT = 'https://atcoder.jp'
11
- COOKIE_DB = 'cookie-store'
11
+ COOKIE_FILE_NAME = '.cookie-store'
12
12
  attr_reader :client, :cookie_jar
13
13
 
14
14
  def initialize
@@ -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)
@@ -57,14 +57,20 @@ module GreenDay
57
57
  raise Error, CGI.unescape(select_flash_cookie.value).split('.').shift
58
58
  end
59
59
 
60
- cookie_jar.save(COOKIE_DB)
60
+ cookie_jar.save(COOKIE_FILE_NAME)
61
61
  end
62
62
 
63
63
  private
64
64
 
65
65
  def create_or_load_cookie_jar
66
66
  jar = HTTP::CookieJar.new
67
- jar.load(COOKIE_DB) if File.exist?(COOKIE_DB)
67
+ if File.exist?(COOKIE_FILE_NAME)
68
+ jar.load(COOKIE_FILE_NAME)
69
+ elsif File.exist?('cookie-store')
70
+ warn 'cookie-store needs rename .cookie-store'
71
+ jar.load('cookie-store')
72
+ end
73
+
68
74
  jar
69
75
  end
70
76
 
data/lib/green_day/cli.rb CHANGED
@@ -1,65 +1,63 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'thor'
4
+ require 'parallel'
5
+ require 'colorize'
6
+ require 'io/console'
4
7
  require_relative 'atcoder_client'
5
8
  require_relative 'contest'
6
9
  require_relative 'test_builder'
7
- require_relative 'snippet_builder'
8
10
 
9
11
  module GreenDay
10
12
  class Cli < Thor
11
13
  desc 'login Atcoder', 'login Atcoder and save session'
12
14
  def login
13
15
  print 'username:'
14
- username = STDIN.gets.chomp!
16
+ username = $stdin.gets(chomp: true)
15
17
  print 'password:'
16
- password = STDIN.gets.chomp!
18
+ password = $stdin.noecho { |stdin| stdin.gets(chomp: true) }.tap { puts }
17
19
 
18
20
  AtcoderClient.new.login(username, password)
21
+ puts(
22
+ "Successfully created #{AtcoderClient::COOKIE_FILE_NAME}"
23
+ .colorize(:green)
24
+ )
19
25
  end
20
26
 
21
27
  desc 'new [contest name]', 'create contest workspace and spec'
22
28
  def new(contest_name)
23
- contest = Contest.new(contest_name)
24
- FileUtils.makedirs("#{contest_name}/spec")
29
+ contest = Contest.new(contest_name, AtcoderClient.new)
30
+ FileUtils.makedirs("#{contest.name}/spec")
25
31
 
26
- contest.tasks.each do |task|
27
- task_code = task.code
28
-
29
- create_submit_file!(contest_name, task_code)
30
- create_spec_file!(contest_name, task_code, task.input_output_hash)
32
+ Parallel.each(contest.tasks, in_threads: THREAD_COUNT) do |task|
33
+ create_submit_file(task)
34
+ create_spec_file(task)
31
35
  end
36
+
37
+ puts "Successfully created #{contest.name} directory".colorize(:green)
32
38
  end
33
39
 
34
40
  private
35
41
 
36
- def create_submit_file!(contest_name, task_code)
37
- File.open(submit_file_path(contest_name, task_code), 'w') do |f|
38
- f.write(SnippetBuilder.build)
39
- end
40
-
41
- true
42
+ def create_submit_file(task)
43
+ File.open(submit_file_path(task), 'w')
42
44
  end
43
45
 
44
- def create_spec_file!(contest_name, task_code, input_output_hash)
46
+ def create_spec_file(task)
45
47
  test =
46
48
  TestBuilder.build_test(
47
- submit_file_path(contest_name, task_code),
48
- input_output_hash
49
+ submit_file_path(task),
50
+ task.sample_answers
49
51
  )
50
- File.open(spec_file_path(contest_name, task_code), 'w') do |f|
51
- f.write(test)
52
- end
53
-
54
- true
52
+ File.write(spec_file_path(task), test)
55
53
  end
56
54
 
57
- def submit_file_path(contest_name, task_code)
58
- "#{contest_name}/#{task_code}.rb"
55
+ def submit_file_path(task)
56
+ "#{task.contest.name}/#{task.code}.rb"
59
57
  end
60
58
 
61
- def spec_file_path(contest_name, task_code)
62
- "#{contest_name}/spec/#{task_code}_spec.rb"
59
+ def spec_file_path(task)
60
+ "#{task.contest.name}/spec/#{task.code}_spec.rb"
63
61
  end
64
62
  end
65
63
  end
@@ -7,14 +7,16 @@ module GreenDay
7
7
  class Contest
8
8
  attr_reader :atcoder_client, :name, :tasks
9
9
 
10
- def initialize(contest_name)
11
- client = AtcoderClient.new
10
+ def initialize(contest_name, client)
12
11
  raise GreenDay::Error 'cant find contest' unless client.contest_exist?(contest_name)
13
12
 
14
13
  @name = contest_name
15
- @tasks = client.fetch_task_codes(self).map do |task_code|
16
- Task.new(self, task_code)
17
- 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
18
20
  end
19
21
  end
20
22
  end
@@ -2,27 +2,21 @@
2
2
 
3
3
  module GreenDay
4
4
  class Task
5
- attr_reader :contest, :code, :input_output_hash
6
- def initialize(contest, code)
5
+ attr_reader :contest, :code, :sample_answers
6
+
7
+ def initialize(contest, code, client)
7
8
  @contest = contest
8
9
  @code = code
9
- @input_output_hash = create_input_output_hash
10
+ @sample_answers = create_sample_answers(client)
10
11
  end
11
12
 
12
13
  private
13
14
 
14
- def create_input_output_hash
15
- client = AtcoderClient.new
16
-
15
+ def create_sample_answers(client)
17
16
  input_samples, output_samples =
18
17
  client.fetch_inputs_and_outputs(contest, self)
19
18
 
20
- hash = {}
21
- input_samples.zip(output_samples).each do |input, output|
22
- hash[input] = output
23
- end
24
-
25
- hash
19
+ input_samples.zip(output_samples).to_h
26
20
  end
27
21
  end
28
22
  end
@@ -6,8 +6,6 @@ module GreenDay
6
6
 
7
7
  def build_test(submit_file_path, input_output_hash)
8
8
  <<~SPEC
9
- require 'rspec'
10
-
11
9
  RSpec.describe 'test' do
12
10
  #{input_output_hash.map { |input, output| build_example(submit_file_path, input, output) }.join("\n")}
13
11
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GreenDay
4
- VERSION = '0.1.9'
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,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: green_day
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
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: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2022-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: faraday
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,19 +67,19 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: rspec
70
+ name: parallel
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: '3.0'
75
+ version: '0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: '3.0'
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: thor
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +94,20 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webrick
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: bundler
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +122,20 @@ dependencies:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: '2.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: codecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
97
139
  - !ruby/object:Gem::Dependency
98
140
  name: dotenv
99
141
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +164,20 @@ dependencies:
122
164
  - - ">="
123
165
  - !ruby/object:Gem::Version
124
166
  version: 12.3.3
167
+ - !ruby/object:Gem::Dependency
168
+ name: rspec
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '3.0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '3.0'
125
181
  - !ruby/object:Gem::Dependency
126
182
  name: rubocop
127
183
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +192,48 @@ dependencies:
136
192
  - - ">="
137
193
  - !ruby/object:Gem::Version
138
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rubocop-rake
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rubocop-rspec
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
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'
139
237
  description: CLI tool for AtCoder and Ruby
140
238
  email:
141
239
  - ikusawasi@gmail.com
@@ -144,7 +242,6 @@ executables:
144
242
  extensions: []
145
243
  extra_rdoc_files: []
146
244
  files:
147
- - ".env.sample"
148
245
  - ".github/workflows/ruby.yml"
149
246
  - ".gitignore"
150
247
  - ".rspec"
@@ -162,7 +259,6 @@ files:
162
259
  - lib/green_day/atcoder_client.rb
163
260
  - lib/green_day/cli.rb
164
261
  - lib/green_day/contest.rb
165
- - lib/green_day/snippet_builder.rb
166
262
  - lib/green_day/task.rb
167
263
  - lib/green_day/test_builder.rb
168
264
  - lib/green_day/version.rb
@@ -172,6 +268,7 @@ licenses:
172
268
  metadata:
173
269
  homepage_uri: https://github.com/QWYNG/green_day
174
270
  source_code_uri: https://github.com/QWYNG/green_day
271
+ rubygems_mfa_required: 'true'
175
272
  post_install_message:
176
273
  rdoc_options: []
177
274
  require_paths:
@@ -180,14 +277,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
277
  requirements:
181
278
  - - ">="
182
279
  - !ruby/object:Gem::Version
183
- version: '0'
280
+ version: 2.7.1
184
281
  required_rubygems_version: !ruby/object:Gem::Requirement
185
282
  requirements:
186
283
  - - ">="
187
284
  - !ruby/object:Gem::Version
188
285
  version: '0'
189
286
  requirements: []
190
- rubygems_version: 3.1.2
287
+ rubygems_version: 3.1.6
191
288
  signing_key:
192
289
  specification_version: 4
193
290
  summary: CLI tool for AtCoder and Ruby
data/.env.sample DELETED
@@ -1,3 +0,0 @@
1
- # for spec
2
- USER_NAME=
3
- PASSWORD=
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SnippetBuilder
4
- ARRAY_INPUT_SNIPPET = 'n = gets.split.map(&:to_i)'
5
- MULTIPLE_LINE_INPUT_SNIPPET = 'array = readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }'
6
-
7
- module_function
8
-
9
- def build
10
- constants
11
- .map { |snippet| '# ' + eval(snippet.to_s) }
12
- .join("\n") + "\n"
13
- end
14
- end