template.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. current_path = File.expand_path(File.dirname(__FILE__))
  2. # Add Devise to Gemfile
  3. gem "devise", "~> 4.2.1"
  4. gem "bootstrap-sass", "~> 3.3.6"
  5. # Install Devise
  6. rails_command "generate devise:install"
  7. # Configure Devise
  8. environment "config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }",
  9. env: 'development'
  10. route "root to: 'home#index'"
  11. # Devise notices are installed via Bootstrap
  12. rails_command "generate devise:views User"
  13. # Create Devise User
  14. generate :devise, "User",
  15. "first_name",
  16. "last_name",
  17. "announcements_last_read_at:datetime"
  18. # Rename Application SCSS
  19. run "mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss"
  20. # Insert Bootstrap Styling
  21. insert_into_file(
  22. "app/assets/stylesheets/application.scss",
  23. "@import 'bootstrap-sprockets';\n@import 'bootstrap'\n",
  24. before: "/*"
  25. )
  26. # Import Templates
  27. run "cp #{current_path}/views/layouts/application.html.erb app/views/layouts/application.html.erb"
  28. run "cp -R #{current_path}/views/shared app/views/shared"
  29. # Migrate
  30. rails_command "db:migrate"
  31. after_bundle do
  32. git :init
  33. git add: "."
  34. git commit: %Q{ -m 'Initial commit' }
  35. end