Sha256: 9f91c0bd15195cacd8f4fc68d67d67ec0f4932d2ec11717b700e6d59e67eef19

Contents?: true

Size: 804 Bytes

Versions: 2

Compression:

Stored size: 804 Bytes

Contents

module Stairs
  class InteractiveConfiguration < Stairs::Step
    title "Configuration"
    description "Interactive prompt for configuring Stairs"

    def run!
      adapter_class = Stairs::EnvAdapters.recommended_adapter
      adapter_name = Stairs::EnvAdapters.name_for_adapter_class(adapter_class)

      choice "Looks like you're using #{adapter_name} to manage environment variables. Is this correct?" do |yes|
        if yes
          Stairs.configuration.env_adapter = adapter_class.new
        else
          choice "Which would you prefer?", Stairs::EnvAdapters::ADAPTERS.map { |n,_a| n.to_s } do |name|
            adapter_class = Stairs::EnvAdapters::ADAPTERS[name.to_sym]
            Stairs.configuration.env_adapter = adapter_class.new
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stairs-0.3.0 lib/stairs/interactive_configuration.rb
stairs-0.2.0 lib/stairs/interactive_configuration.rb