squib 0.12.0 → 0.13.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 (392) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/CHANGELOG.md +16 -1
  4. data/appveyor.yml +2 -3
  5. data/lib/squib/args/sheet.rb +66 -34
  6. data/lib/squib/graphics/save_pdf.rb +1 -1
  7. data/lib/squib/import/data_frame.rb +7 -7
  8. data/lib/squib/version.rb +1 -1
  9. data/samples/autoscale_font/_autoscale_font.rb +1 -1
  10. data/samples/build_groups/build_groups.rb +3 -3
  11. data/samples/colors/_colors.rb +1 -0
  12. data/samples/{config_text_markup.rb → config/config_text_markup.rb} +0 -0
  13. data/samples/{custom_config.rb → config/custom_config.rb} +0 -0
  14. data/samples/{cairo_access.rb → images/_cairo_access.rb} +0 -0
  15. data/samples/images/_images.rb +1 -1
  16. data/samples/{unicode.rb → images/_unicode.rb} +0 -0
  17. data/samples/intro/01_hello.rb +1 -2
  18. data/samples/intro/02_options.rb +1 -2
  19. data/samples/intro/03_layout.rb +1 -2
  20. data/samples/intro/04_arrays.rb +1 -2
  21. data/samples/intro/05_excel.rb +3 -4
  22. data/samples/{tgc_proofs.rb → proofs/_tgc_proofs.rb} +1 -4
  23. data/samples/saves/_save_pdf.rb +7 -0
  24. data/samples/{embed_text.rb → text/_embed_text.rb} +1 -0
  25. data/samples/text/_text.rb +1 -1
  26. data/samples/{text_options.rb → text/_text_options.rb} +1 -1
  27. data/samples/{bug134.rb → text/bug134.rb} +0 -0
  28. data/squib.gemspec +17 -16
  29. metadata +90 -596
  30. data/benchmarks/antialias_best.rb +0 -13
  31. data/benchmarks/antialias_best.yml +0 -1
  32. data/benchmarks/antialias_fast.rb +0 -13
  33. data/benchmarks/antialias_fast.yml +0 -1
  34. data/benchmarks/backend-svg.yml +0 -4
  35. data/benchmarks/backend_memory.rb +0 -14
  36. data/benchmarks/backend_svg.rb +0 -14
  37. data/benchmarks/shiny-purse.png +0 -0
  38. data/benchmarks/spanner.svg +0 -91
  39. data/benchmarks/tons_of_png.rb +0 -6
  40. data/benchmarks/tons_of_svg.rb +0 -7
  41. data/benchmarks/tons_of_text.rb +0 -8
  42. data/docs/Makefile +0 -216
  43. data/docs/_static/css/squibdocs.css +0 -23
  44. data/docs/args/draw.rst +0 -36
  45. data/docs/args/expansion.rst +0 -3
  46. data/docs/args/layout.rst +0 -6
  47. data/docs/args/output_dir.rst +0 -6
  48. data/docs/args/range.rst +0 -6
  49. data/docs/args/transform.rst +0 -51
  50. data/docs/args/trim.rst +0 -11
  51. data/docs/args/wh.rst +0 -12
  52. data/docs/args/xy.rst +0 -12
  53. data/docs/arrays.rst +0 -80
  54. data/docs/backends.rst +0 -20
  55. data/docs/bleed.rst +0 -13
  56. data/docs/build_groups.rst +0 -45
  57. data/docs/colors.rst +0 -90
  58. data/docs/conf.py +0 -287
  59. data/docs/config.rst +0 -135
  60. data/docs/data.rst +0 -26
  61. data/docs/dsl/background.rst +0 -20
  62. data/docs/dsl/build.rst +0 -32
  63. data/docs/dsl/build_groups.rst +0 -23
  64. data/docs/dsl/circle.rst +0 -27
  65. data/docs/dsl/cm.rst +0 -19
  66. data/docs/dsl/configure.rst +0 -18
  67. data/docs/dsl/csv.rst +0 -81
  68. data/docs/dsl/curve.rst +0 -63
  69. data/docs/dsl/data_frame.rst +0 -85
  70. data/docs/dsl/deck.rst +0 -45
  71. data/docs/dsl/disable_build.rst +0 -25
  72. data/docs/dsl/disable_build_globally.rst +0 -46
  73. data/docs/dsl/ellipse.rst +0 -23
  74. data/docs/dsl/enable_build.rst +0 -25
  75. data/docs/dsl/enable_build_globally.rst +0 -44
  76. data/docs/dsl/grid.rst +0 -31
  77. data/docs/dsl/hand.rst +0 -40
  78. data/docs/dsl/hint.rst +0 -15
  79. data/docs/dsl/inches.rst +0 -19
  80. data/docs/dsl/index.rst +0 -9
  81. data/docs/dsl/line.rst +0 -52
  82. data/docs/dsl/mm.rst +0 -19
  83. data/docs/dsl/png.rst +0 -49
  84. data/docs/dsl/polygon.rst +0 -28
  85. data/docs/dsl/rect.rst +0 -22
  86. data/docs/dsl/save.rst +0 -23
  87. data/docs/dsl/save_pdf.rst +0 -89
  88. data/docs/dsl/save_png.rst +0 -46
  89. data/docs/dsl/save_sheet.rst +0 -55
  90. data/docs/dsl/showcase.rst +0 -76
  91. data/docs/dsl/star.rst +0 -35
  92. data/docs/dsl/svg.rst +0 -119
  93. data/docs/dsl/text.rst +0 -292
  94. data/docs/dsl/triangle.rst +0 -50
  95. data/docs/dsl/use_layout.rst +0 -16
  96. data/docs/dsl/xlsx.rst +0 -56
  97. data/docs/guides/game_icons.rst +0 -126
  98. data/docs/guides/getting-started/index.rst +0 -5
  99. data/docs/guides/getting-started/part_0_learning_ruby.rst +0 -145
  100. data/docs/guides/getting-started/part_1_zero_to_game.rst +0 -217
  101. data/docs/guides/getting-started/part_2_iconography.rst +0 -228
  102. data/docs/guides/getting-started/part_3_workflows.rst +0 -46
  103. data/docs/guides/getting-started/part_4_ruby_power.rst +0 -18
  104. data/docs/guides/git.rst +0 -14
  105. data/docs/guides/guard.rst +0 -84
  106. data/docs/guides/hello_world.rst +0 -65
  107. data/docs/guides/projects.rst +0 -35
  108. data/docs/help.rst +0 -157
  109. data/docs/index.rst +0 -35
  110. data/docs/install.rst +0 -68
  111. data/docs/layouts.rst +0 -290
  112. data/docs/learning.rst +0 -12
  113. data/docs/make.bat +0 -263
  114. data/docs/parameters.rst +0 -34
  115. data/docs/server.bat +0 -1
  116. data/docs/text_feature.rst +0 -115
  117. data/docs/units.rst +0 -14
  118. data/samples/autoscale_font/.gitignore +0 -2
  119. data/samples/autoscale_font/card_00_expected.png +0 -0
  120. data/samples/backend/.gitignore +0 -1
  121. data/samples/backend/_backend-config.yml +0 -5
  122. data/samples/backend/backend_00_expected.png +0 -0
  123. data/samples/backend/backend_01_expected.png +0 -0
  124. data/samples/backend/backend_vectorized_expected.pdf +0 -0
  125. data/samples/backend/backend_vectors_00_expected.svg +0 -84
  126. data/samples/backend/backend_vectors_01_expected.svg +0 -84
  127. data/samples/backend/shiny-purse.png +0 -0
  128. data/samples/backend/showcase_expected.png +0 -0
  129. data/samples/backend/spanner.svg +0 -91
  130. data/samples/ball.png +0 -0
  131. data/samples/build_groups/.gitignore +0 -1
  132. data/samples/build_groups/Rakefile +0 -25
  133. data/samples/colors/.gitignore +0 -1
  134. data/samples/colors/color_constants_00_expected.png +0 -0
  135. data/samples/colors/colors_00_expected.png +0 -0
  136. data/samples/colors/gradient_00_expected.png +0 -0
  137. data/samples/config_disable_quotes.yml +0 -3
  138. data/samples/config_text_markup.yml +0 -9
  139. data/samples/custom-config.yml +0 -5
  140. data/samples/customconfig-imgdir/shiny-purse2.png +0 -0
  141. data/samples/customconfig-imgdir/spanner2.svg +0 -91
  142. data/samples/data/.gitignore +0 -1
  143. data/samples/data/explode_quantities.xlsx +0 -0
  144. data/samples/data/quantity_explosion.csv +0 -3
  145. data/samples/data/sample.csv +0 -3
  146. data/samples/data/sample.xlsx +0 -0
  147. data/samples/data/sample_csv_00_expected.png +0 -0
  148. data/samples/data/sample_csv_01_expected.png +0 -0
  149. data/samples/data/sample_csv_qty_00_expected.png +0 -0
  150. data/samples/data/sample_excel_00_expected.png +0 -0
  151. data/samples/data/sample_excel_01_expected.png +0 -0
  152. data/samples/data/sample_excel_02_expected.png +0 -0
  153. data/samples/data/sample_excel_resources_00_expected.png +0 -0
  154. data/samples/data/sample_excel_resources_01_expected.png +0 -0
  155. data/samples/data/sample_xlsx_qty_00_expected.png +0 -0
  156. data/samples/glass-heart.svg +0 -52
  157. data/samples/grit.png +0 -0
  158. data/samples/images/.gitignore +0 -8
  159. data/samples/images/_images_00_expected.png +0 -0
  160. data/samples/images/angler-fish.png +0 -0
  161. data/samples/images/ball.png +0 -0
  162. data/samples/images/glass-heart.svg +0 -52
  163. data/samples/images/grit.png +0 -0
  164. data/samples/images/offset.svg +0 -85
  165. data/samples/images/robot-golem.svg +0 -1
  166. data/samples/images/shiny-purse.png +0 -0
  167. data/samples/images/spanner.svg +0 -91
  168. data/samples/images/sprites.png +0 -0
  169. data/samples/images/with-alpha.png +0 -0
  170. data/samples/intro/.gitignore +0 -2
  171. data/samples/intro/auto-repair.svg +0 -1
  172. data/samples/intro/crawling.svg +0 -1
  173. data/samples/intro/data.xlsx +0 -0
  174. data/samples/intro/humans.svg +0 -1
  175. data/samples/intro/ninja-mask.svg +0 -1
  176. data/samples/intro/part1_00_expected.png +0 -0
  177. data/samples/intro/part2_00_expected.png +0 -0
  178. data/samples/intro/part3_00_expected.png +0 -0
  179. data/samples/intro/part3_layout.yml +0 -34
  180. data/samples/intro/part4_00_expected.png +0 -0
  181. data/samples/intro/part4_01_expected.png +0 -0
  182. data/samples/intro/part5_00_expected.png +0 -0
  183. data/samples/intro/part5_01_expected.png +0 -0
  184. data/samples/intro/part5_02_expected.png +0 -0
  185. data/samples/intro/part5_03_expected.png +0 -0
  186. data/samples/intro/part5_hand_expected.png +0 -0
  187. data/samples/intro/part5_showcase_expected.png +0 -0
  188. data/samples/intro/pirate-skull.svg +0 -1
  189. data/samples/intro/robot-golem.svg +0 -1
  190. data/samples/layouts/custom-layout.yml +0 -60
  191. data/samples/layouts/custom-layout2.yml +0 -15
  192. data/samples/layouts/expected_layouts_builtin_economy_00.png +0 -0
  193. data/samples/layouts/expected_layouts_builtin_fantasy_00.png +0 -0
  194. data/samples/layouts/expected_layouts_builtin_hand_00.png +0 -0
  195. data/samples/layouts/expected_layouts_builtin_playing_card_00.png +0 -0
  196. data/samples/layouts/expected_layouts_builtin_tuck_box_00.png +0 -0
  197. data/samples/layouts/shiny-purse.png +0 -0
  198. data/samples/layouts/spanner.svg +0 -91
  199. data/samples/load_images_config.yml +0 -1
  200. data/samples/offset.svg +0 -71
  201. data/samples/pokercard.png +0 -0
  202. data/samples/project/Gemfile +0 -6
  203. data/samples/project/Guardfile +0 -18
  204. data/samples/project/Rakefile +0 -25
  205. data/samples/project/bw/robot-golem.svg +0 -53
  206. data/samples/project/color/robot-golem.svg +0 -1
  207. data/samples/project/config.yml +0 -2
  208. data/samples/project/layouts/characters.yml +0 -3
  209. data/samples/project/layouts/skills.yml +0 -3
  210. data/samples/ranges/glass-heart.svg +0 -52
  211. data/samples/ranges/ranges_00_expected.png +0 -0
  212. data/samples/saves/.gitignore +0 -1
  213. data/samples/saves/hand_expected.png +0 -0
  214. data/samples/saves/hand_pretty_expected.png +0 -0
  215. data/samples/saves/save-pdf-small_expected.pdf +0 -0
  216. data/samples/saves/save-pdf_expected.pdf +0 -0
  217. data/samples/saves/save_png_00_expected.png +0 -0
  218. data/samples/saves/save_png_trimmed_00_expected.png +0 -0
  219. data/samples/saves/save_sheet_00_expected.png +0 -0
  220. data/samples/saves/save_sheet_01_expected.png +0 -0
  221. data/samples/saves/save_sheet_range_00_expected.png +0 -0
  222. data/samples/saves/save_sheet_range_01_expected.png +0 -0
  223. data/samples/saves/save_single_sheet_00_expected.png +0 -0
  224. data/samples/saves/saves_notrim_01_expected.png +0 -0
  225. data/samples/saves/showcase2_expected.png +0 -0
  226. data/samples/saves/showcase_expected.png +0 -0
  227. data/samples/saves/showcase_individual_00_expected.png +0 -0
  228. data/samples/saves/showcase_individual_01_expected.png +0 -0
  229. data/samples/saves/showcase_individual_02_expected.png +0 -0
  230. data/samples/saves/showcase_individual_03_expected.png +0 -0
  231. data/samples/saves/spanner.svg +0 -91
  232. data/samples/shapes/.gitignore +0 -1
  233. data/samples/shapes/shape_00_expected.png +0 -0
  234. data/samples/shiny-purse.png +0 -0
  235. data/samples/spanner.svg +0 -91
  236. data/samples/sprites.png +0 -0
  237. data/samples/text/.gitignore +0 -2
  238. data/samples/text/README.md +0 -1
  239. data/samples/text/_text_00_expected.png +0 -0
  240. data/samples/text/config.yml +0 -2
  241. data/samples/units/units_00_expected.png +0 -0
  242. data/samples/units/using_units.yml +0 -10
  243. data/spec/api/api_data_spec.rb +0 -172
  244. data/spec/api/api_groups_spec.rb +0 -49
  245. data/spec/api/api_settings_spec.rb +0 -38
  246. data/spec/api/api_units_spec.rb +0 -37
  247. data/spec/args/box_spec.rb +0 -127
  248. data/spec/args/draw_spec.rb +0 -101
  249. data/spec/args/embed_key_spec.rb +0 -13
  250. data/spec/args/input_file_spec.rb +0 -21
  251. data/spec/args/paint_spec.rb +0 -22
  252. data/spec/args/paragraph_spec.rb +0 -153
  253. data/spec/args/range_spec.rb +0 -41
  254. data/spec/args/save_batch_spec.rb +0 -51
  255. data/spec/args/scale_box_spec.rb +0 -71
  256. data/spec/args/sheet_spec.rb +0 -80
  257. data/spec/args/showcase_special_spec.rb +0 -15
  258. data/spec/args/transform_spec.rb +0 -25
  259. data/spec/args/typographer_spec.rb +0 -71
  260. data/spec/args/unit_conversion_spec.rb +0 -29
  261. data/spec/card_spec.rb +0 -11
  262. data/spec/commands/new_spec.rb +0 -48
  263. data/spec/conf_spec.rb +0 -47
  264. data/spec/data/conf/basic.yml +0 -1
  265. data/spec/data/conf/empty.yml +0 -1
  266. data/spec/data/conf/unrecognized.yml +0 -4
  267. data/spec/data/csv/basic.csv +0 -3
  268. data/spec/data/csv/custom_opts.csv +0 -2
  269. data/spec/data/csv/dup_cols.csv +0 -3
  270. data/spec/data/csv/newline.csv +0 -3
  271. data/spec/data/csv/qty.csv +0 -3
  272. data/spec/data/csv/qty_named.csv +0 -3
  273. data/spec/data/csv/with_spaces.csv +0 -3
  274. data/spec/data/csv/yield.csv +0 -3
  275. data/spec/data/layouts/easy-circular-extends.yml +0 -6
  276. data/spec/data/layouts/empty-rule.yml +0 -1
  277. data/spec/data/layouts/empty.yml +0 -1
  278. data/spec/data/layouts/extends-nonexists.yml +0 -3
  279. data/spec/data/layouts/extends-units-mixed.yml +0 -8
  280. data/spec/data/layouts/extends-units.yml +0 -8
  281. data/spec/data/layouts/hard-circular-extends.yml +0 -9
  282. data/spec/data/layouts/multi-extends-single-entry.yml +0 -14
  283. data/spec/data/layouts/multi-level-extends.yml +0 -10
  284. data/spec/data/layouts/multifile-a.yml +0 -4
  285. data/spec/data/layouts/multifile-b.yml +0 -4
  286. data/spec/data/layouts/multifile-extends-a.yml +0 -8
  287. data/spec/data/layouts/multifile-extends-b.yml +0 -9
  288. data/spec/data/layouts/no-extends.yml +0 -5
  289. data/spec/data/layouts/pre-extends.yml +0 -7
  290. data/spec/data/layouts/self-circular-extends.yml +0 -3
  291. data/spec/data/layouts/single-extends.yml +0 -7
  292. data/spec/data/layouts/single-level-multi-extends.yml +0 -12
  293. data/spec/data/samples/autoscale_font/_autoscale_font.rb.txt +0 -133
  294. data/spec/data/samples/basic.rb.txt +0 -248
  295. data/spec/data/samples/cairo_access.rb.txt +0 -59
  296. data/spec/data/samples/colors/_gradients.rb.txt +0 -84
  297. data/spec/data/samples/config_text_markup.rb.txt +0 -74
  298. data/spec/data/samples/custom_config.rb.txt +0 -59
  299. data/spec/data/samples/data/_csv.rb.txt +0 -231
  300. data/spec/data/samples/data/_excel.rb.txt +0 -704
  301. data/spec/data/samples/embed_text.rb.txt +0 -431
  302. data/spec/data/samples/hello_world.rb.txt +0 -38
  303. data/spec/data/samples/images/_more_load_images.rb.txt +0 -335
  304. data/spec/data/samples/layouts.rb.txt +0 -489
  305. data/spec/data/samples/ranges/_ranges.rb.txt +0 -484
  306. data/spec/data/samples/saves/_hand.rb.txt +0 -594
  307. data/spec/data/samples/saves/_portrait_landscape.rb.txt +0 -57
  308. data/spec/data/samples/saves/_save_pdf.rb.txt +0 -1601
  309. data/spec/data/samples/saves/_saves.rb.txt +0 -873
  310. data/spec/data/samples/saves/_showcase.rb.txt +0 -5942
  311. data/spec/data/samples/shapes/_draw_shapes.rb.txt +0 -757
  312. data/spec/data/samples/text_options.rb.txt +0 -1158
  313. data/spec/data/samples/tgc_proofs.rb.txt +0 -102
  314. data/spec/data/samples/units/_units.rb.txt +0 -53
  315. data/spec/data/xlsx/basic.xlsx +0 -0
  316. data/spec/data/xlsx/explode_quantities.xlsx +0 -0
  317. data/spec/data/xlsx/formulas.xlsx +0 -0
  318. data/spec/data/xlsx/whitespace.xlsx +0 -0
  319. data/spec/data/xlsx/with_macros.xlsm +0 -0
  320. data/spec/deck_spec.rb +0 -73
  321. data/spec/graphics/cairo_context_wrapper_spec.rb +0 -104
  322. data/spec/graphics/embedding_utils_spec.rb +0 -73
  323. data/spec/graphics/graphics_save_doc_spec.rb +0 -74
  324. data/spec/import/data_frame_spec.rb +0 -251
  325. data/spec/layout_parser_spec.rb +0 -226
  326. data/spec/logger_spec.rb +0 -12
  327. data/spec/samples/_diffs/gitkeep.txt +0 -0
  328. data/spec/samples/diff-with-css.example.html +0 -39
  329. data/spec/samples/expected/autoscale_00.png +0 -0
  330. data/spec/samples/expected/autoscale_01.png +0 -0
  331. data/spec/samples/expected/autoscale_02.png +0 -0
  332. data/spec/samples/expected/backend_00.png +0 -0
  333. data/spec/samples/expected/backend_00.svg +0 -78
  334. data/spec/samples/expected/backend_01.png +0 -0
  335. data/spec/samples/expected/backend_01.svg +0 -78
  336. data/spec/samples/expected/basic_00.png +0 -0
  337. data/spec/samples/expected/basic_01.png +0 -0
  338. data/spec/samples/expected/basic_02.png +0 -0
  339. data/spec/samples/expected/cairo_access_00.png +0 -0
  340. data/spec/samples/expected/cairo_access_01.png +0 -0
  341. data/spec/samples/expected/card_00.png +0 -0
  342. data/spec/samples/expected/card_01.png +0 -0
  343. data/spec/samples/expected/colors_00.png +0 -0
  344. data/spec/samples/expected/config_disable_text_00.png +0 -0
  345. data/spec/samples/expected/config_text_00.png +0 -0
  346. data/spec/samples/expected/custom-config_00.png +0 -0
  347. data/spec/samples/expected/embed_00.png +0 -0
  348. data/spec/samples/expected/embed_multisheet_00.png +0 -0
  349. data/spec/samples/expected/gitkeep.txt +0 -0
  350. data/spec/samples/expected/gradient_00.png +0 -0
  351. data/spec/samples/expected/hand.png +0 -0
  352. data/spec/samples/expected/hand_pretty.png +0 -0
  353. data/spec/samples/expected/landscape_00.png +0 -0
  354. data/spec/samples/expected/layout2_00.png +0 -0
  355. data/spec/samples/expected/layout_00.png +0 -0
  356. data/spec/samples/expected/layout_builtin_hand_00.png +0 -0
  357. data/spec/samples/expected/layout_builtin_playing_card_00.png +0 -0
  358. data/spec/samples/expected/load_images_00.png +0 -0
  359. data/spec/samples/expected/portrait_00.png +0 -0
  360. data/spec/samples/expected/ranges_00.png +0 -0
  361. data/spec/samples/expected/sample_csv_00.png +0 -0
  362. data/spec/samples/expected/sample_csv_01.png +0 -0
  363. data/spec/samples/expected/sample_excel_00.png +0 -0
  364. data/spec/samples/expected/sample_excel_01.png +0 -0
  365. data/spec/samples/expected/sample_excel_02.png +0 -0
  366. data/spec/samples/expected/save_sheet_00.png +0 -0
  367. data/spec/samples/expected/save_sheet_01.png +0 -0
  368. data/spec/samples/expected/save_sheet_range_00.png +0 -0
  369. data/spec/samples/expected/save_sheet_range_01.png +0 -0
  370. data/spec/samples/expected/save_single_sheet_00.png +0 -0
  371. data/spec/samples/expected/saves_notrim_01.png +0 -0
  372. data/spec/samples/expected/shape_00.png +0 -0
  373. data/spec/samples/expected/showcase.png +0 -0
  374. data/spec/samples/expected/showcase2.png +0 -0
  375. data/spec/samples/expected/showcase_individual_00.png +0 -0
  376. data/spec/samples/expected/showcase_individual_01.png +0 -0
  377. data/spec/samples/expected/showcase_individual_02.png +0 -0
  378. data/spec/samples/expected/showcase_individual_03.png +0 -0
  379. data/spec/samples/expected/text_00.png +0 -0
  380. data/spec/samples/expected/text_01.png +0 -0
  381. data/spec/samples/expected/text_02.png +0 -0
  382. data/spec/samples/expected/tgc_sample_00.png +0 -0
  383. data/spec/samples/expected/units_00.png +0 -0
  384. data/spec/samples/run_samples_spec.rb +0 -17
  385. data/spec/samples/samples_regression_spec.rb +0 -71
  386. data/spec/samples/sanity.html.erb +0 -28
  387. data/spec/samples/sanity.rb +0 -70
  388. data/spec/sanity/.gitignore +0 -1
  389. data/spec/sanity/sanity.html.erb +0 -42
  390. data/spec/sanity/sanity_test.rb +0 -42
  391. data/spec/sanity/tests.yml +0 -12
  392. data/spec/spec_helper.rb +0 -159
@@ -1,16 +0,0 @@
1
- use_layout
2
- ==========
3
-
4
- Load a layout file and merge into the current set of layouts.
5
-
6
- Options
7
- -------
8
-
9
- file
10
- default: ``'layout.yml'``
11
-
12
- The file or array of files to load. Treated exactly how :doc:`/dsl/deck` parses it.
13
-
14
-
15
- Examples
16
- --------
@@ -1,56 +0,0 @@
1
- xlsx
2
- ====
3
-
4
- Pulls ExcelX data from .xlsx files into a hash of arrays keyed by the headers. First row is assumed to be the header row.
5
-
6
- The ``xlsx`` method is a member of ``Squib::Deck``, but it is also available outside of the Deck DSL with ``Squib.xlsx()``. This allows a construction like::
7
-
8
- data = Squib.xlsx file: 'data.xlsx'
9
- Squib::Deck.new(cards: data['name'].size) do
10
- end
11
-
12
- Options
13
- -------
14
-
15
- file
16
- default: ``'deck.xlsx'``
17
-
18
- the xlsx-formatted file to open. Opens relative to the current directory.
19
-
20
- sheet
21
- default: ``0``
22
-
23
- The zero-based index of the sheet from which to read.
24
-
25
- strip
26
- default: ``true``
27
-
28
- When ``true``, strips leading and trailing whitespace on values and headers
29
-
30
- explode
31
- default: ``'qty'``
32
-
33
- Quantity explosion will be applied to the column this name. For example, rows in the csv with a ``'qty'`` of 3 will be duplicated 3 times.
34
-
35
- Individual Pre-processing
36
- -------------------------
37
-
38
- The ``xlsx`` method also takes in a block that will be executed for each cell in your data. This is useful for processing individual cells, like putting a dollar sign in front of dollars, or converting from a float to an integer. The value of the block will be what is assigned to that cell. For example::
39
-
40
- resource_data = Squib.xlsx(file: 'sample.xlsx') do |header, value|
41
- case header
42
- when 'Cost'
43
- "$#{value}k" # e.g. "3" becomes "$3k"
44
- else
45
- value # always return the original value if you didn't do anything to it
46
- end
47
- end
48
-
49
- Examples
50
- --------
51
-
52
- To get the sample Excel files, go to `its source <https://github.com/andymeneely/squib/tree/dev/samples/data>`_
53
-
54
- .. literalinclude:: ../../samples/data/_excel.rb
55
- :language: ruby
56
- :linenos:
@@ -1,126 +0,0 @@
1
- Squib + Game-Icons.net
2
- ======================
3
-
4
- I believe that, in prototyping, you want to focus on getting your idea to the table as fast as possible. Artwork is the kind of thing that can wait for later iterations once you know your game is a good one.
5
-
6
- But! Playtesting with just text is a real drag.
7
-
8
- Fortunately, there's this amazing project going on over at http://game-icons.net. They are in the process of building a massive library of gaming-related icons.
9
-
10
- As a sister project to Squib, I've made a Ruby gem that interfaces with the Game Icons library. With this gem, you can access Game Icons files, and even manipulate them as they go into your game.
11
-
12
- Here are some instructions for working with the Game Icons gem into Squib.
13
-
14
- Install the Gem
15
- ---------------
16
-
17
- To get the gem, do:
18
-
19
- $ gem install game_icons
20
-
21
- The library update frequently, so it's a good idea to upgrade whenever you can.
22
-
23
- $ gem up game_icons
24
-
25
- If you are using Bundler, go ahead and put this in your Gemfile::
26
-
27
- gem 'game_icons'
28
-
29
- And then run ``bundle install`` to install it from there.
30
-
31
- The ``game_icons`` gem has no required dependencies. However, if you want to manipulate the SVG
32
-
33
- To begin using the gem, just require it::
34
-
35
- require 'game_icons'
36
-
37
- Find Your Icon
38
- --------------
39
-
40
- Game-Icons.net has a search engine with some great tagging. Find the icon that you need. The gem will need the "name" of your icon. You can get this easily from the URL. For example:
41
-
42
- http://game-icons.net/lorc/originals/meat.html
43
-
44
- could be called::
45
-
46
- 'meat'
47
- :meat
48
-
49
- Symbols are okay too (really, anything that responds to ``to_s`` will suffice). Spaces are replaced with a dash::
50
-
51
- 'police-badge'
52
- :police_badge
53
-
54
- However, some icons have the same name but different authors. To differentiate these, you put the author name before a slash. Like this::
55
-
56
- 'lorc/meat'
57
- 'andymeneely/police-badge'
58
-
59
- To get the Icon, you use ``GameIcons#get``::
60
-
61
- GameIcons.get(:meat)
62
- GameIcons.get('lorc/meat')
63
- GameIcons.get(:police_badge)
64
- GameIcons.get('police-badge')
65
- GameIcons.get('andymeneely/police-badge')
66
-
67
- If you want to know all the icon names, you can always use::
68
-
69
- GameIcons.names # returns the list of icon names
70
-
71
- If you end up misspelling one, the gem will suggest one:
72
-
73
- .. code-block:: shell
74
-
75
- irb(main):005:0> GameIcons.get(:police_badg)
76
- RuntimeError: game_icons: could not find icon 'police_badg'. Did you mean any of these? police-badge
77
-
78
- Use the SVG File
79
- ----------------
80
-
81
- If you just want to use the icon in your game, you can just use the ``file`` method::
82
-
83
- svg file: GameIcons.get(:police-badge).file
84
-
85
- Recolor the SVG file
86
- --------------------
87
-
88
- The gem will also allow you to recolor the icon as you wish, setting foreground and background::
89
-
90
- # recolor foreground and background to different shades of gray
91
- svg data: GameIcons.get('glass-heart').
92
- recolor(fg: '333', bg: 'ccc').
93
- string
94
-
95
- # recolor with opacity
96
- svg data: GameIcons.get('glass-heart').
97
- recolor(fg: '333', bg: 'ccc',
98
- fg_opacity: 0.25, bg_opacity: 0.75).
99
- string
100
-
101
- Use the SVG XML Data
102
- --------------------
103
-
104
- SVGs are just XML files, and can be manipulated in their own clever ways. GameIcons is super-consistent in the way they format their SVGs - the entire icon is flattened into one path. So you can manipulate how the icon looks in your own way. Here's an example of using straight string substitution::
105
-
106
- svg data: GameIcons.get(:meat).string.gsub('fill="#fff"', 'fill="#abc"')
107
-
108
- Here's a fun one. It replaces all non-white colors in your SVG with black through the SVG::
109
-
110
- svg data: GameIcons.get(:meat).string.gsub(':#ffffff', 'snarfblat').
111
- gsub(/:#[0-9a-f]{6}/, ':#000000').
112
- gsub('snarfblat', ':#ffffff')
113
-
114
- XML can also be manipulated via CSS or XPATH queries via the ``nokogiri`` library, which Squib has as a dependency anyway. Like this::
115
-
116
- doc = Nokogiri::XML(GameIcons.get(:meat).string)
117
- doc.css('path')[1]['fill'] = #f00 # set foreground color to red
118
- svg data: doc.to_xml
119
-
120
-
121
- Path Weirdness
122
- --------------
123
-
124
- Inkscape and Squib's libRSVG renderer can lead to unexpected results for some icons. This has to do with a discrepancy in how path data is interpreted according to the specification. (Specifically, negative numbers need to have a space before them in the path data.) The fix for this is quick and easy, and the gem can do this for you::
125
-
126
- GameIcons.get(:sheep).correct_pathdata.string # corrects path data
@@ -1,5 +0,0 @@
1
- .. toctree::
2
- :maxdepth: 1
3
- :glob:
4
-
5
- part_*
@@ -1,145 +0,0 @@
1
- The Squib Way pt 0: Learning Ruby
2
- ====================================
3
-
4
- This guide is for folks who are new to coding and/or Ruby. Feel free to skip it if you already have some coding experience.
5
-
6
- Not a Programmer?
7
- -----------------
8
-
9
- `I'm not a programmer, but I want to use Squib. Can you make it easy for non-programmers?`
10
-
11
- -- `Frequently Asked Question`
12
-
13
- If you want to use Squib, then you want to automate the graphics generation of a tabletop game in a data-driven way. You want to be able to change your mind about icons, illustrations, stats, and graphic design - then rebuild your game with a just a few keystrokes. Essentially, you want to give a list of instructions to the computer, and have it execute your bidding.
14
-
15
- If you want those things, then I have news for you. I think you *are* a programmer... who just needs to learn some coding. And maybe Squib will finally be your excuse!
16
-
17
- Squib is a Ruby library. To learn Squib, you will need to learn Ruby. There is no getting around that fact. Don't fight it, embrace it.
18
-
19
- Fortunately, Squib doesn't really require tons of Ruby-fu to get going. You can really just start from the examples and go from there. And I've done my best to keep to Ruby's own philosophy that programming in it should be a delight, not a chore.
20
-
21
- Doubly fortunately,
22
-
23
- * Ruby is wonderfully rich in features and expressive in its syntax.
24
- * Ruby has a vibrant, friendly community with people who love to help. I've always thought that Ruby people and board game people would be good friends if they spent more time together.
25
- * Ruby is the language of choice for many new programmers, including many universities.
26
- * Ruby is also "industrial strength", so it really can do just about anything you need it to.
27
-
28
- Plus, resources for learning how to code are ubiquitous on the Internet.
29
-
30
- In this article, we'll go over some topics that you will undoubtedly want to pick up if you're new to programming or just new to Ruby.
31
-
32
- What You DON'T Need To Know about Ruby for Squib
33
- ------------------------------------------------
34
-
35
- Let's get a few things out of the way. When you are out there searching the interwebs for solutions to your problems, you will *not* need to learn anything about the following things:
36
-
37
- * **Rails**. Ruby on Rails is a heavyweight framework for web development. It's awesome in its own way, but it's not relevant to learning Ruby as a language by itself. Squib is about scripting, and will never (NEVER!) be a web app.
38
- * **Object-Oriented Programming**. While OO is very important for developing long-term, scalable applications, some of the philosophy around "Everything in Ruby is an object" can be confusing to newcomers. It's not super-important to grasp this concept for Squib. This means material about classes, modules, mixins, attributes, etc. are not really necessary for Squib scripts. (Contributing to Squib, that's another matter - we use OO a lot internally.)
39
- * **Metaprogramming**. Such a cool thing in Ruby... don't worry about it for Squib. Metaprogramming is for people who literally sleep better at night knowing their designs are extensible for years of software development to come. You're just trying to make a game.
40
-
41
- What You Need to Know about Ruby for Squib
42
- ------------------------------------------
43
-
44
- I won't give you an introduction to Ruby - other people do that quite nicely (see Resources at the bottom of this article). Instead, as you go through learning Ruby, you should pay special attention to the following:
45
-
46
- * Comments
47
- * Variables
48
- * `require`
49
- * What `do` and `end` mean
50
- * Arrays, particularly since most of Squib's arguments are usually Arrays
51
- * Strings and symbols
52
- * String interpolation
53
- * Hashes are important, especially for Excel or CSV importing
54
- * Editing Yaml. Yaml is not Ruby *per se*, but it's a data format common in the Ruby community and Squib uses it in a couple of places (e.g. layouts and the configuration file)
55
- * Methods are useful, but not immediately necessary, for most Squib scripts.
56
-
57
- If you are looking for some advanced Ruby-fu, these are useful to brush up on:
58
-
59
- * ``Enumerable`` - everything you can do with iterating over an Array, for example
60
- * ``map`` - convert one Array to another
61
- * ``zip`` - combine two arrays in parallel
62
- * ``inject`` - process one Enumerable and build up something else
63
-
64
- Find a good text editor
65
- -----------------------
66
-
67
- The text editor is a programmer's most sacred tool. It's where we live, and it's the tool we're most passionate (and dogmatic) about. My personal favorite editors are `SublimeText <http://www.sublimetext.com/3>`_ and `Atom <http://atom.io>`_. There are a bajillion others. The main things you'll need for editing Ruby code are:
68
-
69
- * Line numbers. When you get an error, you'll need to know where to go.
70
- * Monospace fonts. Keeping everything lined up is important, especially in keeping indentation.
71
- * Syntax highlighting. You can catch all kinds of basic syntax mistakes with syntax highlighting. My personal favorite syntax highlighting theme is Monokai.
72
- * Manage a directory of files. Not all text editors support this, but Sublime and Atom are particularly good for this (e.g. `Ctrl+P` can open anything!). Squib is more than just the deck.rb - you've got layout files, a config file, your instructions, a build file, and a bunch of other stuff. Your editor should be able to pull those up for you in a few keystrokes so you don't have to go all the way over to your mouse.
73
-
74
- There are a ton of other things that these editors will do for you. If you're just starting out, don't worry so much about customizing your editor just yet. Work with it for a while and get used to the defaults. After 30+ hours in the editor, only then should you consider installing plugins and customizing options to fit your preferences.
75
-
76
- Command line basics
77
- -------------------
78
-
79
- Executing Ruby is usually done through the command line. Depending on your operating system, you'll have a few options.
80
-
81
- * On Macs, you've got the Terminal, which is essentially a Unix shell in Bash (Bourne-Again SHell). This has an amazing amount of customization possible with a long history in the Linux/Unix/BSD world.
82
- * On Windows, there's the Command Prompt (Windows Key, `cmd`). It's a little janky, but it'll do. I've developed Squib primarily in Windows using the Command Prompt.
83
- * If you're on Linux/BSD/etc, you undoubtedly know what the command line is.
84
-
85
- For example::
86
-
87
- $ cd c:\game-prototypes
88
- $ gem install squib
89
- $ squib new tree-gnome-blasters
90
- $ ruby deck.rb
91
- $ rake
92
- $ bundle install
93
- $ gem up squib
94
-
95
- This might seem arcane at first, but the command line is the single most powerful and expressive tool in computing... if you know how to harness it.
96
-
97
- Edit-Run-Check.
98
- ---------------
99
-
100
- To me, the most important word in all of software development is *incremental*. When you're climbing up a mountain by yourself, do you wait to put in anchors until you reach the summit? No!! You anchor yourself along the way frequently so that when you fall, you don't fall very far.
101
-
102
- In programming, you need to be running your code often. Very often. In an expressive language like Ruby, you should be running your code every 60-90 seconds (seriously). Why? Because if you make a mistake, then you know that you made it in the last 60-90 seconds, and your problem is that much easier to solve. Solving one bug might take two minutes, but solving three bugs at once will take ~20 minutes (empirical studies have actually backed this up exponentiation effect).
103
-
104
- How much code can you write in 60-90 seconds? Maybe 1-5 lines, for fast typists. Think of it this way: the longer you go without running your code, the more debt you're accruing because it will take longer to fix all the bugs you haven't fixed yet.
105
-
106
- That means your code should be stable very often. You'll pick up little tricks here and there. For example, whenever you type a ``(``, you should immediately type a ``)`` afterward and edit in the middle (some text editors even do this for you). Likewise, after every ``do`` you should type ``end`` (that's a Ruby thing). There are many, many more. Tricks like that are all about reducing what you have to remember so that you can keep your code stable.
107
-
108
- With Squib, you'll be doing one other thing: checking your output. Make sure you have some specific cards to check constantly to make sure the card is coming out the way you want. The Squib method :doc:`/dsl/save_png` (or ones like it) should be one of the first methods you write when you make a new deck.
109
-
110
- As a result of all these, you'll have lots of windows open when working with Squib. You'll have a text editor to edit your source code, your spreadsheet (if you're working with one), a command line prompt, and a preview of your image files. It's a lot of windows, I know. That's why computer geeks usually have multiple monitors!
111
-
112
- So, just to recap: your edit-run-check cycle should be *very* short. Trust me on this one.
113
-
114
-
115
- Plan to Fail
116
- ------------
117
-
118
- If you get to a point where you can't possibly figure out what's going on that means one thing.
119
-
120
- You're human.
121
-
122
- Everyone runs into bugs they can't fix. Everyone. Take a break. Put it down. Talk about it out loud. And then, of course, you can always :doc:`/help`.
123
-
124
- Ruby Learning Resources
125
- -----------------------
126
-
127
- Here are some of my favorite resources for getting started with Ruby. A lot of them assume you are also new to programming in general. They do cover material that isn't very relevant to Squib, but that's okay - learning is never wasted, only squandered.
128
-
129
- `CodeSchool's TryRuby <https://www.codeschool.com/courses/try-ruby>`_
130
- This is one of my favorites. It's pretty basic but it walks you through the exercises interactively and makes good use of challenges.
131
-
132
- `RubyMonk.com <https://rubymonk.com/>`_
133
- An interactive explanation through Ruby. Gets a bit philosophical, but hey, what else would you expect from a monk?
134
-
135
- `Pragmatic Programmer's Guide to Ruby (The PickAxe Book) <http://ruby-doc.com/docs/ProgrammingRuby/>`_
136
- One of the best comprehensive resources out there for Ruby - available for free!
137
-
138
- `Ruby's Own Website: Getting Started <https://www.ruby-lang.org/en/documentation/quickstart/>`_
139
- This will take you through the basics of programming in Ruby. It works mostly from the Interactive Ruby shell `irb`, which is pretty helpful for seeing how things work and what Ruby syntax looks like.
140
-
141
- `Why's Poignant Guide to Ruby <http://poignant.guide/>`_
142
- No list of Ruby resources is complete without a reference to this, well, poignant guide to Ruby. Enjoy.
143
-
144
- `The Pragmatic Programmer <http://www.amazon.com/The-Pragmatic-Programmer-Journeyman-Master/dp/020161622X>`_
145
- The best software development book ever written (in my opinion). If you are doing programming and you have one book on your shelf, this is it. Much of what inspired Squib came from this thinking.
@@ -1,217 +0,0 @@
1
- The Squib Way pt 1: Zero to Game
2
- =================================
3
-
4
- I've always felt that the Ruby community and the tabletop game design community had a lot in common, and a lot to learn from each other. Both are all about testing. All about iterative development. Both communities are collegial, creative, and fun.
5
-
6
- But the Ruby community, and the software development community generally, has a lot to teach us game designers about how to develop something. `Ruby has a "way" of doing things <http://therubyway.io/>`_ that is unique and helpful to game designers.
7
-
8
- In this series of guides, I'll introduce you to Squib's key features and I'll walk you through a basic prototype. We'll also take a more circuitous route than normal so that I can touch upon some key design principles and good software development habits so that you can make your Squib scripts maintainable, understandable, flexible, and changeable.
9
-
10
- Prototyping with Squib
11
- ----------------------
12
-
13
- Squib is all about being able to change your mind quickly. Change data, change layout, change artwork, change text. But where do we start? What do we work on first?
14
-
15
- The key to prototyping tabletop games is *playtesting*. At the table. With humans. Printed components. That means that we need to get our idea out of our brains and onto pieces of paper as fast as possible.
16
-
17
- But! We also want to get the *second* (and third and fourth and fifth...) version of our game back to the playtesting table quickly, too. If we work with Squib from day one, our ability to react to feedback will be much smoother once we've laid the groundwork.
18
-
19
-
20
- Get Installed and Set Up
21
- -----------------------------
22
- The ordinary installation is like most Ruby gems::
23
-
24
- $ gem install squib
25
-
26
- See :doc:`/install` for more details.
27
-
28
- This guide also assumes you've got some basic Ruby experience, and you've got your tools set up (i.e. text editor, command line, image preview, etc). See :doc:`part_0_learning_ruby` to see my recommendations.
29
-
30
- Our Idea: Familiar Fights
31
- -------------------------
32
- Let's start with an idea for a game: Familiar Fights. Let's say we want to have players fight each other based on collecting cards that represent their familiars, each with different abilities. We'll have two factions: drones and humans. Each card will have some artwork in it, and some text describing their powers.
33
-
34
- First thing: the title. It stinks, I know. It's gonna change. So instead of naming the directory after our game and getting married to our bad idea, let's give our game a code name. I like to use animal names, so let's go with Arctic Lemming::
35
-
36
- $ squib new arctic-lemming
37
- $ cd arctic-lemming
38
- $ ls
39
- ABOUT.md Gemfile PNP NOTES.md Rakefile _output config.yml deck.rb layout.yml
40
-
41
- Go ahead and put "Familiar Fights" as an idea for a title in the ``IDEAS.md`` file.
42
-
43
- If you're using Git or other version control, now's a good time to commit. See :doc:`/guides/git`.
44
-
45
- Data or Layout?
46
- ---------------
47
-
48
- From a prototyping standpoint, we really have two directions we can work from:
49
-
50
- * Laying out an example card
51
- * Working on the deck data
52
-
53
- There's no wrong direction here - we'll need to do both to get our idea onto the playtesting table. Go where your inspiration guides you. For this example, let's say I've put together ideas for four cards. Here's the data:
54
-
55
- ====== ======= ===============================
56
- name faction power
57
- ====== ======= ===============================
58
- Ninja human Use the power of another player
59
- Pirate human Steal 1 card from another player
60
- Zombie drone Take a card from the discard pile
61
- Robot drone Draw two cards
62
- ====== ======= ===============================
63
-
64
- If you're a spreadsheet person, go ahead and put this into Excel (in the above format). Or, if you want to be plaintext-friendly, put it into a comma-separated format (CSV). Like this:
65
-
66
- .. raw:: html
67
-
68
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
69
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js"></script>
70
- <code data-gist-id="d2bb2eb028b27cf1dace" data-gist-file="data.csv"></code>
71
-
72
- Initial Card Layout
73
- -----------------------------
74
-
75
- Ok let's get into some code now. Here's an "Hello, World" code snippet
76
-
77
- .. raw:: html
78
-
79
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
80
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js"></script>
81
- <code data-gist-id="d2bb2eb028b27cf1dace" data-gist-file="01_hello.rb"></code>
82
-
83
- Let's dissect this:
84
-
85
- * Line 1: this code will bring in the Squib library for us to use. Keep this at the top.
86
- * Line 2: By convention, we put a blank line between our `require` statements and the rest of our code
87
- * Line 3: Define a new deck of cards. Just 1 card for now
88
- * Line 4: Set the background to pink. Colors can be in various notations - see :doc:`/colors`.
89
- * Line 5: Draw a rectangle around the edge of the deck. Note that this has no arguments, because :doc:`/parameters`.
90
- * Line 6: Put some text in upper-left the corner of the card.
91
- * Line 7: Save our card out to a png file called ``card_00.png``. Ordinarily, this will be saved to ``_output/card_00.png``, but in our examples we'll be saving to the current directory (because this documentation has its examples as GitHub gists and gists don't have folders - I do not recommend having ``dir: '.'`` in your code)
92
-
93
- By the way, this is what's created:
94
-
95
- .. raw:: html
96
-
97
- <img src="../../intro/part1_00_expected.png" width=250>
98
-
99
- Now let's incrementally convert the above snippet into just one of our cards. Let's just focus on one card for now. Later we'll hook it up to our CSV and apply that to all of our cards.
100
-
101
- You may have seen in some examples that we can just put in x-y coordinates into our DSL method calls (e.g. ``text x: 0, y: 100``). That's great for customizing our work later, but we want to get this to the table quickly. Instead, let's make use of Squib's feature (see :doc:`/layouts`).
102
-
103
- Layouts are a way of specifying some of your arguments in one place - a layout file. The ``squib new`` command created our own ``layout.yml`` file, but we can also use one of Squib's built-in layout files. Since we just need a title, artwork, and description, we can just use ``economy.yml`` (inspired by a popular deck builder that currently has *dominion* over the genre). Here's how that looks:
104
-
105
- .. raw:: html
106
-
107
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
108
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js"></script>
109
- <code data-gist-id="d2bb2eb028b27cf1dace"
110
- data-gist-file="02_onecard.rb"></code>
111
- <code data-gist-id="d2bb2eb028b27cf1dace"
112
- data-gist-file="02_onecard_rb.png"
113
- class=code_img
114
- ></code>
115
-
116
-
117
- There are a few key decisions I've made here:
118
-
119
- * **Black-and-white**. We're now only using black or white so that we can be printer-friendly.
120
- * **Safe and Cut**. We added two rectangles for guides based on the poker card template from `TheGameCrafter.com <http://www.thegamecrafter.com>`_. This is important to do now and not later. In most print-on-demand templates, we have a 1/8-inch border that is larger than what is to be used, and will be cut down (called a *bleed*). Rather than have to change all our coordinates later, let's build that right into our prototype. Squib can trim around these bleeds for things like :doc:`/dsl/showcase`, :doc:`/dsl/hand`, :doc:`/dsl/save_sheet`, :doc:`/dsl/save_png`, and :doc:`/dsl/save_pdf`. See :doc:`/bleed`.
121
- * **Title**. We added a title based on our data.
122
- * **layout: 'foo'**. Each command references a "layout" rule. These can be seen in our layout file, which is a built-in layout called ``economy.yml`` (see `ours on GitHub <https://github.com/andymeneely/squib/blob/master/lib/squib/layouts/economy.yml>`_ ). Later on, we can define our own layout rules in our own file, but for now we just want to get our work done as fast as possible and make use of the stock layout. See :doc:`/layouts`.
123
-
124
- Multiple Cards
125
- --------------
126
- Ok now we've got a basic card. But we only have one. The real power of Squib is the ability to customize things *per card*. So if we, say, want to have two different titles on two different cards, our `text` call will look like this::
127
-
128
- text str: ['Zombie', 'Robot'], layout: 'title'
129
-
130
- When Squib gets this, it will:
131
-
132
- * See that the ``str:`` option has an array, and put ``'Zombie'`` on the first card and ``'Robot'`` on the second.
133
- * See that the ``layout:`` option is NOT an array - so it will use the same one for every card.
134
-
135
- So technically, these two lines are equivalent::
136
-
137
- text str: ['Zombie', 'Robot'], layout: 'title'
138
- text str: ['Zombie', 'Robot'], layout: ['title','title']
139
-
140
- Ok back to the game. We COULD just put our data into literal arrays. But that's considered bad programming practice (called *hardcoding*, where you put data directly into your code). Instead, let's make use of our CSV data file.
141
-
142
- What the ``csv`` command does here is read in our file and create a hash of arrays. Each array is a column in the table, and the header to the colum is the key to the hash. To see this in action, check it out on Ruby's interactive shell (``irb``)::
143
-
144
- $ irb
145
- 2.1.2 :001 > require 'squib'
146
- => true
147
- 2.1.2 :002 > Squib.csv file: 'data.csv'
148
- => {"name"=>["Ninja", "Pirate", "Zombie", "Robot"], "class"=>["human", "human", "drone", "drone"], "power"=>["Use the power of another player", "Steal 1 card from another player", "Take a card from the discard pile", "Draw two cards"]}
149
-
150
- So, we COULD do this::
151
-
152
- require 'squib'
153
-
154
- Squib::Deck.new cards: 4, layout: 'economy.yml' do
155
- data = csv file: 'data.csv'
156
- #rest of our code
157
- end
158
-
159
- **BUT!** What if we change the number of total cards in the deck? We won't always have 4 cards (i.e. the number 4 is hardcoded). Instead, let's read in the data outside of our ``Squib::Deck.new`` and then create the deck size based on that::
160
-
161
- require 'squib'
162
-
163
- data = Squib.csv file: 'data.csv'
164
-
165
- Squib::Deck.new cards: data['name'].size, layout: 'economy.yml' do
166
- #rest of our code
167
- end
168
-
169
- So now we've got our data, let's replace all of our other hardcoded data from before with their corresponding arrays:
170
-
171
- .. raw:: html
172
-
173
- <code data-gist-id="d2bb2eb028b27cf1dace" data-gist-file="03_csv.rb"></code>
174
- <code data-gist-id="d2bb2eb028b27cf1dace" data-gist-file="03_csv_rb00.png"
175
- class=code_img ></code>
176
- <code data-gist-id="d2bb2eb028b27cf1dace" data-gist-file="03_csv_rb01.png"
177
- class=code_img ></code>
178
- <code data-gist-id="d2bb2eb028b27cf1dace" data-gist-file="03_csv_rb02.png"
179
- class=code_img ></code>
180
- <code data-gist-id="d2bb2eb028b27cf1dace" data-gist-file="03_csv_rb03.png"
181
- class=code_img ></code>
182
-
183
- Awesome! Now we've got our all of our cards prototyped out. Let's add two more calls before we bring this to the table:
184
-
185
- * ``save_pdf`` that stitches our images out to pdf
186
- * A version number, based on today's date
187
-
188
- .. raw:: html
189
-
190
- <code data-gist-id="d2bb2eb028b27cf1dace" data-gist-file="04_save_pdf.rb">
191
- </code>
192
-
193
- The file ``_output/output.pdf`` gets created now. Note that we *don't* want to print out the bleed area, as that is for the printing process, so we add a 1/8-inch trim (Squib defaults to 300ppi, so 300/8=37.5). The ``save_pdf`` defaults to 8.5x11 piece of landscape paper, and arranges the cards in rows - ready for you to print out and play!
194
-
195
- If you're working with version control, I recommend committing multiple times throughout this process. At this stage, I recommend creating a tag when you are ready to print something out so you know what version precisely you printed out.
196
-
197
- To the table!
198
- -------------
199
-
200
- Squib's job is done, for at least this prototype anyway. Now let's print this sheet out and make some cards!
201
-
202
- My recommended approach is to get the following:
203
-
204
- * A pack of standard sized sleeves, 2.5"x3.5"
205
- * Some cardstock to give the cards some spring
206
- * A paper trimmer, rotary cutter, knife+steel ruler - some way to cut your cards quickly.
207
-
208
- Print your cards out on regular office paper. Cut them along the trim lines. Also, cut your cardstock (maybe a tad smaller than 2.5x3.5) and sleeve them. I will often color-code my cardstock backs in prototypes so I can easily tell them apart. Put the cards into the sleeves. You've got your deck!
209
-
210
- Now the most important part: play it. When you think of a rule change or card clarification, just pull the paper out of the sleeve and write on the card. These card print-outs are short-lived anyway.
211
-
212
- When you playtest, take copious notes. If you want, you can keep those notes in the PLAYTESTING.md file.
213
-
214
- Next up...
215
- -----------------------------
216
-
217
- We've got a long way to go on our game. We need artwork, iconography, more data, and more cards. We have a lot of directions we could go from here, so in our next guide we'll start looking at a variety of strategies. We'll also look at ways we can keep our code clean and simple so that we're not afraid to change things later on.