class Docman::Builders::Builder

Public Class Methods

create(params = nil, context = nil, caller = nil) click to toggle source
# File lib/docman/builders/builder.rb, line 11
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) click to toggle source
# File lib/docman/builders/builder.rb, line 20
def self.register_builder(name)
  @@builders[name] = self
end

Public Instance Methods

changed?() click to toggle source
# File lib/docman/builders/builder.rb, line 81
def changed?
  false
end
config() click to toggle source
Calls superclass method Docman::Command#config
# File lib/docman/builders/builder.rb, line 24
def config
  super
  @version = nil
  environment = Application.instance.environment(@context.environment_name)

  clean_changed = environment['clean_changed'].nil? ? true : environment['clean_changed']
  add_action('before_execute', {'type' => :clean_changed}, @context) if clean_changed

  info = @context.info_file_yaml
  if info
    info['context'] = @context
    name = @context['name']
    environment['previous'] = {} if environment['previous'].nil?
    environment['previous'][name] = info
  end

  unless @context.key? 'provider'
    @context['provider'] = self['provider']
  end
  if @context['provider'] && self['target_path_id']
    self['target_path'] = @context[self['target_path_id']]
    @provider = Docman::Command.create({'type' => @context['provider'], 'target_path' => self['target_path']}, @context, self)
  end
end
describe() click to toggle source
# File lib/docman/builders/builder.rb, line 85
def describe
  "Build: #{properties_info}"
end
prefix() click to toggle source
# File lib/docman/builders/builder.rb, line 89
def prefix
  "#{@context['name']} - #{self.class.name}"
end
validate_command() click to toggle source
# File lib/docman/builders/builder.rb, line 49
def validate_command
  raise "Please provide 'context'" if @context.nil?
  raise "Context should be of type 'Info'" unless @context.is_a? Docman::Info
end
version() click to toggle source
# File lib/docman/builders/builder.rb, line 54
def version
  @version
end