class Fastlane::Helper::CarthageOutdatedHelper

Constants

MESSAGE

class methods that you define here become available in your action as `Helper::CarthageOutdatedHelper.your_method`

PATTERN

ex.) Alamofire “4.7.3” -> “4.7.3” (Latest: “4.8.2”)

RESOLVED_PATTERN

ex.) github “Alamofire/Alamofire” “4.7.3”

Public Class Methods

message() click to toggle source
# File lib/fastlane/plugin/dependency_manager_outdated/helper/carthage_outdated_helper.rb, line 25
def self.message
  MESSAGE
end
name() click to toggle source
# File lib/fastlane/plugin/dependency_manager_outdated/helper/carthage_outdated_helper.rb, line 21
def self.name
  "Carthage"
end
parse(str) click to toggle source
# File lib/fastlane/plugin/dependency_manager_outdated/helper/carthage_outdated_helper.rb, line 29
def self.parse(str)
  results = []

  result = str.split(MESSAGE + "\n")[1]
  return results unless result

  libs = result.split("\n")

  libs.each do |lib|
    lib.match(PATTERN)
    results << Dependency.new($1, $2, $3, $4)
  end
  results.map { |r| r.to_hash }
end
resolved(dir) click to toggle source

{“Alamofire”=>“github.com/Alamofire/Alamofire”, “RxSwift”=>“github.com/ReactiveX/RxSwift”}

# File lib/fastlane/plugin/dependency_manager_outdated/helper/carthage_outdated_helper.rb, line 45
def self.resolved(dir)
  lock_file = "Cartfile.resolved"
  dir ||= '.'
  # dir = File.dirname(File.expand_path(__FILE__))
  file = File.join(dir, lock_file)

  results = {}
  File.open(file) do |f|
    f.each_line do |lib|
      lib.match(RESOLVED_PATTERN)
      origin = $1
      repo = $2

      url = nil
      name = nil
      if origin == "github"
        url = "https://github.com/#{repo}"
        name = repo.split("/")[1]
      end
      if origin == "git"
        url = repo
        name = repo.split("/").last
      end
      if name && !name.empty?
        results[name] = url
      end
    end
  rescue => e
    UI.message e
  end
  results
end