Class: Fastlane::Actions::NotificationAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/notification.rb

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, details, output, return_value, sh, step_text

Class Method Details

.authorObject



22
23
24
# File 'lib/fastlane/actions/notification.rb', line 22

def self.author
  ["champo", "cbowns", "KrauseFx"]
end

.available_optionsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fastlane/actions/notification.rb', line 26

def self.available_options
  [
    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)
  ]
end

.descriptionObject



18
19
20
# File 'lib/fastlane/actions/notification.rb', line 18

def self.description
  "Display a Mac OS X notification with custom message and title"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/fastlane/actions/notification.rb', line 40

def self.is_supported?(platform)
  Helper.mac?
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fastlane/actions/notification.rb', line 4

def self.run(params)
  require 'terminal-notifier'

  if params[:subtitle]
    TerminalNotifier.notify(params[:message],
                            title: params[:title],
                         subtitle: params[:subtitle])
  else
    # It should look nice without a subtitle too
    TerminalNotifier.notify(params[:message],
                            title: params[:title])
  end
end