Class: RXFHelperModule::FileX

Inherits:
Object
  • Object
show all
Defined in:
lib/rxfhelper.rb

Class Method Summary collapse

Class Method Details

.chdir(s) ⇒ Object



14
# File 'lib/rxfhelper.rb', line 14

def self.chdir(s)  RXFHelper.chdir(s)   end

.cp(s, s2) ⇒ Object



63
# File 'lib/rxfhelper.rb', line 63

def self.cp(s, s2)    RXFHelper.cp(s, s2)      end

.exist?(filename) ⇒ Boolean



35
36
37
# File 'lib/rxfhelper.rb', line 35

def self.exist?(filename)
  exists? filename
end

.exists?(filename) ⇒ Boolean



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rxfhelper.rb', line 16

def self.exists?(filename)
  
  type = self.filetype(filename)
  
  filex = case type
  when :file
    File
  when :dfs
    DfsFile
  else
    nil
  end

  return nil unless filex
  
  filex.exists? filename
  
end

.filetype(x) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/rxfhelper.rb', line 39

def self.filetype(x)
  
  return :string if x.lines.length > 1
  
  case x
  when /^rse:\/\//
    :rse
  when /^https?:\/\//
    :http
  when /^dfs:\/\//
    :dfs        
  when /^file:\/\//
    :file
  else
    
    if File.exists?(x) then
      :file
    else
      :text
    end
    
  end
end

.mkdir(s) ⇒ Object



64
# File 'lib/rxfhelper.rb', line 64

def self.mkdir(s)     RXFHelper.mkdir(s)       end

.mkdir_p(s) ⇒ Object



65
# File 'lib/rxfhelper.rb', line 65

def self.mkdir_p(s)   RXFHelper.mkdir_p(s)     end

.mv(s, s2) ⇒ Object



66
# File 'lib/rxfhelper.rb', line 66

def self.mv(s, s2)    RXFHelper.mv(s, s2)      end

.pwdObject



67
# File 'lib/rxfhelper.rb', line 67

def self.pwd()        RXFHelper.pwd()          end

.read(x) ⇒ Object



68
# File 'lib/rxfhelper.rb', line 68

def self.read(x)      RXFHelper.read(x).first  end

.write(x, s) ⇒ Object



69
# File 'lib/rxfhelper.rb', line 69

def self.write(x, s)  RXFHelper.write(x, s)    end