rooibos 0.7.0 → 0.7.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de0fd230ae66b1f7bb75d7bc0dbaad374d929efe3102638f0dfd2a7558312bc5
4
- data.tar.gz: 03bc89ff9e8880b053e022dfdf8bbab94f107e153e174402d9ce5c83b9644c2f
3
+ metadata.gz: 90779a1947e5b95b3fadc6917fb2254408ec8361c4995782e01a91019d386628
4
+ data.tar.gz: 50dab255aa26895d8d1cc5bd7b31b14a7cce4c1d052108f5c4010037dfe4c917
5
5
  SHA512:
6
- metadata.gz: de7f4335062b9feefca507ef70b058d1561efe6d3fd69ccf764c2b1e4809d17bd3378380b752cf5c1108957dc7ca94a249b276fe1058c1fe6d9abbecc8d1f060
7
- data.tar.gz: b50d6ddb3cc4ab37d0d2514d3852c95dbedd6c4cb756cbcb7fe7fcf8937189e7137961704bc1a284a9777f5ee83bd8fe263f9bad99e71f45ea5e29d1da6c864e
6
+ metadata.gz: e9b7ef36e9e9095ba819bf36a10715a1a5d8a12ca96104eadc683d4fb7247702bc5d2ac069e67da103e06d72c3e6d6d8224b86dd6576a7fcef65e2e802bda2b6
7
+ data.tar.gz: 6c104e16082e4c548ef28b9022942e30eb9bd9cc40861ac6fe906712f0c059966438e18c6adaccd6874081770033a65609423f9d4898961135fa1621a25cce4c
@@ -8,5 +8,5 @@
8
8
  module Rooibos
9
9
  # The version of this gem.
10
10
  # See https://semver.org/spec/v2.0.0.html
11
- VERSION = "0.7.0"
11
+ VERSION = "0.7.1"
12
12
  end
@@ -8,6 +8,20 @@
8
8
  module Rooibos
9
9
  # Built-in welcome screen used by scaffolded applications.
10
10
  module Welcome
11
+ # Detect the gem name from the file that required this welcome screen.
12
+ # A scaffolded app's main lib file (e.g. lib/hello_rooibos.rb) lives
13
+ # directly under lib/ with no subdirectory — that distinguishes it from
14
+ # gem internals (lib/rooibos/welcome.rb) and test files (test/*.rb).
15
+ # Evaluated once at require-time; nil when loaded outside a lib/ context.
16
+ SOURCE_GEM = begin
17
+ rooibos_lib = File.expand_path("..", String(__dir__)) # this gem's lib/ dir
18
+ caller_locations
19
+ &.filter_map(&:absolute_path)
20
+ &.find { |p| p.match?(%r{/lib/[^/]+\.rb\z}) && !p.start_with?(rooibos_lib) }
21
+ &.then { |p| File.basename(p, ".rb") }
22
+ end
23
+ private_constant :SOURCE_GEM
24
+
11
25
  module UI # :nodoc:
12
26
  module Styles # :nodoc:
13
27
  TEXT = RatatuiRuby::Style::Style.new
@@ -27,12 +41,15 @@ module Rooibos
27
41
  end
28
42
 
29
43
  module Widgets # :nodoc:
44
+ LIB_FILE = SOURCE_GEM ? "lib/#{SOURCE_GEM}.rb" : "lib/your_app.rb"
45
+ TEST_FILE = SOURCE_GEM ? "test/test_#{SOURCE_GEM}.rb" : "test/test_your_app.rb"
46
+
30
47
  WELCOME_TEXT = {
31
48
  "Welcome to Rooibos! You will find the Ruby code " \
32
49
  "for this application in " => Styles::TEXT,
33
- "lib/saturday.rb" => Styles::FILENAME,
50
+ LIB_FILE => Styles::FILENAME,
34
51
  ". The tests that verify it are at " => Styles::TEXT,
35
- "test/test_saturday.rb" => Styles::FILENAME,
52
+ TEST_FILE => Styles::FILENAME,
36
53
  ". You can run the tests with " => Styles::TEXT,
37
54
  "bundle exec rake test" => Styles::COMMAND,
38
55
  ". Visit " => Styles::TEXT,
@@ -6,6 +6,7 @@
6
6
  module Rooibos
7
7
  # Built-in welcome screen used by scaffolded applications.
8
8
  module Welcome
9
+ SOURCE_GEM: String?
9
10
  WEBSITE_URL: String
10
11
 
11
12
  # Internal UI module for styles and widgets.
@@ -26,6 +27,8 @@ module Rooibos
26
27
  end
27
28
 
28
29
  module Widgets
30
+ LIB_FILE: String
31
+ TEST_FILE: String
29
32
  WELCOME_TEXT: Hash[String, RatatuiRuby::Style::Style]
30
33
  PARAGRAPH: RatatuiRuby::Widgets::Paragraph
31
34
  def self.website_button: (?focused: bool, ?hovered: bool) -> RatatuiRuby::Text::Span
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rooibos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kerrick Long