Class: Fastlane::Helper::DependencyManagerOutdatedHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::DependencyManagerOutdatedHelper
- Defined in:
- lib/fastlane/plugin/dependency_manager_outdated/helper/dependency_manager_outdated_helper.rb
Direct Known Subclasses
Class Method Summary collapse
-
.generate_slack_attachments(libs) ⇒ Object
def self.generate_slack_attachments(libs) attachements = [] libs.each do |lib| attachement = lib if lib attachement = lib end.
- .message ⇒ Object
-
.name ⇒ Object
class methods that you define here become available in your action as ‘Helper::DependencyManagerOutdatedHelper.your_method`.
- .notify_slack(libs) ⇒ Object
Class Method Details
.generate_slack_attachments(libs) ⇒ Object
def self.generate_slack_attachments(libs)
attachements = []
libs.each do |lib|
attachement = {title: lib[:name]}
if lib[:repository]
attachement[:title_link] = lib[:repository]
end
fields = []
current = lib[:current]
available = lib[:available]
if current == available
attachement[:color] = "warning"
else
available = "*#{available}*"
attachement[:color] = "danger"
end
# field[:value] = "#{current} -> #{available} (#{lib[:latest]})"
# attachement[:fields] = [field]
fields << {title: "current", value: current, short: true}
fields << {title: "available", value: "#{available} (Latest: #{lib[:latest]})", short: true}
attachement[:fields] = fields
attachements << attachement
end
attachements
end
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/fastlane/plugin/dependency_manager_outdated/helper/dependency_manager_outdated_helper.rb', line 87 def self.(libs) attachements = [] libs.each do |lib| attachement = {title: lib[:name]} if lib[:repository] attachement[:title_link] = lib[:repository] end current = lib[:current] available = lib[:available] if current == available attachement[:color] = "warning" else available = "*#{available}*" attachement[:color] = "danger" end attachement[:text] = "#{current} -> #{available} (Latest: #{lib[:latest]})" attachements << attachement end attachements end |
.message ⇒ Object
15 16 17 |
# File 'lib/fastlane/plugin/dependency_manager_outdated/helper/dependency_manager_outdated_helper.rb', line 15 def self. "" end |
.name ⇒ Object
class methods that you define here become available in your action as ‘Helper::DependencyManagerOutdatedHelper.your_method`
11 12 13 |
# File 'lib/fastlane/plugin/dependency_manager_outdated/helper/dependency_manager_outdated_helper.rb', line 11 def self.name "" end |
.notify_slack(libs) ⇒ Object
19 20 21 22 23 24 25 26 27 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 |
# File 'lib/fastlane/plugin/dependency_manager_outdated/helper/dependency_manager_outdated_helper.rb', line 19 def self.notify_slack(libs) require 'slack-notifier' = DependencyManager.config return if [:skip_slack] return if [:slack_url].to_s.empty? ###################### # see https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/slack.rb ###################### if [:slack_channel].to_s.length > 0 channel = [:slack_channel] channel = ('#' + [:slack_channel]) unless ['#', '@'].include?(channel[0]) # send message to channel by default end attachements = (libs) notifier = Slack::Notifier.new([:slack_url], channel: channel, username: [:slack_username]) text = "[#{name}] #{}" begin results = notifier.ping(text, icon_url: [:slack_icon_url], attachments: attachements) rescue => exception UI.error("Exception: #{exception}") ensure result = results.first if results if !result.nil? && result.code.to_i == 200 UI.success('Successfully sent Slack notification') else UI.verbose(result) unless result.nil? = "Error pushing Slack message, maybe the integration has no permission to post on this channel? Try removing the channel parameter in your Fastfile, this is usually caused by a misspelled or changed group/channel name or an expired SLACK_URL" UI.error() end end end |