Rails-Data-Modeller is a Ruby gem which generates Rails application components, such as models, migrations, controllers. The input data are set as YAML-files.
The project can be installed as a gem, to provide its methods to another application. To do so just include the gem in the Gemfile
:
gem 'rails-data-modeller', git: 'https://github.com/ilkon/rails-data-modeller'
and run bundle install
.
For handy access to gem's tasks add the following code at the end of project's Rakefile
:
require 'data_modeller'
require 'data_modeller/tasks'
::DataModeller::Config.setup_logger
That's it.
To generate parts of a new Rails application run the following task:
rake data_modeller:generate[source_path,dest_path]
The task parameters are:
source_path
-- path to a folder with config-files. When omitted, default value is used: ./data/sample/input.dest_path
-- path to a folder with a new Rails application where generated files will be written to. Default value: ./tmp.
The project can be used as a standalone application. Just fetch it by git clone
command and run bundle install
to make sure all required libraries for the project are installed.
Available rake tasks are the same as when installed as a gem.
The project uses Rubocop for static code analysis. It can run either from command line as rubocop
, or as pre-commit git hook (recommended). When running as a pre-commit hook it checks added or modified files for coding standard compliance, and if problem found cancels the commit.
To install git-hook locally just launch the installation script:
./script/install-git-hooks.sh
To test generators simply run the command
rspec
It reads config-files from ./data/sample/input
folder, generates application component files and compares them with files from ./data/sample/output
folder.