This template serves as the base for every Rails project.
Run create PROJECT_PATH
and it will generate a Rails project with all of our common gems and configurations.
The script is written on bash, so bash
(or its replacement) should be installed. The script calls multiple commands that need to be installed as well:
sed
awk
gem
(usually a part ofruby
)git
-
The script runs a regular
rails new
command, using some pre-configurations from.rails.rc
config-file andtemplate.rb
template. Then it adds / overwrites the app files with the files fromrails/src
folder. -
After that the script asks the user about desired app configuration, such as:
- the database to use (
PostgreSQL
as default orMySQL
) - to use
sidekiq
gem for background job processing - to use
shrine
gem for file upload processing - to use
rails-data-modeller
gem as a generator for models/migrations - etc.
In case of positive answer script adds files from
src
subfolder of corresponding option, and use files from subfoldersubs
for substituting params in the app config files. - the database to use (
-
Next, the script installs
rubocop
gem and runs it with auto-correcting option, to fix all the offences. -
Finally, it initializes the local
git
repository, installs pre-commit hook and exits.
Note: the command
bundle install
is not a part of this script, because of:
- it may fail if some packages are not installed in the target sustem (for example, some database-related packages)
- it may require installing target version of Ruby first and / or gemset (in case of using RVM)
User needs to run this command individually.