green_day 0.6.0 → 0.9.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.
- checksums.yaml +4 -4
- data/.github/workflows/{bump_version_and_push_to_rubygems.yml → push_to_rubygems.yml} +0 -11
- data/README.md +51 -17
- data/lib/green_day/test_builder.rb +13 -6
- data/lib/green_day/version.rb +1 -1
- data/lib/green_day.rb +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53785392f34ac5d93be96ca0132fef875d4b733a389e2f7d6e1a82bd1880b15a
|
4
|
+
data.tar.gz: 1bf1044369856380a00ac3c9009d86282011b94c3e05fe6f59d529093c5733f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d03782bc7b38addeb0c458b58b0ef863ab0f5f8f3e1af0e835522e51a3908fd19dbd4433d1e8c6e37d4a58a99f77a8e3b33866816d7d9d0e059ec2a95f060f6
|
7
|
+
data.tar.gz: 746dba21f2edf01245e1e33f7717bd9f513feaa2ed92629f9ebb58c1106752baab462eafc45916e769bf25a0f46c4030aa755b7ba69b653e2bf52188f5427081
|
@@ -3,13 +3,6 @@ name: Bump version and Push to RubyGems
|
|
3
3
|
on:
|
4
4
|
workflow_dispatch:
|
5
5
|
inputs:
|
6
|
-
miner-or-major:
|
7
|
-
description: 'Minor or major release'
|
8
|
-
required: true
|
9
|
-
default: 'minor'
|
10
|
-
options:
|
11
|
-
- 'minor'
|
12
|
-
- 'major'
|
13
6
|
email:
|
14
7
|
description: Your email
|
15
8
|
required: true
|
@@ -32,16 +25,12 @@ jobs:
|
|
32
25
|
ruby-version: 3.2
|
33
26
|
|
34
27
|
- run: bundle install
|
35
|
-
- run: gem install gem-release
|
36
28
|
|
37
29
|
- name: config
|
38
30
|
run: |
|
39
31
|
git config --global user.email ${{ github.event.inputs.email }}
|
40
32
|
git config --global user.name ${{ github.actor }}
|
41
33
|
|
42
|
-
- name: Bump version
|
43
|
-
run: gem bump --version ${{ github.event.inputs.miner-or-major }}
|
44
|
-
|
45
34
|
- name: Publish to RubyGems
|
46
35
|
run: |
|
47
36
|
mkdir -p $HOME/.gem
|
data/README.md
CHANGED
@@ -50,33 +50,67 @@ For example
|
|
50
50
|
```
|
51
51
|
|
52
52
|
Example of output spec
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
RSpec.describe 'abc150/A.rb' do
|
56
|
+
it 'test with "2 900\n"' do
|
57
|
+
if ENV['GD_REPL']
|
58
|
+
File.chmod(0o755, 'abc150/A.rb')
|
59
|
+
system(%q(expect -c 'set timeout 2; spawn ruby abc150/A.rb; send "2 900\n\\004"; interact'))
|
60
|
+
else
|
61
|
+
io = IO.popen('ruby abc150/A.rb', 'w+')
|
62
|
+
io.puts("2 900\n")
|
59
63
|
io.close_write
|
60
|
-
expect(io.readlines.join).to eq("Yes
|
64
|
+
expect(io.readlines.join).to eq("Yes\n")
|
61
65
|
end
|
66
|
+
end
|
62
67
|
|
63
|
-
|
64
|
-
|
65
|
-
|
68
|
+
it 'test with "1 501\n"' do
|
69
|
+
if ENV['GD_REPL']
|
70
|
+
File.chmod(0o755, 'abc150/A.rb')
|
71
|
+
system(%q(expect -c 'set timeout 2; spawn ruby abc150/A.rb; send "1 501\n\\004"; interact'))
|
72
|
+
else
|
73
|
+
io = IO.popen('ruby abc150/A.rb', 'w+')
|
74
|
+
io.puts("1 501\n")
|
66
75
|
io.close_write
|
67
|
-
expect(io.readlines.join).to eq("No
|
76
|
+
expect(io.readlines.join).to eq("No\n")
|
68
77
|
end
|
78
|
+
end
|
69
79
|
|
70
|
-
|
71
|
-
|
72
|
-
|
80
|
+
it 'test with "4 2000\n"' do
|
81
|
+
if ENV['GD_REPL']
|
82
|
+
File.chmod(0o755, 'abc150/A.rb')
|
83
|
+
system(%q(expect -c 'set timeout 2; spawn ruby abc150/A.rb; send "4 2000\n\\004"; interact'))
|
84
|
+
else
|
85
|
+
io = IO.popen('ruby abc150/A.rb', 'w+')
|
86
|
+
io.puts("4 2000\n")
|
73
87
|
io.close_write
|
74
|
-
expect(io.readlines.join).to eq("Yes
|
88
|
+
expect(io.readlines.join).to eq("Yes\n")
|
75
89
|
end
|
76
|
-
|
77
90
|
end
|
78
|
-
```
|
79
91
|
|
92
|
+
end
|
93
|
+
|
94
|
+
```
|
95
|
+
## Debugging with REPL
|
96
|
+
You can debug your code with sample input and REPL by setting `GD_REPL` environment variable.
|
97
|
+
|
98
|
+
```
|
99
|
+
$ GD_REPL=1 bundle exec rspec abc150/spec/A_spec.rb
|
100
|
+
|
101
|
+
abc150/A.rb
|
102
|
+
spawn ruby abc150/A.rb
|
103
|
+
2 900
|
104
|
+
|
105
|
+
From: abc150/A.rb @ line 2 :
|
106
|
+
|
107
|
+
1: a, b = gets.split.map(&:to_i)
|
108
|
+
=> 2: binding.irb
|
109
|
+
3: puts "Yes"
|
110
|
+
|
111
|
+
irb(main):001:0> a
|
112
|
+
=> 2
|
113
|
+
```
|
80
114
|
## Development
|
81
115
|
|
82
116
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -6,22 +6,29 @@ module GreenDay
|
|
6
6
|
|
7
7
|
def build_test(submit_file_path, input_output_hash)
|
8
8
|
<<~SPEC
|
9
|
-
RSpec.describe '
|
9
|
+
RSpec.describe '#{submit_file_path}' do
|
10
10
|
#{input_output_hash.map { |input, output| build_example(submit_file_path, input, output) }.join("\n")}
|
11
11
|
end
|
12
12
|
SPEC
|
13
13
|
end
|
14
14
|
|
15
|
+
# rubocop:disable Metrics/AbcSize
|
15
16
|
def build_example(submit_file_path, input, output)
|
16
17
|
<<~SPEC
|
17
|
-
#{tab}it 'test with #{unify_cr_lf(input)}' do
|
18
|
-
#{tab}#{tab}
|
19
|
-
#{tab}#{tab}
|
20
|
-
#{tab}#{tab}
|
21
|
-
#{tab}#{tab}
|
18
|
+
#{tab}it 'test with #{unify_cr_lf(input).chomp}' do
|
19
|
+
#{tab}#{tab}if ENV['GD_REPL']
|
20
|
+
#{tab}#{tab}#{tab}File.chmod(0o755, '#{submit_file_path}')
|
21
|
+
#{tab}#{tab}#{tab}system(%q(expect -c 'set timeout 2; spawn ruby #{submit_file_path}; send #{unify_cr_lf("#{input}\\004")}; interact'))
|
22
|
+
#{tab}#{tab}else
|
23
|
+
#{tab}#{tab}#{tab}io = IO.popen('ruby #{submit_file_path}', 'w+')
|
24
|
+
#{tab}#{tab}#{tab}io.puts(#{unify_cr_lf(input)})
|
25
|
+
#{tab}#{tab}#{tab}io.close_write
|
26
|
+
#{tab}#{tab}#{tab}expect(io.readlines.join).to eq(#{unify_cr_lf(output)})
|
27
|
+
#{tab}#{tab}end
|
22
28
|
#{tab}end
|
23
29
|
SPEC
|
24
30
|
end
|
31
|
+
# rubocop:enable Metrics/AbcSize
|
25
32
|
|
26
33
|
def unify_cr_lf(string)
|
27
34
|
return unless string # たまに画像で例を出してくるとsampleの文字がなくなる
|
data/lib/green_day/version.rb
CHANGED
data/lib/green_day.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.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- qwyng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -88,7 +88,7 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- ".github/workflows/
|
91
|
+
- ".github/workflows/push_to_rubygems.yml"
|
92
92
|
- ".github/workflows/ruby.yml"
|
93
93
|
- ".gitignore"
|
94
94
|
- ".rspec"
|