Class: Suspenders::Staging::PullRequestsGenerator

Inherits:
Generators::Base
  • Object
show all
Defined in:
lib/suspenders/generators/staging/pull_requests_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#configure_heroku_staging_pr_pipeline_hostObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/suspenders/generators/staging/pull_requests_generator.rb', line 6

def configure_heroku_staging_pr_pipeline_host
  config = <<-RUBY

  if ENV.fetch('HEROKU_APP_NAME', '').include?('staging-pr-')
    ENV['APPLICATION_HOST'] = ENV['HEROKU_APP_NAME'] + '.herokuapp.com'
    ENV['ASSET_HOST'] = ENV['HEROKU_APP_NAME'] + '.herokuapp.com'
  end
  RUBY

  inject_into_file(
    "config/environments/production.rb",
    config,
    after: "Rails.application.configure do\n",
  )
end

#create_review_apps_setup_scriptObject



22
23
24
25
26
27
28
29
30
# File 'lib/suspenders/generators/staging/pull_requests_generator.rb', line 22

def create_review_apps_setup_script
  template(
    "bin_setup_review_app.erb",
    "bin/setup_review_app",
    force: true,
  )

  run "chmod a+x bin/setup_review_app"
end