Git Product home page Git Product logo

granite's Introduction

Granite

Amber is a web framework written in the Crystal language.

This project is to provide an ORM in Crystal.

Build Status

Documentation

Documentation

Contributing

  1. Fork it ( https://github.com/amberframework/granite/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Running tests

Granite uses Crystal's built in test framework. The tests can be run with $ crystal spec.

The test suite depends on access to a PostgreSQL, MySQL, and SQLite database to ensure the adapters work as intended.

Docker setup

There is a self-contained testing environment provided via the docker-compose.yml file in this repository. We are testing against multiple databases so you have to specify which docker-compose file you would like to use. Replace "{database_type}" with "mysql" or "pg" or "sqlite". Before you can run the docker configuration you have to set the appropriate env variables. To do so you can either load them yourself or modify the .env file that docker-compose loads by default.

You can find postgres versions at https://hub.docker.com/_/postgres/ You can find mysql versions at https://hub.docker.com/_/mysql/

After you have docker installed do the following to run tests:

First run

$ docker-compose -f docker/docker-compose.{database_type}.yml build spec
$ docker-compose -f docker/docker-compose.{database_type}.yml run spec

Subsequent runs

$ docker-compose -f docker/docker-compose.{database_type}.yml run spec

Cleanup

If you're done testing and you'd like to shut down and clean up the docker dependences run the following:

$ docker-compose -f docker/docker-compose.{database_type}.yml down

Run all

To run the specs for each database adapter use ./spec/run_all_specs.sh. This will build and run each adapter, then cleanup after itself.

Local setup

If you'd like to test without docker you can do so by following the instructions below:

  1. Install dependencies with $ shards install
  2. Update .env to use appropriate ENV variables, or create appropriate databases.
  3. Setup 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;
  1. Export .env with $ source .env
  2. $ crystal spec

granite's People

Contributors

adam-stomski avatar akadusei avatar blacksmoke16 avatar c910335 avatar danielwestendorf avatar drinkmorewaters avatar drujensen avatar eliasjpr avatar elorest avatar enricomonese avatar faustinoaq avatar gabrielengel avatar hansterdam avatar hfjallemark avatar icyleaf avatar jens0512 avatar jwaldrip avatar kediboregi avatar maiha avatar migeorge avatar mrsorcus avatar msa7 avatar nathanj avatar noahlh avatar robacarp avatar rvlieshout avatar smd686s avatar thellior avatar veelenga avatar zaidakram avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.