diff --git a/shard.lock b/shard.lock index 3986ee0..2ce31b2 100644 --- a/shard.lock +++ b/shard.lock @@ -7,4 +7,3 @@ shards: version_from_shard: git: https://github.com/hugopl/version_from_shard.git version: 1.2.5 - diff --git a/shards.nix b/shards.nix index 8444749..603ff4c 100644 --- a/shards.nix +++ b/shards.nix @@ -9,4 +9,4 @@ rev = "v1.2.5"; sha256 = "0xizj0q4rd541rwjbx04cjifc2gfx4l5v6q2y7gmd0ndjmkgb8ik"; }; -} +} \ No newline at end of file diff --git a/spec/repo_spec.cr b/spec/repo_spec.cr new file mode 100644 index 0000000..d1e6e8c --- /dev/null +++ b/spec/repo_spec.cr @@ -0,0 +1,37 @@ +require "./spec_helper" + +Spectator.describe Repo do + context "commit" do + let(:with_commit) { + <<-EOF + git: https://github.com/cadmiumcr/transliterator.git + version: 0.1.0+git.commit.46c4c14594057dbcfaf27e7e7c8c164d3f0ce3f1 + EOF + } + + let(:repo) { + Crystal2Nix::Repo.new(Crystal2Nix::Shard.from_yaml(with_commit)) + } + + it "should have the commit as revision" do + expect(repo.rev).to eq("46c4c14594057dbcfaf27e7e7c8c164d3f0ce3f1") + end + end + + context "explicit version" do + let(:with_version) { + <<-EOF + git: https://github.com/crystal-lang/json_mapping.cr.git + version: 0.1.1 + EOF + } + + let(:repo) { + Crystal2Nix::Repo.new(Crystal2Nix::Shard.from_yaml(with_version)) + } + + it "should prefix version references with a v" do + expect(repo.rev).to eq("v0.1.1") + end + end +end diff --git a/src/crystal2nix.cr b/src/crystal2nix.cr index 0b9b558..68a2efb 100644 --- a/src/crystal2nix.cr +++ b/src/crystal2nix.cr @@ -10,4 +10,4 @@ require "./worker" module Crystal2Nix VersionFromShard.declare -end +end \ No newline at end of file diff --git a/src/data.cr b/src/data.cr index 6e550c3..0ca2848 100644 --- a/src/data.cr +++ b/src/data.cr @@ -19,4 +19,4 @@ module Crystal2Nix property hg : String? property version : String end -end +end \ No newline at end of file diff --git a/src/repo.cr b/src/repo.cr index c409271..a6d20ce 100644 --- a/src/repo.cr +++ b/src/repo.cr @@ -29,4 +29,4 @@ module Crystal2Nix @url.to_s end end -end +end \ No newline at end of file diff --git a/src/worker.cr b/src/worker.cr index 0a98a60..36ddcb4 100644 --- a/src/worker.cr +++ b/src/worker.cr @@ -91,4 +91,4 @@ module Crystal2Nix puts "Processing completed successfully." end end -end +end \ No newline at end of file