fastlane/lib/fastlane/actions/puts.rb in fastlane-2.79.0.beta.20180125010002 vs fastlane/lib/fastlane/actions/puts.rb in fastlane-2.79.0.beta.20180126010002

- old
+ new

@@ -1,9 +1,17 @@ module Fastlane module Actions class PutsAction < Action def self.run(params) + # display text from the message param (most likely coming from Swift) + # if called like `puts 'hi'` then params won't be a configuration item, so we have to check + if params.kind_of?(FastlaneCore::Configuration) && params[:message] + UI.message(params[:message]) + return + end + + # no paramter included in the call means treat this like a normal fastlane ruby call UI.message(params.join(' ')) end ##################################################### # @!group Documentation @@ -11,19 +19,31 @@ def self.description "Prints out the given text" end + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :message, + env_name: "FL_PUTS_MESSAGE", + description: "Message to be printed out. Fastlane.swift only", + optional: true, + is_string: true) + ] + end + def self.authors ["KrauseFx"] end def self.is_supported?(platform) true end def self.alias_used(action_alias, params) - UI.important("#{action_alias} called, please use 'puts' instead!") + if !params.kind_of?(FastlaneCore::Configuration) || params[:message].nil? + UI.important("#{action_alias} called, please use 'puts' instead!") + end end def self.aliases ["println", "echo"] end