Top Level Namespace

Defined Under Namespace

Modules: Gena Classes: String

Instance Method Summary collapse

Instance Method Details

#common_path(paths) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/utils/utils.rb', line 59

def common_path(paths)
  common = ''
  paths.each do |file|
    path_components = file.to_s
    if common.empty?
      common = path_components
    else
      common = common.path_intersection path_components
    end
  end

  if File.file? common
    common = common.delete_last_path_component
  end
  if common[-1] == '/'
    common = common[0..-2]
  end
  common
end

#gena_system(*args) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/utils/utils.rb', line 3

def gena_system(*args)
  if $verbose
    system *args
  else
    system *args, :out => ['/dev/null', 'a'], :err => ['/dev/null', 'a']
  end
end