Skip to content

Commit

Permalink
Add expanded local path to shard.yml error message in PathResolver (
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Mar 17, 2022
1 parent ffef6b9 commit f9f52ec
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
22 changes: 16 additions & 6 deletions spec/integration/install_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,22 @@ describe "install" do
end
end

it "shows missing shard.yml in debug info" do
metadata = {dependencies: {noshardyml: "*"}}
with_shard(metadata) do
stdout = run "shards install --no-color -v"
assert_installed "noshardyml", "0.2.0"
stdout.should contain(%(D: Missing "shard.yml" for "noshardyml" at tag v0.1.0))
describe "shows missing shard.yml in debug info" do
it "git" do
metadata = {dependencies: {noshardyml: "*"}}
with_shard(metadata) do
stdout = run "shards install --no-color -v"
assert_installed "noshardyml", "0.2.0"
stdout.should contain(%(D: Missing "shard.yml" for "noshardyml" at tag v0.1.0))
end
end

it "path" do
metadata = {dependencies: {reallynoshardyml: {path: rel_path("reallynoshardyml")}}}
with_shard(metadata) do
ex = expect_raises(FailedCommand) { run "shards install --no-color -v" }
ex.stdout.should contain(%(E: Missing "shard.yml" for "reallynoshardyml" at #{File.expand_path(rel_path("reallynoshardyml")).inspect}))
end
end
end

Expand Down
3 changes: 3 additions & 0 deletions spec/integration/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ private def setup_repositories
create_git_release "noshardyml", "0.1.0", false
create_git_release "noshardyml", "0.2.0"

create_git_repository "reallynoshardyml"
create_git_release "reallynoshardyml", "0.1.0", false

create_git_repository "invalidspec"
create_git_release "invalidspec", "0.1.0", {crystal: [""]}

Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/path.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Shards
if File.exists?(spec_path)
File.read(spec_path)
else
raise Error.new("Missing #{SPEC_FILENAME.inspect} for #{name.inspect}")
raise Error.new("Missing #{SPEC_FILENAME.inspect} for #{name.inspect} at #{File.expand_path(local_path).inspect}")
end
end

Expand Down

0 comments on commit f9f52ec

Please sign in to comment.