Class: Miko::Traveler

Inherits:
Applications show all
Defined in:
lib/miko/traveler.rb

Instance Attribute Summary collapse

Attributes inherited from Applications

#applist, #directory, #found, #option, #path, #user, #verbose

Instance Method Summary collapse

Methods inherited from Applications

#checkScripts, #final_find

Constructor Details

#initialize(option) ⇒ Traveler

Returns a new instance of Traveler.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/miko/traveler.rb', line 10

def initialize( option )
  super( option )

  unless option[:user].nil?
    @user       = option[:user]
    @directory  = "/home/#{user}/public_html/"
  end

  unless option[:directory].nil?
    @directory  = option[:directory]
  end

  unless option[:verbose].nil?
    @verbose    = option[:verbose]
  end

  unless option[:list].nil?
    @list = option[:list]
  end

  @found        = []

end

Instance Attribute Details

#listObject

Returns the value of attribute list.



8
9
10
# File 'lib/miko/traveler.rb', line 8

def list
  @list
end

Instance Method Details

#listScriptsObject



56
57
58
59
60
61
# File 'lib/miko/traveler.rb', line 56

def listScripts
  puts "Supported scripts\n----------------------"
  @applist.each do |script, val|
    puts "- #{script}"
  end
end

#runObject

Define your awesum stuff here



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/miko/traveler.rb', line 34

def run(  )
  if option[:list]
    listScripts
  else
    if File.directory?(@directory) and File.readable?(@directory)

      Find.find( directory ) do |path|
        if File.readable_real?(path)
          if path[/virtfs/].nil?
            checkScripts( path.chomp )
          end
        end
        end

    else
      unless defined?(@verbose).nil?
        raise "Problem accessing directory #{@directory}"
      end
    end
  end
end