Class: Danger::DangerSpmVersionUpdates

Inherits:
Plugin
  • Object
show all
Defined in:
lib/spm_version_updates/plugin.rb

Overview

A Danger plugin for checking if there are versions upgrades available for SPM dependencies

Examples:

Check if MyApp’s SPM dependencies are up to date

spm_version_updates.check_for_updates("MyApp.xcodeproj")

Check dependencies declared in Package.swift manifests

spm_version_updates.check_manifests(["Modules/Package.swift"])

See Also:

  • hbmartin/danger-spm_version_updates

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#check_branchesBoolean

Whether to check dependencies pinned to a branch for newer commits, default true

Returns:

  • (Boolean)


25
26
27
# File 'lib/spm_version_updates/plugin.rb', line 25

def check_branches
  @check_branches
end

#check_revisionsBoolean

Whether to report the latest tagged version for dependencies pinned to a revision, default false

Returns:

  • (Boolean)


29
30
31
# File 'lib/spm_version_updates/plugin.rb', line 29

def check_revisions
  @check_revisions
end

#check_when_exactBoolean

Whether to check when dependencies are exact versions or commits, default false

Returns:

  • (Boolean)


21
22
23
# File 'lib/spm_version_updates/plugin.rb', line 21

def check_when_exact
  @check_when_exact
end

#ignore_reposArray<String>

A list of repository URLs for packages to ignore entirely

Returns:

  • (Array<String>)


41
42
43
# File 'lib/spm_version_updates/plugin.rb', line 41

def ignore_repos
  @ignore_repos
end

#repo_rules_pathString

Path to a YAML file with per-repository semantic update suppression rules

Returns:

  • (String)


45
46
47
# File 'lib/spm_version_updates/plugin.rb', line 45

def repo_rules_path
  @repo_rules_path
end

#report_above_maximumBoolean

Whether to report versions above the maximum version range, default false

Returns:

  • (Boolean)


33
34
35
# File 'lib/spm_version_updates/plugin.rb', line 33

def report_above_maximum
  @report_above_maximum
end

#report_pre_releasesBoolean

Whether to report pre-release versions, default false

Returns:

  • (Boolean)


37
38
39
# File 'lib/spm_version_updates/plugin.rb', line 37

def report_pre_releases
  @report_pre_releases
end

Instance Method Details

#check_for_updates(xcodeproj_path) ⇒ void

This method returns an undefined value.

A method that you can call from your Dangerfile

Parameters:

  • xcodeproj_path (String)

    The path to your Xcode project

Raises:

  • (XcodeParser::XcodeprojPathMustBeSet)

    if the xcodeproj_path is blank

  • (XcodeParser::CouldNotFindResolvedFile)

    if no Package.resolved files were found



53
54
55
# File 'lib/spm_version_updates/plugin.rb', line 53

def check_for_updates(xcodeproj_path)
  run_checker { |checker| checker.check_for_updates(xcodeproj_path) }
end

#check_manifests(manifest_paths, resolved_paths = nil) ⇒ void

This method returns an undefined value.

Check for updates to dependencies declared in one or more Package.swift manifests

Parameters:

  • manifest_paths (Array<String>, String)

    One or more paths to Package.swift manifests

  • resolved_paths (Array<String>, String, nil) (defaults to: nil)

    Optional explicit Package.resolved paths; defaults to a Package.resolved next to each manifest

Raises:

  • (ManifestParser::ManifestPathMustBeSet)

    if manifest_paths is blank

  • (ManifestParser::CouldNotFindManifest)

    if a manifest does not exist

  • (ManifestParser::CouldNotFindResolvedFile)

    if an expected Package.resolved is missing



67
68
69
70
71
72
# File 'lib/spm_version_updates/plugin.rb', line 67

def check_manifests(manifest_paths, resolved_paths = nil)
  paths = Array(manifest_paths).map(&:to_s).reject(&:empty?)
  raise(ManifestParser::ManifestPathMustBeSet) if paths.empty?

  run_checker { |checker| checker.check_manifests(paths, Array(resolved_paths)) }
end