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)


60
61
62
# File 'lib/docman/builders/builder.rb', line 60

def changed?
  false
end

#configObject



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

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

#describeObject



64
65
66
# File 'lib/docman/builders/builder.rb', line 64

def describe
  "Build: #{properties_info}"
end

#prefixObject



68
69
70
# File 'lib/docman/builders/builder.rb', line 68

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

#validate_commandObject



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

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

#versionObject



34
35
36
# File 'lib/docman/builders/builder.rb', line 34

def version
  @version
end