mumuki-gobstones-runner 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metadata_hook.rb +30 -0
- data/lib/render/html_renderer.rb +10 -10
- 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: 4ee66f24cbf630ea1b947379614a6b3df521fc15201e5168072c217876ed944a
|
4
|
+
data.tar.gz: 70873ae034b2cdddecb0131ea972979a6ea917b1521f5d08f908d9ebd5d3607c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c58e64be8352e9d34c631e2cc0dac1a7c17b4663f2ce86132a759e623695df86e9d5c3f0bcbabcab2a73ef6c8643d06a729dd435e015f4ed52b062cb82e3dd6c
|
7
|
+
data.tar.gz: b7f2d8e1027cf39bf3efbed55f0d0f14364c54aa6e2fe8bf820cdf226809e3cf90ad98112c2fe72eb931cb8a11dda2a0e60c063281cf9feaacdce9cfbe5e7d0d
|
data/lib/metadata_hook.rb
CHANGED
@@ -32,4 +32,34 @@ class GobstonesMetadataHook < Mumukit::Hook
|
|
32
32
|
}
|
33
33
|
}
|
34
34
|
end
|
35
|
+
|
36
|
+
def template
|
37
|
+
<<YAML
|
38
|
+
## OPTIONS
|
39
|
+
# show_initial_board: true
|
40
|
+
# show_final_board: true
|
41
|
+
# check_head_position: false
|
42
|
+
# expect_endless_while: false
|
43
|
+
# subject: functionOrProcedure
|
44
|
+
examples:
|
45
|
+
- title: 'Example board title'
|
46
|
+
# arguments:
|
47
|
+
#- Sur
|
48
|
+
initial_board: |
|
49
|
+
GBB/1.0
|
50
|
+
size 3 3
|
51
|
+
cell 0 0 Rojo 1 Verde 1 Negro 1 Azul 1
|
52
|
+
head 0 0
|
53
|
+
final_board: |
|
54
|
+
GBB/1.0
|
55
|
+
size 3 3
|
56
|
+
cell 0 0 Rojo 1 Verde 1 Negro 1 Azul 1
|
57
|
+
head 0 0
|
58
|
+
## EXPECTED ERRORS
|
59
|
+
# error: no_stones
|
60
|
+
# error: out_of_board
|
61
|
+
# error: wrong_argument_type
|
62
|
+
# error: unassigned_variable
|
63
|
+
YAML
|
64
|
+
end
|
35
65
|
end
|
data/lib/render/html_renderer.rb
CHANGED
@@ -8,9 +8,9 @@ module Gobstones
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def render_success(result)
|
11
|
-
|
12
|
-
|
13
|
-
bind_result boards: prepare_boards(
|
11
|
+
board_types = [:initial, :final]
|
12
|
+
board_types.reject!{ |it| it === :initial } unless @options[:show_initial_board]
|
13
|
+
bind_result boards: prepare_boards(board_types, result),
|
14
14
|
reason: prepare_reason(result[:reason])
|
15
15
|
end
|
16
16
|
|
@@ -56,22 +56,22 @@ module Gobstones
|
|
56
56
|
Gobstones::build_error(reason)
|
57
57
|
end
|
58
58
|
|
59
|
-
def prepare_boards(
|
60
|
-
|
59
|
+
def prepare_boards(board_types, result)
|
60
|
+
visible_board_types(board_types, result).map do |it|
|
61
61
|
struct title: "#{it}_board".to_sym,
|
62
62
|
board: visible_board(result, it)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def
|
67
|
-
|
66
|
+
def visible_board_types(board_types, result)
|
67
|
+
board_types.select do |it|
|
68
68
|
must_show = @options["show_#{it}_board".to_sym]
|
69
|
-
|
69
|
+
result[it] && (must_show.nil? || must_show)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
def visible_board(result,
|
74
|
-
board = result[
|
73
|
+
def visible_board(result, board_types)
|
74
|
+
board = result[board_types]
|
75
75
|
|
76
76
|
if board == 'boom'
|
77
77
|
HtmlBoard.new(result[:initial], boom: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-gobstones-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Alfonso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.7.
|
190
|
+
rubygems_version: 2.7.6
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: Gobstones Runner for Mumuki
|