class Fastlane::SwiftFastlaneAPIGenerator

Public Class Methods

new(target_output_path: "swift") click to toggle source
Calls superclass method Fastlane::SwiftAPIGenerator::new
# File fastlane/lib/fastlane/swift_fastlane_api_generator.rb, line 20
def initialize(target_output_path: "swift")
  @target_filename = "Fastlane.swift"
  @target_output_path = File.expand_path(target_output_path)
  @generated_paths = []

  super()

  self.actions_not_supported = ["import", "import_from_git"].to_set
  self.action_options_to_ignore = {

    "precheck" => [
      "negative_apple_sentiment",
      "placeholder_text",
      "other_platforms",
      "future_functionality",
      "test_words",
      "curse_words",
      "custom_text",
      "copyright_date",
      "unreachable_urls"
    ].to_set
  }
end

Public Instance Methods

extend_content(file_content, tool_details) click to toggle source
# File fastlane/lib/fastlane/swift_fastlane_api_generator.rb, line 44
def extend_content(file_content, tool_details)
  file_content << "" # newline because we're adding an extension
  file_content << "// These are all the parsing functions needed to transform our data into the expected types"
  file_content << generate_lanefile_parsing_functions

  tool_objects = generate_lanefile_tool_objects(classes: tool_details.map(&:swift_class))
  file_content << tool_objects

  old_file_content = File.read(fastlane_swift_api_path)
  new_file_content = file_content.join("\n")

  # compare old file content to potential new file content
  api_version = determine_api_version(new_file_content: new_file_content, old_file_content: old_file_content)
  old_api_version = find_api_version_string(content: old_file_content)

  # if there is a change, we need to write out the new file
  if api_version != old_api_version
    file_content << autogen_version_warning_text(api_version: api_version)
  else
    file_content = nil
  end

  return file_content
end