Class: Fastlane::Actions::AddBadgeAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/badge/actions/add_badge_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



29
30
31
# File 'lib/fastlane/plugin/badge/actions/add_badge_action.rb', line 29

def self.authors
  ["HazAT"]
end

.available_optionsObject



46
47
48
# File 'lib/fastlane/plugin/badge/actions/add_badge_action.rb', line 46

def self.available_options
  Helper::BadgeHelper.available_options
end

.descriptionObject



25
26
27
# File 'lib/fastlane/plugin/badge/actions/add_badge_action.rb', line 25

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

.detailsObject



37
38
39
40
41
42
43
44
# File 'lib/fastlane/plugin/badge/actions/add_badge_action.rb', line 37

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",
    "**Note** If you want to reset the badge back to default you can use `sh 'git checkout -- <path>/Assets.xcassets/'`"
  ].join("\n")
end

.example_codeObject



50
51
52
53
54
55
56
57
# File 'lib/fastlane/plugin/badge/actions/add_badge_action.rb', line 50

def self.example_code
  [
    'add_badge(dark: true)',
    'add_badge(alpha: true)',
    'add_badge(custom: "/Users/xxx/Desktop/badge.png")',
    'add_badge(shield: "Version-0.0.3-blue", no_badge: true)'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/fastlane/plugin/badge/actions/add_badge_action.rb', line 59

def self.is_supported?(platform)
  [:ios, :mac, :android].include?(platform)
end

.return_valueObject



33
34
35
# File 'lib/fastlane/plugin/badge/actions/add_badge_action.rb', line 33

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/badge/actions/add_badge_action.rb', line 4

def self.run(params)
  Actions.verify_gem!('badge')

  options = {
    dark: params[:dark],
    custom: params[:custom],
    no_badge: params[:no_badge],
    shield: params[:shield],
    alpha: params[:alpha],
    shield_io_timeout: params[:shield_io_timeout],
    glob: params[:glob],
    alpha_channel: params[:alpha_channel],
    shield_gravity: params[:shield_gravity],
    shield_no_resize: params[:shield_no_resize],
    shield_geometry: params[:shield_geometry],
    shield_scale: params[:shield_scale],
  }

  Helper::BadgeHelper.run(options)
end