Sha256: c1a4285e9035f3154a229aae168f5bd535358068d05600469d82e3571e8b1e58

Contents?: true

Size: 928 Bytes

Versions: 18

Compression:

Stored size: 928 Bytes

Contents

#!/usr/bin/env ruby

$: << "../lib"

require 'zip/zipfilesystem'

EXAMPLE_ZIP = "filesystem.zip"

File.delete(EXAMPLE_ZIP) if File.exists?(EXAMPLE_ZIP)

Zip::ZipFile.open(EXAMPLE_ZIP, Zip::ZipFile::CREATE) {
  |zf|
  zf.file.open("file1.txt", "w") { |os| os.write "first file1.txt" }
  zf.dir.mkdir("dir1")
  zf.dir.chdir("dir1")
  zf.file.open("file1.txt", "w") { |os| os.write "second file1.txt" }
  puts zf.file.read("file1.txt")
  puts zf.file.read("../file1.txt")
  zf.dir.chdir("..")
  zf.file.open("file2.txt", "w") { |os| os.write "first file2.txt" }
  puts "Entries:                   #{zf.entries.join(', ')}"
}

Zip::ZipFile.open(EXAMPLE_ZIP) {
  |zf|
  puts "Entries from reloaded zip: #{zf.entries.join(', ')}"
}

# For other examples, look at zip.rb and ziptest.rb

# Copyright (C) 2003 Thomas Sondergaard
# rubyzip is free software; you can redistribute it and/or
# modify it under the terms of the ruby license.

Version data entries

18 entries across 18 versions & 4 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rubyzip-0.9.9/samples/example_filesystem.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rubyzip-0.9.8/samples/example_filesystem.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rubyzip-0.9.8/samples/example_filesystem.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rubyzip-0.9.8/samples/example_filesystem.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rubyzip-0.9.8/samples/example_filesystem.rb
rubyzip-0.9.9 samples/example_filesystem.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rubyzip-0.9.8/samples/example_filesystem.rb
rubyzip-0.9.8 samples/example_filesystem.rb
rubyzip-0.9.7 samples/example_filesystem.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/rubyzip-0.9.6.1/samples/example_filesystem.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/rubyzip-0.9.6.1/samples/example_filesystem.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/rubyzip-0.9.6.1/samples/example_filesystem.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/rubyzip-0.9.6.1/samples/example_filesystem.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/rubyzip-0.9.6.1/samples/example_filesystem.rb
rubyzip-0.9.6.1 samples/example_filesystem.rb
rubyzip-0.9.5 samples/example_filesystem.rb
mezza-rubyzip-0.9.4.1 samples/example_filesystem.rb
rubyzip-0.9.4 samples/example_filesystem.rb