Class: RBoss::ServiceScript

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

Instance Method Summary collapse

Methods included from Component

#configure, #load_yaml, #new_file_processor

Constructor Details

#initialize(jboss, logger, config) ⇒ ServiceScript

Returns a new instance of ServiceScript.



30
31
32
33
34
35
36
37
38
39
# File 'lib/rboss/components/service_script.rb', line 30

def initialize jboss, logger, config
  @logger = logger
  @jboss = jboss
  @template_path = config.delete :path
  @config = config
  @config[:profile] = @jboss.profile_name
  @config[:jboss_home] = @jboss.home
  @name = @config[:name]
  @name ||= "jboss_init_#{@jboss.profile_name}.sh"
end

Instance Method Details

#processObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rboss/components/service_script.rb', line 41

def process
  @logger.info "Configuring service script..."
  processor = new_file_processor
  processor.with @template_path do |action|
    action.to_process do |content|
      erb = ERB::new(content, 0, "%<>")
      erb.result binding
    end
    processor.copy_to "#{@jboss}/bin/#{@name}"
  end
  processor.process
end