I want to open a tar.gz archive and display the content as a folder
structure and offer possibility to download and view the content. The
archive should not be compressed to a folder but only to a buffer.
Helper:
require ''tarruby''
def testFu
File.directory?(log_folder) or return "Log folder
''#{log_folder}''
doesn''t exist."
log_archive = File.expand_path(@log.log_archive,log_folder)
# a hash which i probably can access from my view
$result = Hash.new
Tar.gzopen(log_archive, File::RDONLY, 0644, Tar::GNU |
Tar::VERBOSE) do |tar|
tar.each do
if tar.reg? # regular file
buf = tar.extract_buffer
$result[tar.pathname] = buf
end
end
end
end
View:
<div class="rightbox">
<h1><%= File.basename(@log.log_archive) %></h1>
<testFu />
<% $result.each do |key, value| %>
<li><%= key %></li>
<!-- how to offer view / download options for the buffer ???
-->
<% end %>
</div>
Is my approach rails compliant? How can I add a download link (from
the buffer) and offer possibilty to view the buffer on click in a
popup window?
Best regards,
Sebastian
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.