Created
July 6, 2011 22:03
-
-
Save wbzyl/1068461 to your computer and use it in GitHub Desktop.
An example of Rails template file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_file 'README' | |
create_file "README.md" do | |
"# Fortunka\n\nTODO" | |
end | |
remove_file "public/index.html" | |
gem "simple_form" | |
generate "simple_form:install" | |
generate :scaffold, "fortune body:text" | |
rake "db:migrate" | |
route "resources :fortunes" | |
route "root :to => 'fortunes#index'" | |
gsub_file "app/views/layouts/application.html.erb", /<body/ do |match| | |
match << " class='fortunes'" | |
end | |
gsub_file "app/assets/stylesheets/fortunes.css.scss", /Then, place scoped styles here.\s*\n/ do |match| | |
match.concat <<CSS | |
width: 640px; | |
margin: 1em auto; | |
padding: 1em 1em 2em 1em; | |
border: 1px solid black; | |
font-size: 16px; | |
line-height: 22px; | |
CSS | |
end | |
append_to_file "app/assets/stylesheets/fortunes.css.scss" do | |
background_color = ask("What is your preferred CSS background color?") | |
<<CSS | |
html { | |
background-color: #{background_color}; | |
} | |
CSS | |
end | |
git :init | |
git :add => "." | |
git :commit => "-a -m 'Pierwsza wrzutka'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful stuff. Copied from a RailsWizard.org recipe.
RDoc: