Class: Docman::Builders::GitProviderBuilder

Inherits:
ProviderBuilder show all
Defined in:
lib/docman/builders/git_provider_builder.rb

Direct Known Subclasses

GitRootChainBuilder, GitStripBuilder

Instance Attribute Summary

Attributes inherited from Command

#type

Instance Method Summary collapse

Methods inherited from ProviderBuilder

#changed?

Methods inherited from Builder

#changed?, #config, create, #describe, #prefix, register_builder, #validate_command, #version

Methods inherited from Command

#add_action, #add_actions, #config, create, #describe, #initialize, #perform, #prefix, register_command, #replace_placeholder, #run_actions, #run_with_hooks

Methods included from Logging

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

Constructor Details

This class inherits a constructor from Docman::Command

Instance Method Details

#build_with_providerObject



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

def build_with_provider
  `find #{@context['full_build_path']} -mindepth 1 -maxdepth 1 -not -name '.git' -print0 | xargs -r -0 rm -rf --` if File.directory? @context['full_build_path']
  FileUtils.rm_r self['target_path'] if @context.need_rebuild? and File.directory? self['target_path']
  result = @provider.perform
  `rsync -a --exclude '.git' #{self['target_path']}/. #{@context['full_build_path']}`
  result
end

#changed_from_last_version?Boolean

Returns:

  • (Boolean)


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

def changed_from_last_version?
  @provider.changed_from_last_version?
end

#executeObject



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

def execute
  prepare_build_dir
  @execute_result = build_with_provider
  changed_from_last_version? ? @execute_result : false
end

#prepare_build_dirObject



7
8
9
# File 'lib/docman/builders/git_provider_builder.rb', line 7

def prepare_build_dir
  FileUtils.mkdir_p(@context['full_build_path'])
end