Sha256: 27607fa20a36a4a0523cd01bcbb6347e84d04cb8a68d69e64732cb901e793e38

Contents?: true

Size: 735 Bytes

Versions: 14

Compression:

Stored size: 735 Bytes

Contents

class SetupController < ApplicationController
  before_filter :require_local!
  layout :false

  def index
    @env = File.read( File.join( Rails.root, ".env" ) )
    @docs = files
  end
  
  protected

  def require_local!
    unless local_request?
      redirect_to root_url, error: "This information is only available to local requests"
    end
  end

  def local_request?
    Rails.application.config.consider_all_requests_local || request.local?
  end

  def files
    docs = Dir.glob(File.join( Rails.root, "docs/README.*" )).collect do |file|
      name = file.gsub( /.*README.\d\d./, "happy_seed:" ).gsub( /.rdoc/, "" )
      html = RDiscount.new( File.read( file ) ).to_html
      { name: name, html: html }
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
happy_seed-0.0.19 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.18 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.17 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.16 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.15 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.14 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.13 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.12 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.11 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.10 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.9 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.8 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.7 lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb
happy_seed-0.0.6 lib/generators/happy_seed/foreman/templates/app/controllers/setup_controller.rb