ezdev - D4uS1/ez-on-rails GitHub Wiki
ezdev - generator
This generator provides configuration files to develop your application without mess. This includes files for CI/CD (currently only gitlab), testing or linting the application etc.
rails generate ez_on_rails:ezdev My-Application-Name
Tipp: We suggest to work in Docker using compose. The necessary configuration files to do so are not delivered by ezdev, because this is just a suggestion. Look at the following section Tipp: Using Docker to get the sggested Docker and compose files.
The following steps are executed by the genrator
1. Copy configuration files
- The following files will be copied
- .rspec
- .rspec.gitlab-ci
- .rubocop.yml
- config/database.gitlab-ci.yml'
- config/database.example.yml
- config/database.yml
- .gitlab-ci.yml
As you can see the generator places the necessary files to run the gitlab-ci, gives you a database.yml example file and adds some suggested rubocop config.
2. Inject dependencies into Gemfile
- The dependencies to run the tests and linter are injected
3. Inject gitignore data
- The files that should not be submitted are injected, this includes the database.yml etc., because you dont know in what environments your mates are developing ;)
Tipp: Using Docker
If you want to user docker for your development environment you can use the following files. Just replace the My-Application-Name occurences with the name of your application you already used in the ezdev generator.
Dockerfile
FROM ruby:3.0.2
RUN apt-get update -qq && apt-get install -y build-essential
RUN apt-get install -y vim
RUN mkdir /My-Application-Name
WORKDIR /My-Application-Name
COPY . /My-Application-Name
RUN bundle install
docker-compose.yml:
version: '3.8'
services:
db:
image: postgres
volumes:
- ./tmp/db:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
web:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- .:/My-Application-Name
ports:
- "3000:3000"
depends_on:
- db