Sha256: 4384619aebaa93c8117f5c5a0abca04488da8559534eed359cb608463da8e306

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

# A framework for building reusable, testable & encapsulated view components in Ruby on Rails.
#
# exe/rag addons/view_component

self.local_template_path = File.dirname(__FILE__)

gac 'base rails 7 image created'

prepare_environment

after_bundle do
  create_db
  scaffolds
  setup_customizations
  migrate_db
end

def scaffolds
  # add_scaffold('post', 'title', 'body:text', 'user:references')
  # add_scaffold('people', 'first_name', 'last_name', 'age:integer', 'address:text')
  # add_scaffold('product', 'name', 'price:integer')
end

def setup_customizations
  route("root 'home#index'")

  force_copy

  add_controller('home', 'index', 'partial', 'component')

  directory "app/components"
  directory "app/controllers"
  directory "app/helpers"
  directory "app/models"
  directory "app/views"
  template  'app/views/layouts/application.html.erb'        , 'app/views/layouts/application.html.erb'
  directory "app/services"
end

def create_db
  # uncomment this if you need custom configuration in database.yml
  # gsub_file('config/database.yml', '  encoding: unicode', db_development_settings)
  db(drop: true, create: true)
end

def migrate_db
  db(migrate: true)
end

def db_development_settings
  <<-'RUBY'
  encoding: unicode
  host: 127.0.0.1
  username: printspeak
  password: printspeak
  RUBY
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 after_templates/addons/view_component/_.rb