danger-spm_version_updates 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25b82d43a6e19f0dcc05f3b6fdb697dec94ae732b5c43c00da69f6adb4a03f5a
|
|
4
|
+
data.tar.gz: f4ff132e689b413207c75788550ab58a198aa9a9c7604b541b2ecfc3f415defe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80234fa9b99f8390a69ec6fabdf8d5d668044b75df4ee379b55e8b805f73641f1e9bfa4cf1990f825ee4c5d4fa47d1a0be7884b659e8cd7925fc2fcabd82722c
|
|
7
|
+
data.tar.gz: 94dc6ba3f345a3e3cf248455c8b1a9f7092f65d72011ee7d7cc4fe7d67db910021afecd522afc27b1982461031120f6389a02432c09dbc89adf36be72f66ae22
|
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
|
|
|
40
40
|
spec.require_paths = ["lib"]
|
|
41
41
|
spec.metadata["rubygems_mfa_required"] = "true"
|
|
42
42
|
|
|
43
|
-
spec.
|
|
44
|
-
spec.
|
|
45
|
-
spec.
|
|
43
|
+
spec.add_dependency("danger-plugin-api", "~> 1.0")
|
|
44
|
+
spec.add_dependency("spm_version_updates", "~> #{SpmVersionUpdates::VERSION}")
|
|
45
|
+
spec.add_dependency("xcodeproj", "~> 1.24")
|
|
46
46
|
end
|
|
@@ -75,8 +75,8 @@ module Danger
|
|
|
75
75
|
|
|
76
76
|
def run_checker
|
|
77
77
|
checker = build_checker
|
|
78
|
-
yield(checker)
|
|
79
|
-
emit_checker_warnings(
|
|
78
|
+
result = yield(checker)
|
|
79
|
+
emit_checker_warnings(result)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def build_checker
|
|
@@ -97,9 +97,9 @@ module Danger
|
|
|
97
97
|
checker.ignore_repos = Array(ignore_repos)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
def emit_checker_warnings(
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
def emit_checker_warnings(result)
|
|
101
|
+
result.updates.each { |detail| warn(render_warning(detail)) }
|
|
102
|
+
result.parse_warnings.each { |record| warn(render_parse_warning(record)) }
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
# Builds the Danger warning markdown for a `.package(...)` declaration the
|
|
@@ -113,22 +113,22 @@ module Danger
|
|
|
113
113
|
# originating manifest. Uses <br> rather than newlines because Danger
|
|
114
114
|
# renders warnings inside a markdown table.
|
|
115
115
|
def render_warning(detail)
|
|
116
|
-
message = detail[
|
|
116
|
+
message = detail["message"]
|
|
117
117
|
links = warning_links(detail)
|
|
118
118
|
message = "#{message} (#{links})" if links
|
|
119
119
|
|
|
120
|
-
source = detail[
|
|
120
|
+
source = detail["source"]
|
|
121
121
|
message = "#{message}<br>Source: `#{source}`" if source
|
|
122
122
|
|
|
123
|
-
command = detail[
|
|
123
|
+
command = detail["suggested_command"]
|
|
124
124
|
command ? "#{message}<br>Update: `#{command}`" : message
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
def warning_links(detail)
|
|
128
|
-
link = RepositoryLink.from(detail[
|
|
128
|
+
link = RepositoryLink.from(detail["repository_url"])
|
|
129
129
|
return unless link
|
|
130
130
|
|
|
131
|
-
current, available = detail.values_at(
|
|
131
|
+
current, available = detail.values_at("current_version", "available_version")
|
|
132
132
|
return unless current && available
|
|
133
133
|
|
|
134
134
|
link.markdown_links([{ current:, available: }], separator: " · ")
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger-spm_version_updates
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Harold Martin
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 2.0.0
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 2.0.0
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: xcodeproj
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -64,10 +64,7 @@ files:
|
|
|
64
64
|
- danger-spm_version_updates.gemspec
|
|
65
65
|
- lib/danger_plugin.rb
|
|
66
66
|
- lib/danger_spm_version_updates.rb
|
|
67
|
-
- lib/spm_version_updates/gem_version.rb
|
|
68
|
-
- lib/spm_version_updates/git.rb
|
|
69
67
|
- lib/spm_version_updates/plugin.rb
|
|
70
|
-
- lib/spm_version_updates/xcode.rb
|
|
71
68
|
homepage: https://github.com/hbmartin/danger-spm_version_updates
|
|
72
69
|
licenses:
|
|
73
70
|
- MIT
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spm_version_updates/git_operations"
|
|
4
|
-
require "spm_version_updates/semver"
|
|
5
|
-
|
|
6
|
-
# Legacy git helper used by the Danger plugin API. Delegates to GitOperations,
|
|
7
|
-
# so lookups gain its retry behavior and raise GitOperations::LsRemoteError
|
|
8
|
-
# instead of masking failures as empty results.
|
|
9
|
-
# @deprecated Use {GitOperations} from the +spm_version_updates+ core gem
|
|
10
|
-
# instead. This shim exists only for backward compatibility with Dangerfiles
|
|
11
|
-
# written against +v0.2.0+.
|
|
12
|
-
module Git
|
|
13
|
-
ALLOWED_PROTOCOLS = GitOperations::ALLOWED_PROTOCOLS
|
|
14
|
-
|
|
15
|
-
# Removes protocol and trailing .git from a repo URL
|
|
16
|
-
# @param [String] repo_url
|
|
17
|
-
# The URL of the repository
|
|
18
|
-
# @return [String]
|
|
19
|
-
def self.trim_repo_url(repo_url)
|
|
20
|
-
GitOperations.trim_repo_url(repo_url)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# Extract a readable name for the repo given the url, generally org/repo
|
|
24
|
-
# @return [String]
|
|
25
|
-
def self.repo_name(repo_url)
|
|
26
|
-
GitOperations.repo_name(repo_url)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Call git to list tags
|
|
30
|
-
# @param [String] repo_url
|
|
31
|
-
# The URL of the dependency's repository
|
|
32
|
-
# @raise [GitOperations::LsRemoteError] if the lookup fails after retries
|
|
33
|
-
# @return [Array<SpmVersionUpdates::Semver>]
|
|
34
|
-
def self.version_tags(repo_url)
|
|
35
|
-
GitOperations.version_tags(repo_url)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Call git to find the last commit on a branch
|
|
39
|
-
# @param [String] repo_url
|
|
40
|
-
# The URL of the dependency's repository
|
|
41
|
-
# @param [String] branch_name
|
|
42
|
-
# The name of the branch on which to find the last commit
|
|
43
|
-
# @raise [GitOperations::LsRemoteError] if the lookup fails after retries
|
|
44
|
-
# @return [String, nil]
|
|
45
|
-
def self.branch_last_commit(repo_url, branch_name)
|
|
46
|
-
GitOperations.branch_last_commit(repo_url, branch_name)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spm_version_updates/package_resolved"
|
|
4
|
-
require "spm_version_updates/xcode_parser"
|
|
5
|
-
require "spm_version_updates/xcode_project_package_reader"
|
|
6
|
-
require "xcodeproj"
|
|
7
|
-
|
|
8
|
-
# Legacy Xcode project parser used by the Danger plugin API.
|
|
9
|
-
# @deprecated Use {XcodeProjectPackageReader} and {XcodeParser} from the
|
|
10
|
-
# +spm_version_updates+ core gem instead. This shim exists only for backward
|
|
11
|
-
# compatibility with Dangerfiles written against +v0.2.0+.
|
|
12
|
-
module Xcode
|
|
13
|
-
# Find the configured SPM dependencies in the xcodeproj
|
|
14
|
-
# @param [String] xcodeproj_path
|
|
15
|
-
# The path of the Xcode project
|
|
16
|
-
# @return [Hash<String, Hash>]
|
|
17
|
-
def self.get_packages(xcodeproj_path)
|
|
18
|
-
raise(XcodeprojPathMustBeSet) if xcodeproj_path.nil? || xcodeproj_path.empty?
|
|
19
|
-
|
|
20
|
-
XcodeProjectPackageReader.package_references(xcodeproj_path).to_h { |package|
|
|
21
|
-
repository_url = package.repository_url
|
|
22
|
-
[Git.trim_repo_url(repository_url), package.requirement]
|
|
23
|
-
}
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Extracts resolved versions from Package.resolved relative to an Xcode project.
|
|
27
|
-
# When a block is given, malformed resolved files are reported to it as
|
|
28
|
-
# `(resolved_path, error)` and skipped; without a block the error is raised.
|
|
29
|
-
# @param [String] xcodeproj_path
|
|
30
|
-
# The path to your Xcode project
|
|
31
|
-
# @raise [CouldNotFindResolvedFile] if no Package.resolved files were found
|
|
32
|
-
# @raise [PackageResolved::MalformedFileError] if a resolved file is invalid JSON and no block is given
|
|
33
|
-
# @return [Hash<String, String>]
|
|
34
|
-
def self.get_resolved_versions(xcodeproj_path)
|
|
35
|
-
resolved_paths = find_packages_resolved_file(xcodeproj_path)
|
|
36
|
-
raise(CouldNotFindResolvedFile) if resolved_paths.empty?
|
|
37
|
-
|
|
38
|
-
resolved_paths.each_with_object({}) { |resolved_path, pins|
|
|
39
|
-
begin
|
|
40
|
-
pins.merge!(PackageResolved.versions_from(resolved_path))
|
|
41
|
-
rescue PackageResolved::MalformedFileError => error
|
|
42
|
-
raise unless block_given?
|
|
43
|
-
|
|
44
|
-
yield(resolved_path, error)
|
|
45
|
-
end
|
|
46
|
-
}
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# Find the Packages.resolved file
|
|
50
|
-
# @return [Array<String>]
|
|
51
|
-
def self.find_packages_resolved_file(xcodeproj_path)
|
|
52
|
-
checked = XcodeProjectPackageReader.package_resolved_candidate_paths(xcodeproj_path)
|
|
53
|
-
locations = checked.select { |path| File.exist?(path) }
|
|
54
|
-
|
|
55
|
-
Kernel.warn("Checked Package.resolved paths: #{checked}")
|
|
56
|
-
Kernel.warn("Found Package.resolved paths: #{locations}")
|
|
57
|
-
locations
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
private_class_method :find_packages_resolved_file
|
|
61
|
-
|
|
62
|
-
# Raised when Danger plugin Xcode mode is invoked without a project path.
|
|
63
|
-
# Aliased to the core parser's class so plugin callers rescuing the legacy
|
|
64
|
-
# name keep working now that the plugin delegates to SpmChecker/XcodeParser.
|
|
65
|
-
XcodeprojPathMustBeSet = XcodeParser::XcodeprojPathMustBeSet
|
|
66
|
-
|
|
67
|
-
# Raised when a Danger plugin Xcode project has no Package.resolved file.
|
|
68
|
-
CouldNotFindResolvedFile = XcodeParser::CouldNotFindResolvedFile
|
|
69
|
-
end
|