Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix command outdated for dep with no releases #455

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions spec/integration/outdated_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ describe "outdated" do
end
end

it "no releases" do
commit = git_commits("missing").first
with_shard({dependencies: {missing: "*"}}, {missing: "0.1.0+git.commit.#{commit}"}) do
run "shards install"

stdout = run "shards outdated --no-color"
# FIXME: This should actually report dependencies are up to date (#446)
stdout.should contain("W: Outdated dependencies:")
stdout.should contain(" * missing (installed: 0.1.0 at #{commit[0..6]})")
end
end

it "available version matching pessimistic operator" do
with_shard({dependencies: {orm: "~> 0.3.0"}}, {orm: "0.3.1"}) do
run "shards install"
Expand Down
5 changes: 3 additions & 2 deletions src/commands/outdated.cr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ module Shards
else
Versions.without_prereleases(resolver.available_releases)
end
latest = Versions.sort(available_versions).first
latest = Versions.sort(available_versions).first?

return if latest == installed

@up_to_date = false
Expand All @@ -66,7 +67,7 @@ module Shards
end

# also report latest version:
if Versions.compare(latest, package.version) < 0
if latest && Versions.compare(latest, package.version) < 0
@output << ", latest: " << resolver.report_version(latest)
end

Expand Down