gem 'administrate'
run 'bundle install'
run 'DISABLE_SPRING=true rails g administrate:install'
helper = <<-RUBY # Expose our application's helpers to Administrate config.to_prepare do Administrate::ApplicationController.helper #{Rails.application.class.module_parent_name.camelize}::Application.helpers end RUBY
environment helper + "\n" append_to_file "app/assets/config/manifest.js", "//= link administrate/application.css\n//= link administrate/application.js"
gsub_file 'app/controllers/admin/application_controller.rb', /# TODO Add authentication logic here\./, "redirect_to '/', alert: 'Not authorized.' unless user_signed_in? && current_user.admin?"