scarpe-components 0.2.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -1
  3. data/Gemfile.lock +85 -0
  4. data/README.md +2 -2
  5. data/assets/bootstrap-themes/bootstrap-cerulean.css +12229 -0
  6. data/assets/bootstrap-themes/bootstrap-cosmo.css +11810 -0
  7. data/assets/bootstrap-themes/bootstrap-cyborg.css +12210 -0
  8. data/assets/bootstrap-themes/bootstrap-darkly.css +12153 -0
  9. data/assets/bootstrap-themes/bootstrap-flatly.css +12126 -0
  10. data/assets/bootstrap-themes/bootstrap-icons.min.css +5 -0
  11. data/assets/bootstrap-themes/bootstrap-journal.css +12099 -0
  12. data/assets/bootstrap-themes/bootstrap-litera.css +12211 -0
  13. data/assets/bootstrap-themes/bootstrap-lumen.css +12369 -0
  14. data/assets/bootstrap-themes/bootstrap-lux.css +11928 -0
  15. data/assets/bootstrap-themes/bootstrap-materia.css +13184 -0
  16. data/assets/bootstrap-themes/bootstrap-minty.css +12177 -0
  17. data/assets/bootstrap-themes/bootstrap-morph.css +12750 -0
  18. data/assets/bootstrap-themes/bootstrap-pulse.css +11890 -0
  19. data/assets/bootstrap-themes/bootstrap-quartz.css +12622 -0
  20. data/assets/bootstrap-themes/bootstrap-sandstone.css +12201 -0
  21. data/assets/bootstrap-themes/bootstrap-simplex.css +12186 -0
  22. data/assets/bootstrap-themes/bootstrap-sketchy.css +12451 -0
  23. data/assets/bootstrap-themes/bootstrap-slate.css +12492 -0
  24. data/assets/bootstrap-themes/bootstrap-solar.css +12149 -0
  25. data/assets/bootstrap-themes/bootstrap-spacelab.css +12266 -0
  26. data/assets/bootstrap-themes/bootstrap-superhero.css +12216 -0
  27. data/assets/bootstrap-themes/bootstrap-united.css +12077 -0
  28. data/assets/bootstrap-themes/bootstrap-vapor.css +12549 -0
  29. data/assets/bootstrap-themes/bootstrap-yeti.css +12325 -0
  30. data/assets/bootstrap-themes/bootstrap-zephyr.css +12283 -0
  31. data/assets/bootstrap-themes/bootstrap.bundle.min.js +7 -0
  32. data/lib/scarpe/components/asset_server.rb +219 -0
  33. data/lib/scarpe/components/base64.rb +23 -5
  34. data/lib/scarpe/components/calzini/alert.rb +49 -0
  35. data/lib/scarpe/components/calzini/art_drawables.rb +227 -0
  36. data/lib/scarpe/components/calzini/border.rb +38 -0
  37. data/lib/scarpe/components/calzini/button.rb +37 -0
  38. data/lib/scarpe/components/calzini/misc.rb +136 -0
  39. data/lib/scarpe/components/calzini/para.rb +237 -0
  40. data/lib/scarpe/components/calzini/slots.rb +109 -0
  41. data/lib/scarpe/components/calzini.rb +236 -0
  42. data/lib/scarpe/components/errors.rb +24 -0
  43. data/lib/scarpe/components/file_helpers.rb +1 -0
  44. data/lib/scarpe/components/html.rb +134 -0
  45. data/lib/scarpe/components/minitest_export_reporter.rb +83 -0
  46. data/lib/scarpe/components/minitest_import_runnable.rb +98 -0
  47. data/lib/scarpe/components/minitest_result.rb +127 -0
  48. data/lib/scarpe/components/modular_logger.rb +5 -5
  49. data/lib/scarpe/components/print_logger.rb +22 -3
  50. data/lib/scarpe/components/process_helpers.rb +37 -0
  51. data/lib/scarpe/components/promises.rb +14 -14
  52. data/lib/scarpe/components/segmented_file_loader.rb +36 -17
  53. data/lib/scarpe/components/string_helpers.rb +10 -0
  54. data/lib/scarpe/components/tiranti.rb +167 -0
  55. data/lib/scarpe/components/unit_test_helpers.rb +48 -6
  56. data/lib/scarpe/components/version.rb +2 -2
  57. metadata +48 -4
@@ -5,6 +5,7 @@ require "json"
5
5
  require "fileutils"
6
6
 
7
7
  require "scarpe/components/file_helpers"
8
+ require "scarpe/components/process_helpers"
8
9
 
9
10
  module Scarpe::Test; end
10
11
 
@@ -20,6 +21,7 @@ ALREADY_SET_UP_LOGGED_TEST_FAILURES = { setup: false }
20
21
  module Scarpe::Test::Helpers
21
22
  # Very useful for tests
22
23
  include Scarpe::Components::FileHelpers
24
+ include Scarpe::Components::ProcessHelpers
23
25
 
24
26
  # Temporarily set env vars for the block of code inside. The old environment
25
27
  # variable values will be restored after the block finishes.
@@ -67,7 +69,7 @@ module Scarpe::Test::LoggedTest
67
69
  @normal_log_config = Shoes::Log.current_log_config
68
70
  Shoes::Log.configure_logger(log_config_for_test)
69
71
 
70
- Shoes::Log.logger("LoggedScarpeTest").info("Test: #{self.class.name}##{self.name}")
72
+ Shoes::Log.logger("LoggedTest").info("Test: #{self.class.name}##{self.name}")
71
73
  end
72
74
 
73
75
  # If you include this module and don't override setup/teardown, everything will
@@ -125,7 +127,7 @@ module Scarpe::Test::LoggedTest
125
127
  def log_config_for_test
126
128
  {
127
129
  "default" => ["debug", "logger/test_failure_#{file_id}.log"],
128
- "DisplayService" => ["debug", "logger/test_failure_events_#{file_id}.log"],
130
+ "DisplayService" => ["debug", "logger/test_failure_display_service_#{file_id}.log"],
129
131
  }.merge(@additional_log_config || {})
130
132
  end
131
133
 
@@ -150,8 +152,8 @@ module Scarpe::Test::LoggedTest
150
152
  return if ALREADY_SET_UP_LOGGED_TEST_FAILURES[:setup]
151
153
 
152
154
  log_dir = self.class.logger_dir
153
- raise("Must set logger directory!") unless log_dir
154
- raise("Can't find logger directory!") unless File.directory?(log_dir)
155
+ raise(Scarpe::MustOverrideMethod, "Must set logger directory!") unless log_dir
156
+ raise(Scarpe::NoSuchFile, "Can't find logger directory!") unless File.directory?(log_dir)
155
157
 
156
158
  ALREADY_SET_UP_LOGGED_TEST_FAILURES[:setup] = true
157
159
  # Delete stale test failures, if any, before starting the first failure-logged test
@@ -181,11 +183,11 @@ module Scarpe::Test::LoggedTest
181
183
  out_loc = filepath.gsub(%r{.log\Z}, ".out.log")
182
184
 
183
185
  if out_loc == filepath
184
- raise "Something is wrong! Could not figure out failure-log output path for #{filepath.inspect}!"
186
+ raise Shoes::Errors::InvalidAttributeValueError, "Something is wrong! Could not figure out failure-log output path for #{filepath.inspect}!"
185
187
  end
186
188
 
187
189
  if File.exist?(out_loc)
188
- raise "Duplicate test file #{out_loc.inspect}? This file should *not* already exist!"
190
+ raise Scarpe::DuplicateFileError, "Duplicate test file #{out_loc.inspect}? This file should *not* already exist!"
189
191
  end
190
192
 
191
193
  out_loc
@@ -215,3 +217,43 @@ module Scarpe::Test::LoggedTest
215
217
  end
216
218
  end
217
219
  end
220
+
221
+ module Scarpe::Test::HTMLAssertions
222
+ # Assert that `actual_html` is the same as `expected_tag` with `opts`.
223
+ # This uses Scarpe's HTML tag-based renderer to render the tag and options
224
+ # into text, and valides that the text is the same.
225
+ #
226
+ # @see Scarpe::Components::HTML.render
227
+ #
228
+ # @param actual_html [String] the html to compare to
229
+ # @param expected_tag [String,Symbol] the HTML tag, used to send a method call
230
+ # @param opts keyword options passed to the tag method call
231
+ # @yield block passed to the tag method call.
232
+ # @return [void]
233
+ def assert_html(actual_html, expected_tag, **opts, &block)
234
+ expected_html = Scarpe::Components::HTML.render do |h|
235
+ h.public_send(expected_tag, opts, &block)
236
+ end
237
+
238
+ assert_equal expected_html, actual_html
239
+ end
240
+
241
+ # Assert that `actual_html` includes `expected_tag` with `opts`.
242
+ # This uses Scarpe's HTML tag-based renderer to render the tag and options
243
+ # into text, and valides that the full HTML contains that tag.
244
+ #
245
+ # @see Scarpe::Components::HTML.render
246
+ #
247
+ # @param actual_html [String] the html to compare to
248
+ # @param expected_tag [String,Symbol] the HTML tag, used to send a method call
249
+ # @param opts keyword options passed to the tag method call
250
+ # @yield block passed to the tag method call.
251
+ # @return [void]
252
+ def assert_contains_html(actual_html, expected_tag, **opts, &block)
253
+ expected_html = Scarpe::Components::HTML.render do |h|
254
+ h.public_send(expected_tag, opts, &block)
255
+ end
256
+
257
+ assert actual_html.include?(expected_html), "Expected #{actual_html.inspect} to include #{expected_html.inspect}!"
258
+ end
259
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Scarpe
3
+ module Scarpe
4
4
  module Components
5
- VERSION = "0.2.2"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scarpe-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Concetto Rudilosso
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-08-29 00:00:00.000000000 Z
12
+ date: 2024-05-06 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email:
@@ -20,14 +20,59 @@ extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
22
  - Gemfile
23
+ - Gemfile.lock
23
24
  - README.md
24
25
  - Rakefile
26
+ - assets/bootstrap-themes/bootstrap-cerulean.css
27
+ - assets/bootstrap-themes/bootstrap-cosmo.css
28
+ - assets/bootstrap-themes/bootstrap-cyborg.css
29
+ - assets/bootstrap-themes/bootstrap-darkly.css
30
+ - assets/bootstrap-themes/bootstrap-flatly.css
31
+ - assets/bootstrap-themes/bootstrap-icons.min.css
32
+ - assets/bootstrap-themes/bootstrap-journal.css
33
+ - assets/bootstrap-themes/bootstrap-litera.css
34
+ - assets/bootstrap-themes/bootstrap-lumen.css
35
+ - assets/bootstrap-themes/bootstrap-lux.css
36
+ - assets/bootstrap-themes/bootstrap-materia.css
37
+ - assets/bootstrap-themes/bootstrap-minty.css
38
+ - assets/bootstrap-themes/bootstrap-morph.css
39
+ - assets/bootstrap-themes/bootstrap-pulse.css
40
+ - assets/bootstrap-themes/bootstrap-quartz.css
41
+ - assets/bootstrap-themes/bootstrap-sandstone.css
42
+ - assets/bootstrap-themes/bootstrap-simplex.css
43
+ - assets/bootstrap-themes/bootstrap-sketchy.css
44
+ - assets/bootstrap-themes/bootstrap-slate.css
45
+ - assets/bootstrap-themes/bootstrap-solar.css
46
+ - assets/bootstrap-themes/bootstrap-spacelab.css
47
+ - assets/bootstrap-themes/bootstrap-superhero.css
48
+ - assets/bootstrap-themes/bootstrap-united.css
49
+ - assets/bootstrap-themes/bootstrap-vapor.css
50
+ - assets/bootstrap-themes/bootstrap-yeti.css
51
+ - assets/bootstrap-themes/bootstrap-zephyr.css
52
+ - assets/bootstrap-themes/bootstrap.bundle.min.js
53
+ - lib/scarpe/components/asset_server.rb
25
54
  - lib/scarpe/components/base64.rb
55
+ - lib/scarpe/components/calzini.rb
56
+ - lib/scarpe/components/calzini/alert.rb
57
+ - lib/scarpe/components/calzini/art_drawables.rb
58
+ - lib/scarpe/components/calzini/border.rb
59
+ - lib/scarpe/components/calzini/button.rb
60
+ - lib/scarpe/components/calzini/misc.rb
61
+ - lib/scarpe/components/calzini/para.rb
62
+ - lib/scarpe/components/calzini/slots.rb
63
+ - lib/scarpe/components/errors.rb
26
64
  - lib/scarpe/components/file_helpers.rb
65
+ - lib/scarpe/components/html.rb
66
+ - lib/scarpe/components/minitest_export_reporter.rb
67
+ - lib/scarpe/components/minitest_import_runnable.rb
68
+ - lib/scarpe/components/minitest_result.rb
27
69
  - lib/scarpe/components/modular_logger.rb
28
70
  - lib/scarpe/components/print_logger.rb
71
+ - lib/scarpe/components/process_helpers.rb
29
72
  - lib/scarpe/components/promises.rb
30
73
  - lib/scarpe/components/segmented_file_loader.rb
74
+ - lib/scarpe/components/string_helpers.rb
75
+ - lib/scarpe/components/tiranti.rb
31
76
  - lib/scarpe/components/unit_test_helpers.rb
32
77
  - lib/scarpe/components/version.rb
33
78
  homepage: https://github.com/scarpe-team/scarpe
@@ -35,7 +80,6 @@ licenses:
35
80
  - MIT
36
81
  metadata:
37
82
  homepage_uri: https://github.com/scarpe-team/scarpe
38
- source_code_uri: https://github.com/scarpe-team/scarpe
39
83
  changelog_uri: https://github.com/scarpe-team/scarpe/blob/main/CHANGELOG.md
40
84
  post_install_message:
41
85
  rdoc_options: []
@@ -52,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
96
  - !ruby/object:Gem::Version
53
97
  version: '0'
54
98
  requirements: []
55
- rubygems_version: 3.4.10
99
+ rubygems_version: 3.5.3
56
100
  signing_key:
57
101
  specification_version: 4
58
102
  summary: Reusable components for Scarpe display libraries