#!/usr/bin/env ruby require 'fileutils' extend FileUtils system 'bin/rails g scaffold Post title body' system 'bin/rails db:migrate' mkdir_p 'sandbox/app/overrides' File.write 'sandbox/app/views/posts/_haml_partial.html.haml', <<~HAML %h2 hello from haml HAML File.write 'sandbox/app/views/posts/_slim_partial.html.slim', <<~SLIM h2 hello from slim SLIM File.write 'sandbox/app/views/posts/_haml_defaced_partial.html.haml', <<~HAML %h3 hello from defaced haml HAML File.write 'sandbox/app/views/posts/_slim_defaced_partial.html.slim', <<~SLIM h3 hello from defaced slim SLIM File.write 'sandbox/app/overrides/improved_posts.rb', <<~RUBY Deface::Override.new( virtual_path: "posts/show", name: "sparkling_post_title", replace: 'p:nth-child(2)', text: "

✨<%= @post.title %>✨

" ) Deface::Override.new( virtual_path: "posts/show", name: "modern_style_post_body", replace: 'p:nth-child(3)', text: "

<%= @post.body %>

" ) Deface::Override.new( virtual_path: "posts/index", name: "sparkling_posts_title", replace: 'tr td:first-child', text: "✨<%= post.title %>✨" ) Deface::Override.new( virtual_path: "posts/index", name: "modern_style_post_body", replace: 'tr td:nth-child(2)', text: "<%= post.body %>" ) Deface::Override.new( virtual_path: "posts/index", name: "haml_and_slim_partials", insert_before: 'table', text: "
<%= render 'haml_partial' %><%= render 'slim_partial' %>
<%= render 'haml_defaced_partial' %><%= render 'slim_defaced_partial' %>
" ) Deface::Override.new( virtual_path: "posts/_haml_defaced_partial", name: "haml_deface", insert_before: 'h3', text: "

HAML subtitle

" ) Deface::Override.new( virtual_path: "posts/_slim_defaced_partial", name: "slim_deface", insert_before: 'h3', text: "

SLIM subtitle

" ) RUBY File.write 'sandbox/config/routes.rb', <<~RUBY Rails.application.routes.draw do resources :posts root to: "posts#index" end RUBY system "bin/rails", "runner", "Post.create(title: 'Foo', body: 'Bar '*10)" system "bin/rails", "runner", "Post.create(title: 'Baz', body: 'Boz '*10)"