green_day 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +12 -44
- data/.rubocop.yml +1 -1
- data/green_day.gemspec +1 -0
- data/lib/green_day/cli.rb +12 -18
- data/lib/green_day/snippet_builder.rb +11 -8
- data/lib/green_day/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb3f3fbe2293b67258b8ac02f28db7c0660eb4f7a7a18d07816bf4b3e1e616df
|
4
|
+
data.tar.gz: a13045a2ffc2266ccd2ebbd4eea4ad99605af4f24de9fd3a1b2b503ab718b872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa65f82bc5b568a4d954b5a1546020f327b06ece50089d905c0877ae08ba08780456668dc6f219830284c86e012318251714e2319812714a7f9a9a17de91fd6a
|
7
|
+
data.tar.gz: 1c08eeacdc7e22142ff5522f2bac98af0c68914d62ccf629bda4b60a5d3d10385ed8cec972687b7123bc4cc1070a81c41c9a90995f1ab6ed9169a4f2ca98cd54
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,60 +1,28 @@
|
|
1
1
|
name: Ruby
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches: [ master ]
|
4
7
|
|
5
8
|
jobs:
|
6
|
-
|
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.
|
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
|
23
15
|
steps:
|
24
16
|
- uses: actions/checkout@v2
|
25
|
-
|
26
|
-
|
27
|
-
uses: masa-iwasaki/setup-rbenv@1.1.0
|
28
|
-
|
29
|
-
- name: Cache RBENV_ROOT
|
30
|
-
uses: actions/cache@v1
|
31
|
-
id: cache_rbenv
|
17
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
18
|
+
uses: actions/setup-ruby@v1
|
32
19
|
with:
|
33
|
-
|
34
|
-
|
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
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
- name: Rspec with rake
|
53
22
|
env:
|
54
23
|
USER_NAME: ${{ secrets.USER_NAME }}
|
55
24
|
PASSWORD: ${{ secrets.PASSWORD }}
|
56
|
-
|
25
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
57
26
|
run: |
|
58
|
-
eval "$(rbenv init -)"
|
59
27
|
bundle install --jobs 4 --retry 3
|
60
28
|
bundle exec rake
|
data/.rubocop.yml
CHANGED
data/green_day.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency 'rspec', '~> 3.0'
|
32
32
|
spec.add_dependency 'thor'
|
33
33
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
34
|
+
spec.add_development_dependency 'codecov'
|
34
35
|
spec.add_development_dependency 'dotenv'
|
35
36
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
36
37
|
spec.add_development_dependency 'rubocop'
|
data/lib/green_day/cli.rb
CHANGED
@@ -24,42 +24,36 @@ module GreenDay
|
|
24
24
|
FileUtils.makedirs("#{contest_name}/spec")
|
25
25
|
|
26
26
|
contest.tasks.each do |task|
|
27
|
-
|
28
|
-
|
29
|
-
create_submit_file!(contest_name, task_code)
|
30
|
-
create_spec_file!(contest_name, task_code, task.input_output_hash)
|
27
|
+
create_submit_file!(contest_name, task)
|
28
|
+
create_spec_file!(contest_name, task)
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
34
32
|
private
|
35
33
|
|
36
|
-
def create_submit_file!(contest_name,
|
37
|
-
File.open(submit_file_path(contest_name,
|
34
|
+
def create_submit_file!(contest_name, task)
|
35
|
+
File.open(submit_file_path(contest_name, task), 'w') do |f|
|
38
36
|
f.write(SnippetBuilder.build)
|
39
37
|
end
|
40
|
-
|
41
|
-
true
|
42
38
|
end
|
43
39
|
|
44
|
-
def create_spec_file!(contest_name,
|
40
|
+
def create_spec_file!(contest_name, task)
|
45
41
|
test =
|
46
42
|
TestBuilder.build_test(
|
47
|
-
submit_file_path(contest_name,
|
48
|
-
input_output_hash
|
43
|
+
submit_file_path(contest_name, task),
|
44
|
+
task.input_output_hash
|
49
45
|
)
|
50
|
-
File.open(spec_file_path(contest_name,
|
46
|
+
File.open(spec_file_path(contest_name, task), 'w') do |f|
|
51
47
|
f.write(test)
|
52
48
|
end
|
53
|
-
|
54
|
-
true
|
55
49
|
end
|
56
50
|
|
57
|
-
def submit_file_path(contest_name,
|
58
|
-
"#{contest_name}/#{
|
51
|
+
def submit_file_path(contest_name, task)
|
52
|
+
"#{contest_name}/#{task.code}.rb"
|
59
53
|
end
|
60
54
|
|
61
|
-
def spec_file_path(contest_name,
|
62
|
-
"#{contest_name}/spec/#{
|
55
|
+
def spec_file_path(contest_name, task)
|
56
|
+
"#{contest_name}/spec/#{task.code}_spec.rb"
|
63
57
|
end
|
64
58
|
end
|
65
59
|
end
|
@@ -1,14 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
4
|
-
|
5
|
-
|
3
|
+
module GreenDay
|
4
|
+
module SnippetBuilder
|
5
|
+
ARRAY_INPUT_SNIPPET = 'gets.split.map(&:to_i)'
|
6
|
+
MULTIPLE_LINE_INPUT_SNIPPET =
|
7
|
+
'readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }'
|
6
8
|
|
7
|
-
|
9
|
+
module_function
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def build
|
12
|
+
[ARRAY_INPUT_SNIPPET, MULTIPLE_LINE_INPUT_SNIPPET]
|
13
|
+
.map { |snippet| '# ' + snippet }
|
14
|
+
.join("\n") + "\n"
|
15
|
+
end
|
13
16
|
end
|
14
17
|
end
|
data/lib/green_day/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2020-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: codecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: dotenv
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|