Class: RBoss::RunConf

Inherits:
Object
  • Object
show all
Includes:
Component, Platform
Defined in:
lib/rboss/components/run_conf.rb

Overview

A class to create a custom run.conf file to a JBoss Profile

The configuration is based on a erb template, variables and jvm args:

:template_path => an absolute path to the template :template => the template string :jvm_args => array with the jvm args to use in JAVA_OPTS, stored in @jvm_args any other key will be stored in a @config variable

This class is used as the binding for erb processor.

author: Marcelo Guimarães <[email protected]>

Instance Method Summary collapse

Methods included from Component

#initialize, #load_yaml, #new_file_processor

Methods included from Platform

#clear, #jboss_cli, #run_conf, #run_conf_template, #twiddle

Instance Method Details

#configure(config) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/rboss/components/run_conf.rb', line 48

def configure config
  @template_path = config.delete :template_path
  @template = config.delete :template
  @jvm_args = config.delete :jvm_args
  @config = config
  parse_config
end

#defaultsObject



44
45
46
# File 'lib/rboss/components/run_conf.rb', line 44

def defaults
  {:jvm_args => []}
end

#processObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rboss/components/run_conf.rb', line 56

def process
  @logger.info "Creating and configuring run.conf"
  if @template_path
    processor = new_file_processor
    processor.with @template_path do |action|
      action.to_process do |content|
        process_template content
      end
      processor.copy_to run_conf
    end
    processor.process
  else
    File.open(run_conf, "w+") { |f| f.write process_template @template }
  end
end