### Home Classes Methods

### In Files

- lib/chef/solr/solr_installer.rb

### Parent

Object

### Namespace

- MODULE Chef::SolrInstaller::Config::CLI
- CLASS Chef::SolrInstaller::Config::CompatConfig

### Methods

- ::configurable
- ::configurables
- ::default_values
- ::new
- #apply_hash
- #configure_from
- #each_configurable
- #solr_base_path
- #solr_base_path=
- #solr_data_path
- #solr_home_path
- #solr_jetty_path
- #to_hash

### Class/Module Index

Quicksearch

- Chef
- Chef::Solr
- Chef::Solr::Application
- Chef::Solr::Application::Solr
- Chef::SolrInstaller
- Chef::SolrInstaller::Config
- Chef::SolrInstaller::Config::CLI
- Chef::SolrInstaller::Config::CompatConfig

No matching classes.

# Chef::SolrInstaller::Config

### Public Class Methods

configurable(value, default=nil) click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 67
    def self.configurable(value, default=nil)
      configurables << value
      attr_accessor value
      default_values[value] = default if default
    end

configurables() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 63
    def self.configurables
      @configurables ||= []
    end

default_values() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 59
    def self.default_values
      @default_values ||= {}
    end

new() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 130
    def initialize
      apply_hash(self.class.default_values)
    end

### Public Instance Methods

apply_hash(hash) click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 153
    def apply_hash(hash)
      hash.each do |key, value|
        method_for_key = "#{key}=".to_sym
        if respond_to?(method_for_key)
          send(method_for_key, value)
        else
          STDERR.puts("Configuration setting #{key} is unknown and will be ignored")
        end
      end
    end

configure_from(argv) click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 134
    def configure_from(argv)
      cli_config = CLI.parse_options(argv)
      #pp :cli_config => cli_config.to_hash
      config_file_config = CompatConfig.new.from_file(cli_config.config_file).to_hash
      #pp :config_file_config => config_file_config
      apply_hash(config_file_config)
      apply_hash(cli_config.to_hash)
      #pp :combined_config => self.to_hash
      self
    end

each_configurable() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 73
    def each_configurable
      self.class.configurables.each do |config_param|
        yield [config_param, send(config_param)]
      end
    end

solr_base_path() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 84
    def solr_base_path
      @solr_base_path || '/var/chef'
    end

solr_base_path=(base_path) click to toggle source

Sets the solr_base_path. Also resets solr_home_path, solr_jetty_path, and solr_data_path.

    # File lib/chef/solr/solr_installer.rb, line 90
    def solr_base_path=(base_path)
      @solr_home_path, @solr_jetty_path, @solr_data_path = nil,nil,nil
      @solr_base_path = base_path
    end

solr_data_path() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 113
    def solr_data_path
      @solr_data_path || File.join(solr_base_path, 'solr', 'data')
    end

solr_home_path() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 99
    def solr_home_path
      @solr_home_path || File.join(solr_base_path, 'solr')
    end

solr_jetty_path() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 106
    def solr_jetty_path
      @solr_jetty_path || File.join(solr_base_path, 'solr-jetty')
    end

to_hash() click to toggle source

    # File lib/chef/solr/solr_installer.rb, line 145
    def to_hash
      self.class.configurables.inject({}) do |hash, config_option|
        value = instance_variable_get("@#{config_option}".to_sym)
        hash[config_option] = value if value
        hash
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.