Skip to content

Instantly share code, notes, and snippets.

@yohfee
Last active July 15, 2021 23:49
Show Gist options
  • Save yohfee/630e36781c6577b9e9e109a7019f0d2f to your computer and use it in GitHub Desktop.
Save yohfee/630e36781c6577b9e9e109a7019f0d2f to your computer and use it in GitHub Desktop.
# rails new your_kuroko2_application --database=mysql --skip-turbolinks --skip-javascript -m https://gist.githubusercontent.com/yohfee/630e36781c6577b9e9e109a7019f0d2f/raw/2c34d3e15fa4cae3f4228edd1039305f52f83b7c/kuroko2_app_template.rb
gsub_file 'Gemfile', /^gem 'turbolinks'.+/, ""
gsub_file 'Gemfile', /^gem 'jbuilder'.+/, ""
gsub_file 'Gemfile', /^gem 'jquery-rails'.+/, ""
gsub_file 'Gemfile', /^gem 'coffee-rails'.+/, ""
gsub_file 'config/database.yml', "encoding: utf8", "encoding: utf8mb4"
gsub_file 'config/database.yml', "host: localhost", "host: 127.0.0.1"
gem 'kuroko2', github: 'yohfee/kuroko2', branch: 'sign_in_with_azure'
gem_group :development do
gem 'foreman'
end
route 'mount Kuroko2::Engine => "/"'
create_file "config/kuroko2.yml", <<-EOF
default: &default
url: 'http://localhost:3000'
action_mailer:
delivery_method: 'test'
execution_logger:
type: 'Void'
custom_tasks:
# custom_task1: 'CustomTask1'
notifiers:
mail:
mail_from: 'Kuroko2 <no-reply@example.com>'
mail_to: "kuroko@example.com"
slack:
webhook_url: 'https://localhost/test/slack'
hipchat:
api_token: 'token'
options:
# api_version: 'v2'
# server_url: 'https://api.example.com'
webhook:
secret_token: '<%= ENV["WEBHOOK_SECRET_TOKEN"] %>'
api_basic_authentication_applications:
test_client_name: 'secret_key'
app_authentication:
google_oauth2:
client_id: '<%= ENV["GOOGLE_CLIENT_ID"] %>'
client_secret: '<%= ENV["GOOGLE_CLIENT_SECRET"] %>'
options:
hd: '<%= ENV["GOOGLE_HOSTED_DOMAIN"] %>'
azure_oauth2:
client_id: '<%= ENV["AZURE_CLIENT_ID"] %>'
client_secret: '<%= ENV["AZURE_CLIENT_SECRET"] %>'
tenant_id: '<%= ENV["AZURE_TENANT_ID"] %>'
extensions:
# controller:
# - DummyExtension
development:
<<: *default
test:
<<: *default
production:
<<: *default
url: 'https://kuroko2.example.com'
# action_mailer:
# delivery_method: 'smtp'
# smtp_settings:
# address: ''
# port: 25
# domain: ''
# execution_logger:
# type: 'CloudWatchLogs'
# option:
# group_name: 'kuroko2'
EOF
create_file "Procfile", <<-EOF
rails: ./bin/rails s -p 3000
executor: ./bin/rails runner Kuroko2::Servers::CommandExecutor.new.run
scheduler: ./bin/rails runner Kuroko2::Servers::JobScheduler.new.run
processor: ./bin/rails runner Kuroko2::Servers::WorkflowProcessor.new.run
EOF
inject_into_file "app/assets/config/manifest.js", after: "//= link_directory ../stylesheets .css\n" do
"//= link kuroko2_manifest.js"
end
run 'bundle install'
rake 'kuroko2:install:migrations'
rake 'db:create'
rake 'db:migrate'
say <<-SAY
============================================================================
Kuroko2 application is now installed and mounts at '/'
============================================================================
SAY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment