Granite is a powerful web framework crafted in the Crystal programming language. This framework promises to simplify your development process by offering a robust Object-Relational Mapping (ORM) solution. Whether you’re maintaining existing features, contributing new ones, or simply running tests, this guide will walk you through the steps effectively and seamlessly.
Seeking Maintainers
Granite is on the lookout for volunteers to take over the maintainership of this repository. This includes reviewing and merging pull requests, as well as ensuring that the framework stays up-to-date with the latest changes in the Crystal language. If you’re interested in contributing, check out more information here.
Documentation
For comprehensive insights into all features of Granite, ensure to refer to the Documentation.
Contributing to Granite
Are you ready to contribute? Here’s how you can do it:
- Fork the project: Fork it.
- Create your feature branch:
git checkout -b my-new-feature
. - Commit your changes:
git commit -am "Add some feature"
. - Push to the branch:
git push origin my-new-feature
. - Create a new Pull Request.
Running Tests
Testing is essential to confirm that everything is functioning smoothly. Granite uses Crystal’s built-in testing framework, and you can run tests either in a dockerized testing environment or locally.
Docker Setup
You can use Docker to establish a self-contained testing environment. Here’s how:
- Ensure Docker is installed on your machine.
- Choose the appropriate docker-compose file based on the database you want to test against:
Environment Variable Setup
Set up your environment variables:
- Option 1: Export environment variables with
$ source .export.sh
or$ source .env
. - Option 2: Modify the default
.env
file for docker-compose as needed.
Running Tests
Use the following command format to run your tests for different databases:
$ docker-compose -f docker/docker-compose.database_type.yml run spec
Cleanup
When you’re done testing:
$ docker-compose -f docker/docker-compose.database_type.yml down
Local Setup
If you prefer to run tests locally, follow these steps:
- Install the necessary dependencies:
$ shards install
. - Make sure to configure the
.env
file correctly or create the required databases. - For setting up databases:
- PostgreSQL:
CREATE USER granite WITH PASSWORD password; CREATE DATABASE granite_db; GRANT ALL PRIVILEGES ON DATABASE granite_db TO granite;
- MySQL:
CREATE USER granite@localhost IDENTIFIED BY password; CREATE DATABASE granite_db; GRANT ALL PRIVILEGES ON granite_db.* TO granite@localhost WITH GRANT OPTION;
- Export your environment variables using
$ source .export.sh
or$ source .env
. - Run the tests with:
$ crystal spec
.
Troubleshooting
If you encounter any issues during the setup or testing processes, here are some ideas to help you out:
- Ensure that you have the correct database credentials in your
.env
file. - Make sure Docker is properly installed and running.
- Verify that your Crystal environment is functioning correctly.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.