Class: Docman::Builders::CopyBuilder

Inherits:
Builder show all
Defined in:
lib/docman/builders/copy_builder.rb

Instance Attribute Summary

Attributes inherited from Command

#type

Instance Method Summary collapse

Methods inherited from Builder

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

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

#executeObject



15
16
17
18
19
20
21
# File 'lib/docman/builders/copy_builder.rb', line 15

def execute
  prepare_build_dir
  docroot_config_dir = Pathname(@context['docroot_config'].docroot_config_dir)
  config_dir = Pathname(@context['docroot_config'].config_dir)
  log("Copy project files from: #{docroot_config_dir}")
  `rsync -a --exclude '.git' --exclude 'config.json' --exclude '#{config_dir.relative_path_from(docroot_config_dir)}' #{File.join(@context['docroot_config'].docroot_dir, 'config')}/. #{@context['full_build_path']}`
end

#prepare_build_dirObject



9
10
11
12
13
# File 'lib/docman/builders/copy_builder.rb', line 9

def prepare_build_dir
  if not @context['root_repo'].nil?
    GitUtil.get(@context['root_repo'], @context['full_build_path'], @context.version_type(type: 'root'), @context.version(type: 'root'), true, 1)
  end
end

#versionObject



23
24
25
# File 'lib/docman/builders/copy_builder.rb', line 23

def version
  @context['build_path']
end