Class: ChatNotifier::App
- Inherits:
-
Object
- Object
- ChatNotifier::App
- Defined in:
- lib/chat_notifier/app.rb
Overview
The application under test: its name plus the source control context (branch and sha), resolved from CI-standard settings with git fallbacks.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #branch ⇒ Object
-
#initialize(name:, settings:, runner: method(:capture)) ⇒ App
constructor
A new instance of App.
- #sha ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name:, settings:, runner: method(:capture)) ⇒ App
Returns a new instance of App.
7 8 9 10 11 |
# File 'lib/chat_notifier/app.rb', line 7 def initialize(name:, settings:, runner: method(:capture)) @name = name @settings = settings @runner = runner end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/chat_notifier/app.rb', line 13 def name @name end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
13 14 15 |
# File 'lib/chat_notifier/app.rb', line 13 def runner @runner end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
13 14 15 |
# File 'lib/chat_notifier/app.rb', line 13 def settings @settings end |
Instance Method Details
#branch ⇒ Object
17 18 19 20 21 22 |
# File 'lib/chat_notifier/app.rb', line 17 def branch return @branch if defined?(@branch) @branch = from_settings("NOTIFY_BRANCH", "GITHUB_HEAD_REF", "GITHUB_REF_NAME") || git("branch --show-current") end |
#sha ⇒ Object
24 25 26 27 28 29 |
# File 'lib/chat_notifier/app.rb', line 24 def sha return @sha if defined?(@sha) @sha = from_settings("NOTIFY_SHA", "GITHUB_SHA") || git("rev-parse --short HEAD") end |
#to_s ⇒ Object
15 |
# File 'lib/chat_notifier/app.rb', line 15 def to_s = name |