danger-spm_version_updates 0.0.4 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +15 -0
- data/.github/workflows/docs.yml +43 -0
- data/.github/workflows/lint_and_test.yml +6 -1
- data/.github/workflows/push_gem.yml +26 -0
- data/.github/workflows/readme.yml +21 -0
- data/.gitignore +135 -3
- data/.idea/.gitignore +8 -0
- data/.idea/danger-plugin-spm-version-updates.iml +130 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.markdownlint.jsonc +6 -0
- data/.rubocop.yml +297 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +111 -55
- data/README.md +41 -10
- data/Rakefile +2 -0
- data/danger-spm_version_updates.gemspec +11 -7
- data/lib/spm_version_updates/gem_version.rb +1 -1
- data/lib/spm_version_updates/plugin.rb +68 -46
- data/spec/spec_helper.rb +0 -6
- data/spec/spm_version_updates_spec.rb +134 -37
- data/spec/support/fixtures/Branch.xcodeproj/project.pbxproj +80 -0
- data/spec/support/fixtures/Branch.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +265 -0
- data/spec/support/fixtures/UpToNextMajor.xcodeproj/project.pbxproj +80 -0
- data/spec/support/fixtures/VersionRange.xcodeproj/project.pbxproj +81 -0
- data/spec/support/fixtures/VersionRange.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +265 -0
- data/spec/support/fixtures/github_pr.json +6 -16
- metadata +94 -30
- data/spec/support/fixtures/Example.xcodeproj/project.pbxproj +0 -152
- /data/spec/support/fixtures/{HasPreRelease.xcodeproj → ExactVersion.xcodeproj}/project.pbxproj +0 -0
- /data/spec/support/fixtures/{Example.xcodeproj → ExactVersion.xcodeproj}/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +0 -0
- /data/spec/support/fixtures/{HasPreRelease.xcodeproj → UpToNextMajor.xcodeproj}/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +0 -0
data/README.md
CHANGED
@@ -2,21 +2,23 @@
|
|
2
2
|
|
3
3
|
[![CI](https://github.com/hbmartin/danger-spm_version_updates/actions/workflows/lint_and_test.yml/badge.svg)](https://github.com/hbmartin/danger-spm_version_updates/actions/workflows/lint_and_test.yml)
|
4
4
|
[![CodeFactor](https://www.codefactor.io/repository/github/hbmartin/danger-spm_version_updates/badge/main)](https://www.codefactor.io/repository/github/hbmartin/danger-spm_version_updates/overview/main)
|
5
|
-
[![Gem Version](https://
|
6
|
-
|
5
|
+
[![Gem Version](https://img.shields.io/gem/v/danger-spm_version_updates?color=D86149)](https://rubygems.org/gems/danger-spm_version_updates)
|
6
|
+
[![codecov](https://codecov.io/gh/hbmartin/danger-spm_version_updates/graph/badge.svg?token=eXgUoWlvP7)](https://codecov.io/gh/hbmartin/danger-spm_version_updates)
|
7
|
+
[![Documentation](https://img.shields.io/badge/Docs-3d3d41?logo=RubyGems)](https://hbmartin.github.io/danger-spm_version_updates/Danger/DangerSpmVersionUpdates.html)
|
8
|
+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
7
9
|
|
8
10
|
A [Danger](https://danger.systems/ruby/) plugin to detect if there are any updates to your Swift Package Manager dependencies.
|
9
11
|
|
10
|
-
It
|
12
|
+
It's fast, lightweight, and does not require swift to be installed on the CI where it is run.
|
11
13
|
|
14
|
+
Note that version 0.1.0 is the last version to support Ruby 2.7
|
12
15
|
|
13
16
|
## Installation
|
14
17
|
|
15
|
-
|
18
|
+
`gem install danger-spm_version_updates`
|
16
19
|
|
17
20
|
or add the following to your Gemfile:
|
18
21
|
|
19
|
-
|
20
22
|
```ruby
|
21
23
|
gem "danger-spm_version_updates"
|
22
24
|
```
|
@@ -35,11 +37,14 @@ You can also configure custom behaviors:
|
|
35
37
|
# Whether to check when dependencies are exact versions or commits, default false
|
36
38
|
spm_version_updates.check_when_exact = true
|
37
39
|
|
38
|
-
# Whether to
|
39
|
-
spm_version_updates.
|
40
|
+
# Whether to report versions above the maximum version range, default false
|
41
|
+
spm_version_updates.report_above_maximum = true
|
42
|
+
|
43
|
+
# Whether to report pre-release versions, default false
|
44
|
+
spm_version_updates.report_pre_releases = true
|
40
45
|
|
41
46
|
# A list of repositories to ignore entirely, must exactly match the URL as configured in the Xcode project
|
42
|
-
spm_version_updates.
|
47
|
+
spm_version_updates.ignore_repos = ["https://github.com/pointfreeco/swift-snapshot-testing"]
|
43
48
|
```
|
44
49
|
|
45
50
|
## Development
|
@@ -50,7 +55,33 @@ spm_version_updates.ignore_repositories = ["https://github.com/pointfreeco/swift
|
|
50
55
|
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
51
56
|
5. Make your changes.
|
52
57
|
|
53
|
-
|
54
58
|
## Authors
|
55
59
|
|
56
|
-
|
60
|
+
- [Harold Martin](https://www.linkedin.com/in/harold-martin-98526971/) - harold.martin at gmail
|
61
|
+
|
62
|
+
## Legal
|
63
|
+
|
64
|
+
Swift and the Swift logo are trademarks of Apple Inc.
|
65
|
+
|
66
|
+
Copyright (c) 2023 Harold Martin <harold.martin@gmail.com>
|
67
|
+
|
68
|
+
MIT License
|
69
|
+
|
70
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
71
|
+
a copy of this software and associated documentation files (the
|
72
|
+
"Software"), to deal in the Software without restriction, including
|
73
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
74
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
75
|
+
permit persons to whom the Software is furnished to do so, subject to
|
76
|
+
the following conditions:
|
77
|
+
|
78
|
+
The above copyright notice and this permission notice shall be
|
79
|
+
included in all copies or substantial portions of the Software.
|
80
|
+
|
81
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
82
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
83
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
84
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
85
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
86
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
87
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -9,6 +9,7 @@ RSpec::Core::RakeTask.new(:specs)
|
|
9
9
|
|
10
10
|
task default: :specs
|
11
11
|
|
12
|
+
desc "Run all test and lint tasks"
|
12
13
|
task :spec do
|
13
14
|
Rake::Task["specs"].invoke
|
14
15
|
Rake::Task["rubocop"].invoke
|
@@ -19,6 +20,7 @@ desc "Run RuboCop on the lib/specs directory"
|
|
19
20
|
RuboCop::RakeTask.new(:rubocop) { |task|
|
20
21
|
task.requires << "rubocop-rspec"
|
21
22
|
task.requires << "rubocop-rake"
|
23
|
+
task.requires << "rubocop-performance"
|
22
24
|
task.patterns = ["lib/**/*.rb", "spec/**/*.rb"]
|
23
25
|
}
|
24
26
|
|
@@ -13,34 +13,38 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.summary = "A Danger plugin to detect if there are any updates to your Swift Package Manager dependencies."
|
14
14
|
spec.homepage = "https://github.com/hbmartin/danger-spm_version_updates"
|
15
15
|
spec.license = "MIT"
|
16
|
-
spec.required_ruby_version = ">=
|
16
|
+
spec.required_ruby_version = ">= 3.0"
|
17
17
|
|
18
18
|
spec.files = `git ls-files`.split($/)
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
20
|
spec.require_paths = ["lib"]
|
21
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
22
22
|
|
23
23
|
spec.add_runtime_dependency("danger-plugin-api", "~> 1.0")
|
24
24
|
spec.add_runtime_dependency("semantic", "~> 1.6")
|
25
|
-
spec.add_runtime_dependency("xcodeproj", "~> 1.
|
25
|
+
spec.add_runtime_dependency("xcodeproj", "~> 1.24")
|
26
26
|
|
27
27
|
# General ruby development
|
28
28
|
spec.add_development_dependency("bundler", "~> 2.0")
|
29
29
|
spec.add_development_dependency("rake", "~> 13.0")
|
30
30
|
|
31
31
|
# Testing support
|
32
|
-
spec.add_development_dependency("rspec", "~> 3.
|
32
|
+
spec.add_development_dependency("rspec", "~> 3.9")
|
33
|
+
spec.add_development_dependency("simplecov", "~> 0.22")
|
34
|
+
spec.add_development_dependency("simplecov-cobertura", "~> 2.1")
|
33
35
|
|
34
36
|
# Linting code and docs
|
35
37
|
spec.add_development_dependency("reek")
|
36
|
-
spec.add_development_dependency("rubocop")
|
38
|
+
spec.add_development_dependency("rubocop", "~> 1.62")
|
39
|
+
spec.add_development_dependency("rubocop-performance")
|
37
40
|
spec.add_development_dependency("rubocop-rake")
|
38
41
|
spec.add_development_dependency("rubocop-rspec")
|
39
|
-
spec.add_development_dependency("yard")
|
42
|
+
spec.add_development_dependency("yard", "~> 0.9.36")
|
40
43
|
|
41
44
|
# Makes testing easy via `bundle exec guard`
|
42
|
-
spec.add_development_dependency("guard", "~> 2.
|
45
|
+
spec.add_development_dependency("guard", "~> 2.16")
|
43
46
|
spec.add_development_dependency("guard-rspec", "~> 4.7")
|
47
|
+
spec.add_development_dependency("guard-rubocop", "~> 1.2")
|
44
48
|
|
45
49
|
# If you want to work on older builds of ruby
|
46
50
|
spec.add_development_dependency("listen", "3.0.7")
|
@@ -6,7 +6,7 @@ require "xcodeproj"
|
|
6
6
|
module Danger
|
7
7
|
# A plugin for checking if there are versions upgrades available for SPM packages
|
8
8
|
#
|
9
|
-
# @example
|
9
|
+
# @example Check if MyApp's SPM dependencies are up to date
|
10
10
|
#
|
11
11
|
# spm_version_updates.check_for_updates("MyApp.xcodeproj")
|
12
12
|
#
|
@@ -18,9 +18,9 @@ module Danger
|
|
18
18
|
# @return [Boolean]
|
19
19
|
attr_accessor :check_when_exact
|
20
20
|
|
21
|
-
# Whether to
|
21
|
+
# Whether to report versions above the maximum version range, default false
|
22
22
|
# @return [Boolean]
|
23
|
-
attr_accessor :
|
23
|
+
attr_accessor :report_above_maximum
|
24
24
|
|
25
25
|
# Whether to report pre-release versions, default false
|
26
26
|
# @return [Boolean]
|
@@ -35,16 +35,8 @@ module Danger
|
|
35
35
|
# The path to your Xcode project
|
36
36
|
# @return [void]
|
37
37
|
def check_for_updates(xcodeproj_path)
|
38
|
-
|
39
|
-
|
40
|
-
project = Xcodeproj::Project.open(xcodeproj_path)
|
41
|
-
remote_packages = filter_remote_packages(project)
|
42
|
-
|
43
|
-
resolved_path = find_packages_resolved(xcodeproj_path)
|
44
|
-
raise(CouldNotFindResolvedFile) unless File.exist?(resolved_path)
|
45
|
-
|
46
|
-
resolved_versions = JSON.load_file!(resolved_path)["pins"]
|
47
|
-
.to_h { |pin| [pin["location"], pin["state"]["version"] || pin["state"]["revision"]] }
|
38
|
+
remote_packages = get_remote_package(xcodeproj_path)
|
39
|
+
resolved_versions = get_resolved_versions(xcodeproj_path)
|
48
40
|
|
49
41
|
remote_packages.each { |repository_url, requirement|
|
50
42
|
next if ignore_repos&.include?(repository_url)
|
@@ -55,9 +47,10 @@ module Danger
|
|
55
47
|
|
56
48
|
# kind can be major, minor, range, exact, branch, or commit
|
57
49
|
|
58
|
-
if kind == "branch"
|
59
|
-
|
60
|
-
|
50
|
+
if kind == "branch"
|
51
|
+
branch = requirement["branch"]
|
52
|
+
last_commit = git_branch_last_commit(repository_url, branch)
|
53
|
+
warn("Newer commit available for #{name} (#{branch}): #{last_commit}") unless last_commit == resolved_version
|
61
54
|
next
|
62
55
|
end
|
63
56
|
|
@@ -65,24 +58,39 @@ module Danger
|
|
65
58
|
next if available_versions.first.to_s == resolved_version
|
66
59
|
|
67
60
|
if kind == "exactVersion" && @check_when_exact
|
68
|
-
|
69
|
-
report_pre_releases ? true : version.pre.nil?
|
70
|
-
}
|
71
|
-
warn(
|
72
|
-
<<-TEXT
|
73
|
-
Newer version of #{name}: #{newestVersion} (but this package is set to exact version #{resolved_version})
|
74
|
-
TEXT
|
75
|
-
) unless newestVersion.to_s == resolved_version
|
61
|
+
warn_for_new_versions_exact(available_versions, name, resolved_version)
|
76
62
|
elsif kind == "upToNextMajorVersion"
|
77
63
|
warn_for_new_versions(:major, available_versions, name, resolved_version)
|
78
64
|
elsif kind == "upToNextMinorVersion"
|
79
65
|
warn_for_new_versions(:minor, available_versions, name, resolved_version)
|
80
|
-
elsif kind == "
|
66
|
+
elsif kind == "versionRange"
|
81
67
|
warn_for_new_versions_range(available_versions, name, requirement, resolved_version)
|
82
68
|
end
|
83
69
|
}
|
84
70
|
end
|
85
71
|
|
72
|
+
# Extracts remote packages from an Xcode project
|
73
|
+
# @param [String] xcodeproj_path
|
74
|
+
# The path to your Xcode project
|
75
|
+
# @return [Hash<String, Hash>]
|
76
|
+
def get_remote_package(xcodeproj_path)
|
77
|
+
raise(XcodeprojPathMustBeSet) if xcodeproj_path.nil?
|
78
|
+
|
79
|
+
filter_remote_packages(Xcodeproj::Project.open(xcodeproj_path))
|
80
|
+
end
|
81
|
+
|
82
|
+
# Extracts resolved versions from Package.resolved relative to an Xcode project
|
83
|
+
# @param [String] xcodeproj_path
|
84
|
+
# The path to your Xcode project
|
85
|
+
# @return [Hash<String, String>]
|
86
|
+
def get_resolved_versions(xcodeproj_path)
|
87
|
+
resolved_path = find_packages_resolved_file(xcodeproj_path)
|
88
|
+
raise(CouldNotFindResolvedFile) unless File.exist?(resolved_path)
|
89
|
+
|
90
|
+
JSON.load_file!(resolved_path)["pins"]
|
91
|
+
.to_h { |pin| [pin["location"], pin["state"]["version"] || pin["state"]["revision"]] }
|
92
|
+
end
|
93
|
+
|
86
94
|
# Extract a readable name for the repo given the url, generally org/repo
|
87
95
|
# @return [String]
|
88
96
|
def repo_name(repo_url)
|
@@ -107,7 +115,7 @@ Newer version of #{name}: #{newestVersion} (but this package is set to exact ver
|
|
107
115
|
|
108
116
|
# Find the Packages.resolved file
|
109
117
|
# @return [String]
|
110
|
-
def
|
118
|
+
def find_packages_resolved_file(xcodeproj_path)
|
111
119
|
if Dir.exist?(xcodeproj_path.sub("xcodeproj", "xcworkspace"))
|
112
120
|
File.join(xcodeproj_path.sub("xcodeproj", "xcworkspace"), "xcshareddata", "swiftpm", "Package.resolved")
|
113
121
|
else
|
@@ -117,44 +125,57 @@ Newer version of #{name}: #{newestVersion} (but this package is set to exact ver
|
|
117
125
|
|
118
126
|
private
|
119
127
|
|
128
|
+
def warn_for_new_versions_exact(available_versions, name, resolved_version)
|
129
|
+
newest_version = available_versions.find { |version|
|
130
|
+
report_pre_releases ? true : version.pre.nil?
|
131
|
+
}
|
132
|
+
warn(
|
133
|
+
<<-TEXT
|
134
|
+
Newer version of #{name}: #{newest_version} (but this package is set to exact version #{resolved_version})
|
135
|
+
TEXT
|
136
|
+
) unless newest_version.to_s == resolved_version
|
137
|
+
end
|
138
|
+
|
120
139
|
def warn_for_new_versions_range(available_versions, name, requirement, resolved_version)
|
121
140
|
max_version = Semantic::Version.new(requirement["maximumVersion"])
|
122
141
|
if available_versions.first < max_version
|
123
142
|
warn("Newer version of #{name}: #{available_versions.first}")
|
124
143
|
else
|
125
144
|
newest_meeting_reqs = available_versions.find { |version|
|
126
|
-
version < max_version && report_pre_releases ? true : version.pre.nil?
|
145
|
+
version < max_version && (report_pre_releases ? true : version.pre.nil?)
|
127
146
|
}
|
128
|
-
warn("Newer version of #{name}: #{newest_meeting_reqs}
|
147
|
+
warn("Newer version of #{name}: #{newest_meeting_reqs}") unless newest_meeting_reqs.to_s == resolved_version
|
129
148
|
warn(
|
130
149
|
<<-TEXT
|
131
150
|
Newest version of #{name}: #{available_versions.first} (but this package is configured up to the next #{max_version} version)
|
132
151
|
TEXT
|
133
|
-
)
|
152
|
+
) if report_above_maximum
|
134
153
|
end
|
135
154
|
end
|
136
155
|
|
137
156
|
def warn_for_new_versions(major_or_minor, available_versions, name, resolved_version_string)
|
138
157
|
resolved_version = Semantic::Version.new(resolved_version_string)
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
158
|
+
newest_meeting_reqs = available_versions.find { |version|
|
159
|
+
(version.send(major_or_minor) == resolved_version.send(major_or_minor)) && (report_pre_releases ? true : version.pre.nil?)
|
160
|
+
}
|
161
|
+
|
162
|
+
warn("Newer version of #{name}: #{newest_meeting_reqs}") unless newest_meeting_reqs == resolved_version
|
163
|
+
return unless report_above_maximum
|
164
|
+
|
165
|
+
newest_above_reqs = available_versions.find { |version|
|
166
|
+
report_pre_releases ? true : version.pre.nil?
|
167
|
+
}
|
168
|
+
warn(
|
169
|
+
<<-TEXT
|
150
170
|
Newest version of #{name}: #{available_versions.first} (but this package is configured up to the next #{major_or_minor} version)
|
151
|
-
|
152
|
-
|
153
|
-
end
|
171
|
+
TEXT
|
172
|
+
) unless newest_above_reqs == newest_meeting_reqs || newest_meeting_reqs.to_s == resolved_version
|
154
173
|
end
|
155
174
|
|
175
|
+
# Remove git call to list tags
|
176
|
+
# @return [Array<Semantic::Version>]
|
156
177
|
def git_versions(repo_url)
|
157
|
-
`git ls-remote -t #{repo_url}`
|
178
|
+
versions = `git ls-remote -t #{repo_url}`
|
158
179
|
.split("\n")
|
159
180
|
.map { |line| line.split("/tags/").last }
|
160
181
|
.filter_map { |line|
|
@@ -164,8 +185,9 @@ Newest version of #{name}: #{available_versions.first} (but this package is conf
|
|
164
185
|
nil
|
165
186
|
end
|
166
187
|
}
|
167
|
-
|
168
|
-
|
188
|
+
versions.sort!
|
189
|
+
versions.reverse!
|
190
|
+
versions
|
169
191
|
end
|
170
192
|
|
171
193
|
def git_branch_last_commit(repo_url, branch_name)
|
data/spec/spec_helper.rb
CHANGED
@@ -11,12 +11,6 @@ require "pry"
|
|
11
11
|
require "danger"
|
12
12
|
require "rspec"
|
13
13
|
|
14
|
-
if `git remote -v` == ""
|
15
|
-
puts "You cannot run tests without setting a local git remote on this repo"
|
16
|
-
puts "It's a weird side-effect of Danger's internals."
|
17
|
-
exit(0)
|
18
|
-
end
|
19
|
-
|
20
14
|
# Use coloured output, it's the best.
|
21
15
|
RSpec.configure do |config|
|
22
16
|
config.filter_gems_from_backtrace("bundler")
|
@@ -1,5 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "simplecov"
|
4
|
+
SimpleCov.start
|
5
|
+
|
6
|
+
require "simplecov-cobertura"
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
8
|
+
|
3
9
|
require File.expand_path("spec_helper", __dir__)
|
4
10
|
|
5
11
|
module Danger
|
@@ -8,9 +14,6 @@ module Danger
|
|
8
14
|
expect(described_class.new(nil)).to be_a Danger::Plugin
|
9
15
|
end
|
10
16
|
|
11
|
-
#
|
12
|
-
# You should test your custom attributes and methods here
|
13
|
-
#
|
14
17
|
describe "with Dangerfile" do
|
15
18
|
before do
|
16
19
|
@dangerfile = testing_dangerfile
|
@@ -22,55 +25,47 @@ module Danger
|
|
22
25
|
allow(@my_plugin.github).to receive(:pr_json).and_return(json)
|
23
26
|
end
|
24
27
|
|
25
|
-
it "
|
26
|
-
allow(@my_plugin).to receive(:git_versions)
|
28
|
+
it "Does not report pre-release versions by default" do
|
29
|
+
allow(@my_plugin).to receive(:git_versions)
|
30
|
+
.and_return [
|
31
|
+
Semantic::Version.new("12.1.6"),
|
32
|
+
Semantic::Version.new("12.2.0-beta.1"),
|
33
|
+
Semantic::Version.new("12.2.0-beta.2"),
|
34
|
+
].sort.reverse
|
27
35
|
|
28
|
-
@my_plugin.
|
36
|
+
@my_plugin.check_when_exact = true
|
37
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/ExactVersion.xcodeproj")
|
29
38
|
|
30
39
|
expect(@dangerfile.status_report[:warnings]).to eq([])
|
31
40
|
end
|
32
41
|
|
33
|
-
it "
|
34
|
-
|
35
|
-
|
42
|
+
it "Does report new versions for exact versions when configured" do
|
43
|
+
allow(@my_plugin).to receive(:git_versions)
|
44
|
+
.and_return [
|
45
|
+
Semantic::Version.new("12.1.6"),
|
46
|
+
Semantic::Version.new("12.1.7"),
|
47
|
+
].sort.reverse
|
36
48
|
|
37
49
|
@my_plugin.check_when_exact = true
|
38
|
-
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/
|
50
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/ExactVersion.xcodeproj")
|
39
51
|
|
40
52
|
expect(@dangerfile.status_report[:warnings]).to eq(
|
41
53
|
[
|
42
|
-
"Newer version of
|
43
|
-
"Newer version of kean/Nuke: 12.2.0-beta.2 (but this package is set to exact version 12.1.6)\n",
|
44
|
-
"Newer version of pointfreeco/swiftui-navigation: 1.0.3 (but this package is set to exact version 1.0.2)\n",
|
45
|
-
"Newer version of getsentry/sentry-cocoa: 8.15.0 (but this package is set to exact version 8.12.0)\n",
|
46
|
-
"Newer version of firebase/firebase-ios-sdk: 10.17.0 (but this package is set to exact version 10.15.0)\n",
|
54
|
+
"Newer version of kean/Nuke: 12.1.7 (but this package is set to exact version 12.1.6)\n",
|
47
55
|
]
|
48
56
|
)
|
49
57
|
end
|
50
58
|
|
51
|
-
it "Does
|
52
|
-
allow(@my_plugin).to receive(:git_versions)
|
53
|
-
|
54
|
-
Semantic::Version.new("12.
|
55
|
-
Semantic::Version.new("12.
|
56
|
-
|
57
|
-
|
58
|
-
Semantic::Version.new("12.0.0-beta.5"),
|
59
|
-
Semantic::Version.new("12.0.0-rc.1"),
|
60
|
-
Semantic::Version.new("12.1.0"),
|
61
|
-
Semantic::Version.new("12.1.1"),
|
62
|
-
Semantic::Version.new("12.1.2"),
|
63
|
-
Semantic::Version.new("12.1.3"),
|
64
|
-
Semantic::Version.new("12.1.4"),
|
65
|
-
Semantic::Version.new("12.1.5"),
|
66
|
-
Semantic::Version.new("12.1.6"),
|
67
|
-
Semantic::Version.new("12.2.0-beta.1"),
|
68
|
-
Semantic::Version.new("12.2.0-beta.2"),
|
69
|
-
]
|
70
|
-
.sort
|
71
|
-
.reverse
|
59
|
+
it "Does report pre-release versions for exact versions when configured" do
|
60
|
+
allow(@my_plugin).to receive(:git_versions)
|
61
|
+
.and_return [
|
62
|
+
Semantic::Version.new("12.1.6"),
|
63
|
+
Semantic::Version.new("12.2.0-beta.2"),
|
64
|
+
].sort.reverse
|
65
|
+
|
72
66
|
@my_plugin.check_when_exact = true
|
73
|
-
@my_plugin.
|
67
|
+
@my_plugin.report_pre_releases = true
|
68
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/ExactVersion.xcodeproj")
|
74
69
|
|
75
70
|
expect(@dangerfile.status_report[:warnings]).to eq(
|
76
71
|
[
|
@@ -78,6 +73,108 @@ Semantic::Version.new("12.2.0-beta.2"),
|
|
78
73
|
]
|
79
74
|
)
|
80
75
|
end
|
76
|
+
|
77
|
+
it "Does report new versions for up to next major" do
|
78
|
+
allow(@my_plugin).to receive(:git_versions)
|
79
|
+
.and_return [
|
80
|
+
Semantic::Version.new("12.1.6"),
|
81
|
+
Semantic::Version.new("12.1.7"),
|
82
|
+
].sort.reverse
|
83
|
+
|
84
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/UpToNextMajor.xcodeproj")
|
85
|
+
|
86
|
+
expect(@dangerfile.status_report[:warnings]).to eq(
|
87
|
+
[
|
88
|
+
"Newer version of kean/Nuke: 12.1.7",
|
89
|
+
]
|
90
|
+
)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "Reports pre-release versions for up to next major when configured" do
|
94
|
+
allow(@my_plugin).to receive(:git_versions)
|
95
|
+
.and_return [
|
96
|
+
Semantic::Version.new("12.1.6"),
|
97
|
+
Semantic::Version.new("12.2.0-beta.2"),
|
98
|
+
].sort.reverse
|
99
|
+
|
100
|
+
@my_plugin.check_when_exact = true
|
101
|
+
@my_plugin.report_pre_releases = true
|
102
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/UpToNextMajor.xcodeproj")
|
103
|
+
|
104
|
+
expect(@dangerfile.status_report[:warnings]).to eq(
|
105
|
+
[
|
106
|
+
"Newer version of kean/Nuke: 12.2.0-beta.2",
|
107
|
+
]
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "Does not report pre-release versions for up to next major" do
|
112
|
+
allow(@my_plugin).to receive(:git_versions)
|
113
|
+
.and_return [
|
114
|
+
Semantic::Version.new("12.1.6"),
|
115
|
+
Semantic::Version.new("12.2.0-beta.2"),
|
116
|
+
Semantic::Version.new("13.0.0"),
|
117
|
+
].sort.reverse
|
118
|
+
|
119
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/UpToNextMajor.xcodeproj")
|
120
|
+
|
121
|
+
expect(@dangerfile.status_report[:warnings]).to eq([])
|
122
|
+
end
|
123
|
+
|
124
|
+
it "Does not report new versions for up to next major when next version is major" do
|
125
|
+
allow(@my_plugin).to receive(:git_versions)
|
126
|
+
.and_return [
|
127
|
+
Semantic::Version.new("12.1.6"),
|
128
|
+
Semantic::Version.new("13.0.0"),
|
129
|
+
].sort.reverse
|
130
|
+
|
131
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/UpToNextMajor.xcodeproj")
|
132
|
+
|
133
|
+
expect(@dangerfile.status_report[:warnings]).to eq([])
|
134
|
+
end
|
135
|
+
|
136
|
+
it "Does report new versions for up to next major when next version is major and configured" do
|
137
|
+
allow(@my_plugin).to receive(:git_versions)
|
138
|
+
.and_return [
|
139
|
+
Semantic::Version.new("12.1.6"),
|
140
|
+
Semantic::Version.new("13.0.0"),
|
141
|
+
].sort.reverse
|
142
|
+
|
143
|
+
@my_plugin.report_above_maximum = true
|
144
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/UpToNextMajor.xcodeproj")
|
145
|
+
|
146
|
+
expect(@dangerfile.status_report[:warnings]).to eq(["Newest version of kean/Nuke: 13.0.0 (but this package is configured up to the next major version)\n"])
|
147
|
+
end
|
148
|
+
|
149
|
+
it "Does report new versions for ranges" do
|
150
|
+
allow(@my_plugin).to receive(:git_versions)
|
151
|
+
.and_return [
|
152
|
+
Semantic::Version.new("13.0.0"),
|
153
|
+
Semantic::Version.new("12.1.6"),
|
154
|
+
Semantic::Version.new("12.1.7"),
|
155
|
+
].sort.reverse
|
156
|
+
|
157
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/VersionRange.xcodeproj")
|
158
|
+
|
159
|
+
expect(@dangerfile.status_report[:warnings]).to eq(
|
160
|
+
[
|
161
|
+
"Newer version of kean/Nuke: 12.1.7",
|
162
|
+
]
|
163
|
+
)
|
164
|
+
end
|
165
|
+
|
166
|
+
it "Does report new versions for branches" do
|
167
|
+
allow(@my_plugin).to receive(:git_branch_last_commit)
|
168
|
+
.and_return "d658f302f56abfd7a163e3b5f44de39b780a64c2"
|
169
|
+
|
170
|
+
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/Branch.xcodeproj")
|
171
|
+
|
172
|
+
expect(@dangerfile.status_report[:warnings]).to eq(
|
173
|
+
[
|
174
|
+
"Newer commit available for kean/Nuke (main): d658f302f56abfd7a163e3b5f44de39b780a64c2",
|
175
|
+
]
|
176
|
+
)
|
177
|
+
end
|
81
178
|
end
|
82
179
|
end
|
83
180
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
// !$*UTF8*$!
|
2
|
+
{
|
3
|
+
archiveVersion = 1;
|
4
|
+
classes = {
|
5
|
+
};
|
6
|
+
objectVersion = 54;
|
7
|
+
objects = {
|
8
|
+
/* Begin PBXGroup section */
|
9
|
+
F1465EF423AA94BF0055F7C3 = {
|
10
|
+
isa = PBXGroup;
|
11
|
+
children = (
|
12
|
+
F1465EFF23AA94BF0055F7C3 /* Demo */,
|
13
|
+
);
|
14
|
+
sourceTree = "<group>";
|
15
|
+
};
|
16
|
+
F1465EFF23AA94BF0055F7C3 /* Demo */ = {
|
17
|
+
isa = PBXGroup;
|
18
|
+
children = ();
|
19
|
+
path = Demo;
|
20
|
+
sourceTree = "<group>";
|
21
|
+
};
|
22
|
+
/* End PBXGroup section */
|
23
|
+
|
24
|
+
/* Begin PBXProject section */
|
25
|
+
F1465EF523AA94BF0055F7C3 /* Project object */ = {
|
26
|
+
isa = PBXProject;
|
27
|
+
attributes = {
|
28
|
+
BuildIndependentTargetsInParallel = YES;
|
29
|
+
LastSwiftUpdateCheck = 1420;
|
30
|
+
LastUpgradeCheck = 1420;
|
31
|
+
TargetAttributes = {
|
32
|
+
F1465EFC23AA94BF0055F7C3 = {
|
33
|
+
CreatedOnToolsVersion = 11.2.1;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
};
|
37
|
+
buildConfigurationList = F1465EF823AA94BF0055F7C3 /* Build configuration list for PBXProject "Demo" */;
|
38
|
+
compatibilityVersion = "Xcode 9.3";
|
39
|
+
developmentRegion = en;
|
40
|
+
hasScannedForEncodings = 0;
|
41
|
+
knownRegions = (
|
42
|
+
en,
|
43
|
+
Base,
|
44
|
+
es,
|
45
|
+
"zh-Hans",
|
46
|
+
fr,
|
47
|
+
);
|
48
|
+
mainGroup = F1465EF423AA94BF0055F7C3;
|
49
|
+
packageReferences = (
|
50
|
+
11BBD37629C1571400F7A968 /* XCRemoteSwiftPackageReference "Nuke" */,
|
51
|
+
);
|
52
|
+
productRefGroup = F1465EFE23AA94BF0055F7C3 /* Products */;
|
53
|
+
projectDirPath = "";
|
54
|
+
projectRoot = "";
|
55
|
+
targets = ();
|
56
|
+
};
|
57
|
+
/* End PBXProject section */
|
58
|
+
|
59
|
+
/* Begin XCConfigurationList section */
|
60
|
+
F1465EF823AA94BF0055F7C3 /* Build configuration list for PBXNativeTarget "Demo" */ = {
|
61
|
+
isa = XCConfigurationList;
|
62
|
+
buildConfigurations = ();
|
63
|
+
defaultConfigurationIsVisible = 0;
|
64
|
+
defaultConfigurationName = Release;
|
65
|
+
};
|
66
|
+
/* End XCConfigurationList section */
|
67
|
+
|
68
|
+
/* Begin XCRemoteSwiftPackageReference section */
|
69
|
+
11BBD37629C1571400F7A968 /* XCRemoteSwiftPackageReference "Nuke" */ = {
|
70
|
+
isa = XCRemoteSwiftPackageReference;
|
71
|
+
repositoryURL = "https://github.com/kean/Nuke";
|
72
|
+
requirement = {
|
73
|
+
branch = main;
|
74
|
+
kind = branch;
|
75
|
+
};
|
76
|
+
};
|
77
|
+
/* End XCRemoteSwiftPackageReference section */
|
78
|
+
};
|
79
|
+
rootObject = F1465EF523AA94BF0055F7C3 /* Project object */;
|
80
|
+
}
|