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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa59fb5ccbedf8faf233f5519d89b260b6885161754a96744a28e5419b689aa7
4
- data.tar.gz: 89c55070f70ac636b94c5259c979d5b3ea1571d68cb0dbb381177ae003558bd8
3
+ metadata.gz: cb3f3fbe2293b67258b8ac02f28db7c0660eb4f7a7a18d07816bf4b3e1e616df
4
+ data.tar.gz: a13045a2ffc2266ccd2ebbd4eea4ad99605af4f24de9fd3a1b2b503ab718b872
5
5
  SHA512:
6
- metadata.gz: 383b488e31d8b09339485ff01551e6b3fa9a940eb6ceb55991048cf64adfeb6bfacdd9af24e5be69ee1794ccd8af9fedfbe3f775d4ddb7e5fc4575b5625070d1
7
- data.tar.gz: 74d9dc5ae1b1a1a0147cfb91918e4b85ed203cca1a21a764977e23c70da2e68ea051df8c01d1706c7424c3500bc7bde62dec1cd9cdc4313e780ad9c3b8b40506
6
+ metadata.gz: aa65f82bc5b568a4d954b5a1546020f327b06ece50089d905c0877ae08ba08780456668dc6f219830284c86e012318251714e2319812714a7f9a9a17de91fd6a
7
+ data.tar.gz: 1c08eeacdc7e22142ff5522f2bac98af0c68914d62ccf629bda4b60a5d3d10385ed8cec972687b7123bc4cc1070a81c41c9a90995f1ab6ed9169a4f2ca98cd54
@@ -1,60 +1,28 @@
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
23
15
  steps:
24
16
  - 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
17
+ - name: Set up Ruby ${{ matrix.ruby }}
18
+ uses: actions/setup-ruby@v1
32
19
  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
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
- RBENV_VERSION: ${{ matrix.ruby }}
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
@@ -10,4 +10,4 @@ Layout/LineLength:
10
10
  Metrics/BlockLength:
11
11
  Exclude:
12
12
  - 'spec/*'
13
-
13
+ - 'green_day.gemspec'
@@ -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'
@@ -24,42 +24,36 @@ module GreenDay
24
24
  FileUtils.makedirs("#{contest_name}/spec")
25
25
 
26
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)
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, task_code)
37
- File.open(submit_file_path(contest_name, task_code), 'w') do |f|
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, task_code, input_output_hash)
40
+ def create_spec_file!(contest_name, task)
45
41
  test =
46
42
  TestBuilder.build_test(
47
- submit_file_path(contest_name, task_code),
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, task_code), 'w') do |f|
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, task_code)
58
- "#{contest_name}/#{task_code}.rb"
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, task_code)
62
- "#{contest_name}/spec/#{task_code}_spec.rb"
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 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) }'
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
- module_function
9
+ module_function
8
10
 
9
- def build
10
- constants
11
- .map { |snippet| '# ' + eval(snippet.to_s) }
12
- .join("\n") + "\n"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GreenDay
4
- VERSION = '0.1.9'
4
+ VERSION = '0.2.0'
5
5
  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.1.9
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-04-23 00:00:00.000000000 Z
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