Module: VrtxCLI

Defined in:
lib/vrtx.rb

Overview

Command line utilities

Class Method Summary collapse

Class Method Details

.substitute_urls(args) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vrtx.rb', line 49

def self.substitute_urls(args)
  if(args.grep(/^http:/) or args.grep(/[a-z]*\.[a-z]*\.[a-z]*[\/a-z]*$/) )then
    new_args = []
    args.each do |arg|
      if(arg =~ /^http:/)then
        arg = Vortex.url2davUrl(arg)
        puts "Warning: changing url to webdav url: " + arg
        new_args += [arg]
      elsif(arg =~ /[a-z]*\.[a-z]*\.[a-z]*[\/a-z]*$/)
        arg = Vortex.url2davUrl("http://" + arg)
        new_args += [arg]
      else
        new_args += [arg]
      end
    end
    args = new_args
  end
  return args
end