Sha256: 1cce33d26e7c7cd1723f8ab2af7afc4b7362e5b85bdaa60c5c7a75bd4ce08f13

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

class Step
  def files_dir
    @files_dir ||= begin
                     dir = @path + ".files"
                     if Path === @path
                       @path.annotate(dir)
                     else
                       Path.setup(dir)
                     end
                     dir = dir.find
                     dir.pkgdir = self
                     dir
                   end
  end

  def file(file = nil)
    dir = files_dir
    Path.setup(dir) unless Path === dir
    return dir if file.nil?
    dir[file]
  end

  def files
    Dir.glob(File.join(files_dir, '**', '*')).reject{|path| File.directory? path }.collect do |path| 
      Misc.path_relative_to(files_dir, path) 
    end
  end

  def bundle_files
    [path, info_file, Dir.glob(File.join(files_dir,"**/*"))].flatten.select{|f| Open.exist?(f) }
  end

  def copy_linked_files_dir
    if File.symlink?(self.files_dir)
      begin
        realpath = Open.realpath(self.files_dir)
        Open.rm self.files_dir
        Open.link_dir realpath, self.files_dir
      rescue
        Log.warn "Copy files_dir for #{self.workflow_short_path} failed: " + $!.message
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scout-gear-10.7.3 lib/scout/workflow/step/file.rb
scout-gear-10.7.2 lib/scout/workflow/step/file.rb