Class: PrePackager::Content

Inherits:
Object
  • Object
show all
Includes:
Executor
Defined in:
lib/pre-packager.rb

Constant Summary collapse

'/usr/local/bin'

Instance Method Summary collapse

Methods included from Executor

#execute

Constructor Details

#initialize(context) ⇒ Content

Returns a new instance of Content.



46
47
48
# File 'lib/pre-packager.rb', line 46

def initialize context
  @context = context
end

Instance Method Details



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/pre-packager.rb', line 50

def link file, options
  link_base = File.join @context.root, @@LINK_BASE_DEFAULT
  FileUtils.mkdir_p link_base

  target = File.join @context.base, @context.name, file
  linkname = Pathname.new(file).basename.to_s
  linkname = @context.name if options[:use_name]
  create_link = proc { |name| File.join link_base, name}

  execute "ln -sf #{target} #{create_link.call(linkname)}"
  execute("ln -sf #{linkname} #{create_link.call(options[:alias])}") if options[:alias]
  # File.symlink File.join(file), File.join(@path, @@LINK_BASE_DEFAULT, link)
end