INNER CODE UNIT · Ruby

static_release_notes

wordpress-mobile/WordPress-Android · fastlane/lanes/promote.rb:506

  def static_release_notes(app:, option:)
    metadata_dir = File.join(FASTLANE_FOLDER, APP_SPECIFIC_VALUES[app][:metadata_dir], 'android')
    notes = Dir.glob(File.join(metadata_dir, '*', 'release_notes_static', "#{option}.txt")).filter_map do |path|
      text = File.read(path).strip
      next if text.empty?

      # Path is <metadata_dir>/<locale>/release_notes_static/<option>.txt; the locale is two dirs up.
      locale = File.basename(File.dirname(path, 2))
      AndroidPublisher::LocalizedText.new(language: locale, text: text)
    end
    UI.user_error!("No static release notes found for option #{option.inspect} (#{app}).") if notes.empty?
    notes
  end

  # Validates the picked option against the registry, raising on anything unknown.
  def validated_release_notes_option(option)
    option = option.to_s.strip
    valid = STATIC_RELEASE_NOTE_OPTIONS.map { |o| o[:key] }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…