Sha256: 9d7423ec26a9ddcbe5cedd6227e62b9b10ff99b02519f1c691edc65f85c0d8f9
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# Generate files and directories from an application model file. Afterwards do # any setup left necessary (e.g. updating the database). # The application model transformation is split into two parts: # 1) parse the model into an object-based representation # 2) render the parsed model into code require 'katapult/parser' module Katapult class TransformGenerator < Rails::Generators::Base desc 'Transform the katapult application model' argument :path, required: true, type: :string, description: 'The path to the application model file' def transform_application_model say_status :parse, path @app_model = Katapult::Parser.new.parse(path) say_status :render, "into #{application_name}" @app_model.render end def write_root_route root_wui = @app_model.wuis.find do |wui| wui.find_action :index end route "root '#{ root_wui.model_name(:variables) }#index'" if root_wui end def migrate run 'bin/rake db:drop:all &> /dev/null' run 'bin/rake db:create db:migrate RAILS_ENV=development' run 'bin/rake db:create db:migrate RAILS_ENV=test' end def print_instructions puts <<-INSTRUCTIONS.strip_heredoc You're done! Now boot up your development server (e.g. with `rails server`) and try your kickstarted application in the browser. INSTRUCTIONS end private def application_name File.basename(Dir.pwd) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
katapult-0.1.1 | lib/generators/katapult/transform/transform_generator.rb |