Sbidu Generators
Use the generators provided by Sbidu to create sbidu applications fast.
Create a Rails App
In order to use the generator you need to first create a blank rails application to run this generator
rails new demo-site.com -T -d mysql --skip-bundle
cd demo-site.com
Add sbidu_generators to Gemfile
Add this line to your application's Gemfile:
gem 'sbidu_generators'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sbidu_generators
Setup Generator
Run the generator script for setup
This will add necessary files like .gitignore, Dockerfile, docker-compose.yml, database.yml template etc to the current project
The only argument it requires is the application name.
$ rails g sbidu_generators:setup demo-site.com
It will also mount the required engines (pattana, usman & dhatu) to the config/routes.rb
Rails.application.routes.draw do
mount Pattana::Engine => "/"
mount Usman::Engine => "/"
mount Dhatu::Engine => "/"
end
Do bundle again as the above command had changed the Gemfile. You might want to delete Gemfile.lock if you run into errors like compatible issues
$ rm Gemfile.lock
$ bundle
Create Database, Copy and Run Migrations
rails railties:install:migrations
rails db:create db:migrate
rails db:migrate RAILS_ENV=test
Import Data
bundle exec rails import:data:all
You can also insert some dummy data (seed data) if you want.
bundle exec rails import:data:dummy:all
License
The gem is available as open source under the terms of the MIT License.
Setup.sh
Alternatevely you could make use of the shell script to run all these and create a rails application ready to launch with minimal template.
You need to download the setup.sh from this repository to your working directory
Then make it executable
$ chmod +x setup.sh
Run the script to create a sbidu rails app where app_name.com is the domain name (a convention followed at sbidu)
$ ./setup.sh app_name.com
Go to the app directory
$ cd app_name.com
Run the generator to copy all website related scripts
$ rails g sbidu_generators:website app_name.com