Class: Docman::Builders::Builder
- Inherits:
-
Command
- Object
- Hash
- Command
- Docman::Builders::Builder
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
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
72
73
74
|
# File 'lib/docman/builders/builder.rb', line 72
def changed?
false
end
|
#config ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/docman/builders/builder.rb', line 23
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_file = File.join(@context['full_build_path'], 'info.yaml')
info = YAML::load_file(info_file) if File.file? info_file
if info
name = @context['name']
environment['previous'] = {} if environment['previous'].nil?
environment['previous'][name] = info
end
end
|
#describe ⇒ Object
76
77
78
|
# File 'lib/docman/builders/builder.rb', line 76
def describe
"Build: #{properties_info}"
end
|
#prefix ⇒ Object
80
81
82
|
# File 'lib/docman/builders/builder.rb', line 80
def prefix
"#{@context['name']} - #{self.class.name}"
end
|
#validate_command ⇒ Object
41
42
43
44
|
# File 'lib/docman/builders/builder.rb', line 41
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 ⇒ Object
46
47
48
|
# File 'lib/docman/builders/builder.rb', line 46
def version
@version
end
|