56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/local_path_builder.rb', line 56
def self.generate( obj, status, salt=Time.now.getutc.to_i.to_s )
mode = {
general: nil,
hash: nil,
path: nil
}
case status
when :silent
mode[:general] = false
mode[:hash] = false
mode[:path] = false
when :hash
mode[:general] = true
mode[:hash] = true
mode[:path] = false
when :path
mode[:general] = true
mode[:hash] = false
mode[:path] = true
when :both
mode[:general] = true
mode[:hash] = true
mode[:path] = true
end
mode[:general] ? puts( 'TREE OVERVIEW' ) : ''
obj[:full] = ''
obj[:full] += obj[:root]
obj[:full] += self.helper_parse_path( self.helper_insert_salt( salt, obj[:name] ) )
mode[:hash] ? puts( self.helper_obj_path( 'l1', salt, [ ] ) ) : ''
mode[:path] ? puts( self.draw_obj_path_local( obj[:full], 2, 4 ) ) : ''
obj[:children].keys.each { | l2 |
obj[:children][ l2 ][:full] = ''
obj[:children][ l2 ][:full] += obj[:full]
obj[:children][ l2 ][:full] += self.helper_parse_path( self.helper_insert_salt( salt, obj[:children][ l2 ][:name] ) )
mode[:hash] ? puts( self.helper_obj_path( 'l2', salt, [ l2 ] ) ) : ''
mode[:path] ? puts( self.draw_obj_path_local( obj[:children][ l2 ][:full], 3, 4 ) ) : ''
FileUtils.mkdir_p obj[:children][ l2 ][:full]
if !obj[:children][ l2 ][:files].nil?
obj[:children][ l2 ][:files].keys.each { | f1 |
obj[:children][ l2 ][:files][ f1 ][:full] = ''
obj[:children][ l2 ][:files][ f1 ][:full] += obj[:children][ l2 ][:full]
obj[:children][ l2 ][:files][ f1 ][:full] += self.helper_insert_salt( salt, obj[:children][ l2 ][:files][ f1 ][:name] )
mode[:hash] ? puts( self.helper_obj_path( 'l2', salt, [ l2 ], f1 ) ) : ''
mode[:path] ? puts( self.draw_obj_path_local( obj[:children][ l2 ][:files][ f1 ][:full], 3, 4 ) ) : ''
}
end
if !obj[:children][ l2 ][:children].nil?
obj[:children][ l2 ][:children].keys.each { | l3 |
obj[:children][ l2 ][:children][ l3 ][:full] = ''
obj[:children][ l2 ][:children][ l3 ][:full] += obj[:children][ l2 ][:full]
obj[:children][ l2 ][:children][ l3 ][:full] += self.helper_parse_path( self.helper_insert_salt( salt, obj[:children][ l2 ][:children][ l3 ][:name] ) )
FileUtils.mkdir_p obj[:children][ l2 ][:children][ l3 ][:full]
mode[:hash] ? puts( self.helper_obj_path( 'l3', salt, [ l2, l3 ] ) ) : ''
mode[:path] ? puts( self.draw_obj_path_local( obj[:children][ l2 ][:children][ l3 ][:full], 4, 4 ) ) : ''
if !obj[:children][ l2 ][:children][ l3 ][:files].nil?
obj[:children][ l2 ][:children][ l3 ][:files].keys.each { | f2 |
obj[:children][ l2 ][:children][ l3 ][:files][ f2 ][:full] = ''
obj[:children][ l2 ][:children][ l3 ][:files][ f2 ][:full] += obj[:children][ l2 ][:children][ l3 ][:full]
obj[:children][ l2 ][:children][ l3 ][:files][ f2 ][:full] += self.helper_insert_salt( salt, obj[:children][ l2 ][:children][ l3 ][:files][ f2 ][:name] )
mode[:hash] ? puts( self.helper_obj_path( 'l3', salt, [ l2, l3 ], f2 ) ) : ''
mode[:path] ? puts( self.draw_obj_path_local( obj[:children][ l2 ][:children][ l3 ][:files][ f2 ][:full], 4, 4 ) ) : ''
}
end
}
end
}
return obj
end
|