template.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. def source_paths
  2. [File.expand_path(File.dirname(__FILE__))]
  3. end
  4. def add_users
  5. # Gemfile
  6. gem 'devise', '~> 4.2.1'
  7. # Install Devise
  8. rails_command "generate devise:install"
  9. # Configure Devise
  10. environment "config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }",
  11. env: 'development'
  12. route "root to: 'home#index'"
  13. # Devise notices are installed via Bootstrap
  14. rails_command "generate devise:views User"
  15. # Create Devise User
  16. generate :devise, "User",
  17. "first_name",
  18. "last_name",
  19. "announcements_last_read_at:datetime"
  20. end
  21. def add_bootstrap
  22. gem 'bootstrap-sass', '~> 3.3.6'
  23. # Replace Application SCSS
  24. run "rm app/assets/stylesheets/application.css"
  25. end
  26. def copy_templates
  27. directory "app", force: true
  28. end
  29. def add_webpack
  30. gem 'webpacker', '~> 1.1'
  31. rails_command 'webpacker:install'
  32. end
  33. def add_sidekiq
  34. gem 'sidekiq', '~> 5.0'
  35. environment "config.active_job.queue_adapter = :sidekiq"
  36. end
  37. def add_foreman
  38. gem 'foreman', '~> 0.84.0'
  39. copy_file "Procfile"
  40. end
  41. # Main setup
  42. add_users
  43. add_bootstrap
  44. copy_templates
  45. add_sidekiq
  46. add_foreman
  47. add_webpack
  48. # Migrate
  49. rails_command "db:create"
  50. rails_command "db:migrate"
  51. after_bundle do
  52. git :init
  53. git add: "."
  54. git commit: %Q{ -m 'Initial commit' }
  55. end