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

Detect version mismatches between shard.yml and git tags #341

Merged
merged 4 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 7 additions & 6 deletions spec/integration/install_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -376,27 +376,28 @@ describe "install" do
end
end

it "fails when shard.yml version doesn't match git tag" do
it "warns when shard.yml version doesn't match git tag" do
metadata = {
dependencies: {
version_mismatch: {git: git_url(:version_mismatch), version: "0.2.0"},
},
}
with_shard(metadata) do
ex = expect_raises(FailedCommand) { run "shards install --no-color" }
ex.stdout.should contain("Error shard version (0.1.0) doesn't match tag version (0.2.0)")
refute_installed "version_mismatch"
stdout = run "shards install --no-color"
stdout.should contain("W: Shard version (0.1.0) doesn't match tag version (0.2.0)")
assert_installed "version_mismatch"
end
end

it "succeeds when version mismatch is fixed" do
it "doesn't warn when version mismatch is fixed" do
metadata = {
dependencies: {
version_mismatch: {git: git_url(:version_mismatch), version: "0.2.1"},
},
}
with_shard(metadata) do
run "shards install"
stdout = run "shards install --no-color"
stdout.should_not contain("doesn't match tag version")
assert_installed "version_mismatch", "0.2.1"
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/molinillo_solver.cr
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module Shards
raise Error.new("Error shard name (#{spec.name}) doesn't match dependency name (#{dependency.name})")
end
if spec.mismatched_version?
raise Error.new("Error shard version (#{spec.original_version}) doesn't match tag version (#{spec.version})")
Log.warn { "Shard version (#{spec.original_version}) doesn't match tag version (#{spec.version})" }
waj marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message should probably also include dependency.name.

end
end
resolver = spec.resolver || raise "BUG: returned Spec has no resolver"
Expand Down