Skip to content

Commit

Permalink
GSOC2024 Submission
Browse files Browse the repository at this point in the history
  • Loading branch information
vidhvath28 committed Sep 1, 2024
1 parent 3deb154 commit 5dffba7
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 4 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# crystal2nix
is a tool that makes it easier to manage and build Crystal projects using the Nix package manager
is a tool that makes it easier to manage and build Crystal projects using the Nix package manager ,currently supports git and mercurial sources .

`crystal2nix`

Expand Down Expand Up @@ -27,6 +27,12 @@ These tests can run offline and thus within the nix sandbox without network con

These commands ensure that your changes are tested thoroughly before being pushed to the repository.

`make test-all`
These command helps use to test both the offline test cases and the integrated test cases together.

`make test-online`
These command helps you to only test the integrated test cases .


## Development

Expand All @@ -35,7 +41,7 @@ We welcome all contributions, whether it's bug fixes, new features, or documenta
## Future plans

In the future, we plan to add support for Fossil resources in the Crystal2Nix project
Add few integrity test case .
Add few more integrity test case .


## Contributing
Expand Down
12 changes: 12 additions & 0 deletions spec/fixtures/reference_shards.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
spectator = {
url = "https://gitlab.com/arctic-fox/spectator.git";
rev = "v0.10.6";
sha256 = "0w6mv1q44is2m19pyspkyiwm84h55nchsm4pp82gdbb0j9ylhckx";
};
version_from_shard = {
url = "https://github.com/hugopl/version_from_shard.git";
rev = "v1.2.5";
sha256 = "0xizj0q4rd541rwjbx04cjifc2gfx4l5v6q2y7gmd0ndjmkgb8ik";
};
}
12 changes: 12 additions & 0 deletions spec/fixtures/test_shard.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2.0
shards:
spectator:
git: https://gitlab.com/arctic-fox/spectator.git
version: 0.10.6

version_from_shard:
git: https://github.com/hugopl/version_from_shard.git
version: 1.2.5



28 changes: 28 additions & 0 deletions spec/integrated_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require "./spec_helper"

Spectator.describe Crystal2Nix::Worker, :online do
def run_and_validate_test(test_shard_lock, reference_shards_nix, generated_shards_nix)
SpecHelper.prepare_for_test(generated_shards_nix)

Crystal2Nix::Worker.new(test_shard_lock).run

generated_content = SpecHelper.read_file(generated_shards_nix)
reference_content = SpecHelper.read_file(reference_shards_nix)

puts "Generated content:\n#{generated_content}"
puts "Reference content:\n#{reference_content}"

expect(generated_content.strip).to eq(reference_content.strip)
ensure
SpecHelper.cleanup_file(generated_shards_nix)
end

it "correctly generates the shards.nix file" do
run_and_validate_test(
"./spec/fixtures/test_shard.lock",
"./spec/fixtures/reference_shards.nix",
"./shards.nix"
)

end
end
4 changes: 2 additions & 2 deletions src/worker.cr
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module Crystal2Nix
end

else
log_message "Unsupported repository type for '#{key}': #{repo.type}. Currently supported types are: git, hg. Please update your configuration or contact support for further assistance."
log_message "Unsupported repository type for '#{key}': #{repo.type}. Currently supported types are: git, hg. ."
break
end

Expand All @@ -89,7 +89,7 @@ module Crystal2Nix
end

File.rename(temp_file_path, SHARDS_NIX)
puts "Processing completed successfully with no errors."
puts "Processing completed successfully."
end
end
end

0 comments on commit 5dffba7

Please sign in to comment.