Sha256: 1cf1f643620765d1b066ece82ea52d8f1f926c7b9ac99f77f78e1d81447e007a

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

module UnderConstruction
  module Generators
    APPLICATION_CONFIG_TXT = <<-EOM

  # Editing UnderConstruction block causes it's clear generator to not work
  before_filter :redirect_to_under_construction

  # Will redirect all requests to under construction page
  def redirect_to_under_construction
    if request.host_with_port == UnderConstruction.config.host_name
      unless request.url =~ /(under_construction|email_storage)/
        redirect_to under_construction_index_path
      end
    end
  end
  EOM

    ROUTES_CONFIG_TXT = <<-EOM

  # generated by under_construction gem
  resources 'under_construction_email_storage', only: :create
  resources 'under_construction', only: :index
  EOM

    if ::Rails::VERSION::MAJOR >= 4
      ROUTES_REDIRECT_TO_TXT = <<-EOM

  # generated by under_construction gem
  match "/*other" => redirect("/under_construction"), via: :all
  EOM
    else
      ROUTES_REDIRECT_TO_TXT = <<-EOM

  # generated by under_construction gem
  match "/*other" => redirect("/under_construction")
  EOM
    end

    if ::Rails::VERSION::MAJOR >= 4
      ROUTES_CLEAR_TXT = <<-EOM

  # generated by under_construction gem
  match "under_construction", :to => redirect('/'), via: :all
  EOM
    else
      ROUTES_CLEAR_TXT = <<-EOM

  # generated by under_construction gem
  match "under_construction", :to => redirect('/')
  EOM
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
under_construction-0.2.2 lib/generators/under_construction/constants.rb
under_construction-0.2.1 lib/generators/under_construction/constants.rb