Class: Docman::Builders::Builder

Inherits:
Command
  • Object
show all
Defined in:
lib/docman/builders/builder.rb

Constant Summary collapse

@@builders =
{}
@@build_results =
{}

Instance Attribute Summary

Attributes inherited from Command

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#add_action, #add_actions, #execute, #initialize, #perform, register_command, #replace_placeholder, #run_actions, #run_with_hooks

Methods included from Logging

#log, logger, #logger, #properties_info, #with_logging

Constructor Details

This class inherits a constructor from Docman::Command

Class Method Details

.create(params = nil, context = nil, caller = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/docman/builders/builder.rb', line 10

def self.create(params = nil, context = nil, caller = nil)
  c = @@builders[params['handler']]
  if c
    c.new(params, context, caller, 'builder')
  else
    raise "Bad builder type: #{type}"
  end
end

.register_builder(name) ⇒ Object



19
20
21
# File 'lib/docman/builders/builder.rb', line 19

def self.register_builder(name)
  @@builders[name] = self
end

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/docman/builders/builder.rb', line 47

def changed?
  false
end

#configObject



23
24
25
26
# File 'lib/docman/builders/builder.rb', line 23

def config
  super
  add_action('before_execute', {'type' => :clean_changed}, @context)
end

#describeObject



51
52
53
# File 'lib/docman/builders/builder.rb', line 51

def describe
  "Build: #{properties_info}"
end

#prefixObject



55
56
57
# File 'lib/docman/builders/builder.rb', line 55

def prefix
  "#{@context['name']} - #{self.class.name}"
end

#validate_commandObject



28
29
30
31
# File 'lib/docman/builders/builder.rb', line 28

def validate_command
  raise "Please provide 'context'" if @context.nil?
  raise "Context should be of type 'Info'" unless @context.is_a? Docman::Info
end