Module: HerokuErrorPages

Defined in:
lib/heroku_error_pages.rb,
lib/heroku_error_pages/config.rb,
lib/heroku_error_pages/railtie.rb,
lib/heroku_error_pages/version.rb,
lib/heroku_error_pages/renderer.rb,
lib/heroku_error_pages/page_config.rb,
lib/heroku_error_pages/public_asset.rb

Defined Under Namespace

Classes: Config, PageConfig, PublicAsset, Railtie, Renderer

Constant Summary collapse

S3_PREFIX =
"heroku_error_pages"
ERROR_PAGE =
"error_page.html"
MAINTENANCE_PAGE =
"maintenance_page.html"
VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.configObject



17
18
19
# File 'lib/heroku_error_pages.rb', line 17

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



21
22
23
# File 'lib/heroku_error_pages.rb', line 21

def configure
  yield config
end

.deployObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/heroku_error_pages.rb', line 25

def deploy
  raise "No custom pages were configured" unless config.error_page || config.maintenance_page

  s3_client = Aws::S3::Client.new(
    credentials: Aws::Credentials.new(
      config.aws_access_key_id,
      config.aws_secret_access_key
    ),
    region: config.aws_region
  )

  deploy_page(config.error_page, s3_client, "error_page.html")
  deploy_page(config.maintenance_page, s3_client, "maintenance_page.html")
  deploy_public_assets(s3_client)
end