geo_pattern 1.5.0 → 1.6.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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +46 -5
  4. data/lib/geo_pattern/color_generators/base_color_generator.rb +2 -9
  5. data/lib/geo_pattern/pattern_helpers.rb +22 -7
  6. data/lib/geo_pattern/roles/comparable_metadata.rb +1 -1
  7. data/lib/geo_pattern/roles/named_generator.rb +1 -1
  8. data/lib/geo_pattern/version.rb +1 -1
  9. metadata +55 -85
  10. data/.github/workflows/ruby.yml +0 -30
  11. data/.gitignore +0 -19
  12. data/.rspec +0 -3
  13. data/.simplecov +0 -26
  14. data/Gemfile +0 -24
  15. data/Rakefile +0 -82
  16. data/fixtures/generated_patterns/chevrons.svg +0 -1
  17. data/fixtures/generated_patterns/concentric_circles.svg +0 -1
  18. data/fixtures/generated_patterns/diamonds.svg +0 -1
  19. data/fixtures/generated_patterns/diamonds_with_base_color.svg +0 -1
  20. data/fixtures/generated_patterns/diamonds_with_color.svg +0 -1
  21. data/fixtures/generated_patterns/hexagons.svg +0 -1
  22. data/fixtures/generated_patterns/mosaic_squares.svg +0 -1
  23. data/fixtures/generated_patterns/nested_squares.svg +0 -1
  24. data/fixtures/generated_patterns/octagons.svg +0 -1
  25. data/fixtures/generated_patterns/overlapping_circles.svg +0 -1
  26. data/fixtures/generated_patterns/overlapping_rings.svg +0 -1
  27. data/fixtures/generated_patterns/plaid.svg +0 -1
  28. data/fixtures/generated_patterns/plus_signs.svg +0 -1
  29. data/fixtures/generated_patterns/sine_waves.svg +0 -1
  30. data/fixtures/generated_patterns/squares.svg +0 -1
  31. data/fixtures/generated_patterns/tessellation.svg +0 -1
  32. data/fixtures/generated_patterns/triangles.svg +0 -1
  33. data/fixtures/generated_patterns/xes.svg +0 -1
  34. data/geo_pattern.gemspec +0 -25
  35. data/script/bootstrap +0 -30
  36. data/script/console +0 -9
  37. data/script/test +0 -21
  38. data/spec/background_generators/solid_generator_spec.rb +0 -52
  39. data/spec/background_spec.rb +0 -27
  40. data/spec/color_generators/base_color_generator_spec.rb +0 -33
  41. data/spec/color_generators/simple_generator_spec.rb +0 -14
  42. data/spec/color_preset_spec.rb +0 -55
  43. data/spec/color_spec.rb +0 -17
  44. data/spec/geo_pattern_spec.rb +0 -116
  45. data/spec/helpers_spec.rb +0 -67
  46. data/spec/pattern_preset_spec.rb +0 -43
  47. data/spec/pattern_sieve_spec.rb +0 -68
  48. data/spec/pattern_spec.rb +0 -74
  49. data/spec/pattern_store_spec.rb +0 -49
  50. data/spec/pattern_validator_spec.rb +0 -30
  51. data/spec/seed_spec.rb +0 -16
  52. data/spec/spec_helper.rb +0 -19
  53. data/spec/structure_generators/chevrons_generator_spec.rb +0 -7
  54. data/spec/structure_generators/concentric_circles_generator_spec.rb +0 -7
  55. data/spec/structure_generators/diamonds_generator_spec.rb +0 -7
  56. data/spec/structure_generators/hexagons_generator_spec.rb +0 -7
  57. data/spec/structure_generators/mosaic_squares_generator_spec.rb +0 -7
  58. data/spec/structure_generators/nested_squares_generator_spec.rb +0 -7
  59. data/spec/structure_generators/octagons_generator_spec.rb +0 -7
  60. data/spec/structure_generators/overlapping_circles_generator_spec.rb +0 -7
  61. data/spec/structure_generators/overlapping_rings_generator_spec.rb +0 -7
  62. data/spec/structure_generators/plaid_generator_spec.rb +0 -7
  63. data/spec/structure_generators/plus_signs_generator_spec.rb +0 -7
  64. data/spec/structure_generators/sine_waves_generator_spec.rb +0 -7
  65. data/spec/structure_generators/squares_generator_spec.rb +0 -7
  66. data/spec/structure_generators/tessellation_generator_spec.rb +0 -7
  67. data/spec/structure_generators/triangles_generator_spec.rb +0 -7
  68. data/spec/structure_generators/xes_generator_spec.rb +0 -7
  69. data/spec/structure_spec.rb +0 -40
  70. data/spec/support/aruba.rb +0 -24
  71. data/spec/support/helpers/fixtures.rb +0 -14
  72. data/spec/support/kernel.rb +0 -46
  73. data/spec/support/matchers/image.rb +0 -19
  74. data/spec/support/matchers/name.rb +0 -17
  75. data/spec/support/rspec.rb +0 -26
  76. data/spec/support/shared_examples/generator.rb +0 -48
  77. data/spec/support/shared_examples/pattern.rb +0 -33
  78. data/spec/support/shared_examples/pattern_name.rb +0 -9
  79. data/spec/support/shared_examples/structure.rb +0 -50
  80. data/spec/support/string.rb +0 -3
  81. data/spec/svg_spec.rb +0 -14
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="226" height="393"><rect x="0" y="0" width="100%" height="100%" fill="rgb(63, 144, 77)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.14133333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(-37.83333333333333, 0.0) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.14133333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(189.16666666666663, 0.0) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.08933333333333333" stroke="#000" stroke-opacity="0.02" transform="translate(0.0, 0.0) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.13266666666666665" stroke="#000" stroke-opacity="0.02" transform="translate(37.83333333333333, 0.0) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.15" stroke="#000" stroke-opacity="0.02" transform="translate(75.66666666666666, 0.0) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.098" stroke="#000" stroke-opacity="0.02" transform="translate(113.49999999999999, 0.0) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.07200000000000001" stroke="#000" stroke-opacity="0.02" transform="translate(151.33333333333331, 0.0) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.07200000000000001" stroke="#000" stroke-opacity="0.02" transform="translate(-37.83333333333333, 65.52925555302251) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.07200000000000001" stroke="#000" stroke-opacity="0.02" transform="translate(189.16666666666663, 65.52925555302251) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.08066666666666666" stroke="#000" stroke-opacity="0.02" transform="translate(0.0, 65.52925555302251) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.07200000000000001" stroke="#000" stroke-opacity="0.02" transform="translate(37.83333333333333, 65.52925555302251) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.08066666666666666" stroke="#000" stroke-opacity="0.02" transform="translate(75.66666666666666, 65.52925555302251) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.15" stroke="#000" stroke-opacity="0.02" transform="translate(113.49999999999999, 65.52925555302251) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.11533333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(151.33333333333331, 65.52925555302251) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.13266666666666665" stroke="#000" stroke-opacity="0.02" transform="translate(-37.83333333333333, 131.05851110604502) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.13266666666666665" stroke="#000" stroke-opacity="0.02" transform="translate(189.16666666666663, 131.05851110604502) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.046" stroke="#000" stroke-opacity="0.02" transform="translate(0.0, 131.05851110604502) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.10666666666666667" stroke="#000" stroke-opacity="0.02" transform="translate(37.83333333333333, 131.05851110604502) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.046" stroke="#000" stroke-opacity="0.02" transform="translate(75.66666666666666, 131.05851110604502) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.08933333333333333" stroke="#000" stroke-opacity="0.02" transform="translate(113.49999999999999, 131.05851110604502) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.046" stroke="#000" stroke-opacity="0.02" transform="translate(151.33333333333331, 131.05851110604502) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.12400000000000001" stroke="#000" stroke-opacity="0.02" transform="translate(-37.83333333333333, 196.58776665906754) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.12400000000000001" stroke="#000" stroke-opacity="0.02" transform="translate(189.16666666666663, 196.58776665906754) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.06333333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(0.0, 196.58776665906754) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.046" stroke="#000" stroke-opacity="0.02" transform="translate(37.83333333333333, 196.58776665906754) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.03733333333333333" stroke="#000" stroke-opacity="0.02" transform="translate(75.66666666666666, 196.58776665906754) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.028666666666666667" stroke="#000" stroke-opacity="0.02" transform="translate(113.49999999999999, 196.58776665906754) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.07200000000000001" stroke="#000" stroke-opacity="0.02" transform="translate(151.33333333333331, 196.58776665906754) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.08066666666666666" stroke="#000" stroke-opacity="0.02" transform="translate(-37.83333333333333, 262.11702221209003) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.08066666666666666" stroke="#000" stroke-opacity="0.02" transform="translate(189.16666666666663, 262.11702221209003) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.098" stroke="#000" stroke-opacity="0.02" transform="translate(0.0, 262.11702221209003) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.098" stroke="#000" stroke-opacity="0.02" transform="translate(37.83333333333333, 262.11702221209003) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.11533333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(75.66666666666666, 262.11702221209003) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.14133333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(113.49999999999999, 262.11702221209003) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.11533333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(151.33333333333331, 262.11702221209003) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.05466666666666667" stroke="#000" stroke-opacity="0.02" transform="translate(-37.83333333333333, 327.64627776511253) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.05466666666666667" stroke="#000" stroke-opacity="0.02" transform="translate(189.16666666666663, 327.64627776511253) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.11533333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(0.0, 327.64627776511253) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.05466666666666667" stroke="#000" stroke-opacity="0.02" transform="translate(37.83333333333333, 327.64627776511253) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#222" fill-opacity="0.06333333333333334" stroke="#000" stroke-opacity="0.02" transform="translate(75.66666666666666, 327.64627776511253) rotate(180, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.07200000000000001" stroke="#000" stroke-opacity="0.02" transform="translate(113.49999999999999, 327.64627776511253) rotate(0, 37.83333333333333, 32.764627776511254)" /><polyline points="37.83333333333333, 0, 75.66666666666666, 65.52925555302251, 0, 65.52925555302251, 37.83333333333333, 0" fill="#ddd" fill-opacity="0.05466666666666667" stroke="#000" stroke-opacity="0.02" transform="translate(151.33333333333331, 327.64627776511253) rotate(180, 37.83333333333333, 32.764627776511254)" /></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="203" height="203"><rect x="0" y="0" width="100%" height="100%" fill="rgb(63, 144, 77)" /><g fill="#ddd" style="opacity:0.14133333333333334;" transform="translate(-33.948,-33.948) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.14133333333333334;" transform="translate(169.73999999999998,-33.948) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.14133333333333334;" transform="translate(-33.948,169.74) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.14133333333333334;" transform="translate(169.73999999999998,169.74) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.08933333333333333;" transform="translate(0.0,-16.974) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.08933333333333333;" transform="translate(0.0,186.714) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.13266666666666665;" transform="translate(33.948,-33.948) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.13266666666666665;" transform="translate(33.948,169.74) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.15;" transform="translate(67.89599999999999,-16.974) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.15;" transform="translate(67.89599999999999,186.714) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.098;" transform="translate(101.844,-33.948) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.098;" transform="translate(101.844,169.74) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.07200000000000001;" transform="translate(135.792,-16.974) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.07200000000000001;" transform="translate(135.792,186.714) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.07200000000000001;" transform="translate(-33.948,0.0) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.07200000000000001;" transform="translate(169.73999999999998,0.0) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.08066666666666666;" transform="translate(0.0,16.973999999999997) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.07200000000000001;" transform="translate(33.948,0.0) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.08066666666666666;" transform="translate(67.89599999999999,16.973999999999997) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.15;" transform="translate(101.844,0.0) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.11533333333333334;" transform="translate(135.792,16.973999999999997) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.13266666666666665;" transform="translate(-33.948,33.94799999999999) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.13266666666666665;" transform="translate(169.73999999999998,33.94799999999999) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.046;" transform="translate(0.0,50.922) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.10666666666666667;" transform="translate(33.948,33.94799999999999) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.046;" transform="translate(67.89599999999999,50.922) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.08933333333333333;" transform="translate(101.844,33.94799999999999) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.046;" transform="translate(135.792,50.922) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.12400000000000001;" transform="translate(-33.948,67.89599999999999) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.12400000000000001;" transform="translate(169.73999999999998,67.89599999999999) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.06333333333333334;" transform="translate(0.0,84.86999999999998) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.046;" transform="translate(33.948,67.89599999999999) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.03733333333333333;" transform="translate(67.89599999999999,84.86999999999998) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.028666666666666667;" transform="translate(101.844,67.89599999999999) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.07200000000000001;" transform="translate(135.792,84.86999999999998) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.08066666666666666;" transform="translate(-33.948,101.844) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.08066666666666666;" transform="translate(169.73999999999998,101.844) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.098;" transform="translate(0.0,118.81799999999998) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.098;" transform="translate(33.948,101.844) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.11533333333333334;" transform="translate(67.89599999999999,118.81799999999998) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.14133333333333334;" transform="translate(101.844,101.844) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.11533333333333334;" transform="translate(135.792,118.81799999999998) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.05466666666666667;" transform="translate(-33.948,135.79200000000003) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.05466666666666667;" transform="translate(169.73999999999998,135.79200000000003) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.05466666666666667;" transform="translate(-33.948,-67.89599999999996) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.11533333333333334;" transform="translate(0.0,152.76600000000002) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.11533333333333334;" transform="translate(0.0,-50.92199999999997) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.05466666666666667;" transform="translate(33.948,135.79200000000003) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.05466666666666667;" transform="translate(33.948,-67.89599999999996) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.06333333333333334;" transform="translate(67.89599999999999,152.76600000000002) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#222" style="opacity:0.06333333333333334;" transform="translate(67.89599999999999,-50.92199999999997) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.07200000000000001;" transform="translate(101.844,135.79200000000003) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.07200000000000001;" transform="translate(101.844,-67.89599999999996) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.05466666666666667;" transform="translate(135.792,152.76600000000002) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g><g fill="#ddd" style="opacity:0.05466666666666667;" transform="translate(135.792,-50.92199999999997) rotate(45, 33.948, 33.948)" ><rect x="24.0" y="0" width="24.0" height="72.0" /><rect x="0" y="24.0" width="72.0" height="24.0" /></g></svg>
data/geo_pattern.gemspec DELETED
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path("lib", __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "geo_pattern/version"
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "geo_pattern"
9
- spec.version = GeoPattern::VERSION
10
- spec.authors = ["Jason Long"]
11
- spec.email = ["jason@jasonlong.me"]
12
- spec.summary = "Generate SVG beautiful patterns"
13
- spec.description = "Generate SVG beautiful patterns"
14
- spec.homepage = "https://github.com/jasonlong/geo_pattern"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0")
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.require_paths = ["lib"]
20
-
21
- spec.required_ruby_version = ">= 2.6"
22
-
23
- spec.add_dependency "color", "~> 1.5"
24
- spec.add_development_dependency "bundler", "~> 2.2"
25
- end
data/script/bootstrap DELETED
@@ -1,30 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- info_msg="\e[0;32m[INFO]\e[0;30m"
6
- error_msg="\e[0;31mFAILED\e[0;30m"
7
-
8
- function output_error_log {
9
- [[ -f error.log ]] && ( cat error.log >&2; rm error.log)
10
- }
11
-
12
- echo -ne "$info_msg Checking if ruby installed? "
13
- which 'ruby' >/dev/null 2>error.log || ( echo -e "$error_msg\n\nCould not find \`ruby\`. Please install ruby or add it to PATH"; output_error_log; exit 1 )
14
- echo OK
15
-
16
- echo -en "$info_msg rubygem \"rake\" "
17
- gem install rake >/dev/null 2>error.log || ( echo -e "$error_msg\n\nAn error occurred during installation of rake. Run \`gem install rake\` yourself."; output_error_log; exit 1 )
18
- echo OK
19
-
20
- if [ -n "$CI" ]; then
21
- echo -e "$info_msg Bootstrapping in CI mode"
22
- rake_task='bootstrap:ci'
23
- else
24
- echo -e "$info_msg Bootstrapping in normal mode"
25
- rake_task='bootstrap'
26
- fi
27
-
28
- echo -en "$info_msg Running rake task \"$rake_task\" "
29
- rake --trace $rake_task >error.log 2>&1 || ( echo -e "$error_msg\n\nAn error occurred during run of rake-task \"$rake_task\". Run \`rake $rake_task\` yourself."; output_error_log; exit 1 )
30
- echo OK
data/script/console DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- $LOAD_PATH << File.expand_path("../lib", __dir__)
5
-
6
- require "pry"
7
- require "geo_pattern"
8
-
9
- Pry.start
data/script/test DELETED
@@ -1,21 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- function output_error_log {
6
- [[ -f error.log ]] && ( cat error.log >&2; rm error.log)
7
- }
8
-
9
- info_msg="\e[0;32m[INFO]\e[0;30m"
10
- error_msg="\e[0;31mFAILED\e[0;30m"
11
-
12
- if [ -n "$CI" ]; then
13
- echo -e "$info_msg Testing in CI mode"
14
- rake_task='test:ci'
15
- else
16
- echo -e "$info_msg Testing in normal mode"
17
- rake_task='test'
18
- fi
19
-
20
- echo -en "$info_msg Running rake task \"$rake_task\" "
21
- bundle exec rake --trace $rake_task
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe BackgroundGenerators::SolidGenerator do
6
- subject(:generator) { described_class.new(seed, preset) }
7
-
8
- let(:seed) { instance_double("GeoPattern::Seed") }
9
- let(:preset) { instance_double("GeoPattern::ColorPreset") }
10
- let(:pattern) { instance_double("GeoPattern::Pattern") }
11
- let(:background_metadata) { instance_double("GeoPattern::BackgroundMetadata") }
12
-
13
- let(:color) { "#aaaaaa" }
14
- let(:base_color) { "#bbbbbb" }
15
- let(:base_color_should_be_used) { true }
16
-
17
- before :each do
18
- allow(seed).to receive(:to_i).with(14, 3).and_return(2616)
19
- allow(seed).to receive(:to_i).with(17, 1).and_return(3)
20
-
21
- allow(preset).to receive(:mode?).with(:base_color).and_return(base_color_should_be_used)
22
- allow(preset).to receive(:color).and_return(color)
23
- allow(preset).to receive(:base_color).and_return(base_color)
24
- end
25
-
26
- it { is_expected.not_to be_nil }
27
-
28
- describe "#generate" do
29
- context "when base color is given" do
30
- let(:generated_color) { %w[187 187 187] }
31
-
32
- before :each do
33
- expect(pattern).to receive(:background=).with(have_image_with_rgb_color(generated_color))
34
- end
35
-
36
- it { generator.generate(pattern) }
37
- end
38
-
39
- context "when color is given" do
40
- let(:base_color_should_be_used) { false }
41
- let(:generated_color) { %w[170 170 170] }
42
-
43
- before :each do
44
- expect(pattern).to receive(:background=).with(have_image_with_rgb_color(generated_color))
45
- end
46
-
47
- it { generator.generate(pattern) }
48
- end
49
-
50
- it_behaves_like "a named generator", :solid
51
- end
52
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe Background do
6
- subject(:metadata) { described_class.new(image: svg_image, preset: preset, generator: generator, color: color) }
7
-
8
- let(:svg_image) { instance_double("GeoPattern::SvgImage") }
9
- let(:svg_image_content) { fixtures_path("generated_patterns/sine_waves.svg").read.chomp }
10
- let(:preset) { instance_double("GeoPattern::ColorPreset") }
11
- let(:generator) { stub_const("GeoPattern::BackgroundGenerators::SolidGenerator", Class.new) }
12
-
13
- let(:color) { "#aaaaaa" }
14
- let(:base_color) { "#bbbbbb" }
15
-
16
- it { is_expected.not_to be_nil }
17
-
18
- before :each do
19
- allow(preset).to receive(:color).and_return(color)
20
- allow(preset).to receive(:base_color).and_return(base_color)
21
- end
22
-
23
- it_behaves_like "a metadata argument", :color
24
- it_behaves_like "a metadata argument", :generator
25
- it_behaves_like "a forwarded metadata argument", :base_color
26
- it_behaves_like "a forwarded metadata argument", :color
27
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe ColorGenerators::BaseColorGenerator do
6
- subject(:generator) { described_class.new(color_string, seed) }
7
-
8
- let(:seed) { instance_double("GeoPattern::Seed") }
9
- let(:seed_value1) { 2616 }
10
- let(:seed_value2) { 2 }
11
-
12
- let(:color_string) { "#ff00ff" }
13
-
14
- it { is_expected.not_to be_nil }
15
-
16
- before :each do
17
- allow(seed).to receive(:to_i).with(14, 3).and_return(seed_value1)
18
- allow(seed).to receive(:to_i).with(17, 1).and_return(seed_value2)
19
- end
20
-
21
- describe "#generate" do
22
- let(:color) { generator.generate }
23
-
24
- context "when sat offset is % 2 == 0" do
25
- it { expect(color.to_svg).to eq "rgb(210, 255, 0)" }
26
- end
27
-
28
- context "when sat offset is not % 2 == 0" do
29
- let(:seed_value2) { 3 }
30
- it { expect(color.to_svg).to eq "rgb(207, 251, 4)" }
31
- end
32
- end
33
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe ColorGenerators::SimpleGenerator do
4
- subject(:generator) { described_class.new(color_string) }
5
-
6
- let(:color_string) { "#ff00ff" }
7
-
8
- it { is_expected.not_to be_nil }
9
-
10
- describe "#generate" do
11
- let(:color) { generator.generate }
12
- it { expect(color.to_svg).to eq "rgb(255, 0, 255)" }
13
- end
14
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe ColorPreset do
6
- subject(:preset) { ColorPreset.new(**options) }
7
- let(:options) do
8
- {
9
- base_color: "#0f0f0f"
10
- }
11
- end
12
-
13
- it { expect(preset).not_to be nil }
14
-
15
- describe "#base_color" do
16
- it { expect(preset.base_color).to eq "#0f0f0f" }
17
- end
18
-
19
- describe "#color" do
20
- context "when set" do
21
- let(:options) do
22
- {
23
- base_color: "#0f0f0f",
24
- color: "#1f1f1f"
25
- }
26
- end
27
-
28
- it { expect(preset.color).to eq "#1f1f1f" }
29
- end
30
- end
31
-
32
- describe "#mode?" do
33
- context "when nil" do
34
- let(:options) do
35
- {
36
- base_color: "#0f0f0f",
37
- color: nil
38
- }
39
- end
40
-
41
- it { expect(preset).to be_mode :base_color }
42
- end
43
-
44
- context "when defined" do
45
- let(:options) do
46
- {
47
- base_color: "#0f0f0f",
48
- color: "#1f1f1f"
49
- }
50
- end
51
-
52
- it { expect(preset).to be_mode :color }
53
- end
54
- end
55
- end
data/spec/color_spec.rb DELETED
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe GeoPattern::Color do
6
- subject(:color) { described_class.new(color_string) }
7
- let(:color_string) { "#ff00ff" }
8
- let(:seed) { instance_double("GeoPattern::Seed") }
9
-
10
- describe "#to_svg" do
11
- it { expect(color.to_svg).to eq "rgb(255, 0, 255)" }
12
- end
13
-
14
- describe "#to_html" do
15
- it { expect(color.to_html).to eq color_string }
16
- end
17
- end
@@ -1,116 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe GeoPattern do
6
- subject(:pattern) { GeoPattern.generate(input) }
7
- let(:input) { "Mastering Markdown" }
8
- let(:color) { "#ffcc00" }
9
- let(:rgb_base_color) { PatternHelpers.html_to_rgb_for_string(seed, color) }
10
- let(:seed) { instance_double("GeoPattern::Seed") }
11
-
12
- before :each do
13
- allow(seed).to receive(:to_i).with(14, 3).and_return(2616)
14
- allow(seed).to receive(:to_i).with(17, 1).and_return(3)
15
- end
16
-
17
- it { expect(pattern).not_to be_nil }
18
-
19
- describe ".generate" do
20
- context "when invoked with the same input it returns the same output" do
21
- let(:other_pattern) { GeoPattern.generate(input) }
22
- it { expect(pattern.to_svg).to eq other_pattern.to_svg }
23
- end
24
-
25
- context "when an invalid option is given" do
26
- subject(:pattern) { GeoPattern.generate(input, **args) }
27
- let(:args) { {unknown: true} }
28
-
29
- it { expect { pattern }.to raise_error ArgumentError }
30
- end
31
-
32
- context "set background color of generated pattern" do
33
- let(:new_color) { "#ffcc00" }
34
-
35
- context "when a base color is set" do
36
- subject(:pattern) { GeoPattern.generate(input, base_color: color) }
37
- let(:new_color) { "#04fbf6" }
38
-
39
- it { expect(pattern.background.color.to_html).to eq(new_color) }
40
- end
41
-
42
- context "when a color is set" do
43
- subject(:pattern) { GeoPattern.generate(input, color: color) }
44
-
45
- it { expect(pattern.background.color.to_html).to eq(new_color) }
46
- end
47
- end
48
-
49
- context "specify the pattern" do
50
- subject(:pattern) { GeoPattern.generate(input, patterns: chosen_pattern) }
51
-
52
- let(:chosen_pattern) { :sine_waves }
53
-
54
- context "when the deprecated generator option is used" do
55
- subject(:pattern) { GeoPattern.generate(input, generator: chosen_pattern) }
56
- subject(:other_pattern) { GeoPattern.generate(input, patterns: chosen_pattern) }
57
-
58
- it { expect { pattern.to_svg }.to output(/deprecated/).to_stderr }
59
- it { silence(:stderr) { expect(pattern.to_svg).to eq other_pattern.to_svg } }
60
- end
61
-
62
- context "when multiple patterns are selected" do
63
- let(:chosen_pattern) { %i[sine_waves xes] }
64
-
65
- it { expect(pattern.structure.name).to eq(:sine_waves).or eq(:xes) }
66
- end
67
-
68
- context "when an old style pattern was chosen via class name" do
69
- it_behaves_like "an old style pattern", ChevronPattern, :chevrons
70
- it_behaves_like "an old style pattern", ConcentricCirclesPattern, :concentric_circles
71
- it_behaves_like "an old style pattern", DiamondPattern, :diamonds
72
- it_behaves_like "an old style pattern", HexagonPattern, :hexagons
73
- it_behaves_like "an old style pattern", MosaicSquaresPattern, :mosaic_squares
74
- it_behaves_like "an old style pattern", NestedSquaresPattern, :nested_squares
75
- it_behaves_like "an old style pattern", OctagonPattern, :octagons
76
- it_behaves_like "an old style pattern", OverlappingCirclesPattern, :overlapping_circles
77
- it_behaves_like "an old style pattern", OverlappingRingsPattern, :overlapping_rings
78
- it_behaves_like "an old style pattern", PlaidPattern, :plaid
79
- it_behaves_like "an old style pattern", PlusSignPattern, :plus_signs
80
- it_behaves_like "an old style pattern", SineWavePattern, :sine_waves
81
- it_behaves_like "an old style pattern", SquarePattern, :squares
82
- it_behaves_like "an old style pattern", TessellationPattern, :tessellation
83
- it_behaves_like "an old style pattern", TrianglePattern, :triangles
84
- it_behaves_like "an old style pattern", XesPattern, :xes
85
- end
86
-
87
- context "when an valid pattern was chosen" do
88
- it_behaves_like "a chosen pattern", :chevrons
89
- it_behaves_like "a chosen pattern", :concentric_circles
90
- it_behaves_like "a chosen pattern", :diamonds
91
- it_behaves_like "a chosen pattern", :hexagons
92
- it_behaves_like "a chosen pattern", :mosaic_squares
93
- it_behaves_like "a chosen pattern", :nested_squares
94
- it_behaves_like "a chosen pattern", :octagons
95
- it_behaves_like "a chosen pattern", :overlapping_circles
96
- it_behaves_like "a chosen pattern", :overlapping_rings
97
- it_behaves_like "a chosen pattern", :plaid
98
- it_behaves_like "a chosen pattern", :plus_signs
99
- it_behaves_like "a chosen pattern", :sine_waves
100
- it_behaves_like "a chosen pattern", :squares
101
- it_behaves_like "a chosen pattern", :tessellation
102
- it_behaves_like "a chosen pattern", :triangles
103
- it_behaves_like "a chosen pattern", :xes
104
- end
105
-
106
- context "when invalid patterns were chosen" do
107
- InvalidPatternClass = Class.new # rubocop:disable Lint/ConstantDefinitionInBlock
108
-
109
- it_behaves_like "an invalid pattern", InvalidPatternClass
110
- it_behaves_like "an invalid pattern", "invalid_pattern"
111
- it_behaves_like "an invalid pattern", :invalid_pattern
112
- it_behaves_like "an invalid pattern", [:sine_waves, "invalid_pattern"]
113
- end
114
- end
115
- end
116
- end
data/spec/helpers_spec.rb DELETED
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe Helpers do
6
- describe ".underscore" do
7
- subject { described_class.underscore string }
8
-
9
- context "when string is empty" do
10
- let(:string) { "" }
11
-
12
- it { is_expected.to eq "" }
13
- end
14
-
15
- context "when string is in snakecase" do
16
- let(:string) { "HelloWorld" }
17
-
18
- it { is_expected.to eq "hello_world" }
19
- end
20
-
21
- context "when string is in snakecase at some places" do
22
- let(:string) { "helloWorld" }
23
-
24
- it { is_expected.to eq "hello_world" }
25
- end
26
- end
27
-
28
- describe ".demodulize" do
29
- subject { described_class.demodulize string }
30
-
31
- context "when constant" do
32
- before :each do
33
- stub_const("HelloWorld", Class.new)
34
- end
35
-
36
- let(:string) { HelloWorld }
37
-
38
- it { is_expected.to eq "HelloWorld" }
39
- end
40
-
41
- context "when string" do
42
- context "is empty" do
43
- let(:string) { "" }
44
-
45
- it { is_expected.to eq "" }
46
- end
47
-
48
- context "starts with ::" do
49
- let(:string) { "::Class" }
50
-
51
- it { is_expected.to eq "Class" }
52
- end
53
-
54
- context "has :: in betweend" do
55
- let(:string) { "HelloWorld::Class" }
56
-
57
- it { is_expected.to eq "Class" }
58
- end
59
-
60
- context "when no namespaces is given" do
61
- let(:string) { "HelloWorld" }
62
-
63
- it { is_expected.to eq "HelloWorld" }
64
- end
65
- end
66
- end
67
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe PatternPreset do
6
- subject(:preset) { PatternPreset.new(options) }
7
- let(:options) do
8
- {
9
- fill_color_dark: "#222",
10
- fill_color_light: "#ddd",
11
- stroke_color: "#000",
12
- stroke_opacity: 0.02,
13
- opacity_min: 0.02,
14
- opacity_max: 0.15
15
- }
16
- end
17
-
18
- it { expect(preset).not_to be nil }
19
-
20
- describe "#fill_color_dark" do
21
- it { expect(preset.fill_color_dark).to eq "#222" }
22
- end
23
-
24
- describe "#fill_color_light" do
25
- it { expect(preset.fill_color_light).to eq "#ddd" }
26
- end
27
-
28
- describe "#stroke_color" do
29
- it { expect(preset.stroke_color).to eq "#000" }
30
- end
31
-
32
- describe "#stroke_opacity" do
33
- it { expect(preset.stroke_opacity).to eq 0.02 }
34
- end
35
-
36
- describe "#opacity_min" do
37
- it { expect(preset.opacity_min).to eq 0.02 }
38
- end
39
-
40
- describe "#opacity_max" do
41
- it { expect(preset.opacity_max).to eq 0.15 }
42
- end
43
- end