Class: Fastlane::Actions::SayAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Class Method Summary collapse

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

.authorObject



41
42
43
# File 'fastlane/lib/fastlane/actions/say.rb', line 41

def self.author
  "KrauseFx"
end

.available_optionsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'fastlane/lib/fastlane/actions/say.rb', line 21

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :text,
                                 description: 'Text to be spoken out loud (as string or array of strings)',
                                 optional: false,
                                 is_string: false),
    FastlaneCore::ConfigItem.new(key: :mute,
                                 env_name: "SAY_MUTE",
                                 description: 'If say should be muted with text printed out',
                                 optional: false,
                                 is_string: false,
                                 type: Boolean,
                                 default_value: false)
  ]
end

.categoryObject



51
52
53
# File 'fastlane/lib/fastlane/actions/say.rb', line 51

def self.category
  :misc
end

.descriptionObject



17
18
19
# File 'fastlane/lib/fastlane/actions/say.rb', line 17

def self.description
  "This action speaks the given text out loud"
end

.example_codeObject



45
46
47
48
49
# File 'fastlane/lib/fastlane/actions/say.rb', line 45

def self.example_code
  [
    'say("I can speak")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



37
38
39
# File 'fastlane/lib/fastlane/actions/say.rb', line 37

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



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

def self.run(params)
  text = params[:text]
  text = text.join(' ') if text.kind_of?(Array)
  text = text.tr("'", '"')

  if params[:mute]
    UI.message(text)
    return text
  else
    Actions.sh("say '#{text}'")
  end
end