class Fastlane::Actions::GenerateIconsAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 35
def self.authors
  ["ericmartineau"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 48
def self.available_options
  [
      FastlaneCore::ConfigItem.new(key: :icon_source_folder,
                                   env_name: "SUNNY_PROJECT_ICON_SOURCE_FOLDER",
                                   description: "The folder to look in for svg icons",
                                   optional: false,
                                   type: String,
                                   default_value: "iconsource/svg"),
      FastlaneCore::ConfigItem.new(key: :icon_set_name,
                                   env_name: "SUNNY_PROJECT_ICON_SET_NAME",
                                   description: "The snake-case name of the icon set",
                                   optional: false,
                                   verify_block: proc do |value|
                                     UI.error!("This value cannot be blank") unless value
                                     UI.error!("This value must be snake case") unless Sunny.underscore(value) == value
                                   end,
                                   type: String),
  ]
end
build_icon_fonts(options) click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 15
def self.build_icon_fonts(options)
  snake_name = options[:icon_set_name]
  camel_value = snake_name.split('_').downcase.collect(&:capitalize).join
  helper.exec_cmd("Generate flutter icons", "icon_font_generator",
                  "--from=#{options[:icon_source_folder]}", "--class-name=#{camel_value}",
                  "--out-font=lib/fonts/#{camel_value}.ttf", "--out-flutter=lib/#{snake_name}_font.dart",
                  "--normalize")

end
description() click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 31
def self.description
  "Generates a flutter icon set as a font"
end
details() click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 43
def self.details
  # Optional:
  ""
end
download_icons() click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 25
def self.download_icons
  Dir.chdir("..") {
    cmd("Download icons", "dart", "tools/iconsource/downloader.dart")
  }
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 68
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 39
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(options) click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb, line 8
def self.run(options)
  Dir.chdir("..") {
    self.download_icons
    self.build_icon_fonts(options)
  }
end