|
@@ -13,7 +13,7 @@ def add_template_repository_to_source_path
|
|
|
at_exit { FileUtils.remove_entry(tempdir) }
|
|
|
git clone: [
|
|
|
"--quiet",
|
|
|
- "http://gogs.anxgang.com/Hiskio/jumpstart.git",
|
|
|
+ "https://github.com/excid3/jumpstart.git",
|
|
|
tempdir
|
|
|
].map(&:shellescape).join(" ")
|
|
|
|
|
@@ -26,19 +26,27 @@ def add_template_repository_to_source_path
|
|
|
end
|
|
|
|
|
|
def add_gems
|
|
|
+ gem 'administrate', '~> 0.10.0'
|
|
|
gem 'bootstrap', '~> 4.1', '>= 4.1.1'
|
|
|
- gem 'devise', '~> 4.5', '>= 4.4.3'
|
|
|
+ gem 'data-confirm-modal', '~> 1.6', '>= 1.6.2'
|
|
|
+ gem 'devise', '~> 4.4', '>= 4.4.3'
|
|
|
gem 'devise-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4'
|
|
|
+ gem 'devise_masquerade', '~> 0.6.2'
|
|
|
gem 'font-awesome-sass', '~> 5.0', '>= 5.0.13'
|
|
|
+ gem 'foreman', '~> 0.84.0'
|
|
|
+ gem 'friendly_id', '~> 5.2', '>= 5.2.4'
|
|
|
gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
|
|
|
gem 'jquery-rails', '~> 4.3.1'
|
|
|
+ gem 'local_time', '~> 2.0', '>= 2.0.1'
|
|
|
gem 'mini_magick', '~> 4.8'
|
|
|
+ gem 'name_of_person', '~> 1.0'
|
|
|
gem 'omniauth-facebook', '~> 5.0'
|
|
|
gem 'omniauth-github', '~> 1.3'
|
|
|
gem 'omniauth-twitter', '~> 1.4'
|
|
|
gem 'sidekiq', '~> 5.1', '>= 5.1.3'
|
|
|
+ gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
|
|
|
gem 'webpacker', '~> 3.5', '>= 3.5.3'
|
|
|
- gem 'procodile', '~> 1.0', '>= 1.0.16'
|
|
|
+ gem 'whenever', require: false
|
|
|
end
|
|
|
|
|
|
def set_application_name
|
|
@@ -82,6 +90,9 @@ def add_users
|
|
|
/ # config.secret_key = .+/,
|
|
|
" config.secret_key = Rails.application.credentials.secret_key_base"
|
|
|
end
|
|
|
+
|
|
|
+ # Add Devise masqueradable to users
|
|
|
+ inject_into_file("app/models/user.rb", "omniauthable, :masqueradable, :", after: "devise :")
|
|
|
end
|
|
|
|
|
|
def add_bootstrap
|
|
@@ -107,7 +118,6 @@ end
|
|
|
|
|
|
def add_webpack
|
|
|
rails_command 'webpacker:install'
|
|
|
- # rails_command 'webpacker:install:stimulus'
|
|
|
end
|
|
|
|
|
|
def add_sidekiq
|
|
@@ -122,10 +132,50 @@ def add_sidekiq
|
|
|
after: "Rails.application.routes.draw do\n"
|
|
|
end
|
|
|
|
|
|
-def add_procodile
|
|
|
+def add_foreman
|
|
|
copy_file "Procfile"
|
|
|
end
|
|
|
|
|
|
+def add_announcements
|
|
|
+ generate "model Announcement published_at:datetime announcement_type name description:text"
|
|
|
+ route "resources :announcements, only: [:index]"
|
|
|
+end
|
|
|
+
|
|
|
+def add_notifications
|
|
|
+ generate "model Notification recipient_id:integer actor_id:integer read_at:datetime action:string notifiable_id:integer notifiable_type:string"
|
|
|
+ route "resources :notifications, only: [:index]"
|
|
|
+end
|
|
|
+
|
|
|
+def add_administrate
|
|
|
+ generate "administrate:install"
|
|
|
+
|
|
|
+ gsub_file "app/dashboards/announcement_dashboard.rb",
|
|
|
+ /announcement_type: Field::String/,
|
|
|
+ "announcement_type: Field::Select.with_options(collection: Announcement::TYPES)"
|
|
|
+
|
|
|
+ gsub_file "app/dashboards/user_dashboard.rb",
|
|
|
+ /email: Field::String/,
|
|
|
+ "email: Field::String,\n password: Field::String.with_options(searchable: false)"
|
|
|
+
|
|
|
+ gsub_file "app/dashboards/user_dashboard.rb",
|
|
|
+ /FORM_ATTRIBUTES = \[/,
|
|
|
+ "FORM_ATTRIBUTES = [\n :password,"
|
|
|
+
|
|
|
+ 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?"
|
|
|
+end
|
|
|
+
|
|
|
+def add_app_helpers_to_administrate
|
|
|
+ environment do <<-RUBY
|
|
|
+ # Expose our application's helpers to Administrate
|
|
|
+ config.to_prepare do
|
|
|
+ Administrate::ApplicationController.helper #{@app_name.camelize}::Application.helpers
|
|
|
+ end
|
|
|
+ RUBY
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
def add_multiple_authentication
|
|
|
insert_into_file "config/routes.rb",
|
|
|
', controllers: { omniauth_callbacks: "users/omniauth_callbacks" }',
|
|
@@ -151,11 +201,28 @@ def add_multiple_authentication
|
|
|
before: " # ==> Warden configuration"
|
|
|
end
|
|
|
|
|
|
+def add_whenever
|
|
|
+ run "wheneverize ."
|
|
|
+end
|
|
|
+
|
|
|
+def add_friendly_id
|
|
|
+ generate "friendly_id"
|
|
|
+
|
|
|
+ insert_into_file(
|
|
|
+ Dir["db/migrate/**/*friendly_id_slugs.rb"].first,
|
|
|
+ "[5.2]",
|
|
|
+ after: "ActiveRecord::Migration"
|
|
|
+ )
|
|
|
+end
|
|
|
|
|
|
def stop_spring
|
|
|
run "spring stop"
|
|
|
end
|
|
|
|
|
|
+def add_sitemap
|
|
|
+ rails_command "sitemap:install"
|
|
|
+end
|
|
|
+
|
|
|
# Main setup
|
|
|
add_template_repository_to_source_path
|
|
|
|
|
@@ -167,9 +234,12 @@ after_bundle do
|
|
|
add_users
|
|
|
add_bootstrap
|
|
|
add_sidekiq
|
|
|
- add_procodile
|
|
|
+ add_foreman
|
|
|
add_webpack
|
|
|
+ add_announcements
|
|
|
+ add_notifications
|
|
|
add_multiple_authentication
|
|
|
+ add_friendly_id
|
|
|
|
|
|
copy_templates
|
|
|
|
|
@@ -178,6 +248,14 @@ after_bundle do
|
|
|
rails_command "db:migrate"
|
|
|
|
|
|
# Migrations must be done before this
|
|
|
+ add_administrate
|
|
|
+
|
|
|
+ add_app_helpers_to_administrate
|
|
|
+
|
|
|
+ add_whenever
|
|
|
+
|
|
|
+ add_sitemap
|
|
|
+
|
|
|
|
|
|
git :init
|
|
|
git add: "."
|