Sha256: 15ea629a2573ad90c8005ec359a90a3f6e0706cd7982b2d1c43c868ed9b573b0

Contents?: true

Size: 1.62 KB

Versions: 17

Compression:

Stored size: 1.62 KB

Contents

module Praxis

  module BootloaderStages

    class Environment < Stage

      # require environment files. we will require 2 files:
      # 1) the environment.rb file    - generic stuff for all environments
      # 2) "Deployer.environment".rb  - environment specific stuff
      def execute
        setup_initial_config!

        env_file = application.root + "config/environment.rb"
        require env_file if File.exists? env_file

        unless application.file_layout
          setup_default_layout!
        end
      end

      def setup_default_layout!
        application.layout do
          layout do
            map :initializers, 'config/initializers/**/*'
            map :lib, 'lib/**/*'
            map :design, 'design/' do
              map :api, 'api.rb'
              map :media_types, '**/media_types/**/*'
              map :resources, '**/resources/**/*'
            end
            map :app, 'app/' do
              map :models, 'models/**/*'
              map :controllers, '**/controllers/**/*'
              map :responses, '**/responses/**/*'
            end
          end
        end
      end

      # TODO: not really sure I like this here... but where else is better?
      def setup_initial_config!
        application.config do
          attribute :praxis do
            attribute :validate_responses, Attributor::Boolean, default: false
            attribute :validate_response_bodies, Attributor::Boolean, default: false

            attribute :show_exceptions, Attributor::Boolean, default: false
            attribute :x_cascade, Attributor::Boolean, default: true
          end
        end
      end

    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
praxis-2.0.pre.9 lib/praxis/bootloader_stages/environment.rb
praxis-2.0.pre.8 lib/praxis/bootloader_stages/environment.rb
praxis-2.0.pre.7 lib/praxis/bootloader_stages/environment.rb
praxis-2.0.pre.6 lib/praxis/bootloader_stages/environment.rb
praxis-2.0.pre.5 lib/praxis/bootloader_stages/environment.rb
praxis-2.0.pre.4 lib/praxis/bootloader_stages/environment.rb
praxis-2.0.pre.3 lib/praxis/bootloader_stages/environment.rb
praxis-2.0.pre.2 lib/praxis/bootloader_stages/environment.rb
praxis-2.0.pre.1 lib/praxis/bootloader_stages/environment.rb
praxis-0.21 lib/praxis/bootloader_stages/environment.rb
praxis-0.20.1 lib/praxis/bootloader_stages/environment.rb
praxis-0.20.0 lib/praxis/bootloader_stages/environment.rb
praxis-0.19.0 lib/praxis/bootloader_stages/environment.rb
praxis-0.18.1 lib/praxis/bootloader_stages/environment.rb
praxis-0.18.0 lib/praxis/bootloader_stages/environment.rb
praxis-0.17.1 lib/praxis/bootloader_stages/environment.rb
praxis-0.17.0 lib/praxis/bootloader_stages/environment.rb