lib/docman/builders/builder.rb in docman-0.0.80 vs lib/docman/builders/builder.rb in docman-0.0.81

- old
+ new

@@ -1,10 +1,11 @@ require 'docman/commands/command' module Docman module Builders class Builder < Docman::Command + @@builders = {} @@build_results = {} def self.create(params = nil, context = nil, caller = nil) @@ -26,19 +27,25 @@ 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 + 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 def validate_command raise "Please provide 'context'" if @context.nil? raise "Context should be of type 'Info'" unless @context.is_a? Docman::Info @@ -49,9 +56,10 @@ end before_execute do if @context.need_rebuild? @context.build_mode = :rebuild + log("Need to rebuild") else if @context.changed? or changed? @context.build_mode = :update log("Changed") else