mkrf 0.1.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.
Files changed (186) hide show
  1. data/CHANGELOG +2 -0
  2. data/MIT-LICENSE +7 -0
  3. data/README +54 -0
  4. data/Rakefile +107 -0
  5. data/lib/mkrf.rb +4 -0
  6. data/lib/mkrf/availability.rb +219 -0
  7. data/lib/mkrf/generator.rb +146 -0
  8. data/test/abstract_unit.rb +4 -0
  9. data/test/fixtures/down_a_directory/header_down_a_directory.h +1 -0
  10. data/test/fixtures/stdmkrf.h +1 -0
  11. data/test/sample_files/libtrivial/Rakefile +31 -0
  12. data/test/sample_files/libtrivial/extconf.rb +3 -0
  13. data/test/sample_files/libtrivial/lib/libtrivial.c +5 -0
  14. data/test/sample_files/libtrivial/lib/libtrivial.o +0 -0
  15. data/test/sample_files/libtrivial/libtrivial_so.bundle +0 -0
  16. data/test/sample_files/libtrivial/mkrf.log +1 -0
  17. data/test/sample_files/libxml-ruby-0.3.8/CHANGELOG +74 -0
  18. data/test/sample_files/libxml-ruby-0.3.8/LICENSE +22 -0
  19. data/test/sample_files/libxml-ruby-0.3.8/README +144 -0
  20. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/cbg.c +76 -0
  21. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/extconf.rb +49 -0
  22. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.c +86 -0
  23. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.h +82 -0
  24. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.rb +107 -0
  25. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/mkrf.log +1 -0
  26. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/old_extconf.rb +95 -0
  27. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attr.c +372 -0
  28. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attr.h +21 -0
  29. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attribute.c +224 -0
  30. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attribute.h +21 -0
  31. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.c +1159 -0
  32. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.h +27 -0
  33. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_dtd.c +168 -0
  34. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_dtd.h +17 -0
  35. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_input_cbg.c +167 -0
  36. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_input_cbg.h +21 -0
  37. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node.c +2139 -0
  38. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node.h +28 -0
  39. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node_set.c +248 -0
  40. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node_set.h +26 -0
  41. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_ns.c +153 -0
  42. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_ns.h +21 -0
  43. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.c +1417 -0
  44. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.h +31 -0
  45. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser_context.c +715 -0
  46. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser_context.h +22 -0
  47. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_sax_parser.c +426 -0
  48. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_sax_parser.h +52 -0
  49. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_schema.c +142 -0
  50. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_schema.h +16 -0
  51. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_tree.c +43 -0
  52. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_tree.h +12 -0
  53. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xinclude.c +20 -0
  54. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xinclude.h +13 -0
  55. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.c +363 -0
  56. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.h +24 -0
  57. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath_context.c +125 -0
  58. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath_context.h +24 -0
  59. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer.c +100 -0
  60. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer.h +27 -0
  61. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer_context.c +21 -0
  62. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer_context.h +18 -0
  63. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/sax_parser_callbacks.inc +202 -0
  64. data/test/sample_files/syck-0.55/CHANGELOG +186 -0
  65. data/test/sample_files/syck-0.55/COPYING +54 -0
  66. data/test/sample_files/syck-0.55/Makefile +582 -0
  67. data/test/sample_files/syck-0.55/Makefile.am +5 -0
  68. data/test/sample_files/syck-0.55/Makefile.in +582 -0
  69. data/test/sample_files/syck-0.55/README +105 -0
  70. data/test/sample_files/syck-0.55/README.BYTECODE +484 -0
  71. data/test/sample_files/syck-0.55/README.EXT +444 -0
  72. data/test/sample_files/syck-0.55/RELEASE +123 -0
  73. data/test/sample_files/syck-0.55/TODO +25 -0
  74. data/test/sample_files/syck-0.55/aclocal.m4 +883 -0
  75. data/test/sample_files/syck-0.55/bootstrap +7 -0
  76. data/test/sample_files/syck-0.55/config.h +79 -0
  77. data/test/sample_files/syck-0.55/config.h.in +78 -0
  78. data/test/sample_files/syck-0.55/config.status +1197 -0
  79. data/test/sample_files/syck-0.55/config/README +14 -0
  80. data/test/sample_files/syck-0.55/config/depcomp +529 -0
  81. data/test/sample_files/syck-0.55/config/install-sh +323 -0
  82. data/test/sample_files/syck-0.55/config/missing +357 -0
  83. data/test/sample_files/syck-0.55/configure +6728 -0
  84. data/test/sample_files/syck-0.55/configure.in +36 -0
  85. data/test/sample_files/syck-0.55/ext/ruby/CHANGELOG +303 -0
  86. data/test/sample_files/syck-0.55/ext/ruby/README +400 -0
  87. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/MANIFEST +1 -0
  88. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/bytecode.c +1170 -0
  89. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/emitter.c +1224 -0
  90. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/extconf.rb +10 -0
  91. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/gram.c +1894 -0
  92. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/gram.h +79 -0
  93. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/handler.c +174 -0
  94. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/implicit.c +2989 -0
  95. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/mkrf.log +1 -0
  96. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/node.c +407 -0
  97. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/rubyext.c +2385 -0
  98. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.c +504 -0
  99. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.h +458 -0
  100. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/token.c +2707 -0
  101. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/yaml2byte.c +250 -0
  102. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/yamlbyte.h +170 -0
  103. data/test/sample_files/syck-0.55/ext/ruby/install.rb +1022 -0
  104. data/test/sample_files/syck-0.55/ext/ruby/lib/okay.rb +161 -0
  105. data/test/sample_files/syck-0.55/ext/ruby/lib/okay/news.rb +69 -0
  106. data/test/sample_files/syck-0.55/ext/ruby/lib/okay/rpc.rb +434 -0
  107. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml.rb +436 -0
  108. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/baseemitter.rb +247 -0
  109. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/basenode.rb +216 -0
  110. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/compat.rb +26 -0
  111. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/constants.rb +45 -0
  112. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/dbm.rb +111 -0
  113. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/emitter.rb +107 -0
  114. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/encoding.rb +33 -0
  115. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/error.rb +34 -0
  116. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/rubytypes.rb +438 -0
  117. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/store.rb +29 -0
  118. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/stream.rb +40 -0
  119. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/stringio.rb +83 -0
  120. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/syck.rb +19 -0
  121. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/tag.rb +86 -0
  122. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/types.rb +188 -0
  123. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/yamlnode.rb +54 -0
  124. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/ypath.rb +52 -0
  125. data/test/sample_files/syck-0.55/ext/ruby/lib/yod.rb +1168 -0
  126. data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-modules.rb +27 -0
  127. data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-sample.rb +336 -0
  128. data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-validate.rb +341 -0
  129. data/test/sample_files/syck-0.55/ext/ruby/samples/okayRpc-client.rb +51 -0
  130. data/test/sample_files/syck-0.55/ext/ruby/samples/okayRpc-server.rb +85 -0
  131. data/test/sample_files/syck-0.55/ext/ruby/samples/yaml-sortHashKeys.rb +128 -0
  132. data/test/sample_files/syck-0.55/ext/ruby/tests/basic.rb +1653 -0
  133. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsAnchorAlias.yml +51 -0
  134. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBasicTests.yml +282 -0
  135. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBlockMapping.yml +78 -0
  136. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBlockSequence.yml +0 -0
  137. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsDocumentSeparator.yml +102 -0
  138. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsErrorTests.yml +23 -0
  139. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsFlowCollections.yml +73 -0
  140. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsFoldedScalars.yml +215 -0
  141. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsMapInSeq.yml +0 -0
  142. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsNullsAndEmpties.yml +66 -0
  143. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsRubyTests.yml +182 -0
  144. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsSpecificationExamples.yml +2699 -0
  145. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsTypeTransfers.yml +265 -0
  146. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsYpath.yml +221 -0
  147. data/test/sample_files/syck-0.55/ext/ruby/yts/cookbook.rb +159 -0
  148. data/test/sample_files/syck-0.55/ext/ruby/yts/index.yml +10 -0
  149. data/test/sample_files/syck-0.55/ext/ruby/yts/yts.rb +193 -0
  150. data/test/sample_files/syck-0.55/lib/Makefile +497 -0
  151. data/test/sample_files/syck-0.55/lib/Makefile.am +27 -0
  152. data/test/sample_files/syck-0.55/lib/Makefile.in +497 -0
  153. data/test/sample_files/syck-0.55/lib/bytecode.c +1170 -0
  154. data/test/sample_files/syck-0.55/lib/bytecode.re +525 -0
  155. data/test/sample_files/syck-0.55/lib/emitter.c +1224 -0
  156. data/test/sample_files/syck-0.55/lib/gram.c +1894 -0
  157. data/test/sample_files/syck-0.55/lib/gram.h +79 -0
  158. data/test/sample_files/syck-0.55/lib/gram.output +2005 -0
  159. data/test/sample_files/syck-0.55/lib/gram.y +481 -0
  160. data/test/sample_files/syck-0.55/lib/handler.c +174 -0
  161. data/test/sample_files/syck-0.55/lib/implicit.c +2989 -0
  162. data/test/sample_files/syck-0.55/lib/implicit.re +206 -0
  163. data/test/sample_files/syck-0.55/lib/node.c +407 -0
  164. data/test/sample_files/syck-0.55/lib/syck.c +504 -0
  165. data/test/sample_files/syck-0.55/lib/syck.h +458 -0
  166. data/test/sample_files/syck-0.55/lib/syck_st.c +577 -0
  167. data/test/sample_files/syck-0.55/lib/syck_st.h +46 -0
  168. data/test/sample_files/syck-0.55/lib/token.c +2707 -0
  169. data/test/sample_files/syck-0.55/lib/token.re +1139 -0
  170. data/test/sample_files/syck-0.55/lib/yaml2byte.c +250 -0
  171. data/test/sample_files/syck-0.55/lib/yamlbyte.h +170 -0
  172. data/test/sample_files/syck-0.55/stamp-h1 +1 -0
  173. data/test/sample_files/syck-0.55/tests/Basic.c +141 -0
  174. data/test/sample_files/syck-0.55/tests/CuTest.c +294 -0
  175. data/test/sample_files/syck-0.55/tests/CuTest.h +84 -0
  176. data/test/sample_files/syck-0.55/tests/Emit.c +87 -0
  177. data/test/sample_files/syck-0.55/tests/Makefile +480 -0
  178. data/test/sample_files/syck-0.55/tests/Makefile.am +13 -0
  179. data/test/sample_files/syck-0.55/tests/Makefile.in +480 -0
  180. data/test/sample_files/syck-0.55/tests/Parse.c +208 -0
  181. data/test/sample_files/syck-0.55/tests/YTS.c +2310 -0
  182. data/test/sample_files/syck-0.55/tests/YTS.c.erb +326 -0
  183. data/test/sample_files/syck-0.55/tests/YTS.c.rb +44 -0
  184. data/test/test_availability.rb +68 -0
  185. data/test/test_generator.rb +74 -0
  186. metadata +252 -0
@@ -0,0 +1,23 @@
1
+ ---
2
+ test: Missing value for hash item
3
+ brief: |
4
+ Third item in this hash doesn't have a value
5
+ yaml: |
6
+ okay: value
7
+ also okay: ~
8
+ causes error because no value specified
9
+ last key: value okay here too
10
+ python-error: causes error because no value specified
11
+
12
+ ---
13
+ test: Not indenting enough
14
+ brief: |
15
+ There was a bug in PyYaml where it was off by one
16
+ in the indentation check. It was allowing the YAML
17
+ below.
18
+ # This is actually valid YAML now. Someone should tell showell.
19
+ yaml: |
20
+ foo:
21
+ firstline: 1
22
+ secondline: 2
23
+ python-error: Inadequate indentation
@@ -0,0 +1,73 @@
1
+ ---
2
+ test: Simple Inline Array
3
+ brief: >
4
+ Sequences can be contained on a
5
+ single line, using the inline syntax.
6
+ Separate each entry with commas and
7
+ enclose in square brackets.
8
+ yaml: |
9
+ ---
10
+ seq: [ a, b, c ]
11
+ python: |
12
+ [
13
+ { 'seq': [ 'a', 'b', 'c' ] }
14
+ ]
15
+ ruby: |
16
+ { 'seq' => [ 'a', 'b', 'c' ] }
17
+
18
+ ---
19
+ test: Simple Inline Hash
20
+ brief: >
21
+ Mapping can also be contained on
22
+ a single line, using the inline
23
+ syntax. Each key-value pair is
24
+ separated by a colon, with a comma
25
+ between each entry in the mapping.
26
+ Enclose with curly braces.
27
+ yaml: |
28
+ ---
29
+ hash: { name: Steve, foo: bar }
30
+ python: |
31
+ [
32
+ { 'hash': {'name': 'Steve', 'foo': 'bar'} }
33
+ ]
34
+ ruby: |
35
+ { 'hash' => { 'name' => 'Steve', 'foo' => 'bar' } }
36
+
37
+ ---
38
+ test: Multi-line Inline Collections
39
+ brief: >
40
+ Both inline sequences and inline mappings
41
+ can span multiple lines, provided that you
42
+ indent the additional lines.
43
+ yaml: |
44
+ languages: [ Ruby,
45
+ Perl,
46
+ Python ]
47
+ websites: { YAML: yaml.org,
48
+ Ruby: ruby-lang.org,
49
+ Python: python.org,
50
+ Perl: use.perl.org }
51
+ ruby: |
52
+ { 'languages' => [ 'Ruby', 'Perl', 'Python' ],
53
+ 'websites' => {
54
+ 'YAML' => 'yaml.org',
55
+ 'Ruby' => 'ruby-lang.org',
56
+ 'Python' => 'python.org',
57
+ 'Perl' => 'use.perl.org'
58
+ }
59
+ }
60
+ ---
61
+ test: Commas in Values
62
+ brief: >
63
+ List items in collections are delimited by commas, but
64
+ there must be a space after each comma. This allows you
65
+ to add numbers without quoting.
66
+ yaml: |
67
+ attendances: [ 45,123, 70,000, 17,222 ]
68
+ python: |
69
+ [
70
+ {'attendances': [ 45123, 70000, 17222 ]}
71
+ ]
72
+ ruby: |
73
+ { 'attendances' => [ 45123, 70000, 17222 ] }
@@ -0,0 +1,215 @@
1
+ --- %YAML:1.0
2
+ test: Single ending newline
3
+ brief: >
4
+ A pipe character, followed by an indented
5
+ block of text is treated as a literal
6
+ block, in which newlines are preserved
7
+ throughout the block, including the final
8
+ newline.
9
+ yaml: |
10
+ ---
11
+ this: |
12
+ Foo
13
+ Bar
14
+
15
+ ruby: |
16
+ { 'this' => "Foo\nBar\n" }
17
+ python: |
18
+ [
19
+ { 'this': "Foo\nBar\n" }
20
+ ]
21
+ ---
22
+ test: The '+' indicator
23
+ brief: >
24
+ The '+' indicator says to keep newlines at the end of text
25
+ blocks.
26
+ yaml: |
27
+ normal: |
28
+ extra new lines not kept
29
+
30
+ preserving: |+
31
+ extra new lines are kept
32
+
33
+
34
+ dummy: value
35
+ ruby: |
36
+ {
37
+ 'normal' => "extra new lines not kept\n",
38
+ 'preserving' => "extra new lines are kept\n\n\n",
39
+ 'dummy' => 'value'
40
+ }
41
+ python: |
42
+ [ {
43
+ 'normal': "extra new lines not kept\n",
44
+ 'preserving': "extra new lines are kept\n\n\n",
45
+ 'dummy': 'value'
46
+ } ]
47
+ ---
48
+ test: Three trailing newlines in literals
49
+ brief: >
50
+ To give you more control over how space
51
+ is preserved in text blocks, YAML has
52
+ the keep '+' and chomp '-' indicators.
53
+ The keep indicator will preserve all
54
+ ending newlines, while the chomp indicator
55
+ will strip all ending newlines.
56
+ yaml: |
57
+ clipped: |
58
+ This has one newline.
59
+
60
+
61
+
62
+ same as "clipped" above: "This has one newline.\n"
63
+
64
+ stripped: |-
65
+ This has no newline.
66
+
67
+
68
+
69
+ same as "stripped" above: "This has no newline."
70
+
71
+ kept: |+
72
+ This has four newlines.
73
+
74
+
75
+
76
+ same as "kept" above: "This has four newlines.\n\n\n\n"
77
+ ruby: |
78
+ {
79
+ 'clipped' => "This has one newline.\n",
80
+ 'same as "clipped" above' => "This has one newline.\n",
81
+ 'stripped' => 'This has no newline.',
82
+ 'same as "stripped" above' => 'This has no newline.',
83
+ 'kept' => "This has four newlines.\n\n\n\n",
84
+ 'same as "kept" above' => "This has four newlines.\n\n\n\n"
85
+ }
86
+ not_yet_in_python: |
87
+ [
88
+ {
89
+ 'clipped': "This has one newline.\n",
90
+ 'same as "clipped" above': "This has one newline.\n",
91
+ 'stripped': 'This has no newline.',
92
+ 'same as "stripped" above': 'This has no newline.',
93
+ 'kept': "This has four newlines.\n\n\n\n",
94
+ 'same as "kept" above': "This has four newlines.\n\n\n\n"
95
+ }
96
+ ]
97
+
98
+ ---
99
+ test: Extra trailing newlines with spaces
100
+ brief: >
101
+ Normally, only a single newline is kept
102
+ from the end of a literal block, unless the
103
+ keep '+' character is used in combination
104
+ with the pipe. The following example
105
+ will preserve all ending whitespace
106
+ since the last line of both literal blocks
107
+ contains spaces which extend past the indentation
108
+ level.
109
+ yaml: |
110
+ ---
111
+ this: |
112
+ Foo
113
+
114
+
115
+ kept: |+
116
+ Foo
117
+
118
+
119
+ ruby: |
120
+ { 'this' => "Foo\n\n \n",
121
+ 'kept' => "Foo\n\n \n" }
122
+
123
+ ---
124
+ test: Folded Block in a Sequence
125
+ brief: >
126
+ A greater-then character, followed by an indented
127
+ block of text is treated as a folded block, in
128
+ which lines of text separated by a single newline
129
+ are concatenated as a single line.
130
+ yaml: |
131
+ ---
132
+ - apple
133
+ - banana
134
+ - >
135
+ can't you see
136
+ the beauty of yaml?
137
+ hmm
138
+ - dog
139
+ python: |
140
+ [
141
+ [
142
+ 'apple',
143
+ 'banana',
144
+ "can't you see the beauty of yaml? hmm\n",
145
+ 'dog'
146
+ ]
147
+ ]
148
+ ruby: |
149
+ [
150
+ 'apple',
151
+ 'banana',
152
+ "can't you see the beauty of yaml? hmm\n",
153
+ 'dog'
154
+ ]
155
+ ---
156
+ test: Folded Block as a Mapping Value
157
+ brief: >
158
+ Both literal and folded blocks can be
159
+ used in collections, as values in a
160
+ sequence or a mapping.
161
+ yaml: |
162
+ ---
163
+ quote: >
164
+ Mark McGwire's
165
+ year was crippled
166
+ by a knee injury.
167
+ source: espn
168
+ python: |
169
+ [
170
+ {
171
+ 'quote': "Mark McGwire's year was crippled by a knee injury.\n",
172
+ 'source': 'espn'
173
+ }
174
+ ]
175
+ ruby: |
176
+ {
177
+ 'quote' => "Mark McGwire's year was crippled by a knee injury.\n",
178
+ 'source' => 'espn'
179
+ }
180
+
181
+ ---
182
+ test: Three trailing newlines in folded blocks
183
+ brief: >
184
+ The keep and chomp indicators can also
185
+ be applied to folded blocks.
186
+ yaml: |
187
+ clipped: >
188
+ This has one newline.
189
+
190
+
191
+
192
+ same as "clipped" above: "This has one newline.\n"
193
+
194
+ stripped: >-
195
+ This has no newline.
196
+
197
+
198
+
199
+ same as "stripped" above: "This has no newline."
200
+
201
+ kept: >+
202
+ This has four newlines.
203
+
204
+
205
+
206
+ same as "kept" above: "This has four newlines.\n\n\n\n"
207
+ ruby: |
208
+ {
209
+ 'clipped' => "This has one newline.\n",
210
+ 'same as "clipped" above' => "This has one newline.\n",
211
+ 'stripped' => 'This has no newline.',
212
+ 'same as "stripped" above' => 'This has no newline.',
213
+ 'kept' => "This has four newlines.\n\n\n\n",
214
+ 'same as "kept" above' => "This has four newlines.\n\n\n\n"
215
+ }
@@ -0,0 +1,66 @@
1
+ --- %YAML:1.0
2
+ test: Empty Sequence
3
+ brief: >
4
+ You can represent the empty sequence
5
+ with an empty inline sequence.
6
+ yaml: |
7
+ empty: []
8
+ python: |
9
+ [
10
+ { 'empty': [] }
11
+ ]
12
+ ruby: |
13
+ { 'empty' => [] }
14
+
15
+ ---
16
+ test: Empty Mapping
17
+ brief: >
18
+ You can represent the empty mapping
19
+ with an empty inline mapping.
20
+ yaml: |
21
+ empty: {}
22
+ python: |
23
+ [
24
+ { 'empty': {} }
25
+ ]
26
+ ruby: |
27
+ { 'empty' => {} }
28
+
29
+ ---
30
+ test: Empty Sequence as Entire Document
31
+ yaml: |
32
+ --- []
33
+ python: |
34
+ [ [] ]
35
+ ruby: |
36
+ []
37
+
38
+ ---
39
+ test: Empty Mapping as Entire Document
40
+ yaml: |
41
+ --- {}
42
+ python: |
43
+ [ {} ]
44
+ ruby: |
45
+ {}
46
+
47
+ ---
48
+ test: Null as Document
49
+ yaml: |
50
+ --- ~
51
+ python: |
52
+ [ None ]
53
+ ruby: |
54
+ nil
55
+
56
+ ---
57
+ test: Empty String
58
+ brief: >
59
+ You can represent an empty string
60
+ with a pair of quotes.
61
+ yaml: |
62
+ --- ''
63
+ python: |
64
+ [ '' ]
65
+ ruby: |
66
+ ''
@@ -0,0 +1,182 @@
1
+ --- %YAML:1.0
2
+ test: Symbols
3
+ brief: >
4
+ Ruby Symbols can be simply serialized using
5
+ the !ruby/symbol transfer method, or the
6
+ abbreviated !ruby/sym.
7
+ yaml: |
8
+ simple symbol: !ruby/symbol Simple
9
+ shortcut syntax: !ruby/sym Simple
10
+ symbols in seqs:
11
+ - !ruby/symbol ValOne
12
+ - !ruby/symbol ValTwo
13
+ - !ruby/symbol ValThree
14
+ symbols in maps:
15
+ - !ruby/symbol MapKey: !ruby/symbol MapValue
16
+ ruby: |
17
+ { 'simple symbol' => :Simple,
18
+ 'shortcut syntax' => :Simple,
19
+ 'symbols in seqs' => [ :ValOne, :ValTwo, :ValThree ],
20
+ 'symbols in maps' => [ { :MapKey => :MapValue } ]
21
+ }
22
+
23
+ ---
24
+ test: Ranges
25
+ brief: >
26
+ Ranges are serialized with the !ruby/range
27
+ type family.
28
+ yaml: |
29
+ normal range: !ruby/range 10..20
30
+ exclusive range: !ruby/range 11...20
31
+ negative range: !ruby/range -1..-5
32
+ ? !ruby/range 0..40
33
+ : range as a map key
34
+ ruby: |
35
+ { 'normal range' => (10..20),
36
+ 'exclusive range' => (11...20),
37
+ 'negative range' => (-1..-5),
38
+ (0..40) => 'range as a map key'
39
+ }
40
+
41
+ ---
42
+ test: Regexps
43
+ brief: >
44
+ Regexps may be serialized to YAML, both its
45
+ syntax and any modifiers.
46
+ yaml: |
47
+ case-insensitive: !ruby/regexp "/George McFly/i"
48
+ complex: !ruby/regexp "/\\A\"((?:[^\"]|\\\")+)\"/"
49
+ simple: !ruby/regexp '/a.b/'
50
+ ruby: |
51
+ { 'simple' => /a.b/, 'complex' => /\A"((?:[^"]|\")+)"/,
52
+ 'case-insensitive' => /George McFly/i }
53
+
54
+ ---
55
+ test: Struct class
56
+ brief: >
57
+ The Ruby Struct class is registered as a YAML
58
+ builtin type through Ruby, so it can safely
59
+ be serialized. To use it, first make sure you
60
+ define your Struct with Struct::new. Then,
61
+ you are able to serialize with Struct#to_yaml
62
+ and unserialize from a YAML stream.
63
+ yaml: |
64
+ --- !ruby/struct:BookStruct
65
+ author: Yukihiro Matsumoto
66
+ title: Ruby in a Nutshell
67
+ year: 2002
68
+ isbn: 0-596-00214-9
69
+ ruby-setup: |
70
+ book_struct = Struct::new( "BookStruct", :author, :title, :year, :isbn )
71
+ ruby: |
72
+ book_struct.new( "Yukihiro Matsumoto", "Ruby in a Nutshell", 2002, "0-596-00214-9" )
73
+
74
+ ---
75
+ test: Nested Structs
76
+ brief: >
77
+ As with other YAML builtins, you may nest the
78
+ Struct inside of other Structs or other data
79
+ types.
80
+ yaml: |
81
+ - !ruby/struct:FoodStruct
82
+ name: Nachos
83
+ ingredients:
84
+ - Mission Chips
85
+ - !ruby/struct:FoodStruct
86
+ name: Tostitos Nacho Cheese
87
+ ingredients:
88
+ - Milk and Enzymes
89
+ - Jack Cheese
90
+ - Some Volatile Chemicals
91
+ taste: Angelic
92
+ - Sour Cream
93
+ taste: Zesty
94
+ - !ruby/struct:FoodStruct
95
+ name: Banana Cream Pie
96
+ ingredients:
97
+ - Bananas
98
+ - Creamy Stuff
99
+ - And Such
100
+ taste: Puffy
101
+ ruby-setup: |
102
+ food_struct = Struct::new( "FoodStruct", :name, :ingredients, :taste )
103
+ ruby: |
104
+ [
105
+ food_struct.new( 'Nachos', [ 'Mission Chips',
106
+ food_struct.new( 'Tostitos Nacho Cheese', [ 'Milk and Enzymes', 'Jack Cheese', 'Some Volatile Chemicals' ], 'Angelic' ),
107
+ 'Sour Cream' ], 'Zesty' ),
108
+ food_struct.new( 'Banana Cream Pie', [ 'Bananas', 'Creamy Stuff', 'And Such' ], 'Puffy' )
109
+ ]
110
+
111
+ ---
112
+ test: Objects
113
+ brief: >
114
+ YAML has generic support for serializing objects
115
+ from any class available in Ruby. If using the
116
+ generic object serialization, no extra code is
117
+ needed.
118
+ yaml: |
119
+ --- !ruby/object:Zoolander
120
+ name: Derek
121
+ look: Blue Steel
122
+ ruby-setup: |
123
+ class Zoolander
124
+ attr_accessor :name, :look
125
+ def initialize( look )
126
+ @name = "Derek"
127
+ @look = look
128
+ end
129
+ def ==( z )
130
+ self.name == z.name and self.look == z.look
131
+ end
132
+ end
133
+ ruby: |
134
+ Zoolander.new( "Blue Steel" )
135
+
136
+ ---
137
+ test: Extending Kernel::Array
138
+ brief: >
139
+ When extending the Array class, your instances
140
+ of such a class will dump as YAML sequences,
141
+ tagged with a class name.
142
+ yaml: |
143
+ --- !ruby/array:MyArray
144
+ - jacket
145
+ - sweater
146
+ - windbreaker
147
+ ruby-setup: |
148
+ class MyArray < ::Array; end
149
+ ruby: |
150
+ outerwear = MyArray.new
151
+ outerwear << 'jacket'
152
+ outerwear << 'sweater'
153
+ outerwear << 'windbreaker'
154
+ outerwear
155
+
156
+ ---
157
+ test: Extending Kernel::Hash
158
+ brief: >
159
+ When extending the Hash class, your instances
160
+ of such a class will dump as YAML maps, tagged
161
+ with a class name.
162
+ yaml: |
163
+ --- !ruby/hash:MyHash
164
+ Black Francis: Frank Black
165
+ Kim Deal: Breeders
166
+ Joey Santiago: Martinis
167
+ ruby-setup: |
168
+ # Note that the @me attribute isn't dumped
169
+ # because the default to_yaml is trained
170
+ # to dump as a regular Hash.
171
+ class MyHash < ::Hash
172
+ attr_accessor :me
173
+ def initialize
174
+ @me = "Why"
175
+ end
176
+ end
177
+ ruby: |
178
+ pixies = MyHash.new
179
+ pixies['Black Francis'] = 'Frank Black'
180
+ pixies['Kim Deal'] = 'Breeders'
181
+ pixies['Joey Santiago'] = 'Martinis'
182
+ pixies