Class: Fastlane::Actions::NotificationAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::NotificationAction
- Defined in:
- fastlane/lib/fastlane/actions/notification.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, authors, deprecated_notes, details, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.author ⇒ Object
24 25 26 |
# File 'fastlane/lib/fastlane/actions/notification.rb', line 24 def self. ["champo", "cbowns", "KrauseFx", "amarcadet", "dusek"] end |
.available_options ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'fastlane/lib/fastlane/actions/notification.rb', line 28 def self. [ FastlaneCore::ConfigItem.new(key: :title, description: "The title to display in the notification", default_value: 'fastlane'), FastlaneCore::ConfigItem.new(key: :subtitle, description: "A subtitle to display in the notification", optional: true), FastlaneCore::ConfigItem.new(key: :message, description: "The message to display in the notification", optional: false), FastlaneCore::ConfigItem.new(key: :sound, description: "The name of a sound to play when the notification appears (names are listed in Sound Preferences)", optional: true), FastlaneCore::ConfigItem.new(key: :activate, description: "Bundle identifier of application to be opened when the notification is clicked", optional: true), FastlaneCore::ConfigItem.new(key: :app_icon, description: "The URL of an image to display instead of the application icon (Mavericks+ only)", optional: true), FastlaneCore::ConfigItem.new(key: :content_image, description: "The URL of an image to display attached to the notification (Mavericks+ only)", optional: true), FastlaneCore::ConfigItem.new(key: :open, description: "URL of the resource to be opened when the notification is clicked", optional: true), FastlaneCore::ConfigItem.new(key: :execute, description: "Shell command to run when the notification is clicked", optional: true) ] end |
.category ⇒ Object
70 71 72 |
# File 'fastlane/lib/fastlane/actions/notification.rb', line 70 def self.category :notifications end |
.description ⇒ Object
20 21 22 |
# File 'fastlane/lib/fastlane/actions/notification.rb', line 20 def self.description "Display a macOS notification with custom message and title" end |
.example_code ⇒ Object
64 65 66 67 68 |
# File 'fastlane/lib/fastlane/actions/notification.rb', line 64 def self.example_code [ 'notification(subtitle: "Finished Building", message: "Ready to upload...")' ] end |
.is_supported?(platform) ⇒ Boolean
60 61 62 |
# File 'fastlane/lib/fastlane/actions/notification.rb', line 60 def self.is_supported?(platform) Helper.mac? end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'fastlane/lib/fastlane/actions/notification.rb', line 4 def self.run(params) require 'terminal-notifier' = params.values # :message is non-optional = .delete(:message) # remove nil keys, since `notify` below does not ignore them and instead translates them into empty strings in output, which looks ugly = .select { |_, v| v } option_map = { app_icon: :appIcon, content_image: :contentImage } = .transform_keys { |k| option_map.fetch(k, k) } TerminalNotifier.notify(, ) end |