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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bc2d1290cae35da099fd7e91689d5ae3cf0a7bffd20f1e35b0c5c5c811d5119
4
- data.tar.gz: 4006b96d27cd8ea4847a867a31328d4cc662f14beec8e224e627e6c913bc060d
3
+ metadata.gz: 4ee66f24cbf630ea1b947379614a6b3df521fc15201e5168072c217876ed944a
4
+ data.tar.gz: 70873ae034b2cdddecb0131ea972979a6ea917b1521f5d08f908d9ebd5d3607c
5
5
  SHA512:
6
- metadata.gz: e3f58a1d6d5f5f4d7d717ed70bd910cf75d220a3d32e1843815b957a9d643e45b61de3205bf0de063108d2630e3ac353f06c451536762c1613211ca83718ddf0
7
- data.tar.gz: af975fc874df88846613a5460b8f8be901065d3415f8cc0164f1d9b06ca4f4c1beba26b4a511ed15191c60257b9266b8ccb535ec1ea9438c5fe75bc9f724e1ae
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
@@ -8,9 +8,9 @@ module Gobstones
8
8
  end
9
9
 
10
10
  def render_success(result)
11
- boards = [:initial, :final]
12
- boards.reject!{ |it| it === :initial } unless @options[:show_initial_board]
13
- bind_result boards: prepare_boards(boards, result),
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(names, result)
60
- visible_names(names, result).map do |it|
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 visible_names(names, result)
67
- names.reject do |it|
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
- !must_show.nil? && !must_show
69
+ result[it] && (must_show.nil? || must_show)
70
70
  end
71
71
  end
72
72
 
73
- def visible_board(result, name)
74
- board = result[name]
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.0
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-02 00:00:00.000000000 Z
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.4
190
+ rubygems_version: 2.7.6
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Gobstones Runner for Mumuki