Class: Docman::Builders::SymlinkBuilder

Inherits:
Builder show all
Defined in:
lib/docman/builders/symlink_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



7
8
9
10
11
12
13
14
15
16
# File 'lib/docman/builders/symlink_builder.rb', line 7

def execute
  if File.directory? @context['full_build_path']
    log("Removed dir: #{@context['full_build_path']} because directory is a directory")
    FileUtils.rm_r(@context['full_build_path'])
  end
  Dir.chdir Pathname(@context['full_build_path']).dirname
  `ln -f -s #{@context['target_path']} #{@context['name']}`
  log("Created symlink: #{@context['full_build_path']}")
  @context['build_path']
end

#versionObject



18
19
20
# File 'lib/docman/builders/symlink_builder.rb', line 18

def version
  @context['build_path']
end