https://github.com/nimblehq/nimble-survey-web
Nimble Survey API for Mobile Challenge and Certification
https://github.com/nimblehq/nimble-survey-web
ruby ruby-on-rails
Last synced: 5 months ago
JSON representation
Nimble Survey API for Mobile Challenge and Certification
- Host: GitHub
- URL: https://github.com/nimblehq/nimble-survey-web
- Owner: nimblehq
- Created: 2020-07-15T10:31:49.000Z (almost 6 years ago)
- Default Branch: develop
- Last Pushed: 2024-04-12T07:31:48.000Z (about 2 years ago)
- Last Synced: 2025-11-11T20:41:35.536Z (8 months ago)
- Topics: ruby, ruby-on-rails
- Language: Ruby
- Size: 1.69 MB
- Stars: 0
- Watchers: 29
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Introduction
> A simple survey API
## Project Setup
### Prerequisites
[](https://www.ruby-lang.org/en/news/2023/03/30/ruby-3-2-2-released/)
[](https://nodejs.org/download/release/v18.15.0/)
[](https://www.docker.com/products/docker-desktop/)
### Development
- Install dependencies:
```sh
make install-dependencies
```
- Set up the environment:
```sh
make env/setup
```
- Start the dev server:
```sh
make dev
```
## Tests
### Docker-based tests on the CI server
Add the following build settings to run the tests in the Docker environment via Docker Compose (configuration in `docker-compose.test.yml`):
- Configure the environment variable `BRANCH_TAG` to tag Docker images per branch:
```sh
export BRANCH_TAG=$CI_BRANCH_ID
```
Each branch needs to have its own Docker image to avoid build settings disparities and leverage Docker image caching.
> BRANCH_TAG must not contain special characters (`/`) to be valid. So using $BRANCH_NAME will not work e.g. chore/setup-docker.
> An alternative is to use a unique identifier such as PR_ID or BRANCH_ID on the CI server.
- Pull the latest version the Docker image for the branch:
```sh
docker pull $DOCKER_IMAGE:$BRANCH_TAG || true
```
On each build, the CI environment does not contain yet a cached version of the image. Therefore, it is required to pull
it first to leverage the `cache_from` settings of Docker Compose which avoids rebuilding the whole Docker image on subsequent test builds.
- Build the Docker image:
```sh
docker-compose -f docker-compose.test.yml build
```
Upon the first build, the whole Docker image is built from the ground up and tagged using `$BRANCH_TAG`.
- Push the latest version of the Docker image for this branch:
```sh
docker push $DOCKER_IMAGE:$BRANCH_TAG
```
- Setup the test database:
```sh
docker-compose -f docker-compose.test.yml run test bin/bundle exec rake db:test:prepare
```
### Test
- Run all tests:
```sh
make test
```
- Run a specific test:
```sh
make test [rspec-params]
```
### Automated Code Review Setup
- Add a bot to this repository or to the organization. The bot requires permission level “Write” to be able to set a PR’s status
- Create a token from bot account with `public_repo` scope, and use it to create a `DANGER_GITHUB_API_TOKEN` secret on this repository
## SVG Icons
- Install the [SVGO](https://github.com/svg/svgo) as global (if you din't install it)
yarn global add svgo
- We place the icons in `/app/assets/images/icons` and use [Svgeez](https://github.com/jgarber623/svgeez) to generate icon sprite
- To generate icon sprite:
bin/svg-sprite
- To use the icon we use `svg_tag` provided in `SvgHelper` and provided `icon_id` matched with icon file name with prefix `icon-`:
svg_tag icon_id: 'icon-[icon-file-name]', html: {}