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:
sedawkgem(usually a part ofruby)git
-
The script runs a regular
rails newcommand, using some pre-configurations from.rails.rcconfig-file andtemplate.rbtemplate. Then it adds / overwrites the app files with the files fromrails/srcfolder. -
After that the script asks the user about desired app configuration, such as:
- the database to use (
PostgreSQLas default orMySQL) - to use
sidekiqgem for background job processing - to use
shrinegem for file upload processing - to use
rails-data-modellergem as a generator for models/migrations - etc.
In case of positive answer script adds files from
srcsubfolder of corresponding option, and use files from subfoldersubsfor substituting params in the app config files. - the database to use (
-
Next, the script installs
rubocopgem and runs it with auto-correcting option, to fix all the offences. -
Finally, it initializes the local
gitrepository, installs pre-commit hook and exits.
Note: the command
bundle installis 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.