Class: Fastlane::Actions::BadgeAction

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

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, output, return_value, sh, step_text

Class Method Details

.authorsObject



66
67
68
# File 'lib/fastlane/actions/badge.rb', line 66

def self.authors
  ["DanielGri"]
end

.available_optionsObject



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
56
57
58
59
60
61
62
63
64
# File 'lib/fastlane/actions/badge.rb', line 25

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :dark,
                                 env_name: "FL_BADGE_DARK",
                                 description: "Adds a dark flavored badge ontop of your icon",
                                 optional: true,
                                 is_string: false,
                                 verify_block: proc do |value|
                                   raise "dark is only a flag and should always be true".red unless value == true
                                 end),
    FastlaneCore::ConfigItem.new(key: :custom,
                                 env_name: "FL_BADGE_CUSTOM",
                                 description: "Add your custom overlay/badge image",
                                 optional: true,
                                 verify_block: proc do |value|
                                   raise "custom should be a valid file path".red unless value and File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :no_badge,
                                 env_name: "FL_BADGE_NO_BADGE",
                                 description: "Hides the beta badge",
                                 optional: true,
                                 is_string: false,
                                 verify_block: proc do |value|
                                   raise "no_badge is only a flag and should always be true".red unless value == true
                                 end),
    FastlaneCore::ConfigItem.new(key: :shield,
                                 env_name: "FL_BADGE_SHIELD",
                                 description: "Add a shield to your app icon from shield.io",
                                 optional: true,
                                 is_string: true),
    FastlaneCore::ConfigItem.new(key: :alpha,
                                 env_name: "FL_BADGE_ALPHA",
                                 description: "Adds and alpha badge instead of the default beta one",
                                 optional: true,
                                 is_string: false,
                                 verify_block: proc do |value|
                                   raise "alpha is only a flag and should always be true".red unless value == true
                                 end)
  ]
end

.descriptionObject



13
14
15
# File 'lib/fastlane/actions/badge.rb', line 13

def self.description
  "Automatically add a badge to your iOS app icon"
end

.detailsObject



17
18
19
20
21
22
23
# File 'lib/fastlane/actions/badge.rb', line 17

def self.details
  [
    "This action will add a light/dark badge onto your app icon.",
    "You can also provide your custom badge/overlay or add an shield for more customization more info:",
    "https://github.com/HazAT/badge"
  ].join("\n")
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/fastlane/actions/badge.rb', line 70

def self.is_supported?(platform)
  platform == :ios
end

.run(params) ⇒ Object



4
5
6
7
# File 'lib/fastlane/actions/badge.rb', line 4

def self.run(params)
  require 'badge'
  Badge::Runner.new.run('.', params[:dark], params[:custom], params[:no_badge], params[:shield], params[:alpha])
end