|
@@ -13,7 +13,7 @@ def add_template_repository_to_source_path
|
|
at_exit { FileUtils.remove_entry(tempdir) }
|
|
at_exit { FileUtils.remove_entry(tempdir) }
|
|
git clone: [
|
|
git clone: [
|
|
"--quiet",
|
|
"--quiet",
|
|
- "http://gogs.anxgang.com/Hiskio/jumpstart.git",
|
|
|
|
|
|
+ "https://github.com/excid3/jumpstart.git",
|
|
tempdir
|
|
tempdir
|
|
].map(&:shellescape).join(" ")
|
|
].map(&:shellescape).join(" ")
|
|
|
|
|
|
@@ -26,19 +26,27 @@ def add_template_repository_to_source_path
|
|
end
|
|
end
|
|
|
|
|
|
def add_gems
|
|
def add_gems
|
|
|
|
+ gem 'administrate', '~> 0.10.0'
|
|
gem 'bootstrap', '~> 4.1', '>= 4.1.1'
|
|
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-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4'
|
|
|
|
+ gem 'devise_masquerade', '~> 0.6.2'
|
|
gem 'font-awesome-sass', '~> 5.0', '>= 5.0.13'
|
|
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 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
|
|
gem 'jquery-rails', '~> 4.3.1'
|
|
gem 'jquery-rails', '~> 4.3.1'
|
|
|
|
+ gem 'local_time', '~> 2.0', '>= 2.0.1'
|
|
gem 'mini_magick', '~> 4.8'
|
|
gem 'mini_magick', '~> 4.8'
|
|
|
|
+ gem 'name_of_person', '~> 1.0'
|
|
gem 'omniauth-facebook', '~> 5.0'
|
|
gem 'omniauth-facebook', '~> 5.0'
|
|
gem 'omniauth-github', '~> 1.3'
|
|
gem 'omniauth-github', '~> 1.3'
|
|
gem 'omniauth-twitter', '~> 1.4'
|
|
gem 'omniauth-twitter', '~> 1.4'
|
|
gem 'sidekiq', '~> 5.1', '>= 5.1.3'
|
|
gem 'sidekiq', '~> 5.1', '>= 5.1.3'
|
|
|
|
+ gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
|
|
gem 'webpacker', '~> 3.5', '>= 3.5.3'
|
|
gem 'webpacker', '~> 3.5', '>= 3.5.3'
|
|
- gem 'procodile', '~> 1.0', '>= 1.0.16'
|
|
|
|
|
|
+ gem 'whenever', require: false
|
|
end
|
|
end
|
|
|
|
|
|
def set_application_name
|
|
def set_application_name
|
|
@@ -82,6 +90,9 @@ def add_users
|
|
/ # config.secret_key = .+/,
|
|
/ # config.secret_key = .+/,
|
|
" config.secret_key = Rails.application.credentials.secret_key_base"
|
|
" config.secret_key = Rails.application.credentials.secret_key_base"
|
|
end
|
|
end
|
|
|
|
+
|
|
|
|
+ # Add Devise masqueradable to users
|
|
|
|
+ inject_into_file("app/models/user.rb", "omniauthable, :masqueradable, :", after: "devise :")
|
|
end
|
|
end
|
|
|
|
|
|
def add_bootstrap
|
|
def add_bootstrap
|
|
@@ -107,7 +118,6 @@ end
|
|
|
|
|
|
def add_webpack
|
|
def add_webpack
|
|
rails_command 'webpacker:install'
|
|
rails_command 'webpacker:install'
|
|
- # rails_command 'webpacker:install:stimulus'
|
|
|
|
end
|
|
end
|
|
|
|
|
|
def add_sidekiq
|
|
def add_sidekiq
|
|
@@ -122,10 +132,50 @@ def add_sidekiq
|
|
after: "Rails.application.routes.draw do\n"
|
|
after: "Rails.application.routes.draw do\n"
|
|
end
|
|
end
|
|
|
|
|
|
-def add_procodile
|
|
|
|
|
|
+def add_foreman
|
|
copy_file "Procfile"
|
|
copy_file "Procfile"
|
|
end
|
|
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
|
|
def add_multiple_authentication
|
|
insert_into_file "config/routes.rb",
|
|
insert_into_file "config/routes.rb",
|
|
', controllers: { omniauth_callbacks: "users/omniauth_callbacks" }',
|
|
', controllers: { omniauth_callbacks: "users/omniauth_callbacks" }',
|
|
@@ -151,11 +201,28 @@ def add_multiple_authentication
|
|
before: " # ==> Warden configuration"
|
|
before: " # ==> Warden configuration"
|
|
end
|
|
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
|
|
def stop_spring
|
|
run "spring stop"
|
|
run "spring stop"
|
|
end
|
|
end
|
|
|
|
|
|
|
|
+def add_sitemap
|
|
|
|
+ rails_command "sitemap:install"
|
|
|
|
+end
|
|
|
|
+
|
|
# Main setup
|
|
# Main setup
|
|
add_template_repository_to_source_path
|
|
add_template_repository_to_source_path
|
|
|
|
|
|
@@ -167,9 +234,12 @@ after_bundle do
|
|
add_users
|
|
add_users
|
|
add_bootstrap
|
|
add_bootstrap
|
|
add_sidekiq
|
|
add_sidekiq
|
|
- add_procodile
|
|
|
|
|
|
+ add_foreman
|
|
add_webpack
|
|
add_webpack
|
|
|
|
+ add_announcements
|
|
|
|
+ add_notifications
|
|
add_multiple_authentication
|
|
add_multiple_authentication
|
|
|
|
+ add_friendly_id
|
|
|
|
|
|
copy_templates
|
|
copy_templates
|
|
|
|
|
|
@@ -178,6 +248,14 @@ after_bundle do
|
|
rails_command "db:migrate"
|
|
rails_command "db:migrate"
|
|
|
|
|
|
# Migrations must be done before this
|
|
# Migrations must be done before this
|
|
|
|
+ add_administrate
|
|
|
|
+
|
|
|
|
+ add_app_helpers_to_administrate
|
|
|
|
+
|
|
|
|
+ add_whenever
|
|
|
|
+
|
|
|
|
+ add_sitemap
|
|
|
|
+
|
|
|
|
|
|
git :init
|
|
git :init
|
|
git add: "."
|
|
git add: "."
|