From 0b05368359260ed5a97643ba2fed28930edbc68e Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Wed, 2 Nov 2005 05:34:07 +0000 Subject: [PATCH] [BREAKS BUILD] Database schema, Rakefile and contents of config directory are brought inline with 0.14.2 defaults --- config/boot.rb | 17 + config/database.default.yml | 65 - config/environment.rb | 117 +- config/environments/development.rb | 17 +- config/environments/production.rb | 20 +- config/environments/test.rb | 27 +- db/schema.rb | 55 + .../RedCloth-3.0.3/lib => lib}/redcloth.rb | 0 .../rubyzip-0.5.8/lib => lib}/zip/ioextras.rb | 0 .../lib => lib}/zip/stdrubyext.rb | 0 .../lib => lib}/zip/tempfile_bugfixed.rb | 0 {vendor/rubyzip-0.5.8/lib => lib}/zip/zip.rb | 0 .../lib => lib}/zip/zipfilesystem.rb | 0 .../lib => lib}/zip/ziprequire.rb | 0 rakefile.rb | 136 +- vendor/RedCloth-3.0.3/RedCloth.gemspec | 52 - vendor/RedCloth-3.0.3/bin/redcloth | 3 - vendor/RedCloth-3.0.3/doc/CHANGELOG | 149 -- vendor/RedCloth-3.0.3/doc/COPYING | 25 - vendor/RedCloth-3.0.3/doc/README | 108 -- vendor/RedCloth-3.0.3/doc/REFERENCE | 216 --- vendor/RedCloth-3.0.3/doc/make.rb | 359 ---- vendor/RedCloth-3.0.3/install.rb | 1032 ----------- vendor/RedCloth-3.0.3/run-tests.rb | 26 - vendor/RedCloth-3.0.3/tests/code.yml | 105 -- vendor/RedCloth-3.0.3/tests/images.yml | 171 -- vendor/RedCloth-3.0.3/tests/instiki.yml | 39 - vendor/RedCloth-3.0.3/tests/links.yml | 155 -- vendor/RedCloth-3.0.3/tests/lists.yml | 77 - vendor/RedCloth-3.0.3/tests/markdown.yml | 218 --- vendor/RedCloth-3.0.3/tests/poignant.yml | 64 - vendor/RedCloth-3.0.3/tests/table.yml | 198 --- vendor/RedCloth-3.0.3/tests/textism.yml | 397 ----- vendor/rubyzip-0.5.8/ChangeLog | 1273 -------------- vendor/rubyzip-0.5.8/NEWS | 110 -- vendor/rubyzip-0.5.8/README | 70 - vendor/rubyzip-0.5.8/Rakefile | 110 -- vendor/rubyzip-0.5.8/TODO | 9 - vendor/rubyzip-0.5.8/install.rb | 22 - vendor/rubyzip-0.5.8/samples/example.rb | 69 - .../samples/example_filesystem.rb | 34 - vendor/rubyzip-0.5.8/samples/gtkRubyzip.rb | 86 - vendor/rubyzip-0.5.8/samples/write_simple.rb | 13 - vendor/rubyzip-0.5.8/samples/zipfind.rb | 74 - vendor/rubyzip-0.5.8/test/alltests.rb | 9 - vendor/rubyzip-0.5.8/test/data/file1.txt | 46 - .../test/data/file1.txt.deflatedData | Bin 482 -> 0 bytes vendor/rubyzip-0.5.8/test/data/file2.txt | 1504 ---------------- .../rubyzip-0.5.8/test/data/notzippedruby.rb | 7 - vendor/rubyzip-0.5.8/test/data/rubycode.zip | Bin 617 -> 0 bytes vendor/rubyzip-0.5.8/test/data/rubycode2.zip | Bin 261 -> 0 bytes .../rubyzip-0.5.8/test/data/testDirectory.bin | Bin 303 -> 0 bytes .../rubyzip-0.5.8/test/data/zipWithDirs.zip | Bin 1934 -> 0 bytes vendor/rubyzip-0.5.8/test/gentestfiles.rb | 155 -- vendor/rubyzip-0.5.8/test/ioextrastest.rb | 208 --- vendor/rubyzip-0.5.8/test/stdrubyexttest.rb | 52 - .../rubyzip-0.5.8/test/zipfilesystemtest.rb | 829 --------- vendor/rubyzip-0.5.8/test/ziprequiretest.rb | 43 - vendor/rubyzip-0.5.8/test/ziptest.rb | 1557 ----------------- 59 files changed, 156 insertions(+), 9972 deletions(-) create mode 100644 config/boot.rb delete mode 100644 config/database.default.yml create mode 100644 db/schema.rb rename {vendor/RedCloth-3.0.3/lib => lib}/redcloth.rb (100%) rename {vendor/rubyzip-0.5.8/lib => lib}/zip/ioextras.rb (100%) rename {vendor/rubyzip-0.5.8/lib => lib}/zip/stdrubyext.rb (100%) rename {vendor/rubyzip-0.5.8/lib => lib}/zip/tempfile_bugfixed.rb (100%) rename {vendor/rubyzip-0.5.8/lib => lib}/zip/zip.rb (100%) rename {vendor/rubyzip-0.5.8/lib => lib}/zip/zipfilesystem.rb (100%) rename {vendor/rubyzip-0.5.8/lib => lib}/zip/ziprequire.rb (100%) delete mode 100644 vendor/RedCloth-3.0.3/RedCloth.gemspec delete mode 100644 vendor/RedCloth-3.0.3/bin/redcloth delete mode 100644 vendor/RedCloth-3.0.3/doc/CHANGELOG delete mode 100644 vendor/RedCloth-3.0.3/doc/COPYING delete mode 100644 vendor/RedCloth-3.0.3/doc/README delete mode 100644 vendor/RedCloth-3.0.3/doc/REFERENCE delete mode 100644 vendor/RedCloth-3.0.3/doc/make.rb delete mode 100644 vendor/RedCloth-3.0.3/install.rb delete mode 100644 vendor/RedCloth-3.0.3/run-tests.rb delete mode 100644 vendor/RedCloth-3.0.3/tests/code.yml delete mode 100644 vendor/RedCloth-3.0.3/tests/images.yml delete mode 100644 vendor/RedCloth-3.0.3/tests/instiki.yml delete mode 100644 vendor/RedCloth-3.0.3/tests/links.yml delete mode 100644 vendor/RedCloth-3.0.3/tests/lists.yml delete mode 100644 vendor/RedCloth-3.0.3/tests/markdown.yml delete mode 100644 vendor/RedCloth-3.0.3/tests/poignant.yml delete mode 100644 vendor/RedCloth-3.0.3/tests/table.yml delete mode 100644 vendor/RedCloth-3.0.3/tests/textism.yml delete mode 100644 vendor/rubyzip-0.5.8/ChangeLog delete mode 100644 vendor/rubyzip-0.5.8/NEWS delete mode 100644 vendor/rubyzip-0.5.8/README delete mode 100644 vendor/rubyzip-0.5.8/Rakefile delete mode 100644 vendor/rubyzip-0.5.8/TODO delete mode 100644 vendor/rubyzip-0.5.8/install.rb delete mode 100644 vendor/rubyzip-0.5.8/samples/example.rb delete mode 100644 vendor/rubyzip-0.5.8/samples/example_filesystem.rb delete mode 100644 vendor/rubyzip-0.5.8/samples/gtkRubyzip.rb delete mode 100644 vendor/rubyzip-0.5.8/samples/write_simple.rb delete mode 100644 vendor/rubyzip-0.5.8/samples/zipfind.rb delete mode 100644 vendor/rubyzip-0.5.8/test/alltests.rb delete mode 100644 vendor/rubyzip-0.5.8/test/data/file1.txt delete mode 100644 vendor/rubyzip-0.5.8/test/data/file1.txt.deflatedData delete mode 100644 vendor/rubyzip-0.5.8/test/data/file2.txt delete mode 100644 vendor/rubyzip-0.5.8/test/data/notzippedruby.rb delete mode 100644 vendor/rubyzip-0.5.8/test/data/rubycode.zip delete mode 100644 vendor/rubyzip-0.5.8/test/data/rubycode2.zip delete mode 100644 vendor/rubyzip-0.5.8/test/data/testDirectory.bin delete mode 100644 vendor/rubyzip-0.5.8/test/data/zipWithDirs.zip delete mode 100644 vendor/rubyzip-0.5.8/test/gentestfiles.rb delete mode 100644 vendor/rubyzip-0.5.8/test/ioextrastest.rb delete mode 100644 vendor/rubyzip-0.5.8/test/stdrubyexttest.rb delete mode 100644 vendor/rubyzip-0.5.8/test/zipfilesystemtest.rb delete mode 100644 vendor/rubyzip-0.5.8/test/ziprequiretest.rb delete mode 100644 vendor/rubyzip-0.5.8/test/ziptest.rb diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 00000000..c681a36b --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,17 @@ +unless defined?(RAILS_ROOT) + root_path = File.join(File.dirname(__FILE__), '..') + unless RUBY_PLATFORM =~ /mswin32/ + require 'pathname' + root_path = Pathname.new(root_path).cleanpath.to_s + end + RAILS_ROOT = root_path +end + +if File.directory?("#{RAILS_ROOT}/vendor/rails") + require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" +else + require 'rubygems' + require 'initializer' +end + +Rails::Initializer.run(:set_load_path) \ No newline at end of file diff --git a/config/database.default.yml b/config/database.default.yml deleted file mode 100644 index 3dd03157..00000000 --- a/config/database.default.yml +++ /dev/null @@ -1,65 +0,0 @@ -production: - adapter: sqlite3 - dbfile: db/prod.db -development: - adapter: sqlite3 - dbfile: db/dev.db -test: - adapter: sqlite3 - dbfile: db/test.db - -# Sample Sqlite 2 Config -#production: -# adapter: sqlite -# dbfile: db/prod.db -#development: -# adapter: sqlite -# dbfile: db/dev.db -#test: -# adapter: sqlite -# dbfile: db/test.db - -# Sample Postgresql Config -#production: -# adapter: postgresql -# host: localhost -# database: instiki_prod -# username: user -# password: pass -# -#development: -# adapter: postgresql -# host: localhost -# database: instiki_dev -# username: user -# password: pass -# -#test: -# adapter: postgresql -# host: localhost -# database: instiki_test -# username: user -# password: pass - -# Sample MySQL Config -#production: -# adapter: mysql -# host: localhost -# database: instiki_prod -# username: user -# password: pass -# -#development: -# adapter: mysql -# host: localhost -# database: instiki_dev -# username: user -# password: pass -# -#test: -# adapter: mysql -# host: localhost -# database: instiki_test -# username: user -# password: pass - diff --git a/config/environment.rb b/config/environment.rb index 509f4ac0..4d19868a 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,95 +1,34 @@ -# Load the Rails framework and configure your application. -# You can include your own configuration at the end of this file. -# -# Be sure to restart your webserver when you modify this file. +# Bootstrap the Rails environment, frameworks, and default configuration +require File.join(File.dirname(__FILE__), 'boot') -if RUBY_VERSION < '1.8.2' - puts 'Instiki requires Ruby 1.8.2+' - exit +Rails::Initializer.run do |config| + # Skip frameworks you're not going to use + config.frameworks -= [ :action_web_service, :action_mailer ] + + # Use the database for sessions instead of the file system + # (create the session table with 'rake create_sessions_table') + config.action_controller.session_store = :active_record_store + + # Enable page/fragment caching by setting a file-based store + # (remember to create the caching directory and make it readable to the application) + # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache" + + # Activate observers that should always be running + # config.active_record.observers = :cacher, :garbage_collector + + # Make Active Record use UTC-base instead of local time + config.active_record.default_timezone = :utc + + # Use Active Record's schema dumper instead of SQL when creating the test database + # (enables use of different database adapters for development and test environments) + config.active_record.schema_format = :ruby + + # See Rails::Configuration for more options end +# Instiki-specific configuration below +require_dependency 'instiki_errors' + # Enable UTF-8 support $KCODE = 'u' require 'jcode' - -# The path to the root directory of your application. -RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../') - -# The environment your application is currently running. Don't set -# this here; put it in your webserver's configuration as the RAILS_ENV -# environment variable instead. -# -# See config/environments/*.rb for environment-specific configuration. -RAILS_ENV = ENV['RAILS_ENV'] || 'development' - -# Load the Rails framework. Mock classes for testing come first. -ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"] - -# Then model subdirectories. -ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"]) -ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"]) - -# Followed by the standard includes. -ADDITIONAL_LOAD_PATHS.concat %w( - app - app/models - app/controllers - app/helpers - app/apis - components - config - lib - vendor - vendor/rails/railties - vendor/rails/railties/lib - vendor/rails/actionpack/lib - vendor/rails/activesupport/lib - vendor/rails/activerecord/lib - vendor/rails/actionmailer/lib - vendor/rails/actionwebservice/lib - vendor/RedCloth-3.0.3/lib - vendor/rubyzip-0.5.8/lib -).map { |dir| "#{RAILS_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } - -# Prepend to $LOAD_PATH -ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } - -# Require Rails libraries. -require 'rubygems' unless File.directory?("#{RAILS_ROOT}/vendor/rails") - -require 'active_support' -require 'active_record' -require 'action_controller' -require 'action_mailer' -require 'action_web_service' - -# Environment-specific configuration. -require_dependency "environments/#{RAILS_ENV}" -ActiveRecord::Base.configurations = File.open("#{RAILS_ROOT}/config/database.yml") { |f| YAML::load(f) } -ActiveRecord::Base.establish_connection - -# Configure defaults if the included environment did not. -begin - RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log") - RAILS_DEFAULT_LOGGER.level = (RAILS_ENV == 'production' ? Logger::INFO : Logger::DEBUG) -rescue StandardError - RAILS_DEFAULT_LOGGER = Logger.new(STDERR) - RAILS_DEFAULT_LOGGER.level = Logger::WARN - RAILS_DEFAULT_LOGGER.warn( - "Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0666. " + - "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed." - ) -end - -[ActiveRecord, ActionController, ActionMailer].each { |mod| mod::Base.logger ||= RAILS_DEFAULT_LOGGER } -[ActionController, ActionMailer].each { |mod| mod::Base.template_root ||= "#{RAILS_ROOT}/app/views/" } - -# Set up routes. -ActionController::Routing::Routes.reload - -Controllers = Dependencies::LoadingModule.root( - File.join(RAILS_ROOT, 'app', 'controllers'), - File.join(RAILS_ROOT, 'components') -) - -require_dependency 'instiki_errors' diff --git a/config/environments/development.rb b/config/environments/development.rb index d214c666..a151c3ba 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,14 +1,17 @@ # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. +config.cache_classes = false # Log error messages when you accidentally call methods on nil. -require 'active_support/whiny_nil' +config.whiny_nils = true -# Reload code; show full error reports; disable caching. -Dependencies.mechanism = :load -ActionController::Base.consider_all_requests_local = true -ActionController::Base.perform_caching = false +# Enable the breakpoint server that script/breakpointer connects to +config.breakpoint_server = true -# The breakpoint server port that script/breakpointer connects to. -BREAKPOINT_SERVER_PORT = 42531 +# Show full error reports and disable caching +config.action_controller.consider_all_requests_local = true +config.action_controller.perform_caching = false + +# Don't care if the mailer can't send +config.action_mailer.raise_delivery_errors = false diff --git a/config/environments/production.rb b/config/environments/production.rb index 80c7661f..f2b9ed68 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,17 @@ -Dependencies.mechanism = :require -ActionController::Base.consider_all_requests_local = false -ActionController::Base.perform_caching = true +# The production environment is meant for finished, "live" apps. +# Code is not reloaded between requests +config.cache_classes = true + +# Use a different logger for distributed setups +# config.logger = SyslogLogger.new + + +# Full error reports are disabled and caching is turned on +config.action_controller.consider_all_requests_local = false +config.action_controller.perform_caching = true + +# Enable serving of images, stylesheets, and javascripts from an asset server +# config.action_controller.asset_host = "http://assets.example.com" + +# Disable delivery errors if you bad email addresses should just be ignored +# config.action_mailer.raise_delivery_errors = false diff --git a/config/environments/test.rb b/config/environments/test.rb index a5813f5d..66b823dc 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,23 @@ -Dependencies.mechanism = :require -ActionController::Base.consider_all_requests_local = true -ActionController::Base.perform_caching = false -FileYard.restrict_upload_access = false \ No newline at end of file +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! +config.cache_classes = true + +# Log error messages when you accidentally call methods on nil. +config.whiny_nils = true + +# Show full error reports and disable caching +config.action_controller.consider_all_requests_local = true +config.action_controller.perform_caching = false + +# Tell ActionMailer not to deliver emails to the real world. +# The :test delivery method accumulates sent emails in the +# ActionMailer::Base.deliveries array. +config.action_mailer.delivery_method = :test + +# Overwrite the default settings for fixtures in tests. See Fixtures +# for more details about these settings. +# config.transactional_fixtures = true +# config.instantiated_fixtures = false +# config.pre_loaded_fixtures = false \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 00000000..4eb50fdf --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,55 @@ +# This file is autogenerated. Instead of editing this file, please use the +# migrations feature of ActiveRecord to incrementally modify your database, and +# then regenerate this schema definition. + +ActiveRecord::Schema.define() do + + create_table "pages", :force => true do |t| + t.column "created_at", :datetime, :null => false + t.column "updated_at", :datetime, :null => false + t.column "web_id", :integer, :null => false + t.column "locked_by", :string, :limit => 60 + t.column "name", :string, :limit => 60 + t.column "locked_at", :datetime + end + + create_table "revisions", :force => true do |t| + t.column "created_at", :datetime, :null => false + t.column "updated_at", :datetime, :null => false + t.column "revised_at", :datetime, :null => false + t.column "page_id", :integer, :null => false + t.column "content", :text, :null => false + t.column "author", :string, :limit => 60 + t.column "ip", :string, :limit => 60 + end + + create_table "system", :force => true do |t| + t.column "password", :string, :limit => 60 + end + + create_table "webs", :force => true do |t| + t.column "created_at", :datetime, :null => false + t.column "updated_at", :datetime, :null => false + t.column "name", :string, :limit => 60, :null => false + t.column "address", :string, :limit => 60, :null => false + t.column "password", :string, :limit => 60 + t.column "additional_style", :string + t.column "allow_uploads", :integer, :default => 1 + t.column "published", :integer, :default => 0 + t.column "count_pages", :integer, :default => 0 + t.column "markup", :string, :limit => 50, :default => "textile" + t.column "color", :string, :limit => 6, :default => "008B26" + t.column "max_upload_size", :integer, :default => 100 + t.column "safe_mode", :integer, :default => 0 + t.column "brackets_only", :integer, :default => 0 + end + + create_table "wiki_references", :force => true do |t| + t.column "created_at", :datetime, :null => false + t.column "updated_at", :datetime, :null => false + t.column "page_id", :integer, :null => false + t.column "referenced_name", :string, :limit => 60, :null => false + t.column "link_type", :string, :limit => 1, :null => false + end + +end diff --git a/vendor/RedCloth-3.0.3/lib/redcloth.rb b/lib/redcloth.rb similarity index 100% rename from vendor/RedCloth-3.0.3/lib/redcloth.rb rename to lib/redcloth.rb diff --git a/vendor/rubyzip-0.5.8/lib/zip/ioextras.rb b/lib/zip/ioextras.rb similarity index 100% rename from vendor/rubyzip-0.5.8/lib/zip/ioextras.rb rename to lib/zip/ioextras.rb diff --git a/vendor/rubyzip-0.5.8/lib/zip/stdrubyext.rb b/lib/zip/stdrubyext.rb similarity index 100% rename from vendor/rubyzip-0.5.8/lib/zip/stdrubyext.rb rename to lib/zip/stdrubyext.rb diff --git a/vendor/rubyzip-0.5.8/lib/zip/tempfile_bugfixed.rb b/lib/zip/tempfile_bugfixed.rb similarity index 100% rename from vendor/rubyzip-0.5.8/lib/zip/tempfile_bugfixed.rb rename to lib/zip/tempfile_bugfixed.rb diff --git a/vendor/rubyzip-0.5.8/lib/zip/zip.rb b/lib/zip/zip.rb similarity index 100% rename from vendor/rubyzip-0.5.8/lib/zip/zip.rb rename to lib/zip/zip.rb diff --git a/vendor/rubyzip-0.5.8/lib/zip/zipfilesystem.rb b/lib/zip/zipfilesystem.rb similarity index 100% rename from vendor/rubyzip-0.5.8/lib/zip/zipfilesystem.rb rename to lib/zip/zipfilesystem.rb diff --git a/vendor/rubyzip-0.5.8/lib/zip/ziprequire.rb b/lib/zip/ziprequire.rb similarity index 100% rename from vendor/rubyzip-0.5.8/lib/zip/ziprequire.rb rename to lib/zip/ziprequire.rb diff --git a/rakefile.rb b/rakefile.rb index 033b052f..054f782d 100755 --- a/rakefile.rb +++ b/rakefile.rb @@ -1,134 +1,10 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/switchtower.rake, and they will automatically be available to Rake. + +require(File.join(File.dirname(__FILE__), 'config', 'boot')) + require 'rake' require 'rake/testtask' require 'rake/rdoctask' -$VERBOSE = nil -TEST_CHANGES_SINCE = Time.now - 600 - -desc "Run all the tests on a fresh test database" -task :default => [ :test_units, :test_functional ] - - -desc 'Require application environment.' -task :environment do - unless defined? RAILS_ROOT - require File.dirname(__FILE__) + '/config/environment' - end -end - -desc "Generate API documentation, show coding stats" -task :doc => [ :appdoc, :stats ] - - -desc "Run the unit tests in test/unit" -Rake::TestTask.new("test_units") { |t| - t.libs << "test" - t.pattern = 'test/unit/**/*_test.rb' - t.verbose = true -} - -desc "Run the functional tests in test/functional" -Rake::TestTask.new("test_functional") { |t| - t.libs << "test" - t.pattern = 'test/functional/**/*_test.rb' - t.verbose = true -} - -desc "Generate documentation for the application" -Rake::RDocTask.new("appdoc") { |rdoc| - rdoc.rdoc_dir = 'doc/app' - rdoc.title = "Rails Application Documentation" - rdoc.options << '--line-numbers --inline-source' - rdoc.rdoc_files.include('doc/README_FOR_APP') - rdoc.rdoc_files.include('app/**/*.rb') -} - -desc "Generate documentation for the Rails framework" -Rake::RDocTask.new("apidoc") { |rdoc| - rdoc.rdoc_dir = 'doc/api' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] - rdoc.title = "Rails Framework Documentation" - rdoc.options << '--line-numbers --inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/railties/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/railties/MIT-LICENSE') - rdoc.rdoc_files.include('vendor/rails/activerecord/README') - rdoc.rdoc_files.include('vendor/rails/activerecord/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/activerecord/lib/active_record/**/*.rb') - rdoc.rdoc_files.exclude('vendor/rails/activerecord/lib/active_record/vendor/*') - rdoc.rdoc_files.include('vendor/rails/actionpack/README') - rdoc.rdoc_files.include('vendor/rails/actionpack/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_controller/**/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_view/**/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionmailer/README') - rdoc.rdoc_files.include('vendor/rails/actionmailer/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/actionmailer/lib/action_mailer/base.rb') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/README') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service.rb') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/api/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/client/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/container/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/dispatcher/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/protocol/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/support/*.rb') - rdoc.rdoc_files.include('vendor/rails/activesupport/README') - rdoc.rdoc_files.include('vendor/rails/activesupport/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb') -} - -desc "Report code statistics (KLOCs, etc) from the application" -task :stats => [ :environment ] do - require 'code_statistics' - CodeStatistics.new( - ["Helpers", "app/helpers"], - ["Controllers", "app/controllers"], - ["APIs", "app/apis"], - ["Components", "components"], - ["Functionals", "test/functional"], - ["Models", "app/models"], - ["Units", "test/unit"] - ).to_s -end - -desc "Empty the test database" -task :purge_test_database => :environment do - abcs = ActiveRecord::Base.configurations - case abcs["test"]["adapter"] - when "mysql" - ActiveRecord::Base.establish_connection(:test) - ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"]) - when "postgresql" - ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"] - ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"] - ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"] - `dropdb -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` - `createdb -T template0 -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` - when "sqlite","sqlite3" - File.delete(abcs["test"]["dbfile"]) if File.exist?(abcs["test"]["dbfile"]) - when "sqlserver" - dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-') - `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}` - `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql` - else - raise "Unknown database adapter '#{abcs["test"]["adapter"]}'" - end -end - -desc "Clears all *.log files in log/" -task :clear_logs => :environment do - FileList["log/*.log"].each do |log_file| - f = File.open(log_file, "w") - f.close - end -end - -desc "Migrate the database according to the migrate scripts in db/migrate (only supported on PG/MySQL). A specific version can be targetted with VERSION=x" -task :migrate => :environment do - ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + '/db/migrate/', ENV["VERSION"] ? ENV["VERSION"].to_i : nil) -end - -task :ft => :test_functional -task :ut => :test_units \ No newline at end of file +require 'tasks/rails' \ No newline at end of file diff --git a/vendor/RedCloth-3.0.3/RedCloth.gemspec b/vendor/RedCloth-3.0.3/RedCloth.gemspec deleted file mode 100644 index ca64b780..00000000 --- a/vendor/RedCloth-3.0.3/RedCloth.gemspec +++ /dev/null @@ -1,52 +0,0 @@ -require 'rubygems' -spec = Gem::Specification.new do |s| - - ## Basic Information - - s.name = 'RedCloth' - s.version = "3.0.3" - s.platform = Gem::Platform::RUBY - s.summary = <<-TXT - RedCloth is a module for using Textile and Markdown in Ruby. Textile and Markdown are text formats. - A very simple text format. Another stab at making readable text that can be converted to HTML. - TXT - s.description = <<-TXT - No need to use verbose HTML to build your docs, your blogs, your pages. Textile gives you readable text while you're writing and beautiful text for your readers. And if you need to break out into HTML, Textile will allow you to do so. - - Textile also handles some subtleties of formatting which will enhance your document's readability: - - * Single- and double-quotes around words or phrases are converted to curly quotations, much easier on - the eye. "Observe!" - - * Double hyphens are replaced with an em-dash. Observe -- very nice! - - * Single hyphens are replaced with en-dashes. Observe - so cute! - - * Triplets of periods become an ellipsis. Observe... - - * The letter 'x' becomes a dimension sign when used alone. Observe: 2 x 2. - - * Conversion of ==(TM)== to (TM), ==(R)== to (R), ==(C)== to (C). - - For more on Textile's language, hop over to "A Textile Reference":http://hobix.com/textile/. For more - on Markdown, see "Daring Fireball's page":http://daringfireball.net/projects/markdown/. - TXT - - ## Include tests, libs, docs - - s.files = ['bin/**/*', 'tests/**/*', 'lib/**/*', 'docs/**/*', 'run-tests.rb'].collect do |dirglob| - Dir.glob(dirglob) - end.flatten.delete_if {|item| item.include?("CVS")} - - ## Load-time details - - s.require_path = 'lib' - s.autorequire = 'redcloth' - - ## Author and project details - - s.author = "Why the Lucky Stiff" - s.email = "why@ruby-lang.org" - s.rubyforge_project = "redcloth" - s.homepage = "http://www.whytheluckystiff.net/ruby/redcloth/" -end diff --git a/vendor/RedCloth-3.0.3/bin/redcloth b/vendor/RedCloth-3.0.3/bin/redcloth deleted file mode 100644 index 81abf7db..00000000 --- a/vendor/RedCloth-3.0.3/bin/redcloth +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/local/bin/ruby18 -require 'redcloth' -puts RedCloth.new( ARGF.read ).to_html diff --git a/vendor/RedCloth-3.0.3/doc/CHANGELOG b/vendor/RedCloth-3.0.3/doc/CHANGELOG deleted file mode 100644 index 7b5f9cf3..00000000 --- a/vendor/RedCloth-3.0.3/doc/CHANGELOG +++ /dev/null @@ -1,149 +0,0 @@ ---- %YAML:1.0 -- version: 3.0.3 - date: 2005-02-06 - changes: - - Stack overflow regexp on code inlines obliterated. - - Citations scaled back. - - Toggle span tags on CAPS with :no_span_tags accessor. - -- version: 3.0.2 - date: 2005-02-02 - changes: - - Stack overflow Regexps replaced. - - All code blocks protected from formatting. - - Hard breaks working. - - Filter HTML now uses detailed cleaner. - -- version: 3.0.1 - date: 2004-11-15 - changes: - - Using `float' rather than `text-align' to align image blocks. - - Shelving more HTML attributes to prevent them from clashing with Textile glyphs. - - Simplifying the block regexp. - -- version: 3.0 - date: 2004-10-26 - changes: - - Broke up the Textile engine into smaller parts, recoded central block parser. - - Added preliminary support for Markdown. - - Added support for custom Textile prefixes. - - RedCloth now generates XHTML fragments. - - Complete HTML documents should now work, RedCloth ignores complex HTML. - -- version: 2.0.12 - date: 2004-08-09 - changes: - - Escaping tighter for
 tags that share a single line.
-    - No more String#htmlesc!.  Moved to RedCloth#htmlesc.
-    - Pruned out the code that was handling multibyte.
-
-- version: 2.0.11
-  date: 2004-06-01
-  changes:
-    - Fixed the new 2.0-style aliased links.
-    - Lines starting with div opening or closing tags aren't given paragraph tags.
-    - Escaped some sample markup that was being translated by RDoc.
-    - Subtle changes to the quick tags to help them interact with surrounding HTML better.
-    - Ensure angle brackets inside code quick tags get escaped.
-    - New patch and test by F. Ros to fix 
 tags with class settings.
-    - Commented out encode_entities and fix_entities, they do nothing now.  Thanks, Denis.
-    - Scaled back QTAGS a back to avoid mixing up hyphens and dels.  Thanks, Denis.
-    - Work on the references to ensure they are generating at least XHTML 1.0 Transitional.
-
-- version: 2.0.10
-  date: 2004-05-26
-  changes:
-    - Table and list problems.  Rewrote the 
 handling code.. again.
-
-- version: 2.0.9
-  date: 2004-05-26
-  changes:
-    - Improved RDoc.  Ri documentation is auto-installed now!
-    - Links were consuming closing HTML tags.  (See latest test in tests/links.yml.)
-    - Further speed patch from Denis.  Good good.
-    - Patch by F. Ros to fix 
 tags with class settings.
-
-- version: 2.0.8
-  date: 2004-05-22
-  changes:
-    - First scan of the glyphs() method only scans for pre|notextile|code, the
-      deeper passes scan for all HTML.  Now inlines work around HTML tags!
-      (What a pain!)
-    - Moved tables and blocks into glyphs to keep them shielded from the parser
-      if they are in 
 tags.
-    - Patch by Denis Mertz to speed up RedCloth by compiling the various RegExps
-      only once.  Thanks, David!
-
-- version: 2.0.7
-  date: 2004-04-21
-  changes:
-    - New REFERENCE and QUICK-REFERENCE.  See http://hobix.com/textile/.
-    - Lists rewritten to accomplish better line folding.
-    - Better, greedier links.
-    - Additional link and list tests.
-
-- version: 2.0.6
-  date: 2004-04-16
-  changes:
-    - Bold and strong tags were mixed up.  '*' is now strong.  '**' is bold.
-      They were swapped until now.
-    - Horizontal alignments were pretty buggy.  Combining alignments with
-      indents was totally broken.
-    - Fixed table problem.  Now glyphs are handled between tables and blocks.
-    - Nested 
 and  tags are now escaped.  Much better handling of
-      HTML inside 
 tags.  Really: quite nice.
-    - Patch from Florian Gross to fix an html filtration inconsistency.
-
-- version: 2.0.5
-  date: 2004-04-14
-  changes: 
-    - Added safe mode (patch courtesy of Florian Gross).
-    - Added line folding (suggested by Jim Menard).
-    - Fixing notextile tags to work multi-line.
-    - Ambiguity with em-dash and block opener.
-    - Footnote bug. (Thanks, Jim Menard!)
-
-- version: 2.0.4
-  date: 2004-04-08
-  changes:
-    - Scaled back aggresiveness of the inline matching to aid the em-dash.
-    - Scaled back footnotes to stay out of array indices.
-
-- version: 2.0.3
-  date: 2004-04-02
-  changes:
-    - Handling of pre, code, notextile was all wrong.  Also, got rid of the goofed up
-      split then collect.  Now using gsub! and recursion to handle inlines and glyphs.
-    - Better acronym support.
-    - Suppression of Regexp warnings.
-    - Single- and double-quoted string wierdness.  Thanks, Bret Pettichord.
-
-- version: 2.0.2
-  date: 2004-03-08
-  changes:
-    - Fixed broken lists, broken tables.
-    - code/pre tags now escape properly, glyphs are working, spans are working when surrounded by html tags.
-    - Fixed classes and ids. 
-    - Restricted notextile tags to a single line.
-
-- version: 2.0.1
-  date: 2004-02-10
-  changes:
-    - Unmatched closing slash on regexps in ruby 1.6.8.
-    - Fixes to bulleted lists.
-
-- version: 2.0
-  date: 2004-02-06
-  changes:
-    - Complete rewrite of RedCloth, against beta2 from textism.com.
-
-- version: 0.41
-  date: 2003-06-20
-  changes:
-    - Newlines were outputing as escaped.
-
-- version: 0.4
-  date: 2003-06-20
-  changes:
-    - Initial public release.
-    - Integration of YAML-based PyTextile tests.
diff --git a/vendor/RedCloth-3.0.3/doc/COPYING b/vendor/RedCloth-3.0.3/doc/COPYING
deleted file mode 100644
index 044109ae..00000000
--- a/vendor/RedCloth-3.0.3/doc/COPYING
+++ /dev/null
@@ -1,25 +0,0 @@
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, 
-  this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-
-* Neither the name Textile nor the names of its contributors may be used to
-  endorse or promote products derived from this software without specific
-  prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/RedCloth-3.0.3/doc/README b/vendor/RedCloth-3.0.3/doc/README
deleted file mode 100644
index 1ae4560c..00000000
--- a/vendor/RedCloth-3.0.3/doc/README
+++ /dev/null
@@ -1,108 +0,0 @@
-p=. !redcloth3-title.png!
-
-
-
-RedCloth is a module for using Textile in Ruby.  Textile is a text format.  A very simple text format.  Another stab at making readable text that can be converted to HTML.
-
-h2. What is Textile?
-
-Textile is a simple markup language.
-
-table{width:400px}.
-|_. textile|_. to|_. html|
-| _a phrase_ |->|_a phrase_|
-| *a phrase* |->|*a phrase*|
-| _*a phrase*_ |->|_*a phrase*_|
-| "Google":http://google.com |->|"Google":http://google.com|
-
-No need to use verbose HTML to build your docs, your blogs, your pages.  Textile gives you readable text while you're writing and beautiful text for your readers.  And if you need to break out into HTML, Textile will allow you to do so.
-
-Textile also handles some subtleties of formatting which will enhance your document's readability:
-
-* Single- and double-quotes around words or phrases are converted to curly quotations, much easier on
-  the eye.  "Observe!"
-
-* Double hyphens are replaced with an em-dash.  Observe -- very nice!
-
-* Single hyphens are replaced with en-dashes. Observe - so cute!
-
-* Triplets of periods become an ellipsis.  Observe...
-
-* The letter 'x' becomes a dimension sign when used alone.  Observe: 2 x 2.
-
-* Conversion of (TM) to (TM), (R) to (R), (C) to (C).
-
-For more on Textile's language, hop over to "A Textile Reference":http://hobix.com/textile/.
-
-h2. Using RedCloth
-
-The RedCloth class is an extension of Ruby's String class. Use it like you would a String:
-
-
-  >> r = RedCloth.new "*strong text* and _emphasized text_"
-  => "*strong text* and _emphasized text_"
-  >> r.gsub!( 'text', 'words' )
-  => "*strong words* and _emphasized words_"
-
- -To generate HTML from your RedCloth object, use the @RedCloth#to_html@ method: - -
-  >> r.to_html
-  => "

strong words and emphasized words

" -
- - -h2. Installing RedCloth - -To install RedCloth via RubyGems: - -
-  gem install RedCloth
-
- -Or "download RedCloth":http://rubyforge.org/frs/download.php/2852/RedCloth-3.0.2.tar.gz and simply run the install.rb like so: - -
-  ruby install.rb config
-  ruby install.rb setup
-  sudo ruby install.rb install
-
- - -h2. Acknowledgements - -Textile is (c) 2003 Dean Allen. All rights reserved. You can read more "here":http://www.textism.com/tools/textile/. - -RedCloth is also based on PyTextile, which is: Copyright (c) 2003, "Mark Pilgrim":http://diveintomark.org/. All rights reserved. You can read more about PyTextile "here":http://dealmeida.net/projects/textile. - diff --git a/vendor/RedCloth-3.0.3/doc/REFERENCE b/vendor/RedCloth-3.0.3/doc/REFERENCE deleted file mode 100644 index a3e5bec0..00000000 --- a/vendor/RedCloth-3.0.3/doc/REFERENCE +++ /dev/null @@ -1,216 +0,0 @@ ---- -- A Textile Reference: - - Textile is a simple text markup. Simple symbols mark words' emphasis. Blocks of text - can be easily tagged as headers, quotes, or lists. A Textile document can then be - converted to HTML(Hypertext Markup Language) for viewing on the web. - - You can try Textile out on the "Textile home page":http://www.textism.com/tools/textile/. - Textile is also available as "RedCloth":http://whytheluckystiff.net/ruby/redcloth/ for - Ruby or "PyTextile":http://dealmeida.net/projects/textile for Python. - - Also refer to the "*Quick Reference*":javascript:quickRedReference(); for this guide. - - h4. Reading the Examples - - In each section below, examples are provided to clearly illustrate. In each example, - the Textile example is followed by the raw HTML it is translated into, followed by how - the HTML appears in the browser. - - - - Textile example - - Converted to HTML - - Browser-view -- Writing in Textile: - - Textile looks for paragraphs in your text. Paragraphs are separated by one blank line. - Every paragraph is translated as an HTML paragraph. - - !!example "A single paragraph.\n\nFollowed by another." - - h4. Using HTML in Textile - - You can certainly use HTML tags inside your Textile documents. HTML will only be escaped - if it's found in a @pre@ or @code@ block. - - !!example "I am very serious.\n\n
\n  I am very serious.\n
" - - h4. Line Breaks - - Line breaks are converted to HTML breaks. - - !!example "I spoke.\nAnd none replied." - - Line breaks can be disabled in RedCloth by turning on @fold_lines@. - - h4. Entities - - Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye. - - !!example '"Observe!"' - - Double hyphens are replaced with an em-dash. - - !!example Observe -- very nice! - - Single hyphens are replaced with en-dashes. - - !!example Observe - tiny and brief. - - Triplets of periods become an ellipsis. - - !!example Observe... - - The letter 'x' becomes a dimension sign when used alone. - - !!example 'Observe: 2 x 2.' - - Conversion of trademark and copyright symbols. - - !!example 'one(TM), two(R), three(C).' -- Quick Block Modifiers: - - Blocks of text default to being treated as paragraphs. But modifers can be affixed - to the beginning of a block to change its treatment. - - h4. Headers - - To make an entire paragraph into a Header, place "hn." at - its beginning, where _n_ is a number from 1-6. - - !!example h1. Header 1 - - !!example h2. Header 2 - - !!example h3. Header 3 - - h4. Block Quotes - - To make an entire paragraph into a block quotation, place - "bq." before it. - - !!example "An old text\n\nbq. A block quotation.\n\nAny old text" - - h4. Footnotes - - Numeric references within text to footnotes appear between square brackets. - - !!example This is covered elsewhere[1]. - - To create the footnote that corresponds to its reference within the text, begin a new paragraph with fn and the - footnote's number, followed by a dot and a space. - - !!example fn1. Down here, in fact. -- Quick Phrase Modifiers: - - h4. Structural Emphasis - - Emphasis to text is added by surrounding a phrase with underscores. In HTML, this often - appears as italics. - - !!example I _believe_ every word. - - Strength can be give to text by surrounding with asterisks. In HTML, this strength appears - as bold. - - !!example And then? She *fell*! - - Both italics and bold can be forced by doubling the underscores or asterisks. - - !!example "I __know__.\nI **really** __know__." - - Use double question marks to indicate _citation_. The title of a book, for instance. - - !!example "??Cat's Cradle?? by Vonnegut" - - Code phrases can be surrounded by at-symbols. - - !!example "Convert with @r.to_html@" - - To indicate a passage which has been deleted, surround the passage with hypens. - - !!example "I'm -sure- not sure." - - Pluses around a passage indicate its insertion. - - !!example "You are a +pleasant+ child." - - To superscript a phrase, surround with carets. - - !!example "a ^2^ + b ^2^ = c ^2^" - - To subscript, surround with tildes. - - !!example "log ~2~ x" - - h4. HTML-Specific - - Lastly, if you find yourself needing to customize the style of a passage, use percent symbols - to translate the passage as an HTML span. - - !!example I'm %unaware% of most soft drinks. - - This way, you can apply style settings, as described in the next section to arbitrary phrases. - - !!example "I'm %{color:red}unaware%\nof most soft drinks." -- Attributes: - - Tailoring Textile to suit your needs is quite easy. Attributes allow you to provide CSS(Cascading - Style Sheets) information about any phrase. - - h4. Block Attributes - - A block can be tagged with a CSS class by circling the class in parentheses and - placing it just before the period which marks the block. - - !!example p(example1). An example - - An element ID can be given by prefixing the ID with a pound symbol and using it in place of - the class. - - !!example p(#big-red). Red here - - Class and ID can be combined by placing the class first. - - !!example p(example1#big-red2). Red here - - Style settings can be provided directly by surrounding them in curly braces. - - !!example p{color:blue;margin:30px}. Spacey blue - - Language designations can be given between angel brackets. - - !!example p[fr]. rouge - - h4. Phrase Attributes - - All block attributes can be applied to phrases as well by placing them just inside the - opening modifier. - - !!example "I seriously *{color:red}blushed*\nwhen I _(big)sprouted_ that\ncorn stalk from my\n%[es]cabeza%." - - h4. Block Alignments - - Text inside blocks can be aligned in four basic ways. - - !!example p<. align left - - !!example p>. align right - - !!example p=. centered - - !!example p<>. justified - - Indentation can also be specified by provide a single left paren for every 1em to the left. A single right - paren for every 1em to the right. - - !!example p(. left ident 1em - - !!example p((. left ident 2em - - !!example p))). right ident 3em - - h4. Combining Alignments - - Identation may be coupled with alignment. - - !!example "h2()>. Bingo." - - And, furthermore, coupled with language settings and CSS styles. - - !!example "h3()>[no]{color:red}. Bingo" - - h4. HTML in Textile - - Textile is designed for quickening the simple markups. For more complex formatting, you are encouraged - to break out into HTML. - - For example, long code blocks belong between @pre@ and @code@ tags. Please also indent your code inside - the tags to be sure that all Textile processors out there will ignore the contents. - - !!example | -
-      
-        a.gsub!( /
-      
- - You may also choose to surround sections with @div@ tags to separate your document into sections. - "Instiki":http://www.instiki.org/ uses this technique to float a sidebar to the right. - - !!example | -
- - h3. Sidebar - - "Hobix":http://hobix.com/ - "Ruby":http://ruby-lang.org/ - -
- - The main text of the - page goes here and will - stay to the left of the - sidebar. - -- Lists: - - h4. Numeric Lists - - To make a numbered list, place each item in its own paragraph, preceded by "#". - - !!example "# A first item\n# A second item\n# A third" - - These lists may be nested by increasing the number of pound symbols preceding child entries. - - !!example "# Fuel could be:\n## Coal\n## Gasoline\n## Electricity\n# Humans need only:\n## Water\n## Protein" - - h4. Bulleted Lists - - Bulleted lists use an asterisk in place of the pound. - - !!example "* A first item\n* A second item\n* A third" - - These lists may be nested in like manner. - - !!example "* Fuel could be:\n** Coal\n** Gasoline\n** Electricity\n* Humans need only:\n** Water\n** Protein" -- External References: - - h4. Hypertext Links - - Basic links are comprised of a phrase which is linked to a URL(Universal Resource Locator). Place the - descriptive phrase in quotation marks. Follow it immediately by a colon and the URL. - - !!example I searched "Google":http://google.com. - - Notice, the link won't include any trailing punctuation. - - h4. Link Aliases - - If you are using the same link several times in your document, or you'd just like to be a tad more - organized, you can use a link alias. Place the URL anywhere in your document, beginning with its - alias in square brackets. Then, use the alias in place of the URL, using the link format above. - - !!example | - I am crazy about "Hobix":hobix - and "it's":hobix "all":hobix I ever - "link to":hobix! - - [hobix]http://hobix.com - - h4. Embedded Images - - You can embed an image in your Textile document by surrounding its URL with exclamation marks. - - !!example "!http://hobix.com/sample.jpg!" - - URLs may be relative. - - A title for the image can also be provided in parens, just before the closing exclamation. - - !!example "!openwindow1.gif(Bunny.)!" - - The title also acts as *alt* text should the image not be found. - - Links can be attached to images with a colon. - - !!example "!openwindow1.gif!:http://hobix.com/" - - h4. Image Alignments - - Alignments can be applied as well to images. - - !!example "!>obake.gif!\n\nAnd others sat all round the small\nmachine and paid it to sing to them." - - h4. Acronyms - - Definitions for acronyms can be provided by following an acronym with its definition in parens. - - !!example We use CSS(Cascading Style Sheets). -- Tables: - - Simple tables can be built by separating fields with pipe characters - - !!example "| name | age | sex |\n| joan | 24 | f |\n| archie | 29 | m |\n| bella | 45 | f |" - - Specify header cells by marking them with an underscore and period. - - !!example "|_. name |_. age |_. sex |\n| joan | 24 | f |\n| archie | 29 | m |\n| bella | 45 | f |" - - h4. Cell Attributes - - The period used above marks the end of a cell's attributes. Other attributes can be applied as well. - - !!example "|_. attribute list |\n|<. align left |\n|>. align right|\n|=. center |\n|<>. justify |\n|^. valign top |\n|~. bottom |" - - You can also specify colspans with a backslash, followed by the cell width. - - !!example "|\\2. spans two cols |\n| col 1 | col 2 |" - - Rowspan is specified by a forward slash, followed by the row height. - - !!example "|/3. spans 3 rows | a |\n| b |\n| c |" - - All block attributes can be applied to table cells as well. - - !!example "|{background:#ddd}. Grey cell|" - - h4. Table and Row Attributes - - Table-wide attributes can be applied before the first row of the table. On its own line, followed by - a period. - - !!example "table{border:1px solid black}.\n|This|is|a|row|\n|This|is|a|row|" - - Attributes can be applied to a single row by supplying the attribute before the row starts, using a - @table@ modifier and following it by a period. - - !!example "|This|is|a|row|\n{background:#ddd}. |This|is|grey|row|" diff --git a/vendor/RedCloth-3.0.3/doc/make.rb b/vendor/RedCloth-3.0.3/doc/make.rb deleted file mode 100644 index 3789beaa..00000000 --- a/vendor/RedCloth-3.0.3/doc/make.rb +++ /dev/null @@ -1,359 +0,0 @@ -$:.unshift '../lib' -require 'yaml' -require 'redcloth' - -class String - # - # Flexible HTML escaping - # - def htmlesc!( mode ) - gsub!( '&', '&' ) - gsub!( '"', '"' ) if mode != :NoQuotes - gsub!( "'", ''' ) if mode == :Quotes - gsub!('<', '<') - gsub!('>', '>') - end -end - -def a_name( phrase ) - phrase.downcase. - gsub( /\W+/, '-' ) -end - -file_name = ARGV.shift -case file_name -when 'README' - puts <<-HTML - - - - - RedCloth [Textile Humane Web Text for Ruby] - - - - HTML - puts RedCloth.new( File.open( file_name ).read ).to_html - puts "" - puts "" -when 'QUICK-REFERENCE' - YAML::add_private_type( "example" ) do |type, val| - esc = val.dup - esc.htmlesc!( :NoQuotes ) - [ :example, esc.gsub( /\n/, '
' ), - RedCloth.new( val ).to_html ] - end - - content = YAML::load( File.open( 'REFERENCE' ) ) - - sections = content.collect { |c| c.keys.first } - sections.shift - - puts <<-HTML - - - - - Textile Quick Reference - - - - - - - HTML - - ct = 0 - content.each do |section| - section.each do |header, parags| - puts "" if ct.nonzero? - parags.each do |p| - if p.is_a?( Array ) and p[0] == :example - puts "" + - "" - end - end - end - ct += 1 - end - puts "

Textile Quick Reference

Sections: #{ sections.collect { |s| "#{ s.gsub( /\s/, ' ' ) }" }.join( ' | ' ) }
#{ header }
#{ p[1] }
#{ p[2] }
" - puts "" - puts "" - -when 'REFERENCE' - YAML::add_private_type( "example" ) do |type, val| - esc = val.dup - esc.htmlesc!( :NoQuotes ) - [ esc.gsub( /\n/, '
' ), - RedCloth.new( val ).to_html. - gsub( /;(\w)/, '; \1' ). - htmlesc!( :NoQuotes ). - gsub( /\n/, '
' ), - RedCloth.new( val ).to_html ] - end - - content = YAML::load( File.open( file_name ) ) - - sections = content.collect { |c| c.keys.first } - sections.shift - - puts <<-HTML - - - - - Textile Reference - - - - - - HTML - - ct = 0 - content.each do |section| - section.each do |header, parags| - if ct.zero? - puts "" - puts "" - else - puts "" - end - parags.each do |p| - if p.is_a? Array - puts "" + - "" + - "" - else - puts "" - end - end - unless ct.zero? - puts "" - end - end - ct += 1 - end - puts "

#{ header }

Sections: #{ sections.collect { |s| "#{ s.gsub( /\s/, ' ' ) }" }.join( ' | ' ) }
#{ ct }.
#{ header }
#{ p[0] }

#{ p[1] }

#{ p[2] }
" - puts RedCloth.new( p ).to_html - puts "
" - puts "" - puts "" -end diff --git a/vendor/RedCloth-3.0.3/install.rb b/vendor/RedCloth-3.0.3/install.rb deleted file mode 100644 index 2313f9e9..00000000 --- a/vendor/RedCloth-3.0.3/install.rb +++ /dev/null @@ -1,1032 +0,0 @@ -#!/usr/local/bin/ruby -# -# This file is automatically generated. DO NOT MODIFY! -# -# install.rb -# -# Copyright (c) 2000-2002 Minero Aoki -# -# This program is free software. -# You can distribute/modify this program under the terms of -# the GNU Lesser General Public License version 2. -# - -### begin compat.rb - -unless Enumerable.instance_methods.include? 'inject' then -module Enumerable - def inject( result ) - each do |i| - result = yield(result, i) - end - result - end -end -end - -def File.read_all( fname ) - File.open(fname, 'rb') {|f| return f.read } -end - -def File.write( fname, str ) - File.open(fname, 'wb') {|f| f.write str } -end - -### end compat.rb -### begin config.rb - -if i = ARGV.index(/\A--rbconfig=/) then - file = $' - ARGV.delete_at(i) - require file -else - require 'rbconfig' -end - - -class ConfigTable - - c = ::Config::CONFIG - - rubypath = c['bindir'] + '/' + c['ruby_install_name'] - - major = c['MAJOR'].to_i - minor = c['MINOR'].to_i - teeny = c['TEENY'].to_i - version = "#{major}.#{minor}" - - # ruby ver. >= 1.4.4? - newpath_p = ((major >= 2) or - ((major == 1) and - ((minor >= 5) or - ((minor == 4) and (teeny >= 4))))) - - re = Regexp.new('\A' + Regexp.quote(c['prefix'])) - subprefix = lambda {|path| - re === path and path.sub(re, '$prefix') - } - - if c['rubylibdir'] then - # 1.6.3 < V - stdruby = subprefix.call(c['rubylibdir']) - siteruby = subprefix.call(c['sitedir']) - versite = subprefix.call(c['sitelibdir']) - sodir = subprefix.call(c['sitearchdir']) - elsif newpath_p then - # 1.4.4 <= V <= 1.6.3 - stdruby = "$prefix/lib/ruby/#{version}" - siteruby = subprefix.call(c['sitedir']) - versite = siteruby + '/' + version - sodir = "$site-ruby/#{c['arch']}" - else - # V < 1.4.4 - stdruby = "$prefix/lib/ruby/#{version}" - siteruby = "$prefix/lib/ruby/#{version}/site_ruby" - versite = siteruby - sodir = "$site-ruby/#{c['arch']}" - end - - DESCRIPTER = [ - [ 'prefix', [ c['prefix'], - 'path', - 'path prefix of target environment' ] ], - [ 'std-ruby', [ stdruby, - 'path', - 'the directory for standard ruby libraries' ] ], - [ 'site-ruby-common', [ siteruby, - 'path', - 'the directory for version-independent non-standard ruby libraries' ] ], - [ 'site-ruby', [ versite, - 'path', - 'the directory for non-standard ruby libraries' ] ], - [ 'bin-dir', [ '$prefix/bin', - 'path', - 'the directory for commands' ] ], - [ 'rb-dir', [ '$site-ruby', - 'path', - 'the directory for ruby scripts' ] ], - [ 'so-dir', [ sodir, - 'path', - 'the directory for ruby extentions' ] ], - [ 'data-dir', [ '$prefix/share', - 'path', - 'the directory for shared data' ] ], - [ 'ruby-path', [ rubypath, - 'path', - 'path to set to #! line' ] ], - [ 'ruby-prog', [ rubypath, - 'name', - 'the ruby program using for installation' ] ], - [ 'make-prog', [ 'make', - 'name', - 'the make program to compile ruby extentions' ] ], - [ 'without-ext', [ 'no', - 'yes/no', - 'does not compile/install ruby extentions' ] ] - ] - - SAVE_FILE = 'config.save' - - def ConfigTable.each_name( &block ) - keys().each( &block ) - end - - def ConfigTable.keys - DESCRIPTER.collect {|k,*dummy| k } - end - - def ConfigTable.each_definition( &block ) - DESCRIPTER.each( &block ) - end - - def ConfigTable.get_entry( name ) - name, ent = DESCRIPTER.assoc(name) - ent - end - - def ConfigTable.get_entry!( name ) - get_entry(name) or raise ArgumentError, "no such config: #{name}" - end - - def ConfigTable.add_entry( name, vals ) - ConfigTable::DESCRIPTER.push [name,vals] - end - - def ConfigTable.remove_entry( name ) - get_entry name or raise ArgumentError, "no such config: #{name}" - DESCRIPTER.delete_if {|n,arr| n == name } - end - - def ConfigTable.config_key?( name ) - get_entry(name) ? true : false - end - - def ConfigTable.bool_config?( name ) - ent = get_entry(name) or return false - ent[1] == 'yes/no' - end - - def ConfigTable.value_config?( name ) - ent = get_entry(name) or return false - ent[1] != 'yes/no' - end - - def ConfigTable.path_config?( name ) - ent = get_entry(name) or return false - ent[1] == 'path' - end - - - class << self - - alias newobj new - - def new - c = newobj() - c.__send__ :init - c - end - - def load - c = newobj() - File.file? SAVE_FILE or - raise InstallError, "#{File.basename $0} config first" - File.foreach( SAVE_FILE ) do |line| - k, v = line.split( '=', 2 ) - c.instance_eval { - @table[k] = v.strip - } - end - c - end - - end - - def initialize - @table = {} - end - - def init - DESCRIPTER.each do |k, (default, vname, desc, default2)| - @table[k] = default - end - end - private :init - - def save - File.open( SAVE_FILE, 'w' ) {|f| - @table.each do |k, v| - f.printf "%s=%s\n", k, v if v - end - } - end - - def []=( k, v ) - ConfigTable.config_key? k or raise InstallError, "unknown config option #{k}" - if ConfigTable.path_config? k then - @table[k] = (v[0,1] != '$') ? File.expand_path(v) : v - else - @table[k] = v - end - end - - def []( key ) - @table[key] or return nil - @table[key].gsub( %r<\$([^/]+)> ) { self[$1] } - end - - def set_raw( key, val ) - @table[key] = val - end - - def get_raw( key ) - @table[key] - end - -end - - -class MetaConfigEnvironment - - def self.eval_file( file ) - return unless File.file? file - new.instance_eval File.read_all(file), file, 1 - end - - private - - def config_names - ConfigTable.keys - end - - def config?( name ) - ConfigTable.config_key? name - end - - def bool_config?( name ) - ConfigTable.bool_config? name - end - - def value_config?( name ) - ConfigTable.value_config? name - end - - def path_config?( name ) - ConfigTable.path_config? name - end - - def add_config( name, argname, default, desc ) - ConfigTable.add_entry name,[default,argname,desc] - end - - def add_path_config( name, default, desc ) - add_config name, 'path', default, desc - end - - def add_bool_config( name, default, desc ) - add_config name, 'yes/no', default ? 'yes' : 'no', desc - end - - def set_config_default( name, default ) - if bool_config? name then - ConfigTable.get_entry!(name)[0] = default ? 'yes' : 'no' - else - ConfigTable.get_entry!(name)[0] = default - end - end - - def remove_config( name ) - ent = ConfigTable.get_entry(name) - ConfigTable.remove_entry name - ent - end - -end - -### end config.rb -### begin fileop.rb - -module FileOperations - - def mkdir_p( dname, prefix = nil ) - dname = prefix + dname if prefix - $stderr.puts "mkdir -p #{dname}" if verbose? - return if no_harm? - - # does not check '/'... it's too abnormal case - dirs = dname.split(%r_(?=/)_) - if /\A[a-z]:\z/i === dirs[0] then - disk = dirs.shift - dirs[0] = disk + dirs[0] - end - dirs.each_index do |idx| - path = dirs[0..idx].join('') - Dir.mkdir path unless dir? path - end - end - - def rm_f( fname ) - $stderr.puts "rm -f #{fname}" if verbose? - return if no_harm? - - if File.exist? fname or File.symlink? fname then - File.chmod 0777, fname - File.unlink fname - end - end - - def rm_rf( dn ) - $stderr.puts "rm -rf #{dn}" if verbose? - return if no_harm? - - Dir.chdir dn - Dir.foreach('.') do |fn| - next if fn == '.' - next if fn == '..' - if dir? fn then - verbose_off { - rm_rf fn - } - else - verbose_off { - rm_f fn - } - end - end - Dir.chdir '..' - Dir.rmdir dn - end - - def mv( src, dest ) - rm_f dest - begin - File.link src, dest - rescue - File.write dest, File.read_all(src) - File.chmod File.stat(src).mode, dest - end - rm_f src - end - - def install( from, dest, mode, prefix = nil ) - $stderr.puts "install #{from} #{dest}" if verbose? - return if no_harm? - - realdest = prefix + dest if prefix - if dir? realdest then - realdest += '/' + File.basename(from) - end - str = File.read_all(from) - if diff? str, realdest then - verbose_off { - rm_f realdest if File.exist? realdest - } - File.write realdest, str - File.chmod mode, realdest - - File.open( objdir + '/InstalledFiles', 'a' ) {|f| f.puts realdest } - end - end - - def diff?( orig, targ ) - return true unless File.exist? targ - orig != File.read_all(targ) - end - - def command( str ) - $stderr.puts str if verbose? - system str or raise RuntimeError, "'system #{str}' failed" - end - - def ruby( str ) - command config('ruby-prog') + ' ' + str - end - - def dir?( dname ) - # for corrupted windows stat() - File.directory?( (dname[-1,1] == '/') ? dname : dname + '/' ) - end - - def all_files( dname ) - Dir.open( dname ) {|d| - return d.find_all {|n| File.file? "#{dname}/#{n}" } - } - end - - def all_dirs( dname ) - Dir.open( dname ) {|d| - return d.find_all {|n| dir? "#{dname}/#{n}" } - %w(. ..) - } - end - -end - -### end fileop.rb -### begin base.rb - -class InstallError < StandardError; end - - -class Installer - - Version = '3.1.2' - Copyright = 'Copyright (c) 2000-2002 Minero Aoki' - - - @toplevel = nil - - def self.declear_toplevel_installer( inst ) - @toplevel and - raise ArgumentError, 'more than one toplevel installer decleared' - @toplevel = inst - end - - def self.toplevel_installer - @toplevel - end - - - FILETYPES = %w( bin lib ext data ) - - include FileOperations - - def initialize( config, opt, srcroot, objroot ) - @config = config - @options = opt - @srcdir = File.expand_path(srcroot) - @objdir = File.expand_path(objroot) - @currdir = '.' - end - - def inspect - "#<#{type} #{__id__}>" - end - - # - # configs/options - # - - def get_config( key ) - @config[key] - end - - alias config get_config - - def set_config( key, val ) - @config[key] = val - end - - def no_harm? - @options['no-harm'] - end - - def verbose? - @options['verbose'] - end - - def verbose_off - save, @options['verbose'] = @options['verbose'], false - yield - @options['verbose'] = save - end - - # - # srcdir/objdir - # - - attr_reader :srcdir - alias srcdir_root srcdir - alias package_root srcdir - - def curr_srcdir - "#{@srcdir}/#{@currdir}" - end - - attr_reader :objdir - alias objdir_root objdir - - def curr_objdir - "#{@objdir}/#{@currdir}" - end - - def srcfile( path ) - curr_srcdir + '/' + path - end - - def srcexist?( path ) - File.exist? srcfile(path) - end - - def srcdirectory?( path ) - dir? srcfile(path) - end - - def srcfile?( path ) - File.file? srcfile(path) - end - - def srcentries( path = '.' ) - Dir.open( curr_srcdir + '/' + path ) {|d| - return d.to_a - %w(. ..) - hookfilenames - } - end - - def srcfiles( path = '.' ) - srcentries(path).find_all {|fname| - File.file? File.join(curr_srcdir, path, fname) - } - end - - def srcdirectories( path = '.' ) - srcentries(path).find_all {|fname| - dir? File.join(curr_srcdir, path, fname) - } - end - - def dive_into( rel ) - return unless dir? "#{@srcdir}/#{rel}" - - dir = File.basename(rel) - Dir.mkdir dir unless dir? dir - save = Dir.pwd - Dir.chdir dir - $stderr.puts '---> ' + rel if verbose? - @currdir = rel - yield - Dir.chdir save - $stderr.puts '<--- ' + rel if verbose? - @currdir = File.dirname(rel) - end - - # - # config - # - - def exec_config - exec_task_traverse 'config' - end - - def config_dir_bin( rel ) - end - - def config_dir_lib( rel ) - end - - def config_dir_ext( rel ) - extconf if extdir? curr_srcdir - end - - def extconf - opt = @options['config-opt'].join(' ') - command "#{config('ruby-prog')} #{curr_srcdir}/extconf.rb #{opt}" - end - - def config_dir_data( rel ) - end - - # - # setup - # - - def exec_setup - exec_task_traverse 'setup' - end - - def setup_dir_bin( relpath ) - all_files( curr_srcdir ).each do |fname| - add_rubypath "#{curr_srcdir}/#{fname}" - end - end - - SHEBANG_RE = /\A\#!\s*\S*ruby\S*/ - - def add_rubypath( path ) - $stderr.puts %Q if verbose? - return if no_harm? - - tmpfile = File.basename(path) + '.tmp' - begin - File.open( path ) {|r| - File.open( tmpfile, 'w' ) {|w| - first = r.gets - return unless SHEBANG_RE === first # reject '/usr/bin/env ruby' - - w.print first.sub( SHEBANG_RE, '#!' + config('ruby-path') ) - w.write r.read - } } - mv tmpfile, File.basename(path) - ensure - rm_f tmpfile if File.exist? tmpfile - end - end - - def setup_dir_lib( relpath ) - end - - def setup_dir_ext( relpath ) - if extdir? curr_srcdir then - make - end - end - - def make - command config('make-prog') - end - - def setup_dir_data( relpath ) - end - - # - # install - # - - def exec_install - exec_task_traverse 'install' - end - - def install_dir_bin( rel ) - install_files targfiles, config('bin-dir') + '/' + rel, 0755 - end - - def install_dir_lib( rel ) - install_files targfiles, config('rb-dir') + '/' + rel, 0644 - begin - require 'rdoc/rdoc' - ri_site = true - if RDOC_VERSION =~ /^0\./ - require 'rdoc/options' - unless Options::OptionList::OPTION_LIST.assoc('--ri-site') - ri_site = false - end - end - if ri_site - r = RDoc::RDoc.new - r.document(%w{--ri-site}) - end - rescue - puts "** Unable to install Ri documentation for RedCloth **" - end - end - - def install_dir_ext( rel ) - if extdir? curr_srcdir then - install_dir_ext_main File.dirname(rel) - end - end - - def install_dir_ext_main( rel ) - install_files allext('.'), config('so-dir') + '/' + rel, 0555 - end - - def install_dir_data( rel ) - install_files targfiles, config('data-dir') + '/' + rel, 0644 - end - - def install_files( list, dest, mode ) - mkdir_p dest, @options['install-prefix'] - list.each do |fname| - install fname, dest, mode, @options['install-prefix'] - end - end - - def targfiles - (targfilenames() - hookfilenames()).collect {|fname| - File.exist?(fname) ? fname : File.join(curr_srcdir(), fname) - } - end - - def targfilenames - [ curr_srcdir(), '.' ].inject([]) {|ret, dir| - ret | all_files(dir) - } - end - - def hookfilenames - %w( pre-%s post-%s pre-%s.rb post-%s.rb ).collect {|fmt| - %w( config setup install clean ).collect {|t| sprintf fmt, t } - }.flatten - end - - def allext( dir ) - _allext(dir) or raise InstallError, - "no extention exists: Have you done 'ruby #{$0} setup' ?" - end - - DLEXT = /\.#{ ::Config::CONFIG['DLEXT'] }\z/ - - def _allext( dir ) - Dir.open( dir ) {|d| - return d.find_all {|fname| DLEXT === fname } - } - end - - # - # clean - # - - def exec_clean - exec_task_traverse 'clean' - rm_f 'config.save' - rm_f 'InstalledFiles' - end - - def clean_dir_bin( rel ) - end - - def clean_dir_lib( rel ) - end - - def clean_dir_ext( rel ) - clean - end - - def clean - command config('make-prog') + ' clean' if File.file? 'Makefile' - end - - def clean_dir_data( rel ) - end - - # - # lib - # - - def exec_task_traverse( task ) - run_hook 'pre-' + task - FILETYPES.each do |type| - if config('without-ext') == 'yes' and type == 'ext' then - $stderr.puts 'skipping ext/* by user option' if verbose? - next - end - traverse task, type, task + '_dir_' + type - end - run_hook 'post-' + task - end - - def traverse( task, rel, mid ) - dive_into( rel ) { - run_hook 'pre-' + task - __send__ mid, rel.sub( %r_\A.*?(?:/|\z)_, '' ) - all_dirs( curr_srcdir ).each do |d| - traverse task, rel + '/' + d, mid - end - run_hook 'post-' + task - } - end - - def run_hook( name ) - try_run_hook curr_srcdir + '/' + name or - try_run_hook curr_srcdir + '/' + name + '.rb' - end - - def try_run_hook( fname ) - return false unless File.file? fname - - env = self.dup - begin - env.instance_eval File.read_all(fname), fname, 1 - rescue - raise InstallError, "hook #{fname} failed:\n" + $!.message - end - true - end - - def extdir?( dir ) - File.exist? dir + '/MANIFEST' - end - -end - -### end base.rb -### begin toplevel.rb - -class ToplevelInstaller < Installer - - TASKS = [ - [ 'config', 'saves your configurations' ], - [ 'show', 'shows current configuration' ], - [ 'setup', 'compiles extention or else' ], - [ 'install', 'installs files' ], - [ 'clean', "does `make clean' for each extention" ] - ] - - - def initialize( root ) - super nil, {'verbose' => true}, root, '.' - Installer.declear_toplevel_installer self - end - - - def execute - run_metaconfigs - - case task = parsearg_global() - when 'config' - @config = ConfigTable.new - else - @config = ConfigTable.load - end - parsearg_TASK task - - exectask task - end - - - def run_metaconfigs - MetaConfigEnvironment.eval_file "#{srcdir_root}/#{metaconfig}" - end - - def metaconfig - 'metaconfig' - end - - - def exectask( task ) - if task == 'show' then - exec_show - else - try task - end - end - - def try( task ) - $stderr.printf "#{File.basename $0}: entering %s phase...\n", task if verbose? - begin - __send__ 'exec_' + task - rescue - $stderr.printf "%s failed\n", task - raise - end - $stderr.printf "#{File.basename $0}: %s done.\n", task if verbose? - end - - # - # processing arguments - # - - def parsearg_global - task_re = /\A(?:#{TASKS.collect {|i| i[0] }.join '|'})\z/ - - while arg = ARGV.shift do - case arg - when /\A\w+\z/ - task_re === arg or raise InstallError, "wrong task: #{arg}" - return arg - - when '-q', '--quiet' - @options['verbose'] = false - - when '--verbose' - @options['verbose'] = true - - when '-h', '--help' - print_usage $stdout - exit 0 - - when '-v', '--version' - puts "#{File.basename $0} version #{Version}" - exit 0 - - when '--copyright' - puts Copyright - exit 0 - - else - raise InstallError, "unknown global option '#{arg}'" - end - end - - raise InstallError, 'no task or global option given' - end - - - def parsearg_TASK( task ) - mid = "parsearg_#{task}" - if respond_to? mid, true then - __send__ mid - else - ARGV.empty? or - raise InstallError, "#{task}: unknown options: #{ARGV.join ' '}" - end - end - - def parsearg_config - re = /\A--(#{ConfigTable.keys.join '|'})(?:=(.*))?\z/ - @options['config-opt'] = [] - - while i = ARGV.shift do - if /\A--?\z/ === i then - @options['config-opt'] = ARGV.dup - break - end - m = re.match(i) or raise InstallError, "config: unknown option #{i}" - name, value = m.to_a[1,2] - if value then - if ConfigTable.bool_config?(name) then - /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i === value or raise InstallError, "config: --#{name} allows only yes/no for argument" - value = (/\Ay(es)?|\At(rue)/i === value) ? 'yes' : 'no' - end - else - ConfigTable.bool_config?(name) or raise InstallError, "config: --#{name} requires argument" - value = 'yes' - end - @config[name] = value - end - end - - def parsearg_install - @options['no-harm'] = false - @options['install-prefix'] = '' - while a = ARGV.shift do - case a - when /\A--no-harm\z/ - @options['no-harm'] = true - when /\A--prefix=(.*)\z/ - path = $1 - path = File.expand_path(path) unless path[0,1] == '/' - @options['install-prefix'] = path - else - raise InstallError, "install: unknown option #{a}" - end - end - end - - - def print_usage( out ) - out.puts - out.puts 'Usage:' - out.puts " ruby #{File.basename $0} " - out.puts " ruby #{File.basename $0} [] []" - - fmt = " %-20s %s\n" - out.puts - out.puts 'Global options:' - out.printf fmt, '-q,--quiet', 'suppress message outputs' - out.printf fmt, ' --verbose', 'output messages verbosely' - out.printf fmt, '-h,--help', 'print this message' - out.printf fmt, '-v,--version', 'print version and quit' - out.printf fmt, '--copyright', 'print copyright and quit' - - out.puts - out.puts 'Tasks:' - TASKS.each do |name, desc| - out.printf " %-10s %s\n", name, desc - end - - out.puts - out.puts 'Options for config:' - ConfigTable.each_definition do |name, (default, arg, desc, default2)| - out.printf " %-20s %s [%s]\n", - '--'+ name + (ConfigTable.bool_config?(name) ? '' : '='+arg), - desc, - default2 || default - end - out.printf " %-20s %s [%s]\n", - '--rbconfig=path', 'your rbconfig.rb to load', "running ruby's" - - out.puts - out.puts 'Options for install:' - out.printf " %-20s %s [%s]\n", - '--no-harm', 'only display what to do if given', 'off' - - out.puts - end - - # - # config - # - - def exec_config - super - @config.save - end - - # - # show - # - - def exec_show - ConfigTable.each_name do |k| - v = @config.get_raw(k) - if not v or v.empty? then - v = '(not specified)' - end - printf "%-10s %s\n", k, v - end - end - -end - -### end toplevel.rb - -if $0 == __FILE__ then - begin - installer = ToplevelInstaller.new( Dir.pwd ) - installer.execute - rescue - raise if $DEBUG - $stderr.puts $!.message - $stderr.puts "try 'ruby #{$0} --help' for usage" - exit 1 - end -end diff --git a/vendor/RedCloth-3.0.3/run-tests.rb b/vendor/RedCloth-3.0.3/run-tests.rb deleted file mode 100644 index 65b5c969..00000000 --- a/vendor/RedCloth-3.0.3/run-tests.rb +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env ruby -require 'lib/redcloth' -require 'yaml' - -Dir["tests/*.yml"].each do |testfile| - YAML::load_documents( File.open( testfile ) ) do |doc| - if doc['in'] and doc['out'] - red = RedCloth.new( doc['in'] ) - html = if testfile =~ /markdown/ - red.to_html( :markdown ) - else - red.to_html - end - puts "---" - - html.gsub!( /\n+/, "\n" ) - doc['out'].gsub!( /\n+/, "\n" ) - if html == doc['out'] - puts "success: true" - else - puts "out: "; p html - puts "expected: "; p doc['out'] - end - end - end -end diff --git a/vendor/RedCloth-3.0.3/tests/code.yml b/vendor/RedCloth-3.0.3/tests/code.yml deleted file mode 100644 index bc7bd2cc..00000000 --- a/vendor/RedCloth-3.0.3/tests/code.yml +++ /dev/null @@ -1,105 +0,0 @@ ---- -in: 'This is an empty dictionary: @{}@' -out: '

This is an empty dictionary: {}

' ---- -in: |- - Testing nested pre tags... - -
-  
-    Good code here.
-
-    
-      a = 1
-    
- - Bad code here. - - -
-
- -out: |- -

Testing nested pre tags…

- - -
-  
-    Good code here.
-  
-    <pre>
-      a = 1
-    </pre>
-  
-    Bad code here.
-  
-    <script language="JavaScript">
-      window.open( "about:blank" );
-    </script>
-  
-  
---- -in: |- -
-  *** test
-  
-out: |- -
-  *** test
-  
---- -in: |- - - *** test - -out: |- - *** test ---- -in: '*this is strong*' -out: '

this is strong

' ---- -in: '*this test is strong*' -out: '

this test is strong

' ---- -in:
 __inline__
-out:
 __inline__
---- -in: |- - * @foo@ - * @bar@ - * and @x@ is also. -out: "
    \n\t
  • foo
  • \n\t\t
  • bar
  • \n\t\t
  • and x is also.
  • \n\t
" ---- -in: |- -
  
-
  
-out: |- -
 <hello> 
-
 <hello> 
---- -in: | - Test of Markdown-style indented code. - - a = [1, 2, 3] - a.each do |x| - puts "test number", x, - "and more!" - end - - Paragraph 2. - - Paragraph 3. -out: |- -

Test of Markdown-style indented code.

- -
a = [1, 2, 3]
-  a.each do |x|
-    puts "test number", x,
-      "and more!" 
-  end
- -

Paragraph 2.

- -

Paragraph 3.

diff --git a/vendor/RedCloth-3.0.3/tests/images.yml b/vendor/RedCloth-3.0.3/tests/images.yml deleted file mode 100644 index d097e0fb..00000000 --- a/vendor/RedCloth-3.0.3/tests/images.yml +++ /dev/null @@ -1,171 +0,0 @@ ---- -in: This is an !image.jpg! -out:

This is an

---- -in: This is an !image.jpg(with alt text)! -out:

This is an with alt text

---- -in: This is an !http://example.com/i/image.jpg! -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg#a1! -out:

This is an

---- -in: This is an !image.jpg!. -out:

This is an .

---- -in: This is an !image.jpg(with alt text)!. -out:

This is an with alt text.

---- -in: This is an !http://example.com/i/image.jpg!. -out:

This is an .

---- -in: This is an !http://example.com/i/image.jpg#a1!. -out:

This is an .

---- -in: This is not an image!!! -out:

This is not an image!!!

---- -in: This is an !http://example.com/i/image.jpg!:#1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:#a -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:#a1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:#a10 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html#1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html#a1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html#a10 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a10 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/ -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/#1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/#a -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/#a1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/#a10 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a10 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a10 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10 -out:

This is an

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b. -out:

This is an .

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1. -out:

This is an .

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a. -out:

This is an .

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1. -out:

This is an .

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10. -out:

This is an .

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b, but this is not. -out:

This is an , but this is not.

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1, but this is not. -out:

This is an , but this is not.

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a, but this is not. -out:

This is an , but this is not.

---- -in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1, but this is not. -out:

This is an , but this is not.

---- -in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not. -out:

(This is an ) This is not.

---- -in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b) This is not. -out:

(This is an ) This is not.

---- -in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1) This is not. -out:

(This is an ) This is not.

---- -in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a) This is not. -out:

(This is an ) This is not.

---- -in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1) This is not. -out:

(This is an ) This is not.

---- -in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not. -out:

(This is an ) This is not.

diff --git a/vendor/RedCloth-3.0.3/tests/instiki.yml b/vendor/RedCloth-3.0.3/tests/instiki.yml deleted file mode 100644 index 89b8ec6b..00000000 --- a/vendor/RedCloth-3.0.3/tests/instiki.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- # Bugs filed at http://www.instiki.org/show/BugReports -in: |- - _Hi, Joe Bob?, this should all be in italic!_ -out: |- -

Hi, Joe Bob?, this should all be in italic!

---- -in: '*this span is strong*' -out: '

this span is strong

' ---- -in: '*this Camel Thing? is strong*' -out: '

this Camel Thing? is strong

' ---- -in: '_this span is italic_' -out: '

this span is italic

' ---- -in: '%{color:red}nested span because of Camel Word?%' -out: '

nested span because of Camel Word?

' ---- -in: |- - h2. Version History - - * "Version - 0.0":http://www.threewordslong.com/render-0-8-9b.patch - Early version using MD5 hashes. - * "Version - 0.1":http://www.threewordslong.com/chunk-0-1.patch.gz - First cut of new system. Much cleaner. - * "Version 0.2":http://www.threewordslong.com/chunk-0-2.patch.gz - Fixed problem with "authors" page and some tests. -out: |- -

Version History

- -
    -
  • Version - 0.0 – Early version using MD5 hashes.
  • -
  • Version - 0.1 – First cut of new system. Much cleaner.
  • -
  • Version 0.2 – Fixed problem with “authors” page and some tests.
  • -
---- -in: "--richSeymour --whyTheLuckyStiff" -out: "

—richSeymour—whyTheLuckyStiff

" diff --git a/vendor/RedCloth-3.0.3/tests/links.yml b/vendor/RedCloth-3.0.3/tests/links.yml deleted file mode 100644 index 16b63331..00000000 --- a/vendor/RedCloth-3.0.3/tests/links.yml +++ /dev/null @@ -1,155 +0,0 @@ ---- -in: '"link text":#1' -out:

link text

---- -in: '"link text":#a' -out:

link text

---- -in: '"link text":#a1' -out:

link text

---- -in: '"link text":#a10' -out:

link text

---- -in: '"link text":index.html' -out:

link text

---- -in: '"link text":index.html#1' -out:

link text

---- -in: '"link text":index.html#a' -out:

link text

---- -in: '"link text":index.html#a1' -out:

link text

---- -in: '"link text":index.html#a10' -out:

link text

---- -in: '"link text":http://example.com/' -out:

link text

---- -in: '"link text":http://example.com/#1' -out:

link text

---- -in: '"link text":http://example.com/#a' -out:

link text

---- -in: '"link text":http://example.com/#a1' -out:

link text

---- -in: '"link text":http://example.com/#a10' -out:

link text

---- -in: '"link text":http://example.com/index.html' -out:

link text

---- -in: '"link text":http://example.com/index.html#a' -out:

link text

---- -in: '"link text":http://example.com/index.html#1' -out:

link text

---- -in: '"link text":http://example.com/index.html#a1' -out:

link text

---- -in: '"link text":http://example.com/index.html#a10' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar#a' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar#1' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar#a1' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar#a10' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar&a=b' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar&a=b#1' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar&a=b#a' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar&a=b#a1' -out:

link text

---- -in: '"link text":http://example.com/?foo=bar&a=b#a10' -out:

link text

---- -in: 'This is a "link":http://example.com/' -out:

This is a link

---- -in: 'This is a "link":http://example.com/.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/index.html.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/index.html#a.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/index.html#1.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/index.html#a1.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/index.html#a10.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/?foo=bar.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/?foo=bar#1.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/?foo=bar#a.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/?foo=bar#a1.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/?foo=bar#a10.' -out:

This is a link.

---- -in: 'This is a "link":http://example.com/?foo=bar#a10, but this is not.' -out:

This is a link, but this is not.

---- -in: '(This is a "link":http://example.com/?foo=bar#a10) but this is not.' -out:

(This is a link) but this is not.

---- -in: '"link text(link title)":http://example.com/' -out:

link text

-# --- -# in: '"link text(link title) ":http://example.com/' -# out:

“link text(link title) “:http://example.com/

-# comments: this is a real test and should pass ---- -in: '"(link) text(link title)":http://example.com/' -out:

text

-comments: link text can not contain parentheses ---- -in: '"Dive Into XML":http://www.xml.com/pub/au/164' -out:

Dive Into XML

---- -in: '"Lab Exercises":../lab/exercises/exercises.html.' -out:

Lab Exercises.

---- -in: 'Go to "discuss":http://www.dreammoods.com/cgibin/cutecast/cutecast.pl?forum=1&thread=26627 to discuss.' -out:

Go to discuss to discuss.

---- -in: '* "rubylang":http://www.ruby-lang.org/en/' -out: "" ---- -in: 'The ION coding style document found at "IONCodingStyleGuide.doc":http://perforce:8081/@md=d&cd=//&c=82E@//depot/systest/system/main/pub/doc/IONCodingStyleGuide.doc?ac=22 codifies a couple of rules to ensure reasonably consistent code and documentation of libraries in ION. Test text' -out:

The ION coding style document found at IONCodingStyleGuide.doc codifies a couple of rules to ensure reasonably consistent code and documentation of libraries in ION. Test text

diff --git a/vendor/RedCloth-3.0.3/tests/lists.yml b/vendor/RedCloth-3.0.3/tests/lists.yml deleted file mode 100644 index cf8938f0..00000000 --- a/vendor/RedCloth-3.0.3/tests/lists.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- # Bret Pettichord, Thanks. -in: |- - * first line - * second - line - * third line -out: |- -
    -
  • first line
  • -
  • second - line
  • -
  • third line
  • -
---- -in: |- - p. start - - * one - and one - * two - and two - * three - - p. end -out: |- -

start

-
    -
  • one - and one
  • -
  • two - and two
  • -
  • three
  • -
- -

end

---- -in: |- - Funky: - - * Testing - *# number - *##* bullet - *# number - *# number - yeah number - #* bullet - *** okay - ****# what - - -out: |- -

Funky:

-
    -
  • Testing -
      -
    1. number -
        -
      • bullet
      • -
      -
    2. -
    3. number
    4. -
    5. number - yeah number
    6. -
        -
      • bullet -
          -
        • okay -
            -
          1. what
          2. -
      • -
  • -
- - ---- -in: "* command run: @time ruby run-tests.rb > toto@" -out: "
    \n\t
  • command run: time ruby run-tests.rb > toto
  • \n\t
" diff --git a/vendor/RedCloth-3.0.3/tests/markdown.yml b/vendor/RedCloth-3.0.3/tests/markdown.yml deleted file mode 100644 index a053ea39..00000000 --- a/vendor/RedCloth-3.0.3/tests/markdown.yml +++ /dev/null @@ -1,218 +0,0 @@ -in: | - This is a regular paragraph. - - - - - -
Foo
- - This is another regular paragraph. -out: |- -

This is a regular paragraph.

- - - - - - -
Foo
-

This is another regular paragraph.

---- -in: '"Larry Bird":http://images.google.com/images?num=30&q=larry+bird' -out: '

"Larry Bird":http://images.google.com/images?num=30&q=larry+bird

' ---- -in: '©' -out:

©

---- -in: AT&T -out:

AT&T

- -# We don't do this. -# --- -# in: 4 < 5 -# out: 4 < 5 ---- -in: | - This is an H1 - ============= - - This is an H2 - ------------- -out: |- -

This is an H1

- -

This is an H2

---- -in: | - # This is an H1 - - ## This is an H2 - - ###### This is an H6 -out: |- -

This is an H1

- -

This is an H2

- -
This is an H6
---- -in: | - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - > - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - > id sem consectetuer libero luctus adipiscing. -out: |- -
-

This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

- -

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - id sem consectetuer libero luctus adipiscing.

- -
---- -in: | - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - > - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - id sem consectetuer libero luctus adipiscing. -out: |- -
-

This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

- -

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - id sem consectetuer libero luctus adipiscing.

- -
---- -in: | - > This is the first level of quoting. - > - > > This is nested blockquote. - > - > Back to the first level. -out: |- -
-

This is the first level of quoting.

-
-

This is nested blockquote.

- -
- - - -

Back to the first level.

- -
---- -in: | - > ## This is a header. - > - > 1. This is the first list item. - > 2. This is the second list item. - > - > Here's some example code: - > - > return shell_exec("echo $input | $markdown_script"); -out: |- -
-

This is a header.

- - - -

1. This is the first list item. - 2. This is the second list item.

- -

Here's some example code:

-
return shell_exec("echo $input | $markdown_script");
- -
---- -in: | - * * * - - *** - - ***** - - - - - - - --------------------------------------- - - _ _ _ -out: |- -
- -
- -
- -
- -
- -
---- -in: | - This is [an example](http://example.com/ "Title") inline link. - - [This link](http://example.net/) has no title attribute. -out: |- -

This is an example inline link.

- -

This link has no title attribute.

---- -in: See my [About](/about/) page for details. -out:

See my About page for details.

---- -in: | - This is [an example][id] reference-style link. - - This is [an example] [id] reference-style link. - - [id]: http://example.com/ "Optional Title Here" -out: |- -

This is an example reference-style link.

- -

This is an example reference-style link.

---- -in: | - [Google][] - [Google]: http://google.com/ -out:

Google

---- -in: | - Visit [Daring Fireball][] for more information. - [Daring Fireball]: http://daringfireball.net/ -out:

Visit Daring Fireball for more information.

---- -in: | - I get 10 times more traffic from [Google] [1] than from - [Yahoo] [2] or [MSN] [3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -out: |- -

I get 10 times more traffic from Google than from - Yahoo or MSN.

---- -in: | - I get 10 times more traffic from [Google][] than from - [Yahoo][] or [MSN][]. - - [google]: http://google.com/ "Google" - [yahoo]: http://search.yahoo.com/ "Yahoo Search" - [msn]: http://search.msn.com/ "MSN Search" -out: |- -

I get 10 times more traffic from Google than from - Yahoo or MSN.

diff --git a/vendor/RedCloth-3.0.3/tests/poignant.yml b/vendor/RedCloth-3.0.3/tests/poignant.yml deleted file mode 100644 index 1a0f6942..00000000 --- a/vendor/RedCloth-3.0.3/tests/poignant.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- # Tests from the (Poignant Guide) -in: > - h3. False - - - ! - if plastic_cup - print "Plastic cup is on the up 'n' up!" - end -
- - - If @plastic_cup@ contains either @nil@ or @false@, you won't see anything print - to the screen. They're not on the @if@ guest list. So @if@ isn't going to run - any of the code it's protecting. - - - But @nil@ and @false@ need not walk away in shame. They may be of questionable - character, but @unless@ runs a smaller establishment that caters to the bedraggled. - The @unless@ keyword has a policy of only allowing those with a negative charge in. - Who are: @nil@ and @false@. - - -
-    unless plastic_cup
-      print "Plastic cup is on the down low."
-    end
-  
- - - You can also use @if@ and @unless@ at the end of a single line of code, if that's - all that is being protected. - - -
-    print "Yeah, plastic cup is up again!" if plastic_cup
-    print "Hardly. It's down." unless plastic_cup
-  
- - - Now that you've met @false@, I'm sure you can see what's on next. - -out: "

False

\n\n\t

\"Shape

\n\n\t

The cat Trady Blix. Frozen in emptiness. Immaculate whiskers rigid. Placid eyes of lake. Tail of warm icicle. Sponsored by a Very Powerful Pause Button.

\n\n\t

The darkness surrounding Blix can be called negative space. Hang on to that phrase. Let it suggest that the emptiness has a negative connotation. In a similar way, nil has a slightly sour note that it whistles.

\n\n\t

Generally speaking, everything in Ruby has a positive charge to it. This spark flows through strings, numbers, regexps, all of it. Only two keywords wear a shady cloak: nil and false draggin us down.

\n\n\t

You can test that charge with an if keyword. It looks very much like the do blocks we saw in the last chapter, in that both end with an end.

\n\n\n
\n  if plastic_cup\n    print \"Plastic cup is on the up 'n' up!\" \n  end\n
\n\t

If plastic_cup contains either nil or false, you won’t see anything print to the screen. They’re not on the if guest list. So if isn’t going to run any of the code it’s protecting.

\n\n\t

But nil and false need not walk away in shame. They may be of questionable character, but unless runs a smaller establishment that caters to the bedraggled. The unless keyword has a policy of only allowing those with a negative charge in. Who are: nil and false.

\n\n\n
\n  unless plastic_cup\n    print \"Plastic cup is on the down low.\" \n  end\n
\n\t

You can also use if and unless at the end of a single line of code, if that’s all that is being protected.

\n\n\n
\n  print \"Yeah, plastic cup is up again!\" if plastic_cup\n  print \"Hardly. It's down.\" unless plastic_cup\n
\n\t

Now that you’ve met false, I’m sure you can see what’s on next.

" diff --git a/vendor/RedCloth-3.0.3/tests/table.yml b/vendor/RedCloth-3.0.3/tests/table.yml deleted file mode 100644 index bf5059e1..00000000 --- a/vendor/RedCloth-3.0.3/tests/table.yml +++ /dev/null @@ -1,198 +0,0 @@ -in: | - {background:#ddd}. |S|Target|Complete|App|Milestone| - |!/i/g.gif!|11/18/04|11/18/04|070|XML spec complete| - |!/i/g.gif!|11/29/04|11/29/04|011|XML spec complete (KH is on schedule)| - |!/i/g.gif!|11/29/04|11/29/04|051|XML spec complete (KH is on schedule)| - |!/i/g.gif!|11/29/04|11/29/04|081|XML spec complete (KH is on schedule)| - |!/i/g.gif!|11/19/04|11/22/04|070|Preprocessor complete| - |!/i/g.gif!|11/22/04|11/22/04|070|Dialog pass 1 builds an index file| - |!/i/g.gif!|11/24/04|11/24/04|070|Dialog pass 2 98% complete| - |!/i/g.gif!|11/30/04|11/30/04|070|Feature complete. Passes end-to-end smoke test.| - |!/i/g.gif!|11/30/04|11/30/04|011|Preprocessor updates complete| - |!/i/g.gif!|11/30/04|11/30/04|051|Preprocessor updates complete| - |!/i/g.gif!|11/30/04|11/29/04|081|Preprocessor updates complete| - |!/i/w.gif!|12/02/04|.|011|Dialog pass 1 and 2 complete (98+%)| - |!/i/w.gif!|12/02/04|.|051|Dialog pass 1 and 2 complete (98+%)| - |!/i/w.gif!|12/02/04|.|081|Dialog pass 1 and 2 complete (98+%)| - |!/i/w.gif!|12/03/04|.|011|Feature complete| - |!/i/w.gif!|12/03/04|.|051|Feature complete| - |!/i/w.gif!|12/03/04|.|081|Feature complete| - |!/i/w.gif!|12/10/04|.|011|Deployed to Napa test workstation. Passes smoke test.| - |!/i/w.gif!|12/10/04|.|051|Deployed to Napa test workstation. Passes smoke test.| - |!/i/w.gif!|12/10/04|.|081|Deployed to Napa test workstation. Passes smoke test.| - |!/i/w.gif!|12/10/04|.|070|Deployed to Napa test workstation. Passes smoke test.| - |!/i/w.gif!|12/17/04|.|011|System testing complete. Begin testing with live customer data.| - |!/i/w.gif!|12/17/04|.|051|System testing complete. Begin testing with live customer data.| - |!/i/w.gif!|12/17/04|.|081|System testing complete. Begin testing with live customer data.| - |!/i/w.gif!|12/17/04|.|070|System testing complete. Begin testing with live customer data.| -out: |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STargetCompleteAppMilestone
11/18/0411/18/04070XML spec complete
11/29/0411/29/04011XML spec complete (KH is on schedule)
11/29/0411/29/04051XML spec complete (KH is on schedule)
11/29/0411/29/04081XML spec complete (KH is on schedule)
11/19/0411/22/04070Preprocessor complete
11/22/0411/22/04070Dialog pass 1 builds an index file
11/24/0411/24/04070Dialog pass 2 98% complete
11/30/0411/30/04070Feature complete. Passes end-to-end smoke test.
11/30/0411/30/04011Preprocessor updates complete
11/30/0411/30/04051Preprocessor updates complete
11/30/0411/29/04081Preprocessor updates complete
12/02/04011Dialog pass 1 and 2 complete (98+%)
12/02/04051Dialog pass 1 and 2 complete (98+%)
12/02/04081Dialog pass 1 and 2 complete (98+%)
12/03/04011Feature complete
12/03/04051Feature complete
12/03/04081Feature complete
12/10/04011Deployed to Napa test workstation. Passes smoke test.
12/10/04051Deployed to Napa test workstation. Passes smoke test.
12/10/04081Deployed to Napa test workstation. Passes smoke test.
12/10/04070Deployed to Napa test workstation. Passes smoke test.
12/17/04011System testing complete. Begin testing with live customer data.
12/17/04051System testing complete. Begin testing with live customer data.
12/17/04081System testing complete. Begin testing with live customer data.
12/17/04070System testing complete. Begin testing with live customer data.
diff --git a/vendor/RedCloth-3.0.3/tests/textism.yml b/vendor/RedCloth-3.0.3/tests/textism.yml deleted file mode 100644 index 5489c04d..00000000 --- a/vendor/RedCloth-3.0.3/tests/textism.yml +++ /dev/null @@ -1,397 +0,0 @@ ---- -in: h1. Header 1 -out:

Header 1

---- -in: h2. Header 2 -out:

Header 2

---- -in: h3. Header 3 -out:

Header 3

---- -in: |- - Any old text. - - bq. A block quotation. - - Any old text. - -out: |- -

Any old text.

- -
-

A block quotation.

-
- -

Any old text.

- ---- -in: This is covered elsewhere[1]. -out:

This is covered elsewhere1.

---- -in: fn1. Down here, in fact. -out:

1 Down here, in fact.

---- -in: |- - # A first item - # A second item - # A third item - # A fourth item -out: |- -
    -
  1. A first item
  2. -
  3. A second item
  4. -
  5. A third item
  6. -
  7. A fourth item
  8. -
---- -in: |- - * A first item - * A second item - * A third item - * A fourth item - -out: |- -
    -
  • A first item
  • -
  • A second item
  • -
  • A third item
  • -
  • A fourth item
  • -
- ---- -in: _a phrase_ -out:

a phrase

---- -in: __a phrase__ -out:

a phrase

---- -in: '*a phrase*' -out:

a phrase

---- -in: '**a phrase**' -out:

a phrase

---- -in: Nabokov's ??Pnin?? -out:

Nabokov’s Pnin

---- -in: -a phrase- -out:

a phrase

---- -in: +a phrase+ -out:

a phrase

---- -in: ^a phrase^ -out:

a phrase

---- -in: ~a phrase~ -out:

a phrase

-# --- -# in: %(caps)SPAN% -# out:

SPAN ---- -in: %{color:red}red% -out:

red

---- -in: %[fr]rouge% -out:

rouge

---- -in: _(big)red_ -out:

red

---- -in: p(bob). A paragraph -out:

A paragraph

---- -in: p{color:#ddd}. A paragraph -out:

A paragraph

---- -in: p[fr]. A paragraph -out:

A paragraph

---- -in: h2()>. right-aligned header2, indented 1em both side -out:

right-aligned header2, indented 1em both side

---- -in: h3=. centered header -out:

centered header

---- -in: '!>/image.gif! right-aligned image' -out:

right-aligned image

---- -in: p[no]{color:red}. A Norse of a different colour. -out:

A Norse of a different colour.

---- -in: |- - |This|is|a|simple|table| - |This|is|a|simple|row| -out: |- - - - - - - - - - - - - - - - -
Thisisasimpletable
Thisisasimplerow
---- -in: |- - table{border:1px solid black}. - |This|is|a|row| - |This|is|a|row| -out: |- - - - - - - - - - - - - - -
Thisisarow
Thisisarow
---- -in: '{background:#ddd}. |This|is|a|row|' -out: |- - - - - - - - -
Thisisarow
---- -in: |- - |{background:#ddd}. Cell with gray background| - |\2. Cell spanning 2 columns| - |/3. Cell spanning 3 rows| - |>. Right-aligned cell| -out: |- - - - - - - - - - - - - - -
Cell with gray background
Cell spanning 2 columns
Cell spanning 3 rows
Right-aligned cell
-# --- -# in: |- -# This is a "link":bob to Bob's website. -# -# [bob]http://itsbob.com/index.html ---- -in: ACLU(American Civil Liberties Union) -out:

ACLU

---- -in: |- - h2{color:green}. This is a title - - h3. This is a subhead - - p{color:red}. This is some text of dubious character. Isn't the use of "quotes" just lazy writing -- and theft of 'intellectual property' besides? I think the time has come to see a block quote. - - bq[fr]. This is a block quote. I'll admit it's not the most exciting block quote ever devised. - - Simple list: - - #{color:blue} one - # two - # three - - Multi-level list: - - # one - ## aye - ## bee - ## see - # two - ## x - ## y - # three - - Mixed list: - - * Point one - * Point two - ## Step 1 - ## Step 2 - ## Step 3 - * Point three - ** Sub point 1 - ** Sub point 2 - - - Well, that went well. How about we insert an old-fashioned hypertext link? Will the quote marks in the tags get messed up? No! - - "This is a link (optional title)":http://www.textism.com - - table{border:1px solid black}. - |_. this|_. is|_. a|_. header| - <{background:gray}. |\2. this is|{background:red;width:200px}. a|^<>{height:200px}. row| - |this|<>{padding:10px}. is|^. another|(bob#bob). row| - - An image: - - !/common/textist.gif(optional alt text)! - - # Librarians rule - # Yes they do - # But you knew that - - Some more text of dubious character. Here is a noisome string of CAPITAL letters. Here is something we want to _emphasize_. - That was a linebreak. And something to indicate *strength*. Of course I could use my own HTML tags if I felt like it. - - h3. Coding - - This is some code, "isn't it". Watch those quote marks! Now for some preformatted text: - -
-  
-      $text = str_replace("

%::%

","",$text); - $text = str_replace("%::%

","",$text); - $text = str_replace("%::%","",$text); - -
-
- - This isn't code. - - - So you see, my friends: - - * The time is now - * The time is not later - * The time is not yesterday - * We must act - -out: |- -

This is a title

- -

This is a subhead

- -

This is some text of dubious character. Isn’t the use of “quotes” just lazy writing—and theft of ‘intellectual property’ besides? I think the time has come to see a block quote.

- -
-

This is a block quote. I’ll admit it’s not the most exciting block quote ever devised.

-
- -

Simple list:

-
    -
  1. one
  2. -
  3. two
  4. -
  5. three
  6. -
- -

Multi-level list:

-
    -
  1. one -
      -
    1. aye
    2. -
    3. bee
    4. -
    5. see
    6. -
    -
  2. -
  3. two -
      -
    1. x
    2. -
    3. y
    4. -
    -
  4. -
  5. three
  6. -
- -

Mixed list:

-
    -
  • Point one
  • -
  • Point two -
      -
    1. Step 1
    2. -
    3. Step 2
    4. -
    5. Step 3
    6. -
    -
  • -
  • Point three -
      -
    • Sub point 1
    • -
    • Sub point 2
    • -
  • -
- -

Well, that went well. How about we insert an old-fashioned hypertext link? Will the quote marks in the tags get messed up? No!

- -

This is a link

- - - - - - - - - - - - - - - - - - - -
thisisaheader
this isarow
thisisanotherrow
- - - -

An image:

- -

optional alt text

-
    -
  1. Librarians rule
  2. -
  3. Yes they do
  4. -
  5. But you knew that
  6. -
- -

Some more text of dubious character. Here is a noisome string of CAPITAL letters. Here is something we want to emphasize. - That was a linebreak. And something to indicate strength. Of course I could use my own HTML tags if I felt like it.

- -

Coding

- -

This is some code, "isn't it". Watch those quote marks! Now for some preformatted text:

- - -
-  
-      $text = str_replace("<p>%::%</p>","",$text);
-      $text = str_replace("%::%</p>","",$text);
-      $text = str_replace("%::%","",$text);
-  
-  
-  
-

This isn’t code.

- -

So you see, my friends:

-
    -
  • The time is now
  • -
  • The time is not later
  • -
  • The time is not yesterday
  • -
  • We must act
  • -
- diff --git a/vendor/rubyzip-0.5.8/ChangeLog b/vendor/rubyzip-0.5.8/ChangeLog deleted file mode 100644 index 1bb67582..00000000 --- a/vendor/rubyzip-0.5.8/ChangeLog +++ /dev/null @@ -1,1273 +0,0 @@ -2005-03-17 18:11 thomas - - * NEWS, README, lib/zip/zip.rb: [no log message] - -2005-03-17 18:04 thomas - - * install.rb: Fixed install.rb - -2005-03-03 18:38 thomas - - * Rakefile: [no log message] - -2005-02-27 16:23 thomas - - * lib/zip/ziprequire.rb: Added documentation to ziprequire - -2005-02-27 16:17 thomas - - * README, TODO, lib/zip/ziprequire.rb: Added documentation to - ziprequire - -2005-02-27 15:02 thomas - - * Rakefile, test/ziptest.rb: [no log message] - -2005-02-19 21:30 thomas - - * lib/zip/ioextras.rb, lib/zip/stdrubyext.rb, - lib/zip/tempfile_bugfixed.rb, lib/zip/zip.rb, - lib/zip/ziprequire.rb, test/ioextrastest.rb, - test/stdrubyexttest.rb, test/zipfilesystemtest.rb, - test/ziprequiretest.rb, test/ziptest.rb: Added more rdoc and - changed the remaining tests to Test::Unit - -2005-02-19 20:28 thomas - - * lib/zip/: ioextras.rb, zip.rb: Added documentation to - ZipInputStream and ZipOutputStream - -2005-02-18 10:27 thomas - - * README: [no log message] - -2005-02-17 23:21 thomas - - * README, Rakefile: Added ppackage (publish package) task to - Rakefile - -2005-02-17 22:49 thomas - - * README, Rakefile, TODO: Added pdoc (publish doc) task to Rakefile - -2005-02-17 21:27 thomas - - * README, Rakefile, TODO, lib/zip/stdrubyext.rb, lib/zip/zip.rb, - lib/zip/zipfilesystem.rb: Added a bunch of documentation - -2005-02-17 09:47 thomas - - * test/ziptest.rb: [no log message] - -2005-02-16 20:04 thomas - - * NEWS, README, Rakefile: Improved documentation and added rdoc - task to Rakefile - -2005-02-16 19:01 thomas - - * NEWS, Rakefile, lib/zip/zip.rb: [no log message] - -2005-02-16 18:47 thomas - - * Rakefile, samples/example.rb, samples/example_filesystem.rb, - samples/gtkRubyzip.rb, samples/write_simple.rb, - samples/zipfind.rb, test/.cvsignore, test/gentestfiles.rb: - Improvements to Rakefile - -2005-02-15 23:35 thomas - - * NEWS, TODO: [no log message] - -2005-02-15 23:26 thomas - - * Rakefile, rubyzip.gemspec: Now uses Rake to build gem - -2005-02-15 22:52 thomas - - * Rakefile: [no log message] - -2005-02-15 22:39 thomas - - * lib/zip/zip.rb, test/.cvsignore, test/ziptest.rb, NEWS: Fixed - compatibility issue with ruby 1.8.2. Migrated test suite to - Test::Unit - -2005-02-15 22:10 thomas - - * NEWS, lib/zip/ioextras.rb, lib/zip/stdrubyext.rb, - lib/zip/tempfile_bugfixed.rb, lib/zip/zip.rb, - lib/zip/zipfilesystem.rb, lib/zip/ziprequire.rb, test/.cvsignore, - test/file1.txt, test/file1.txt.deflatedData, test/file2.txt, - test/gentestfiles.rb, test/ioextrastest.rb, - test/notzippedruby.rb, test/rubycode.zip, test/rubycode2.zip, - test/stdrubyexttest.rb, test/testDirectory.bin, - test/zipWithDirs.zip, test/zipfilesystemtest.rb, - test/ziprequiretest.rb, test/ziptest.rb, test/data/.cvsignore, - test/data/file1.txt, test/data/file1.txt.deflatedData, - test/data/file2.txt, test/data/notzippedruby.rb, - test/data/rubycode.zip, test/data/rubycode2.zip, - test/data/testDirectory.bin, test/data/zipWithDirs.zip: Changed - directory structure - -2005-02-13 22:44 thomas - - * Rakefile, TODO: [no log message] - -2005-02-13 22:38 thomas - - * rubyzip.gemspec: [no log message] - -2005-02-13 21:53 thomas - - * install.rb: Made install.rb independent of the current path - (fixes bug reported by Drew Robinson) - -2004-12-12 11:22 thomas - - * NEWS, TODO, samples/write_simple.rb: Fixed 'version needed to - extract'-field wrong in local headers - -2004-05-02 15:17 thomas - - * rubyzip.gemspec: Added gemspec contributed by Chad Fowler - -2004-04-02 07:25 thomas - - * NEWS: Fix for FreeBSD 4.9 - -2004-03-29 00:28 thomas - - * NEWS: [no log message] - -2004-03-28 17:59 thomas - - * NEWS: [no log message] - -2004-03-27 16:09 thomas - - * test/stdrubyexttest.rb: Patch for stdrubyext.rb from Nobu Nakada - -2004-03-27 15:30 thomas - - * test/: ioextrastest.rb, stdrubyexttest.rb: converted some files - to unix line-endings - -2004-03-25 16:34 thomas - - * NEWS, install.rb: Significantly reduced memory footprint when - modifying zip files - -2004-03-16 18:20 thomas - - * install.rb, test/alltests.rb, test/ioextrastest.rb, - test/stdrubyexttest.rb, test/ziptest.rb: IO utility classes moved - to new file ioextras.rb. Tests moved to new file ioextrastest.rb - -2004-02-27 13:21 thomas - - * NEWS: Optimization to avoid decompression and recompression - -2004-01-30 16:17 thomas - - * NEWS: [no log message] - -2004-01-30 16:07 thomas - - * README, test/zipfilesystemtest.rb, test/ziptest.rb: Applied - extra-field patch - -2003-12-13 16:57 thomas - - * TODO: [no log message] - -2003-12-10 00:25 thomas - - * test/ziptest.rb: (Temporary) fix to bug reported by Takashi Sano - -2003-08-23 09:42 thomas - - * test/ziptest.rb, NEWS: Fixed ZipFile.get_ouput_stream bug - data - was never written to zip - -2003-08-21 16:05 thomas - - * install.rb: [no log message] - -2003-08-21 16:01 thomas - - * alltests.rb, stdrubyexttest.rb, zipfilesystemtest.rb, - ziprequiretest.rb, ziptest.rb, test/alltests.rb, - test/stdrubyexttest.rb, test/zipfilesystemtest.rb, - test/ziprequiretest.rb, test/ziptest.rb: Moved all test ruby - files to test/ - -2003-08-21 15:54 thomas - - * NEWS, install.rb, stdrubyext.rb, stdrubyexttest.rb, zip.rb, - zipfilesystem.rb, zipfilesystemtest.rb, ziprequire.rb, - ziprequiretest.rb, ziptest.rb, samples/example.rb, - samples/example_filesystem.rb, samples/gtkRubyzip.rb, - samples/zipfind.rb: Moved all production source files to zip/ so - they are in the same dir as when they are installed - -2003-08-21 15:31 thomas - - * NEWS, TODO, alltests.rb: [no log message] - -2003-08-21 15:26 thomas - - * filearchive.rb, filearchivetest.rb, fileutils.rb: Removed - filearchive.rb, filearchivetest.rb and fileutils.rb - -2003-08-21 15:24 thomas - - * samples/.cvsignore, samples/example_filesystem.rb, zip.rb: Added - samples/example_filesystem.rb. Fixed Tempfile creation for - entries created with get_output_stream where entries were in a - subdirectory - -2003-08-21 15:15 thomas - - * zip.rb, ziptest.rb: Fixed mkdir bug. ZipFile.mkdir didn't work if - the zipfile doesn't exist already - -2003-08-21 15:05 thomas - - * ziptest.rb: [no log message] - -2003-08-21 14:53 thomas - - * TODO, zipfilesystemtest.rb: Globbing test placeholder commented - out - -2003-08-21 14:32 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented ZipFsDir.new - and open - -2003-08-21 14:19 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented DirFsIterator - and tests - -2003-08-20 22:50 thomas - - * NEWS, TODO: [no log message] - -2003-08-20 22:45 thomas - - * zipfilesystemtest.rb: [no log message] - -2003-08-20 22:44 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsDir.foreach, ZipFsDir.entries now reimplemented in terms of - it - -2003-08-20 22:25 thomas - - * README: [no log message] - -2003-08-20 18:08 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: [no log message] - -2003-08-20 17:30 thomas - - * zipfilesystem.rb: All access from ZipFsFile and ZipFsDir to - ZipFile is now routed through ZipFileNameMapper which has the - single responsibility of mapping entry/filenames - -2003-08-20 17:18 thomas - - * alltests.rb, stdrubyext.rb, stdrubyexttest.rb: Added - stdrubyexttest.rb and added test test_select_map - -2003-08-20 16:10 thomas - - * zipfilesystem.rb: ZipFsDir was in the wrong module. ZipFileSystem - now has a ctor that creates ZipFsDir and ZipFsFile instances, - instead of creating them lazily. It then passes the dir instance - to the file instance and vice versa - -2003-08-20 15:55 thomas - - * zip.rb, zipfilesystem.rb, zipfilesystemtest.rb: ZipFsFile.open - honours chdir - -2003-08-20 15:39 thomas - - * stdrubyext.rb, zip.rb, zipfilesystem.rb, zipfilesystemtest.rb, - ziptest.rb: Fixed ZipEntry::parent_as_string. Implemented - ZipFsDir.chdir, pwd and entries including test - -2003-08-19 15:44 thomas - - * zip.rb, zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsDir.mkdir - -2003-08-19 15:07 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsDir.delete (and aliases rmdir and unlink) - -2003-08-19 14:33 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Another dummy - implementation and commented out a test for select() which can be - added later - -2003-08-18 20:40 thomas - - * ziptest.rb: Honoured 1.8.0 Object.to_a deprecation warning - -2003-08-18 20:30 thomas - - * zip.rb, ziptest.rb, samples/example.rb, samples/zipfind.rb: - Converted a few more names to ruby underscore style that I missed - with the automated processing the first time around - -2003-08-18 18:39 thomas - - * zip.rb, zipfilesystem.rb, zipfilesystemtest.rb, ziptest.rb: - Implemented Zip::ZipFile.get_output_stream - -2003-08-17 18:28 thomas - - * README, install.rb, stdrubyext.rb, zipfilesystem.rb, - zipfilesystemtest.rb: Updated README with Documentation section. - Updated install.rb. Fixed three tests that failed on 1.8.0. - -2003-08-14 05:40 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Added empty - implementations of atime and ctime - -2003-08-13 17:08 thomas - - * simpledist.rb: Moved simpledist to a separate repository called - 'misc' - -2003-08-13 16:31 thomas - - * NEWS: [no log message] - -2003-08-13 16:29 thomas - - * stdrubyext.rb, zip.rb, zipfilesystem.rb, zipfilesystemtest.rb, - ziprequire.rb, ziprequiretest.rb, ziptest.rb, samples/example.rb, - samples/gtkRubyzip.rb, samples/zipfind.rb: Changed all method - names to the ruby convention underscore style - -2003-08-13 15:18 thomas - - * alltests.rb, zipfilesystem.rb, zipfilesystemtest.rb: Implemented - a lot more of the stat methods. Mostly with dummy implementations - that return values that indicate that these features aren't - supported - -2003-08-13 11:44 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented more methods - and tests in zipfilesystem. Mostly empty methods as permissions - and file types other than files and directories are not supported - -2003-08-13 11:29 thomas - - * install.rb, stdrubyext.rb, zip.rb, zipfilesystem.rb, - zipfilesystemtest.rb: Addd file stdrubyext.rb and moved the - modifications to std ruby classes to it. Refactored the ZipFsStat - tests and ZipFsStat. Added Module.forwardMessages and used it to - implement the forwarding of calls in ZipFsStat - -2003-08-13 10:39 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Added - Zip::ZipFsFile::ZipFsStat and started implementing it and its - methods - -2003-08-13 10:02 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb, ziptest.rb: Updated and - added missing copyright notices - -2003-08-13 10:00 thomas - - * zip.rb, zipfilesystem.rb, zipfilesystemtest.rb: zipfilesystem.rb - is becoming big and not everyone will want to use that code. - Therefore zip.rb no longer requires it. Instead you must require - zipfilesystem.rb itself if you want to use it - -2003-08-13 09:51 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented dummy - permission test methods - -2003-08-13 06:37 thomas - - * TODO, zip.rb, ziptest.rb: Merged from patch from Kristoffer - Lunden. Fixed more 1.8.0 incompatibilites - tests run on 1.8.0 - now - -2003-08-12 19:18 thomas - - * zip.rb: Get rid of 1.8.0 warning - -2003-08-12 19:14 thomas - - * ziptest.rb: ruby 1.8.0 compatibility fix - -2003-08-12 19:13 thomas - - * NEWS, zip.rb: ruby-zlib 0.6.0 compatibility fix - -2002-12-22 20:12 thomas - - * zip.rb: [no log message] - -2002-09-16 22:11 thomas - - * NEWS: [no log message] - -2002-09-15 17:16 thomas - - * samples/zipfind.rb: [no log message] - -2002-09-15 00:02 thomas - - * samples/zipfind.rb: [no log message] - -2002-09-14 22:59 thomas - - * samples/zipfind.rb: Added simple zipfind script - -2002-09-13 23:53 thomas - - * TODO: Added TODO about openmode for zip entries binary/ascii - -2002-09-13 20:54 thomas - - * NEWS: ziptest now runs without errors with ruby-1.7.2-4 (Andy's - latest build) - -2002-09-13 20:51 thomas - - * zip.rb, ziprequiretest.rb, ziptest.rb: ziptest now runs without - errors with ruby-1.7.2-4 (Andy's latest build) - -2002-09-12 00:20 thomas - - * zipfilesystemtest.rb: Improved ZipFsFile.delete/unlink test - -2002-09-12 00:12 thomas - - * test/.cvsignore: [no log message] - -2002-09-12 00:10 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.delete/unlink - -2002-09-11 22:22 thomas - - * alltests.rb: [no log message] - -2002-09-11 22:18 thomas - - * NEWS, zip.rb, zipfilesystem.rb, zipfilesystemtest.rb: Fixed - AbstractInputStream.each_line ignored its aSeparator argument. - Implemented more ZipFsFile methods - -2002-09-11 21:28 thomas - - * zip.rb, zipfilesystem.rb, zipfilesystemtest.rb: ZipFileSystem is - now a module instead of a class, and is mixed into ZipFile, - instead of being made available as a property fileSystem - -2002-09-10 23:45 thomas - - * NEWS: Updated NEWS file - -2002-09-10 23:26 thomas - - * zip.rb: [no log message] - -2002-09-10 22:39 thomas - - * NEWS, zip.rb, ziptest.rb: Fix bug: rewind should reset lineno. - Fix bug: Deflater.read uses separate buffer from produceInput - (feeding gets/readline etc) - -2002-09-09 23:48 thomas - - * .cvsignore: [no log message] - -2002-09-09 22:55 uid26649 - - * zip.rb, ziptest.rb: Implemented ZipInputStream.rewind and - AbstractInputStream.lineno. Tests for both - -2002-09-09 20:31 thomas - - * zip.rb, ziptest.rb: ZipInputStream and ZipOutstream (thru their - AbstractInputStream and AbstractOutputStream now lie about being - kind_of?(IO) - -2002-09-08 16:38 thomas - - * zipfilesystemtest.rb: [no log message] - -2002-09-08 16:07 thomas - - * filearchive.rb, filearchivetest.rb, zip.rb, ziptest.rb: Moved - String additions from filearchive.rb to zip.rb (and moved tests - along too to ziptest.rb). Added ZipEntry.parentAsString and - ZipEntrySet.parent - -2002-09-08 15:28 thomas - - * ziptest.rb: Implemented ZipEntrySetTest.testDup and testCompound - -2002-09-08 15:17 thomas - - * TODO, zip.rb, ziptest.rb: Replaced Array with EntrySet for - keeping entries in a zip file. Tagged repository before this - commit, so this change can be rolled back, if it stinks - -2002-09-07 20:21 thomas - - * zip.rb, ziptest.rb: Implemented ZipEntry.<=> - -2002-09-07 14:48 thomas - - * ziptest.rb: Removed unused code - -2002-08-11 15:14 thomas - - * zip.rb, ziptest.rb: Made some changes to accomodate ruby 1.7.2 - -2002-07-27 15:25 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented ZipFsFile.new - -2002-07-27 00:30 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.pipe - -2002-07-27 00:25 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.link - -2002-07-27 00:23 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.symlink - -2002-07-27 00:20 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.readlink, wrapped ZipFileSystem class in Zip module - -2002-07-27 00:14 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.zero? - -2002-07-27 00:01 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented test for - ZipFsFile.directory? - -2002-07-26 23:56 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.socket? - -2002-07-26 23:50 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.join - -2002-07-26 23:32 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.ftype - -2002-07-26 23:19 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.blockdev? - -2002-07-26 23:12 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.size? (slightly different from size) - -2002-07-26 23:03 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.split - -2002-07-26 23:00 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implemented - ZipFsFile.symlink? - -2002-07-26 22:58 thomas - - * alltests.rb, zip.rb, zipfilesystem.rb, zipfilesystemtest.rb: - Implemented ZipFsFile.mtime - -2002-07-26 17:08 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: Implement ZipFsFile.file? - -2002-07-26 17:06 thomas - - * zip.rb, ziptest.rb: Implemented ZipEntry.file? - -2002-07-26 16:57 thomas - - * alltests.rb, filearchive.rb, filearchivetest.rb, zip.rb, - zipfilesystem.rb, zipfilesystemtest.rb, ziprequire.rb, - ziptest.rb: Implemented ZipFileSystem::ZipFsFile.size - -2002-07-26 16:41 thomas - - * zipfilesystem.rb, zipfilesystemtest.rb: [no log message] - -2002-07-26 16:40 thomas - - * test/zipWithDirs.zip: Changed zipWithDirs.zip so all the entries - in it have unix file endings - -2002-07-26 16:12 thomas - - * alltests.rb, zip.rb, zipfilesystem.rb, zipfilesystemtest.rb: - Started implementing ZipFileSystem - -2002-07-26 15:56 thomas - - * test/zipWithDirs.zip: Added a zip file for testing with a - directory structure - -2002-07-22 21:40 thomas - - * TODO: [no log message] - -2002-07-22 17:49 thomas - - * TODO: [no log message] - -2002-07-21 18:20 thomas - - * NEWS: [no log message] - -2002-07-21 18:12 thomas - - * TODO: Updated TODO with a refactoring idea for FileArchive - -2002-07-21 17:59 thomas - - * filearchive.rb, filearchivetest.rb: Added some FileArchiveAdd - tests and cleaned up some of the FileArchive tests. extract and - add now have individual test fixtures. - -2002-07-21 16:02 thomas - - * filearchive.rb, filearchivetest.rb: Added tests for extract - called with regex src arg and Enumerable src arg - -2002-07-21 15:37 thomas - - * filearchivetest.rb: Added test for continueOnExistsProc when - extracting from a file archive - -2002-07-20 17:13 thomas - - * TODO, filearchivetest.rb, fileutils.rb, ziptest.rb, - test/.cvsignore: Added (failing) tests for FileArchive.add, added - code for creating test files for FileArchive.add tests. Added - fileutils.rb, which is borrowed from ruby 1.7.2 - -2002-07-20 16:07 thomas - - * filearchive.rb, filearchivetest.rb: [no log message] - -2002-07-20 16:05 thomas - - * filearchivetest.rb: Added tests for String extensions - -2002-07-20 02:20 thomas - - * alltests.rb, ziprequiretest.rb, ziptest.rb: [no log message] - -2002-07-20 00:42 thomas - - * install.rb: [no log message] - -2002-07-20 00:42 thomas - - * TODO: Updated TODO - -2002-07-20 00:35 thomas - - * filearchive.rb, filearchivetest.rb: All FileArchive.extract tests - run - -2002-07-19 23:11 thomas - - * filearchive.rb, filearchivetest.rb: [no log message] - -2002-07-19 19:41 thomas - - * filearchivetest.rb: [no log message] - -2002-07-19 19:06 thomas - - * filearchive.rb, filearchivetest.rb: [no log message] - -2002-07-19 18:48 thomas - - * filearchive.rb, filearchivetest.rb, zip.rb: [no log message] - -2002-07-08 13:41 thomas - - * TODO: [no log message] - -2002-06-11 19:47 thomas - - * filearchive.rb, filearchivetest.rb, zip.rb, ziptest.rb: [no log - message] - -2002-05-25 00:41 thomas - - * simpledist.rb: Added hackish script for creating dist files - -2002-04-30 21:22 thomas - - * TODO: [no log message] - -2002-04-30 21:16 thomas - - * filearchive.rb, filearchivetest.rb: [no log message] - -2002-04-30 20:40 thomas - - * filearchive.rb, filearchivetest.rb: Improved testing and wrote - some of the skeleton of extract. Still to do: Fix glob, so it - returns a hashmap instead of a list. The map will need to map the - full entry name to the last part of the name (which is only - really interesting for recursively extracted entries, otherwise - it is just the name). Glob.expandPathList should also output - directories with a trailing slash, which is doesn't right now. - -2002-04-30 19:52 thomas - - * filearchive.rb, filearchivetest.rb: Implemented the first few - tests for FileArchive - -2002-04-24 22:06 thomas - - * ziprequire.rb, ziprequiretest.rb: Appended copyright message to - ziprequire.rb and ziprequiretest.rb - -2002-04-24 20:59 thomas - - * zip.rb: Made ZipEntry tolerate invalid dates - -2002-04-21 00:57 thomas - - * NEWS, TODO, zip.rb, ziptest.rb: Read and write entry modification - date/time correctly - -2002-04-20 02:44 thomas - - * ziprequiretest.rb, test/rubycode2.zip: improved ZipRequireTest - -2002-04-20 02:39 thomas - - * ziprequire.rb: Made a warning go away - -2002-04-20 02:38 thomas - - * ziprequire.rb, ziprequiretest.rb, test/notzippedruby.rb, - test/rubycode.zip: Fixed a bug in ziprequire. Added - ziprequiretest.rb and test data files - -2002-04-19 22:43 thomas - - * zip.rb, ziptest.rb: Added recursion support to Glob module - -2002-04-18 21:37 thomas - - * NEWS, TODO, zip.rb, ziptest.rb: Added Glob module and GlobTest - unit test suite. This module provides the functionality to expand - a 'glob pattern' given a list of files - Next step is to use this - module in ZipFile - -2002-04-01 22:55 thomas - - * NEWS: [no log message] - -2002-04-01 21:16 thomas - - * TODO, zip.rb, ziprequire.rb: Added ziprequire.rb which contains a - proof-of-concept implementation of a require implementation that - can load ruby modules from a zip file. Needs unit tests and - polish. - -2002-03-31 01:13 thomas - - * README: [no log message] - -2002-03-30 16:14 thomas - - * TODO: [no log message] - -2002-03-30 01:52 thomas - - * .cvsignore, README, zip.rb: Added rdoc markup (only #:nodoc:all - modifiers) to zip.rb. Made README 'RDoc compliant' - -2002-03-29 23:29 thomas - - * TODO: [no log message] - -2002-03-29 23:26 thomas - - * example.rb, samples/.cvsignore, samples/example.rb, - samples/gtkRubyzip.rb: Moved example.rb to samples/. Added - another sample gtkRubyzip.rb - -2002-03-29 20:12 thomas - - * NEWS, TODO: [no log message] - -2002-03-29 20:06 thomas - - * .cvsignore, file1.txt, file1.txt.deflatedData, testDirectory.bin, - ziptest.rb, test/.cvsignore, test/file1.txt, - test/file1.txt.deflatedData, test/file2.txt, - test/testDirectory.bin: Added test/ directory and moved the - manually created test data files into it. Changed ziptest.rb so - it runs in test/ directory - -2002-03-29 19:43 thomas - - * TODO: [no log message] - -2002-03-29 18:15 thomas - - * NEWS, zip.rb, ziptest.rb: Don't decompress and recompress zip - entries when changing zip file - -2002-03-29 17:50 thomas - - * zip.rb: Performance optimization: Only write new ZipFile, if it - has been changed. The test suite runs in half the time now. - -2002-03-28 22:12 thomas - - * TODO: [no log message] - -2002-03-23 17:31 thomas - - * TODO: [no log message] - -2002-03-22 22:47 thomas - - * NEWS: [no log message] - -2002-03-22 22:25 thomas - - * NEWS, TODO: [no log message] - -2002-03-22 22:18 thomas - - * ziptest.rb: Found the tests that didn't use blocks to make sure - input streams are closed as soon as they arent used anymore and - got rid of the GC.start - -2002-03-22 22:12 thomas - - * ziptest.rb: All tests run on windows ruby 1.6.6 - -2002-03-22 10:38 thomas - - * zip.rb, ziptest.rb: Windows fixes: Fixed ZipFile.initialize which - needed to open zipfile file in binary mode. Added another - workaround for the return value from File.open(name) where name - is the name of a directory - ruby returns different exceptions in - linux, win/cygwin and windows. A number of tests failed because - in windows you cant delete a file that is open. Fixed by changing - ziptest.rb to use ZipInputStream.getInputStream with blocks a few - places. There is a hack in CommanZipFileFixture.setup where the - GC is explicitly invoked. Should be fixed with blocks instead. - The only currently failing test fails because the test data - creation fails to add a comment to 4entry.zip, because echo eats - the remainder of the line including the pipe character and the - following zip -z 4 entry.zip command - -2002-03-21 22:18 thomas - - * NEWS: [no log message] - -2002-03-21 22:12 thomas - - * NEWS, README, TODO, install.rb: Added install.rb - -2002-03-21 21:45 thomas - - * ziptest.rb: [no log message] - -2002-03-21 20:54 thomas - - * NEWS, TODO: [no log message] - -2002-03-21 20:34 thomas - - * .cvsignore, TODO, zip.rb, ziptest.rb: Added - test_extractDirectoryExistsAsFileOverwrite and fixed to pass - -2002-03-21 20:22 thomas - - * zip.rb, ziptest.rb: Extraction of directory entries is now - supported - -2002-03-20 21:59 thomas - - * NEWS: [no log message] - -2002-03-20 21:24 thomas - - * COPYING, README, README.txt: Removed COPYING, renamed README.txt - to README. Updated README - -2002-03-20 21:18 thomas - - * example.rb: Fixed example.rb added example that shows zip file - manipulation with Zip::ZipFile - -2002-03-20 21:00 thomas - - * .cvsignore: [no log message] - -2002-03-20 20:56 thomas - - * TODO, zip.rb, ziptest.rb: Directories can now be added (not - recursively, the directory entry itself. Directories are - recognized by a empty entries with a trailing /. The purpose of - storing them explicitly in the zip file is to be able to store - permission and ownership information - -2002-03-20 20:08 thomas - - * TODO, zip.rb, ziptest.rb: zip.rb depended on ftools but it was - only included in ziptest.rb - -2002-03-20 19:07 thomas - - * zip.rb, ziptest.rb: ZipError is now a subclass of StandardError - instead of RuntimeError. ZipError now has several subclasses. - -2002-03-19 22:26 thomas - - * TODO: [no log message] - -2002-03-19 22:19 thomas - - * TODO, ziptest.rb: Unit test ZipFile.getInputStream with block - -2002-03-19 22:11 thomas - - * TODO, zip.rb, ziptest.rb: Unit test for adding new entry with - name that already exists in archive, and fixed to pass test - -2002-03-19 21:40 thomas - - * TODO, zip.rb, ziptest.rb: Added unit tests for rename to existing - entry - -2002-03-19 20:42 thomas - - * TODO: [no log message] - -2002-03-19 20:40 thomas - - * TODO, zip.rb, ziptest.rb: Unit test calling ZipFile.extract with - block - -2002-03-18 21:06 thomas - - * TODO: [no log message] - -2002-03-18 21:05 thomas - - * zip.rb, ziptest.rb: ZipFile#commit now reinitializes ZipFile. - -2002-03-18 20:42 thomas - - * TODO, zip.rb, ziptest.rb: Refactoring: - - Collapsed ZipEntry and ZipStreamableZipEntry into ZipEntry. - - Collapsed BasicZipFile and ZipFile into ZipFile. - -2002-03-18 18:05 thomas - - * zip.rb: Removed method that was never called - -2002-03-17 22:33 thomas - - * TODO: [no log message] - -2002-03-17 22:25 thomas - - * ziptest.rb: Run tests with =true as default - -2002-03-17 22:22 thomas - - * NEWS, TODO, zip.rb, ziptest.rb: Now runs with -w switch without - warnings - -2002-03-17 21:10 thomas - - * .cvsignore: [no log message] - -2002-03-17 21:04 thomas - - * zip.rb, ziptest.rb: Down to one failing test - -2002-03-17 20:36 thomas - - * zip.rb, ziptest.rb: [no log message] - -2002-03-17 17:22 thomas - - * TODO, zip.rb, ziptest.rb: [no log message] - -2002-02-25 19:42 thomas - - * TODO: Added more todos - -2002-02-23 15:51 thomas - - * zip.rb: [no log message] - -2002-02-23 15:30 thomas - - * zip.rb, ziptest.rb: [no log message] - -2002-02-23 14:16 thomas - - * zip.rb, ziptest.rb: [no log message] - -2002-02-03 18:47 thomas - - * ziptest.rb: [no log message] - -2002-02-02 15:58 thomas - - * example.rb, zip.rb, ziptest.rb: [no log message] - -2002-02-02 00:16 thomas - - * .cvsignore: [no log message] - -2002-02-02 00:14 thomas - - * example.rb, zip.rb, ziptest.rb: Renamed SimpleZipFile to - BasicZipFile - -2002-02-02 00:09 thomas - - * TODO: [no log message] - -2002-02-02 00:01 thomas - - * ziptest.rb: More test cases - all of them failing, so now there - are 18 failing test cases. Three more test cases to implement, - then it is time for the production code - -2002-02-01 21:49 thomas - - * ziptest.rb: [no log message] - -2002-02-01 21:34 thomas - - * ziptest.rb: Also run SimpleZipFile tests for ZipFile. - -2002-02-01 20:11 thomas - - * example.rb, zip.rb, ziptest.rb: ZipFile renamed to SimpleZipFile. - The new ZipFile will have many more methods that are useful for - managing archives. - -2002-01-29 20:30 thomas - - * TODO: [no log message] - -2002-01-26 00:18 thomas - - * NEWS: [no log message] - -2002-01-26 00:14 thomas - - * ziptest.rb: In unit test: work around ruby/cygwin weirdness. You - get an Errno::EEXISTS instead of an Errno::EISDIR if you try to - open a file for writing that is a directory. - -2002-01-26 00:02 thomas - - * ziptest.rb: Fixed test that failed on windows because of CRLF - line ending - -2002-01-25 23:58 thomas - - * ziptest.rb: [no log message] - -2002-01-25 23:29 thomas - - * .cvsignore, example.rb, zip.rb: Fixed bug reading from empty - deflated entry in zip file - -2002-01-25 23:01 thomas - - * .cvsignore: [no log message] - -2002-01-25 22:56 thomas - - * ziptest.rb: [no log message] - -2002-01-25 22:51 thomas - - * NEWS, README.txt, zip.rb, ziptest.rb: Zip write support is now - fully functional in the form of ZipOutputStream. - -2002-01-25 21:12 thomas - - * zip.rb, ziptest.rb: [no log message] - -2002-01-25 20:37 thomas - - * zip.rb, ziptest.rb: [no log message] - -2002-01-20 16:00 thomas - - * zip.rb, ziptest.rb: Added Deflater and DeflaterTest. - -2002-01-20 00:39 thomas - - * .cvsignore: [no log message] - -2002-01-20 00:23 thomas - - * .cvsignore: Added .cvsignore file - -2002-01-20 00:09 thomas - - * zip.rb, ziptest.rb: Added ZipEntry.writeCDirEntry and misc minor - fixes - -2002-01-19 23:28 thomas - - * example.rb, zip.rb, ziptest.rb: NOTICE: Not all tests run!! - - ZipOutputStream in progress - - Wrapped rubyzip in namespace module Zip. - -2002-01-17 18:52 thomas - - * ziptest.rb: Fail nicely if the user doesn't have info-zip - compatible zip in the path - -2002-01-10 18:02 thomas - - * zip.rb: Adjusted chunk size to 32k after a few perf measurements - -2002-01-09 22:10 thomas - - * README.txt: License now same as rubys, not just GPL - -2002-01-06 00:19 thomas - - * README.txt: [no log message] - -2002-01-05 23:09 thomas - - * NEWS, README.txt: Updated NEWS file - -2002-01-05 23:05 thomas - - * README.txt, zip.rb, ziptest.rb, zlib.c.diff: Added tests for - decompressors and a tests for ZipLocalEntry, - ZipCentralDirectoryEntry and ZipCentralDirectory for handling of - corrupt data - -2002-01-05 22:21 thomas - - * file1.txt.deflatedData: deflated data extracted from a zip file. - contains file1.txt - -2002-01-05 20:05 thomas - - * zip.rb: Changed references to Inflate to Zlib::inflate for - compatibility with ruby-zlib-0.5 - -2002-01-05 19:28 thomas - - * README.txt, zip.rb, ziptest.rb: [no log message] - -2002-01-05 01:52 thomas - - * example.rb, NEWS: [no log message] - -2002-01-05 01:37 thomas - - * COPYING, README.txt: [no log message] - -2002-01-05 01:31 thomas - - * ziptest.rb: Fixed problem with test file creation - -2002-01-05 01:15 thomas - - * README.txt: Updated README.txt - -2002-01-05 01:13 thomas - - * zip.rb, ziptest.rb: ZipFile now works - -2002-01-04 21:51 thomas - - * testDirectory.bin, zip.rb, ziptest.rb: - ZipCentralDirectoryEntryTest now runs - -2002-01-04 18:40 thomas - - * ziptest.rb: Changed - ZIpLocalNEtryTest::test_ReadLocalEntryHeaderOfFirstTestZipEntry - so it works on both unix too. It only worked on windows because - the test made assumptions about the compressed size and crc of an - entry, but that differs depending on the OS because of the CRLF - thing. - -2002-01-04 18:37 thomas - - * README.txt: Added note about zlib.c patch - -2002-01-02 18:48 thomas - - * README.txt, example.rb, file1.txt, zip.rb, ziptest.rb, - zlib.c.diff: Initial revision - -2002-01-02 18:48 thomas - - * README.txt, example.rb, file1.txt, zip.rb, ziptest.rb, - zlib.c.diff: initial - diff --git a/vendor/rubyzip-0.5.8/NEWS b/vendor/rubyzip-0.5.8/NEWS deleted file mode 100644 index 37911fdb..00000000 --- a/vendor/rubyzip-0.5.8/NEWS +++ /dev/null @@ -1,110 +0,0 @@ -= Version 0.5.8 - -Fixed install script. - -= Version 0.5.7 - -install.rb no longer assumes it is being run from the toplevel source -dir. Directory structure changed to reflect common ruby library -project structure. Migrated from RubyUnit to Test::Unit format. Now -uses Rake to build source packages and gems and run unit tests. - -= Version 0.5.6 - -Fix for FreeBSD 4.9 which returns Errno::EFBIG instead of -Errno::EINVAL for some invalid seeks. Fixed 'version needed to -extract'-field incorrect in local headers. - -= Version 0.5.5 - -Fix for a problem with writing zip files that concerns only ruby 1.8.1. - -= Version 0.5.4 - -Significantly reduced memory footprint when modifying zip files. - -= Version 0.5.3 - -Added optimization to avoid decompressing and recompressing individual -entries when modifying a zip archive. - -= Version 0.5.2 - -Fixed ZipFile corruption bug in ZipFile class. Added basic unix -extra-field support. - -= Version 0.5.1 - -Fixed ZipFile.get_output_stream bug. - -= Version 0.5.0 - -List of changes: -* Ruby 1.8.0 and ruby-zlib 0.6.0 compatibility -* Changed method names from camelCase to rubys underscore style. -* Installs to zip/ subdir instead of directly to site_ruby -* Added ZipFile.directory and ZipFile.file - each method return an -object that can be used like Dir and File only for the contents of the -zip file. -* Added sample application zipfind which works like Find.find, only -Zip::ZipFind.find traverses into zip archives too. - -Bug fixes: -* AbstractInputStream.each_line with non-default separator - - -= Version 0.5.0a - -Source reorganized. Added ziprequire, which can be used to load ruby -modules from a zip file, in a fashion similar to jar files in -Java. Added gtkRubyzip, another sample application. Implemented -ZipInputStream.lineno and ZipInputStream.rewind - -Bug fixes: - -* Read and write date and time information correctly for zip entries. -* Fixed read() using separate buffer, causing mix of gets/readline/read to -cause problems. - -= Version 0.4.2 - -Performance optimizations. Test suite runs in half the time. - -= Version 0.4.1 - -Windows compatibility fixes. - -= Version 0.4.0 - -Zip::ZipFile is now mutable and provides a more convenient way of -modifying zip archives than Zip::ZipOutputStream. Operations for -adding, extracting, renaming, replacing and removing entries to zip -archives are now available. - -Runs without warnings with -w switch. - -Install script install.rb added. - - -= Version 0.3.1 - -Rudimentary support for writing zip archives. - - -= Version 0.2.2 - -Fixed and extended unit test suite. Updated to work with ruby/zlib -0.5. It doesn't work with earlier versions of ruby/zlib. - - -= Version 0.2.0 - -Class ZipFile added. Where ZipInputStream is used to read the -individual entries in a zip file, ZipFile reads the central directory -in the zip archive, so you can get to any entry in the zip archive -without having to skipping through all the preceeding entries. - - -= Version 0.1.0 - -First working version of ZipInputStream. diff --git a/vendor/rubyzip-0.5.8/README b/vendor/rubyzip-0.5.8/README deleted file mode 100644 index 6ed15a92..00000000 --- a/vendor/rubyzip-0.5.8/README +++ /dev/null @@ -1,70 +0,0 @@ -= rubyzip - -rubyzip is a ruby library for reading and writing zip files. - -= Install - -If you have rubygems you can install rubyzip directly from the gem -repository - - gem install rubyzip - -Otherwise obtain the source (see below) and run - - ruby install.rb - -To run the unit tests you need to have test::unit installed - - rake test - - -= Documentation - -There is more than one way to access or create a zip archive with -rubyzip. The basic API is modeled after the classes in -java.util.zip from the Java SDK. This means there are classes such -as Zip::ZipInputStream, Zip::ZipOutputStream and -Zip::ZipFile. Zip::ZipInputStream provides a basic interface for -iterating through the entries in a zip archive and reading from the -entries in the same way as from a regular File or IO -object. ZipOutputStream is the corresponding basic output -facility. Zip::ZipFile provides a mean for accessing the archives -central directory and provides means for accessing any entry without -having to iterate through the archive. Unlike Java's -java.util.zip.ZipFile rubyzip's Zip::ZipFile is mutable, which means -it can be used to change zip files as well. - -Another way to access a zip archive with rubyzip is to use rubyzip's -Zip::ZipFileSystem API. Using this API files can be read from and -written to the archive in much the same manner as ruby's builtin -classes allows files to be read from and written to the file system. - -rubyzip also features the -zip/ziprequire.rb[link:files/lib/zip/ziprequire_rb.html] module which -allows ruby to load ruby modules from zip archives. - -For details about the specific behaviour of classes and methods refer -to the test suite. Finally you can generate the rdoc documentation or -visit http://rubyzip.sourceforge.net. - -= License - -rubyzip is distributed under the same license as ruby. See -http://www.ruby-lang.org/en/LICENSE.txt - - -= Website and Project Home - -http://rubyzip.sourceforge.net - -http://sourceforge.net/projects/rubyzip - -== Download (tarballs and gems) - -http://sourceforge.net/project/showfiles.php?group_id=43107&package_id=35377 - -= Authors - -Thomas Sondergaard (thomas at sondergaard.cc) - -extra-field support contributed by Tatsuki Sugiura (sugi at nemui.org) diff --git a/vendor/rubyzip-0.5.8/Rakefile b/vendor/rubyzip-0.5.8/Rakefile deleted file mode 100644 index 03b65c2d..00000000 --- a/vendor/rubyzip-0.5.8/Rakefile +++ /dev/null @@ -1,110 +0,0 @@ -# Rakefile for RubyGems -*- ruby -*- - -require 'rubygems' -require 'rake/clean' -require 'rake/testtask' -require 'rake/packagetask' -require 'rake/gempackagetask' -require 'rake/rdoctask' -require 'rake/contrib/sshpublisher' -require 'net/ftp' - -PKG_NAME = 'rubyzip' -PKG_VERSION = File.read('lib/zip/zip.rb').match(/\s+VERSION\s*=\s*'(.*)'/)[1] - -PKG_FILES = FileList.new - -PKG_FILES.add %w{ README NEWS TODO ChangeLog install.rb Rakefile } -PKG_FILES.add %w{ samples/*.rb } -PKG_FILES.add %w{ test/*.rb } -PKG_FILES.add %w{ test/data/* } -PKG_FILES.exclude "test/data/generated" -PKG_FILES.add %w{ lib/**/*.rb } - -def clobberFromCvsIgnore(path) - CLOBBER.add File.readlines(path+'/.cvsignore').map { - |f| File.join(path, f.chomp) - } -end - -clobberFromCvsIgnore '.' -clobberFromCvsIgnore 'samples' -clobberFromCvsIgnore 'test' -clobberFromCvsIgnore 'test/data' - -task :default => [:test] - -desc "Run unit tests" -task :test do - ruby %{-C test alltests.rb} -end - -# Shortcuts for test targets -task :ut => [:test] - -spec = Gem::Specification.new do |s| - s.name = PKG_NAME - s.version = PKG_VERSION - s.author = "Thomas Sondergaard" - s.email = "thomas(at)sondergaard.cc" - s.homepage = "http://rubyzip.sourceforge.net/" - s.platform = Gem::Platform::RUBY - s.summary = "rubyzip is a ruby module for reading and writing zip files" - s.files = PKG_FILES.to_a #Dir.glob("{samples,lib,test,docs}/**/*").delete_if {|item| item.include?("CVS") || item.include?("rdoc") || item =~ /~$/ } - s.require_path = 'lib' - s.autorequire = 'zip/zip' -end - -Rake::GemPackageTask.new(spec) do |pkg| - pkg.need_zip = true - pkg.need_tar = true -end - -Rake::RDocTask.new do |rd| - rd.main = "README" - rd.rdoc_files.add %W{ lib/zip/*.rb README NEWS TODO ChangeLog } - rd.options << "--title 'rubyzip documentation' --webcvs http://cvs.sourceforge.net/viewcvs.py/rubyzip/rubyzip/" -# rd.options << "--all" -end - -desc "Publish documentation" -task :pdoc => [:rdoc] do - Rake::SshFreshDirPublisher. - new("thomas@rubyzip.sourceforge.net", "rubyzip/htdocs", "html").upload -end - -desc "Publish package" -task :ppackage => [:package] do - Net::FTP.open("upload.sourceforge.net", - "ftp", - ENV['USER']+"@"+ENV['HOSTNAME']) { - |ftpclient| - ftpclient.chdir "incoming" - Dir['pkg/*.{tgz,zip,gem}'].each { - |e| - ftpclient.putbinaryfile(e, File.basename(e)) - } - } -end - -desc "Generate the ChangeLog file" -task :ChangeLog do - puts "Updating ChangeLog" - system %{cvs2cl} -end - -desc "Make a release" -task :release => [:tag_release, :pdoc, :ppackage] do -end - -desc "Make a release tag" -task :tag_release do - tag = "release-#{PKG_VERSION.gsub('.','-')}" - - puts "Checking for tag '#{tag}'" - if (Regexp.new("^\\s+#{tag}") =~ `cvs log README`) - abort "Tag '#{tag}' already exists" - end - puts "Tagging module with '#{tag}'" - system("cvs tag #{tag}") -end diff --git a/vendor/rubyzip-0.5.8/TODO b/vendor/rubyzip-0.5.8/TODO deleted file mode 100644 index 457298c6..00000000 --- a/vendor/rubyzip-0.5.8/TODO +++ /dev/null @@ -1,9 +0,0 @@ - -* Fix problem with mixing AbstractInputStream::gets and AbstractInputStream::read -* Implement ZipFsDir.glob -* ZipFile.checkIntegrity method -* non-MSDOS permission attributes -** See mail from Ned Konz to ruby-talk subj. "Re: SV: [ANN] Archive 0.2" -* Packager version, required unpacker version in zip headers -** See mail from Ned Konz to ruby-talk subj. "Re: SV: [ANN] Archive 0.2" -* implement storing attributes and ownership information diff --git a/vendor/rubyzip-0.5.8/install.rb b/vendor/rubyzip-0.5.8/install.rb deleted file mode 100644 index 405e2b0b..00000000 --- a/vendor/rubyzip-0.5.8/install.rb +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env ruby - -$VERBOSE = true - -require 'rbconfig' -require 'find' -require 'ftools' - -include Config - -files = %w{ stdrubyext.rb ioextras.rb zip.rb zipfilesystem.rb ziprequire.rb tempfile_bugfixed.rb } - -INSTALL_DIR = File.join(CONFIG["sitelibdir"], "zip") -File.makedirs(INSTALL_DIR) - -SOURCE_DIR = File.join(File.dirname($0), "lib/zip") - -files.each { - |filename| - installPath = File.join(INSTALL_DIR, filename) - File::install(File.join(SOURCE_DIR, filename), installPath, 0644, true) -} diff --git a/vendor/rubyzip-0.5.8/samples/example.rb b/vendor/rubyzip-0.5.8/samples/example.rb deleted file mode 100644 index 741afa76..00000000 --- a/vendor/rubyzip-0.5.8/samples/example.rb +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env ruby - -$: << "../lib" -system("zip example.zip example.rb gtkRubyzip.rb") - -require 'zip/zip' - -####### Using ZipInputStream alone: ####### - -Zip::ZipInputStream.open("example.zip") { - |zis| - entry = zis.get_next_entry - print "First line of '#{entry.name} (#{entry.size} bytes): " - puts "'#{zis.gets.chomp}'" - entry = zis.get_next_entry - print "First line of '#{entry.name} (#{entry.size} bytes): " - puts "'#{zis.gets.chomp}'" -} - - -####### Using ZipFile to read the directory of a zip file: ####### - -zf = Zip::ZipFile.new("example.zip") -zf.each_with_index { - |entry, index| - - puts "entry #{index} is #{entry.name}, size = #{entry.size}, compressed size = #{entry.compressed_size}" - # use zf.get_input_stream(entry) to get a ZipInputStream for the entry - # entry can be the ZipEntry object or any object which has a to_s method that - # returns the name of the entry. -} - - -####### Using ZipOutputStream to write a zip file: ####### - -Zip::ZipOutputStream.open("exampleout.zip") { - |zos| - zos.put_next_entry("the first little entry") - zos.puts "Hello hello hello hello hello hello hello hello hello" - - zos.put_next_entry("the second little entry") - zos.puts "Hello again" - - # Use rubyzip or your zip client of choice to verify - # the contents of exampleout.zip -} - -####### Using ZipFile to change a zip file: ####### - -Zip::ZipFile.open("exampleout.zip") { - |zf| - zf.add("thisFile.rb", "example.rb") - zf.rename("thisFile.rb", "ILikeThisName.rb") - zf.add("Again", "example.rb") -} - -# Lets check -Zip::ZipFile.open("exampleout.zip") { - |zf| - puts "Changed zip file contains: #{zf.entries.join(', ')}" - zf.remove("Again") - puts "Without 'Again': #{zf.entries.join(', ')}" -} - -# For other examples, look at zip.rb and ziptest.rb - -# Copyright (C) 2002 Thomas Sondergaard -# rubyzip is free software; you can redistribute it and/or -# modify it under the terms of the ruby license. diff --git a/vendor/rubyzip-0.5.8/samples/example_filesystem.rb b/vendor/rubyzip-0.5.8/samples/example_filesystem.rb deleted file mode 100644 index 867e8d4f..00000000 --- a/vendor/rubyzip-0.5.8/samples/example_filesystem.rb +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env ruby - -$: << "../lib" - -require 'zip/zipfilesystem' -require 'ftools' - -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. diff --git a/vendor/rubyzip-0.5.8/samples/gtkRubyzip.rb b/vendor/rubyzip-0.5.8/samples/gtkRubyzip.rb deleted file mode 100644 index 5d91829d..00000000 --- a/vendor/rubyzip-0.5.8/samples/gtkRubyzip.rb +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env ruby - -$: << "../lib" - -$VERBOSE = true - -require 'gtk' -require 'zip/zip' - -class MainApp < Gtk::Window - def initialize - super() - set_usize(400, 256) - set_title("rubyzip") - signal_connect(Gtk::Window::SIGNAL_DESTROY) { Gtk.main_quit } - - box = Gtk::VBox.new(false, 0) - add(box) - - @zipfile = nil - @buttonPanel = ButtonPanel.new - @buttonPanel.openButton.signal_connect(Gtk::Button::SIGNAL_CLICKED) { - show_file_selector - } - @buttonPanel.extractButton.signal_connect(Gtk::Button::SIGNAL_CLICKED) { - puts "Not implemented!" - } - box.pack_start(@buttonPanel, false, false, 0) - - sw = Gtk::ScrolledWindow.new - sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) - box.pack_start(sw, true, true, 0) - - @clist = Gtk::CList.new(["Name", "Size", "Compression"]) - @clist.set_selection_mode(Gtk::SELECTION_BROWSE) - @clist.set_column_width(0, 120) - @clist.set_column_width(1, 120) - @clist.signal_connect(Gtk::CList::SIGNAL_SELECT_ROW) { - |w, row, column, event| - @selected_row = row - } - sw.add(@clist) - end - - class ButtonPanel < Gtk::HButtonBox - attr_reader :openButton, :extractButton - def initialize - super - set_layout(Gtk::BUTTONBOX_START) - set_spacing(0) - @openButton = Gtk::Button.new("Open archive") - @extractButton = Gtk::Button.new("Extract entry") - pack_start(@openButton) - pack_start(@extractButton) - end - end - - def show_file_selector - @fileSelector = Gtk::FileSelection.new("Open zip file") - @fileSelector.show - @fileSelector.ok_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) { - open_zip(@fileSelector.filename) - @fileSelector.destroy - } - @fileSelector.cancel_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) { - @fileSelector.destroy - } - end - - def open_zip(filename) - @zipfile = Zip::ZipFile.open(filename) - @clist.clear - @zipfile.each { - |entry| - @clist.append([ entry.name, - entry.size.to_s, - (100.0*entry.compressedSize/entry.size).to_s+"%" ]) - } - end -end - -mainApp = MainApp.new() - -mainApp.show_all - -Gtk.main diff --git a/vendor/rubyzip-0.5.8/samples/write_simple.rb b/vendor/rubyzip-0.5.8/samples/write_simple.rb deleted file mode 100644 index 648989a2..00000000 --- a/vendor/rubyzip-0.5.8/samples/write_simple.rb +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env ruby - -$: << "../lib" - -require 'zip/zip' - -include Zip - -ZipOutputStream.open('simple.zip') { - |zos| - ze = zos.put_next_entry 'entry.txt' - zos.puts "Hello world" -} diff --git a/vendor/rubyzip-0.5.8/samples/zipfind.rb b/vendor/rubyzip-0.5.8/samples/zipfind.rb deleted file mode 100644 index 54ad936e..00000000 --- a/vendor/rubyzip-0.5.8/samples/zipfind.rb +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env ruby - -$VERBOSE = true - -$: << "../lib" - -require 'zip/zip' -require 'find' - -module Zip - module ZipFind - def self.find(path, zipFilePattern = /\.zip$/i) - Find.find(path) { - |fileName| - yield(fileName) - if zipFilePattern.match(fileName) && File.file?(fileName) - begin - Zip::ZipFile.foreach(fileName) { - |zipEntry| - yield(fileName + File::SEPARATOR + zipEntry.to_s) - } - rescue Errno::EACCES => ex - puts ex - end - end - } - end - - def self.find_file(path, fileNamePattern, zipFilePattern = /\.zip$/i) - self.find(path, zipFilePattern) { - |fileName| - yield(fileName) if fileNamePattern.match(fileName) - } - end - - end -end - -if __FILE__ == $0 - module ZipFindConsoleRunner - - PATH_ARG_INDEX = 0; - FILENAME_PATTERN_ARG_INDEX = 1; - ZIPFILE_PATTERN_ARG_INDEX = 2; - - def self.run(args) - check_args(args) - Zip::ZipFind.find_file(args[PATH_ARG_INDEX], - args[FILENAME_PATTERN_ARG_INDEX], - args[ZIPFILE_PATTERN_ARG_INDEX]) { - |fileName| - report_entry_found fileName - } - end - - def self.check_args(args) - if (args.size != 3) - usage - exit - end - end - - def self.usage - puts "Usage: #{$0} PATH ZIPFILENAME_PATTERN FILNAME_PATTERN" - end - - def self.report_entry_found(fileName) - puts fileName - end - - end - - ZipFindConsoleRunner.run(ARGV) -end diff --git a/vendor/rubyzip-0.5.8/test/alltests.rb b/vendor/rubyzip-0.5.8/test/alltests.rb deleted file mode 100644 index 691349af..00000000 --- a/vendor/rubyzip-0.5.8/test/alltests.rb +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env ruby - -$VERBOSE = true - -require 'stdrubyexttest' -require 'ioextrastest' -require 'ziptest' -require 'zipfilesystemtest' -require 'ziprequiretest' diff --git a/vendor/rubyzip-0.5.8/test/data/file1.txt b/vendor/rubyzip-0.5.8/test/data/file1.txt deleted file mode 100644 index 23ea2f73..00000000 --- a/vendor/rubyzip-0.5.8/test/data/file1.txt +++ /dev/null @@ -1,46 +0,0 @@ - -AUTOMAKE_OPTIONS = gnu - -EXTRA_DIST = test.zip - -CXXFLAGS= -g - -noinst_LIBRARIES = libzipios.a - -bin_PROGRAMS = test_zip test_izipfilt test_izipstream -# test_flist - -libzipios_a_SOURCES = backbuffer.h fcol.cpp fcol.h \ - fcol_common.h fcolexceptions.cpp fcolexceptions.h \ - fileentry.cpp fileentry.h flist.cpp \ - flist.h flistentry.cpp flistentry.h \ - flistscanner.h ifiltstreambuf.cpp ifiltstreambuf.h \ - inflatefilt.cpp inflatefilt.h izipfilt.cpp \ - izipfilt.h izipstream.cpp izipstream.h \ - zipfile.cpp zipfile.h ziphead.cpp \ - ziphead.h flistscanner.ll - -# test_flist_SOURCES = test_flist.cpp - -test_izipfilt_SOURCES = test_izipfilt.cpp - -test_izipstream_SOURCES = test_izipstream.cpp - -test_zip_SOURCES = test_zip.cpp - -# Notice that libzipios.a is not specified as -L. -lzipios -# If it was, automake would not include it as a dependency. - -# test_flist_LDADD = libzipios.a - -test_izipfilt_LDADD = libzipios.a -lz - -test_zip_LDADD = libzipios.a -lz - -test_izipstream_LDADD = libzipios.a -lz - - - -flistscanner.cc : flistscanner.ll - $(LEX) -+ -PFListScanner -o$@ $^ - diff --git a/vendor/rubyzip-0.5.8/test/data/file1.txt.deflatedData b/vendor/rubyzip-0.5.8/test/data/file1.txt.deflatedData deleted file mode 100644 index bfbb4f42c009154e9e3304855c31813275b709d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 482 zcmV<80UiE@RMBpmFcf{>{fa9!51TglfJv3cnzTZrO$4cwhiS+$rdV}s6dQHj*U#Vt z3=5f`xX0%l?mad@^t@d^Mn6{hdb5q!PZ{3gi);W^yKNff%Q)Lw#4v5bKfDIG+wJa? z=pnns-~~V`F15*%_4Ca zj^EboH)XZqO6tya0#)-~Treih@%_}yQ1_j5gZaJAdUeEVT>IuDsQSN`rbJ4Y7;mF@ zf!i26zX>!yBbTKhhP8Aj^y*W$=fmwAo%K2sJ)!HNmwM3k8J!jDh3C2&Q7T4?A^j^} z9r3Ik8+;@B3zEjD19@fmrW#RnN-n8r3f5ArlwiSXCJQF% zdpJoZSw_p{^uI6; YT71LBFMz*PQb9>fNlr&oR8>Ys3VC(y$N&HU diff --git a/vendor/rubyzip-0.5.8/test/data/file2.txt b/vendor/rubyzip-0.5.8/test/data/file2.txt deleted file mode 100644 index cc9ef6ad..00000000 --- a/vendor/rubyzip-0.5.8/test/data/file2.txt +++ /dev/null @@ -1,1504 +0,0 @@ -#!/usr/bin/env ruby - -$VERBOSE = true - -require 'rubyunit' -require 'zip' - -include Zip - -Dir.chdir "test" - -class AbstractInputStreamTest < RUNIT::TestCase - # AbstractInputStream subclass that provides a read method - - TEST_LINES = [ "Hello world#{$/}", - "this is the second line#{$/}", - "this is the last line"] - TEST_STRING = TEST_LINES.join - class TestAbstractInputStream - include AbstractInputStream - def initialize(aString) - @contents = aString - @readPointer = 0 - end - - def read(charsToRead) - retVal=@contents[@readPointer, charsToRead] - @readPointer+=charsToRead - return retVal - end - - def produceInput - read(100) - end - - def inputFinished? - @contents[@readPointer] == nil - end - end - - def setup - @io = TestAbstractInputStream.new(TEST_STRING) - end - - def test_gets - assert_equals(TEST_LINES[0], @io.gets) - assert_equals(TEST_LINES[1], @io.gets) - assert_equals(TEST_LINES[2], @io.gets) - assert_equals(nil, @io.gets) - end - - def test_getsMultiCharSeperator - assert_equals("Hell", @io.gets("ll")) - assert_equals("o world#{$/}this is the second l", @io.gets("d l")) - end - - def test_each_line - lineNumber=0 - @io.each_line { - |line| - assert_equals(TEST_LINES[lineNumber], line) - lineNumber+=1 - } - end - - def test_readlines - assert_equals(TEST_LINES, @io.readlines) - end - - def test_readline - test_gets - begin - @io.readline - fail "EOFError expected" - rescue EOFError - end - end -end - -class ZipEntryTest < RUNIT::TestCase - TEST_ZIPFILE = "someZipFile.zip" - TEST_COMMENT = "a comment" - TEST_COMPRESSED_SIZE = 1234 - TEST_CRC = 325324 - TEST_EXTRA = "Some data here" - TEST_COMPRESSIONMETHOD = ZipEntry::DEFLATED - TEST_NAME = "entry name" - TEST_SIZE = 8432 - TEST_ISDIRECTORY = false - - def test_constructorAndGetters - entry = ZipEntry.new(TEST_ZIPFILE, - TEST_NAME, - TEST_COMMENT, - TEST_EXTRA, - TEST_COMPRESSED_SIZE, - TEST_CRC, - TEST_COMPRESSIONMETHOD, - TEST_SIZE) - - assert_equals(TEST_COMMENT, entry.comment) - assert_equals(TEST_COMPRESSED_SIZE, entry.compressedSize) - assert_equals(TEST_CRC, entry.crc) - assert_equals(TEST_EXTRA, entry.extra) - assert_equals(TEST_COMPRESSIONMETHOD, entry.compressionMethod) - assert_equals(TEST_NAME, entry.name) - assert_equals(TEST_SIZE, entry.size) - assert_equals(TEST_ISDIRECTORY, entry.isDirectory) - end - - def test_equality - entry1 = ZipEntry.new("file.zip", "name", "isNotCompared", - "something extra", 123, 1234, - ZipEntry::DEFLATED, 10000) - entry2 = ZipEntry.new("file.zip", "name", "isNotComparedXXX", - "something extra", 123, 1234, - ZipEntry::DEFLATED, 10000) - entry3 = ZipEntry.new("file.zip", "name2", "isNotComparedXXX", - "something extra", 123, 1234, - ZipEntry::DEFLATED, 10000) - entry4 = ZipEntry.new("file.zip", "name2", "isNotComparedXXX", - "something extraXX", 123, 1234, - ZipEntry::DEFLATED, 10000) - entry5 = ZipEntry.new("file.zip", "name2", "isNotComparedXXX", - "something extraXX", 12, 1234, - ZipEntry::DEFLATED, 10000) - entry6 = ZipEntry.new("file.zip", "name2", "isNotComparedXXX", - "something extraXX", 12, 123, - ZipEntry::DEFLATED, 10000) - entry7 = ZipEntry.new("file.zip", "name2", "isNotComparedXXX", - "something extraXX", 12, 123, - ZipEntry::STORED, 10000) - entry8 = ZipEntry.new("file.zip", "name2", "isNotComparedXXX", - "something extraXX", 12, 123, - ZipEntry::STORED, 100000) - - assert_equals(entry1, entry1) - assert_equals(entry1, entry2) - - assert(entry2 != entry3) - assert(entry3 != entry4) - assert(entry4 != entry5) - assert(entry5 != entry6) - assert(entry6 != entry7) - assert(entry7 != entry8) - - assert(entry7 != "hello") - assert(entry7 != 12) - end -end - -module IOizeString - attr_reader :tell - - def read(count = nil) - @tell ||= 0 - count = size unless count - retVal = slice(@tell, count) - @tell += count - return retVal - end - - def seek(index, offset) - @tell ||= 0 - case offset - when IO::SEEK_END - newPos = size + index - when IO::SEEK_SET - newPos = index - when IO::SEEK_CUR - newPos = @tell + index - else - raise "Error in test method IOizeString::seek" - end - if (newPos < 0 || newPos >= size) - raise Errno::EINVAL - else - @tell=newPos - end - end - - def reset - @tell = 0 - end -end - -class ZipLocalEntryTest < RUNIT::TestCase - def test_readLocalEntryHeaderOfFirstTestZipEntry - File.open(TestZipFile::TEST_ZIP3.zipName) { - |file| - entry = ZipEntry.readLocalEntry(file) - - assert_equal("", entry.comment) - # Differs from windows and unix because of CR LF - # assert_equal(480, entry.compressedSize) - # assert_equal(0x2a27930f, entry.crc) - # extra field is 21 bytes long - # probably contains some unix attrutes or something - # disabled: assert_equal(nil, entry.extra) - assert_equal(ZipEntry::DEFLATED, entry.compressionMethod) - assert_equal(TestZipFile::TEST_ZIP3.entryNames[0], entry.name) - assert_equal(File.size(TestZipFile::TEST_ZIP3.entryNames[0]), entry.size) - assert(! entry.isDirectory) - } - end - - def test_readLocalEntryFromNonZipFile - File.open("ziptest.rb") { - |file| - assert_equals(nil, ZipEntry.readLocalEntry(file)) - } - end - - def test_readLocalEntryFromTruncatedZipFile - zipFragment="" - File.open(TestZipFile::TEST_ZIP2.zipName) { |f| zipFragment = f.read(12) } # local header is at least 30 bytes - zipFragment.extend(IOizeString).reset - entry = ZipEntry.new - entry.readLocalEntry(zipFragment) - fail "ZipError expected" - rescue ZipError - end - - def test_writeEntry - entry = ZipEntry.new("file.zip", "entryName", "my little comment", - "thisIsSomeExtraInformation", 100, 987654, - ZipEntry::DEFLATED, 400) - writeToFile("localEntryHeader.bin", "centralEntryHeader.bin", entry) - entryReadLocal, entryReadCentral = readFromFile("localEntryHeader.bin", "centralEntryHeader.bin") - compareLocalEntryHeaders(entry, entryReadLocal) - compareCDirEntryHeaders(entry, entryReadCentral) - end - - private - def compareLocalEntryHeaders(entry1, entry2) - assert_equals(entry1.compressedSize , entry2.compressedSize) - assert_equals(entry1.crc , entry2.crc) - assert_equals(entry1.extra , entry2.extra) - assert_equals(entry1.compressionMethod, entry2.compressionMethod) - assert_equals(entry1.name , entry2.name) - assert_equals(entry1.size , entry2.size) - assert_equals(entry1.localHeaderOffset, entry2.localHeaderOffset) - end - - def compareCDirEntryHeaders(entry1, entry2) - compareLocalEntryHeaders(entry1, entry2) - assert_equals(entry1.comment, entry2.comment) - end - - def writeToFile(localFileName, centralFileName, entry) - File.open(localFileName, "wb") { |f| entry.writeLocalEntry(f) } - File.open(centralFileName, "wb") { |f| entry.writeCDirEntry(f) } - end - - def readFromFile(localFileName, centralFileName) - localEntry = nil - cdirEntry = nil - File.open(localFileName, "rb") { |f| localEntry = ZipEntry.readLocalEntry(f) } - File.open(centralFileName, "rb") { |f| cdirEntry = ZipEntry.readCDirEntry(f) } - return [localEntry, cdirEntry] - end -end - - -module DecompressorTests - # expects @refText and @decompressor - - def test_readEverything - assert_equals(@refText, @decompressor.read) - end - - def test_readInChunks - chunkSize = 5 - while (decompressedChunk = @decompressor.read(chunkSize)) - assert_equals(@refText.slice!(0, chunkSize), decompressedChunk) - end - assert_equals(0, @refText.size) - end -end - -class InflaterTest < RUNIT::TestCase - include DecompressorTests - - def setup - @file = File.new("file1.txt.deflatedData", "rb") - @refText="" - File.open("file1.txt") { |f| @refText = f.read } - @decompressor = Inflater.new(@file) - end - - def teardown - @file.close - end -end - - -class PassThruDecompressorTest < RUNIT::TestCase - include DecompressorTests - TEST_FILE="file1.txt" - def setup - @file = File.new(TEST_FILE) - @refText="" - File.open(TEST_FILE) { |f| @refText = f.read } - @decompressor = PassThruDecompressor.new(@file, File.size(TEST_FILE)) - end - - def teardown - @file.close - end -end - - -module AssertEntry - def assertNextEntry(filename, zis) - assertEntry(filename, zis, zis.getNextEntry.name) - end - - def assertEntry(filename, zis, entryName) - assert_equals(filename, entryName) - assertEntryContentsForStream(filename, zis, entryName) - end - - def assertEntryContentsForStream(filename, zis, entryName) - File.open(filename, "rb") { - |file| - expected = file.read - actual = zis.read - if (expected != actual) - if (expected.length > 400 || actual.length > 400) - zipEntryFilename=entryName+".zipEntry" - File.open(zipEntryFilename, "wb") { |file| file << actual } - fail("File '#{filename}' is different from '#{zipEntryFilename}'") - else - assert_equals(expected, actual) - end - end - } - end - - def AssertEntry.assertContents(filename, aString) - fileContents = "" - File.open(filename, "rb") { |f| fileContents = f.read } - if (fileContents != aString) - if (expected.length > 400 || actual.length > 400) - stringFile = filename + ".other" - File.open(stringFile, "wb") { |f| f << aString } - fail("File '#{filename}' is different from contents of string stored in '#{stringFile}'") - else - assert_equals(expected, actual) - end - end - end - - def assertStreamContents(zis, testZipFile) - assert(zis != nil) - testZipFile.entryNames.each { - |entryName| - assertNextEntry(entryName, zis) - } - assert_equals(nil, zis.getNextEntry) - end - - def assertTestZipContents(testZipFile) - ZipInputStream.open(testZipFile.zipName) { - |zis| - assertStreamContents(zis, testZipFile) - } - end - - def assertEntryContents(zipFile, entryName, filename = entryName.to_s) - zis = zipFile.getInputStream(entryName) - assertEntryContentsForStream(filename, zis, entryName) - ensure - zis.close if zis - end -end - - - -class ZipInputStreamTest < RUNIT::TestCase - include AssertEntry - - def test_new - zis = ZipInputStream.new(TestZipFile::TEST_ZIP2.zipName) - assertStreamContents(zis, TestZipFile::TEST_ZIP2) - zis.close - end - - def test_openWithBlock - ZipInputStream.open(TestZipFile::TEST_ZIP2.zipName) { - |zis| - assertStreamContents(zis, TestZipFile::TEST_ZIP2) - } - end - - def test_openWithoutBlock - zis = ZipInputStream.open(TestZipFile::TEST_ZIP2.zipName) - assertStreamContents(zis, TestZipFile::TEST_ZIP2) - end - - def test_incompleteReads - ZipInputStream.open(TestZipFile::TEST_ZIP2.zipName) { - |zis| - entry = zis.getNextEntry - assert_equals(TestZipFile::TEST_ZIP2.entryNames[0], entry.name) - assert zis.gets.length > 0 - entry = zis.getNextEntry - assert_equals(TestZipFile::TEST_ZIP2.entryNames[1], entry.name) - assert_equals(0, entry.size) - assert_equals(nil, zis.gets) - entry = zis.getNextEntry - assert_equals(TestZipFile::TEST_ZIP2.entryNames[2], entry.name) - assert zis.gets.length > 0 - entry = zis.getNextEntry - assert_equals(TestZipFile::TEST_ZIP2.entryNames[3], entry.name) - assert zis.gets.length > 0 - } - end - -end - -class TestFiles - RANDOM_ASCII_FILE1 = "randomAscii1.txt" - RANDOM_ASCII_FILE2 = "randomAscii2.txt" - RANDOM_ASCII_FILE3 = "randomAscii3.txt" - RANDOM_BINARY_FILE1 = "randomBinary1.bin" - RANDOM_BINARY_FILE2 = "randomBinary2.bin" - - EMPTY_TEST_DIR = "emptytestdir" - - ASCII_TEST_FILES = [ RANDOM_ASCII_FILE1, RANDOM_ASCII_FILE2, RANDOM_ASCII_FILE3 ] - BINARY_TEST_FILES = [ RANDOM_BINARY_FILE1, RANDOM_BINARY_FILE2 ] - TEST_DIRECTORIES = [ EMPTY_TEST_DIR ] - TEST_FILES = [ ASCII_TEST_FILES, BINARY_TEST_FILES, EMPTY_TEST_DIR ].flatten! - - def TestFiles.createTestFiles(recreate) - if (recreate || - ! (TEST_FILES.inject(true) { |accum, element| accum && File.exists?(element) })) - - ASCII_TEST_FILES.each_with_index { - |filename, index| - createRandomAscii(filename, 1E4 * (index+1)) - } - - BINARY_TEST_FILES.each_with_index { - |filename, index| - createRandomBinary(filename, 1E4 * (index+1)) - } - - ensureDir(EMPTY_TEST_DIR) - end - end - - private - def TestFiles.createRandomAscii(filename, size) - File.open(filename, "wb") { - |file| - while (file.tell < size) - file << rand - end - } - end - - def TestFiles.createRandomBinary(filename, size) - File.open(filename, "wb") { - |file| - while (file.tell < size) - file << rand.to_a.pack("V") - end - } - end - - def TestFiles.ensureDir(name) - if File.exists?(name) - return if File.stat(name).directory? - File.delete(name) - end - Dir.mkdir(name) - end - -end - -# For representation and creation of -# test data -class TestZipFile - attr_accessor :zipName, :entryNames, :comment - - def initialize(zipName, entryNames, comment = "") - @zipName=zipName - @entryNames=entryNames - @comment = comment - end - - def TestZipFile.createTestZips(recreate) - files = Dir.entries(".") - if (recreate || - ! (files.index(TEST_ZIP1.zipName) && - files.index(TEST_ZIP2.zipName) && - files.index(TEST_ZIP3.zipName) && - files.index(TEST_ZIP4.zipName) && - files.index("empty.txt") && - files.index("short.txt") && - files.index("longAscii.txt") && - files.index("longBinary.bin") )) - raise "failed to create test zip '#{TEST_ZIP1.zipName}'" unless - system("zip #{TEST_ZIP1.zipName} ziptest.rb") - raise "failed to remove entry from '#{TEST_ZIP1.zipName}'" unless - system("zip #{TEST_ZIP1.zipName} -d ziptest.rb") - - File.open("empty.txt", "w") {} - - File.open("short.txt", "w") { |file| file << "ABCDEF" } - ziptestTxt="" - File.open("ziptest.rb") { |file| ziptestTxt=file.read } - File.open("longAscii.txt", "w") { - |file| - while (file.tell < 1E5) - file << ziptestTxt - end - } - - testBinaryPattern="" - File.open("empty.zip") { |file| testBinaryPattern=file.read } - testBinaryPattern *= 4 - - File.open("longBinary.bin", "wb") { - |file| - while (file.tell < 3E5) - file << testBinaryPattern << rand - end - } - raise "failed to create test zip '#{TEST_ZIP2.zipName}'" unless - system("zip #{TEST_ZIP2.zipName} #{TEST_ZIP2.entryNames.join(' ')}") - - # without bash system interprets everything after echo as parameters to - # echo including | zip -z ... - raise "failed to add comment to test zip '#{TEST_ZIP2.zipName}'" unless - system("bash -c \"echo #{TEST_ZIP2.comment} | zip -z #{TEST_ZIP2.zipName}\"") - - raise "failed to create test zip '#{TEST_ZIP3.zipName}'" unless - system("zip #{TEST_ZIP3.zipName} #{TEST_ZIP3.entryNames.join(' ')}") - - raise "failed to create test zip '#{TEST_ZIP4.zipName}'" unless - system("zip #{TEST_ZIP4.zipName} #{TEST_ZIP4.entryNames.join(' ')}") - end - rescue - raise $!.to_s + - "\n\nziptest.rb requires the Info-ZIP program 'zip' in the path\n" + - "to create test data. If you don't have it you can download\n" + - "the necessary test files at http://sf.net/projects/rubyzip." - end - - TEST_ZIP1 = TestZipFile.new("empty.zip", []) - TEST_ZIP2 = TestZipFile.new("4entry.zip", %w{ longAscii.txt empty.txt short.txt longBinary.bin}, - "my zip comment") - TEST_ZIP3 = TestZipFile.new("test1.zip", %w{ file1.txt }) - TEST_ZIP4 = TestZipFile.new("zipWithDir.zip", [ "file1.txt", - TestFiles::EMPTY_TEST_DIR]) -end - - -class AbstractOutputStreamTest < RUNIT::TestCase - class TestOutputStream - include AbstractOutputStream - - attr_accessor :buffer - - def initialize - @buffer = "" - end - - def << (data) - @buffer << data - self - end - end - - def setup - @outputStream = TestOutputStream.new - - @origCommaSep = $, - @origOutputSep = $\ - end - - def teardown - $, = @origCommaSep - $\ = @origOutputSep - end - - def test_write - count = @outputStream.write("a little string") - assert_equals("a little string", @outputStream.buffer) - assert_equals("a little string".length, count) - - count = @outputStream.write(". a little more") - assert_equals("a little string. a little more", @outputStream.buffer) - assert_equals(". a little more".length, count) - end - - def test_print - $\ = nil # record separator set to nil - @outputStream.print("hello") - assert_equals("hello", @outputStream.buffer) - - @outputStream.print(" world.") - assert_equals("hello world.", @outputStream.buffer) - - @outputStream.print(" You ok ", "out ", "there?") - assert_equals("hello world. You ok out there?", @outputStream.buffer) - - $\ = "\n" - @outputStream.print - assert_equals("hello world. You ok out there?\n", @outputStream.buffer) - - @outputStream.print("I sure hope so!") - assert_equals("hello world. You ok out there?\nI sure hope so!\n", @outputStream.buffer) - - $, = "X" - @outputStream.buffer = "" - @outputStream.print("monkey", "duck", "zebra") - assert_equals("monkeyXduckXzebra\n", @outputStream.buffer) - - $\ = nil - @outputStream.buffer = "" - @outputStream.print(20) - assert_equals("20", @outputStream.buffer) - end - - def test_printf - @outputStream.printf("%d %04x", 123, 123) - assert_equals("123 007b", @outputStream.buffer) - end - - def test_putc - @outputStream.putc("A") - assert_equals("A", @outputStream.buffer) - @outputStream.putc(65) - assert_equals("AA", @outputStream.buffer) - end - - def test_puts - @outputStream.puts - assert_equals("\n", @outputStream.buffer) - - @outputStream.puts("hello", "world") - assert_equals("\nhello\nworld\n", @outputStream.buffer) - - @outputStream.buffer = "" - @outputStream.puts("hello\n", "world\n") - assert_equals("hello\nworld\n", @outputStream.buffer) - - @outputStream.buffer = "" - @outputStream.puts(["hello\n", "world\n"]) - assert_equals("hello\nworld\n", @outputStream.buffer) - - @outputStream.buffer = "" - @outputStream.puts(["hello\n", "world\n"], "bingo") - assert_equals("hello\nworld\nbingo\n", @outputStream.buffer) - - @outputStream.buffer = "" - @outputStream.puts(16, 20, 50, "hello") - assert_equals("16\n20\n50\nhello\n", @outputStream.buffer) - end -end - - -module CrcTest - def runCrcTest(compressorClass) - str = "Here's a nice little text to compute the crc for! Ho hum, it is nice nice nice nice indeed." - fakeOut = AbstractOutputStreamTest::TestOutputStream.new - - deflater = compressorClass.new(fakeOut) - deflater << str - assert_equals(0x919920fc, deflater.crc) - end -end - - - -class PassThruCompressorTest < RUNIT::TestCase - include CrcTest - - def test_size - File.open("dummy.txt", "wb") { - |file| - compressor = PassThruCompressor.new(file) - - assert_equals(0, compressor.size) - - t1 = "hello world" - t2 = "" - t3 = "bingo" - - compressor << t1 - assert_equals(compressor.size, t1.size) - - compressor << t2 - assert_equals(compressor.size, t1.size + t2.size) - - compressor << t3 - assert_equals(compressor.size, t1.size + t2.size + t3.size) - } - end - - def test_crc - runCrcTest(PassThruCompressor) - end -end - -class DeflaterTest < RUNIT::TestCase - include CrcTest - - def test_outputOperator - txt = loadFile("ziptest.rb") - deflate(txt, "deflatertest.bin") - inflatedTxt = inflate("deflatertest.bin") - assert_equals(txt, inflatedTxt) - end - - private - def loadFile(fileName) - txt = nil - File.open(fileName, "rb") { |f| txt = f.read } - end - - def deflate(data, fileName) - File.open(fileName, "wb") { - |file| - deflater = Deflater.new(file) - deflater << data - deflater.finish - assert_equals(deflater.size, data.size) - file << "trailing data for zlib with -MAX_WBITS" - } - end - - def inflate(fileName) - txt = nil - File.open(fileName, "rb") { - |file| - inflater = Inflater.new(file) - txt = inflater.read - } - end - - def test_crc - runCrcTest(Deflater) - end -end - -class ZipOutputStreamTest < RUNIT::TestCase - include AssertEntry - - TEST_ZIP = TestZipFile::TEST_ZIP2.clone - TEST_ZIP.zipName = "output.zip" - - def test_new - zos = ZipOutputStream.new(TEST_ZIP.zipName) - zos.comment = TEST_ZIP.comment - writeTestZip(zos) - zos.close - assertTestZipContents(TEST_ZIP) - end - - def test_open - ZipOutputStream.open(TEST_ZIP.zipName) { - |zos| - zos.comment = TEST_ZIP.comment - writeTestZip(zos) - } - assertTestZipContents(TEST_ZIP) - end - - def test_writingToClosedStream - assertIOErrorInClosedStream { |zos| zos << "hello world" } - assertIOErrorInClosedStream { |zos| zos.puts "hello world" } - assertIOErrorInClosedStream { |zos| zos.write "hello world" } - end - - def test_cannotOpenFile - name = TestFiles::EMPTY_TEST_DIR - begin - zos = ZipOutputStream.open(name) - rescue Exception - assert($!.kind_of?(Errno::EISDIR) || # Linux - $!.kind_of?(Errno::EEXIST) || # Windows/cygwin - $!.kind_of?(Errno::EACCES), # Windows - "Expected Errno::EISDIR (or on win/cygwin: Errno::EEXIST), but was: #{$!.type}") - end - end - - def assertIOErrorInClosedStream - assert_exception(IOError) { - zos = ZipOutputStream.new("test_putOnClosedStream.zip") - zos.close - yield zos - } - end - - def writeTestZip(zos) - TEST_ZIP.entryNames.each { - |entryName| - zos.putNextEntry(entryName) - File.open(entryName, "rb") { |f| zos.write(f.read) } - } - end -end - - - -module Enumerable - def compareEnumerables(otherEnumerable) - otherAsArray = otherEnumerable.to_a - index=0 - each_with_index { - |element, index| - return false unless yield(element, otherAsArray[index]) - } - return index+1 == otherAsArray.size - end -end - - -class ZipCentralDirectoryEntryTest < RUNIT::TestCase - - def test_readFromStream - File.open("testDirectory.bin", "rb") { - |file| - entry = ZipEntry.readCDirEntry(file) - - assert_equals("longAscii.txt", entry.name) - assert_equals(ZipEntry::DEFLATED, entry.compressionMethod) - assert_equals(106490, entry.size) - assert_equals(3784, entry.compressedSize) - assert_equals(0xfcd1799c, entry.crc) - assert_equals("", entry.comment) - - entry = ZipEntry.readCDirEntry(file) - assert_equals("empty.txt", entry.name) - assert_equals(ZipEntry::STORED, entry.compressionMethod) - assert_equals(0, entry.size) - assert_equals(0, entry.compressedSize) - assert_equals(0x0, entry.crc) - assert_equals("", entry.comment) - - entry = ZipEntry.readCDirEntry(file) - assert_equals("short.txt", entry.name) - assert_equals(ZipEntry::STORED, entry.compressionMethod) - assert_equals(6, entry.size) - assert_equals(6, entry.compressedSize) - assert_equals(0xbb76fe69, entry.crc) - assert_equals("", entry.comment) - - entry = ZipEntry.readCDirEntry(file) - assert_equals("longBinary.bin", entry.name) - assert_equals(ZipEntry::DEFLATED, entry.compressionMethod) - assert_equals(1000024, entry.size) - assert_equals(70847, entry.compressedSize) - assert_equals(0x10da7d59, entry.crc) - assert_equals("", entry.comment) - - entry = ZipEntry.readCDirEntry(file) - assert_equals(nil, entry) -# Fields that are not check by this test: -# version made by 2 bytes -# version needed to extract 2 bytes -# general purpose bit flag 2 bytes -# last mod file time 2 bytes -# last mod file date 2 bytes -# compressed size 4 bytes -# uncompressed size 4 bytes -# disk number start 2 bytes -# internal file attributes 2 bytes -# external file attributes 4 bytes -# relative offset of local header 4 bytes - -# file name (variable size) -# extra field (variable size) -# file comment (variable size) - - } - end - - def test_ReadEntryFromTruncatedZipFile - fragment="" - File.open("testDirectory.bin") { |f| fragment = f.read(12) } # cdir entry header is at least 46 bytes - fragment.extend(IOizeString) - entry = ZipEntry.new - entry.readCDirEntry(fragment) - fail "ZipError expected" - rescue ZipError - end - -end - -class ZipCentralDirectoryTest < RUNIT::TestCase - - def test_readFromStream - File.open(TestZipFile::TEST_ZIP2.zipName, "rb") { - |zipFile| - cdir = ZipCentralDirectory.readFromStream(zipFile) - - assert_equals(TestZipFile::TEST_ZIP2.entryNames.size, cdir.size) - assert(cdir.compareEnumerables(TestZipFile::TEST_ZIP2.entryNames) { - |cdirEntry, testEntryName| - cdirEntry.name == testEntryName - }) - assert_equals(TestZipFile::TEST_ZIP2.comment, cdir.comment) - } - end - - def test_readFromInvalidStream - File.open("ziptest.rb", "rb") { - |zipFile| - cdir = ZipCentralDirectory.new - cdir.readFromStream(zipFile) - } - fail "ZipError expected!" - rescue ZipError - end - - def test_ReadFromTruncatedZipFile - fragment="" - File.open("testDirectory.bin") { |f| fragment = f.read } - fragment.slice!(12) # removed part of first cdir entry. eocd structure still complete - fragment.extend(IOizeString) - entry = ZipCentralDirectory.new - entry.readFromStream(fragment) - fail "ZipError expected" - rescue ZipError - end - - def test_writeToStream - entries = [ ZipEntry.new("file.zip", "flimse", "myComment", "somethingExtra"), - ZipEntry.new("file.zip", "secondEntryName"), - ZipEntry.new("file.zip", "lastEntry.txt", "Has a comment too") ] - cdir = ZipCentralDirectory.new(entries, "my zip comment") - File.open("cdirtest.bin", "wb") { |f| cdir.writeToStream(f) } - cdirReadback = ZipCentralDirectory.new - File.open("cdirtest.bin", "rb") { |f| cdirReadback.readFromStream(f) } - - assert_equals(cdir.entries, cdirReadback.entries) - end - - def test_equality - cdir1 = ZipCentralDirectory.new([ ZipEntry.new("file.zip", "flimse", nil, - "somethingExtra"), - ZipEntry.new("file.zip", "secondEntryName"), - ZipEntry.new("file.zip", "lastEntry.txt") ], - "my zip comment") - cdir2 = ZipCentralDirectory.new([ ZipEntry.new("file.zip", "flimse", nil, - "somethingExtra"), - ZipEntry.new("file.zip", "secondEntryName"), - ZipEntry.new("file.zip", "lastEntry.txt") ], - "my zip comment") - cdir3 = ZipCentralDirectory.new([ ZipEntry.new("file.zip", "flimse", nil, - "somethingExtra"), - ZipEntry.new("file.zip", "secondEntryName"), - ZipEntry.new("file.zip", "lastEntry.txt") ], - "comment?") - cdir4 = ZipCentralDirectory.new([ ZipEntry.new("file.zip", "flimse", nil, - "somethingExtra"), - ZipEntry.new("file.zip", "lastEntry.txt") ], - "comment?") - assert_equals(cdir1, cdir1) - assert_equals(cdir1, cdir2) - - assert(cdir1 != cdir3) - assert(cdir2 != cdir3) - assert(cdir2 != cdir3) - assert(cdir3 != cdir4) - - assert(cdir3 != "hello") - end -end - - -class BasicZipFileTest < RUNIT::TestCase - include AssertEntry - - def setup - @zipFile = ZipFile.new(TestZipFile::TEST_ZIP2.zipName) - @testEntryNameIndex=0 - end - - def nextTestEntryName - retVal=TestZipFile::TEST_ZIP2.entryNames[@testEntryNameIndex] - @testEntryNameIndex+=1 - return retVal - end - - def test_entries - assert_equals(TestZipFile::TEST_ZIP2.entryNames, @zipFile.entries.map {|e| e.name} ) - end - - def test_each - @zipFile.each { - |entry| - assert_equals(nextTestEntryName, entry.name) - } - assert_equals(4, @testEntryNameIndex) - end - - def test_foreach - ZipFile.foreach(TestZipFile::TEST_ZIP2.zipName) { - |entry| - assert_equals(nextTestEntryName, entry.name) - } - assert_equals(4, @testEntryNameIndex) - end - - def test_getInputStream - @zipFile.each { - |entry| - assertEntry(nextTestEntryName, @zipFile.getInputStream(entry), - entry.name) - } - assert_equals(4, @testEntryNameIndex) - end - - def test_getInputStreamBlock - fileAndEntryName = @zipFile.entries.first.name - @zipFile.getInputStream(fileAndEntryName) { - |zis| - assertEntryContentsForStream(fileAndEntryName, - zis, - fileAndEntryName) - } - end -end - -class CommonZipFileFixture < RUNIT::TestCase - include AssertEntry - - EMPTY_FILENAME = "emptyZipFile.zip" - - TEST_ZIP = TestZipFile::TEST_ZIP2.clone - TEST_ZIP.zipName = "4entry_copy.zip" - - def setup - File.delete(EMPTY_FILENAME) if File.exists?(EMPTY_FILENAME) - File.copy(TestZipFile::TEST_ZIP2.zipName, TEST_ZIP.zipName) - end -end - -class ZipFileTest < CommonZipFileFixture - - def test_createFromScratch - comment = "a short comment" - - zf = ZipFile.new(EMPTY_FILENAME, ZipFile::CREATE) - zf.comment = comment - zf.close - - zfRead = ZipFile.new(EMPTY_FILENAME) - assert_equals(comment, zfRead.comment) - assert_equals(0, zfRead.entries.length) - end - - def test_add - srcFile = "ziptest.rb" - entryName = "newEntryName.rb" - assert(File.exists? srcFile) - zf = ZipFile.new(EMPTY_FILENAME, ZipFile::CREATE) - zf.add(entryName, srcFile) - zf.close - - zfRead = ZipFile.new(EMPTY_FILENAME) - assert_equals("", zfRead.comment) - assert_equals(1, zfRead.entries.length) - assert_equals(entryName, zfRead.entries.first.name) - AssertEntry.assertContents(srcFile, - zfRead.getInputStream(entryName) { |zis| zis.read }) - end - - def test_addExistingEntryName - assert_exception(ZipEntryExistsError) { - ZipFile.open(TEST_ZIP.zipName) { - |zf| - zf.add(zf.entries.first.name, "ziptest.rb") - } - } - end - - def test_addExistingEntryNameReplace - gotCalled = false - replacedEntry = nil - ZipFile.open(TEST_ZIP.zipName) { - |zf| - replacedEntry = zf.entries.first.name - zf.add(replacedEntry, "ziptest.rb") { gotCalled = true; true } - } - assert(gotCalled) - ZipFile.open(TEST_ZIP.zipName) { - |zf| - assertContains(zf, replacedEntry, "ziptest.rb") - } - end - - def test_addDirectory - ZipFile.open(TEST_ZIP.zipName) { - |zf| - zf.add(TestFiles::EMPTY_TEST_DIR, TestFiles::EMPTY_TEST_DIR) - } - ZipFile.open(TEST_ZIP.zipName) { - |zf| - dirEntry = zf.entries.detect { |e| e.name == TestFiles::EMPTY_TEST_DIR+"/" } - assert(dirEntry.isDirectory) - } - end - - def test_remove - entryToRemove, *remainingEntries = TEST_ZIP.entryNames - - File.copy(TestZipFile::TEST_ZIP2.zipName, TEST_ZIP.zipName) - - zf = ZipFile.new(TEST_ZIP.zipName) - assert(zf.entries.map { |e| e.name }.include?(entryToRemove)) - zf.remove(entryToRemove) - assert(! zf.entries.map { |e| e.name }.include?(entryToRemove)) - assert_equals(zf.entries.map {|x| x.name }.sort, remainingEntries.sort) - zf.close - - zfRead = ZipFile.new(TEST_ZIP.zipName) - assert(! zfRead.entries.map { |e| e.name }.include?(entryToRemove)) - assert_equals(zfRead.entries.map {|x| x.name }.sort, remainingEntries.sort) - zfRead.close - end - - - def test_rename - entryToRename, *remainingEntries = TEST_ZIP.entryNames - - zf = ZipFile.new(TEST_ZIP.zipName) - assert(zf.entries.map { |e| e.name }.include? entryToRename) - - newName = "changed name" - assert(! zf.entries.map { |e| e.name }.include?(newName)) - - zf.rename(entryToRename, newName) - assert(zf.entries.map { |e| e.name }.include? newName) - - zf.close - - zfRead = ZipFile.new(TEST_ZIP.zipName) - assert(zfRead.entries.map { |e| e.name }.include? newName) - zfRead.close - end - - def test_renameToExistingEntry - oldEntries = nil - ZipFile.open(TEST_ZIP.zipName) { |zf| oldEntries = zf.entries } - - assert_exception(ZipEntryExistsError) { - ZipFile.open(TEST_ZIP.zipName) { - |zf| - zf.rename(zf.entries[0], zf.entries[1].name) - } - } - - ZipFile.open(TEST_ZIP.zipName) { - |zf| - assert_equals(oldEntries.map{ |e| e.name }, zf.entries.map{ |e| e.name }) - } - end - - def test_renameToExistingEntryOverwrite - oldEntries = nil - ZipFile.open(TEST_ZIP.zipName) { |zf| oldEntries = zf.entries } - - gotCalled = false - ZipFile.open(TEST_ZIP.zipName) { - |zf| - zf.rename(zf.entries[0], zf.entries[1].name) { gotCalled = true; true } - } - - assert(gotCalled) - oldEntries.delete_at(0) - ZipFile.open(TEST_ZIP.zipName) { - |zf| - assert_equals(oldEntries.map{ |e| e.name }, - zf.entries.map{ |e| e.name }) - } - end - - def test_renameNonEntry - nonEntry = "bogusEntry" - targetEntry = "targetEntryName" - zf = ZipFile.new(TEST_ZIP.zipName) - assert(! zf.entries.include?(nonEntry)) - assert_exception(ZipNoSuchEntryError) { - zf.rename(nonEntry, targetEntry) - } - zf.commit - assert(! zf.entries.include?(targetEntry)) - ensure - zf.close - end - - def test_renameEntryToExistingEntry - entry1, entry2, *remaining = TEST_ZIP.entryNames - zf = ZipFile.new(TEST_ZIP.zipName) - assert_exception(ZipEntryExistsError) { - zf.rename(entry1, entry2) - } - ensure - zf.close - end - - def test_replace - unchangedEntries = TEST_ZIP.entryNames.dup - entryToReplace = unchangedEntries.delete_at(2) - newEntrySrcFilename = "ziptest.rb" - - zf = ZipFile.new(TEST_ZIP.zipName) - zf.replace(entryToReplace, newEntrySrcFilename) - - zf.close - - zfRead = ZipFile.new(TEST_ZIP.zipName) - AssertEntry::assertContents(newEntrySrcFilename, - zfRead.getInputStream(entryToReplace) { |is| is.read }) - zfRead.close - end - - def test_replaceNonEntry - entryToReplace = "nonExistingEntryname" - ZipFile.open(TEST_ZIP.zipName) { - |zf| - assert_exception(ZipNoSuchEntryError) { - zf.replace(entryToReplace, "ziptest.rb") - } - } - end - - def test_commit - newName = "renamedFirst" - zf = ZipFile.new(TEST_ZIP.zipName) - oldName = zf.entries.first - zf.rename(oldName, newName) - zf.commit - - zfRead = ZipFile.new(TEST_ZIP.zipName) - assert(zfRead.entries.detect { |e| e.name == newName } != nil) - assert(zfRead.entries.detect { |e| e.name == oldName } == nil) - zfRead.close - - zf.close - end - - # This test tests that after commit, you - # can delete the file you used to add the entry to the zip file - # with - def test_commitUseZipEntry - File.copy(TestFiles::RANDOM_ASCII_FILE1, "okToDelete.txt") - zf = ZipFile.open(TEST_ZIP.zipName) - zf.add("okToDelete.txt", "okToDelete.txt") - assertContains(zf, "okToDelete.txt") - zf.commit - File.move("okToDelete.txt", "okToDeleteMoved.txt") - assertContains(zf, "okToDelete.txt", "okToDeleteMoved.txt") - end - -# def test_close -# zf = ZipFile.new(TEST_ZIP.zipName) -# zf.close -# assert_exception(IOError) { -# zf.extract(TEST_ZIP.entryNames.first, "hullubullu") -# } -# end - - def test_compound1 - renamedName = "renamedName" - originalEntries = [] - begin - zf = ZipFile.new(TEST_ZIP.zipName) - originalEntries = zf.entries.dup - - assertNotContains(zf, TestFiles::RANDOM_ASCII_FILE1) - zf.add(TestFiles::RANDOM_ASCII_FILE1, - TestFiles::RANDOM_ASCII_FILE1) - assertContains(zf, TestFiles::RANDOM_ASCII_FILE1) - - zf.rename(zf.entries[0], renamedName) - assertContains(zf, renamedName) - - TestFiles::BINARY_TEST_FILES.each { - |filename| - zf.add(filename, filename) - assertContains(zf, filename) - } - - assertContains(zf, originalEntries.last.to_s) - zf.remove(originalEntries.last.to_s) - assertNotContains(zf, originalEntries.last.to_s) - - ensure - zf.close - end - begin - zfRead = ZipFile.new(TEST_ZIP.zipName) - assertContains(zfRead, TestFiles::RANDOM_ASCII_FILE1) - assertContains(zfRead, renamedName) - TestFiles::BINARY_TEST_FILES.each { - |filename| - assertContains(zfRead, filename) - } - assertNotContains(zfRead, originalEntries.last.to_s) - ensure - zfRead.close - end - end - - def test_compound2 - begin - zf = ZipFile.new(TEST_ZIP.zipName) - originalEntries = zf.entries.dup - - originalEntries.each { - |entry| - zf.remove(entry) - assertNotContains(zf, entry) - } - assert(zf.entries.empty?) - - TestFiles::ASCII_TEST_FILES.each { - |filename| - zf.add(filename, filename) - assertContains(zf, filename) - } - assert_equals(zf.entries.map { |e| e.name }, TestFiles::ASCII_TEST_FILES) - - zf.rename(TestFiles::ASCII_TEST_FILES[0], "newName") - assertNotContains(zf, TestFiles::ASCII_TEST_FILES[0]) - assertContains(zf, "newName") - ensure - zf.close - end - begin - zfRead = ZipFile.new(TEST_ZIP.zipName) - asciiTestFiles = TestFiles::ASCII_TEST_FILES.dup - asciiTestFiles.shift - asciiTestFiles.each { - |filename| - assertContains(zf, filename) - } - - assertContains(zf, "newName") - ensure - zfRead.close - end - end - - private - def assertContains(zf, entryName, filename = entryName) - assert(zf.entries.detect { |e| e.name == entryName} != nil, "entry #{entryName} not in #{zf.entries.join(', ')} in zip file #{zf}") - assertEntryContents(zf, entryName, filename) if File.exists?(filename) - end - - def assertNotContains(zf, entryName) - assert(zf.entries.detect { |e| e.name == entryName} == nil, "entry #{entryName} in #{zf.entries.join(', ')} in zip file #{zf}") - end -end - -class ZipFileExtractTest < CommonZipFileFixture - EXTRACTED_FILENAME = "extEntry" - ENTRY_TO_EXTRACT, *REMAINING_ENTRIES = TEST_ZIP.entryNames.reverse - - def setup - super - File.delete(EXTRACTED_FILENAME) if File.exists?(EXTRACTED_FILENAME) - end - - def test_extract - ZipFile.open(TEST_ZIP.zipName) { - |zf| - zf.extract(ENTRY_TO_EXTRACT, EXTRACTED_FILENAME) - - assert(File.exists? EXTRACTED_FILENAME) - AssertEntry::assertContents(EXTRACTED_FILENAME, - zf.getInputStream(ENTRY_TO_EXTRACT) { |is| is.read }) - } - end - - def test_extractExists - writtenText = "written text" - File.open(EXTRACTED_FILENAME, "w") { |f| f.write(writtenText) } - - assert_exception(ZipDestinationFileExistsError) { - ZipFile.open(TEST_ZIP.zipName) { - |zf| - zf.extract(zf.entries.first, EXTRACTED_FILENAME) - } - } - File.open(EXTRACTED_FILENAME, "r") { - |f| - assert_equals(writtenText, f.read) - } - end - - def test_extractExistsOverwrite - writtenText = "written text" - File.open(EXTRACTED_FILENAME, "w") { |f| f.write(writtenText) } - - gotCalled = false - ZipFile.open(TEST_ZIP.zipName) { - |zf| - zf.extract(zf.entries.first, EXTRACTED_FILENAME) { gotCalled = true; true } - } - - assert(gotCalled) - File.open(EXTRACTED_FILENAME, "r") { - |f| - assert(writtenText != f.read) - } - end - - def test_extractNonEntry - zf = ZipFile.new(TEST_ZIP.zipName) - assert_exception(ZipNoSuchEntryError) { zf.extract("nonExistingEntry", "nonExistingEntry") } - ensure - zf.close if zf - end - - def test_extractNonEntry2 - outFile = "outfile" - assert_exception(ZipNoSuchEntryError) { - zf = ZipFile.new(TEST_ZIP.zipName) - nonEntry = "hotdog-diddelidoo" - assert(! zf.entries.include?(nonEntry)) - zf.extract(nonEntry, outFile) - zf.close - } - assert(! File.exists?(outFile)) - end - -end - -class ZipFileExtractDirectoryTest < CommonZipFileFixture - TEST_OUT_NAME = "emptyOutDir" - - def openZip(&aProc) - assert(aProc != nil) - ZipFile.open(TestZipFile::TEST_ZIP4.zipName, &aProc) - end - - def extractTestDir(&aProc) - openZip { - |zf| - zf.extract(TestFiles::EMPTY_TEST_DIR, TEST_OUT_NAME, &aProc) - } - end - - def setup - super - - Dir.rmdir(TEST_OUT_NAME) if File.directory? TEST_OUT_NAME - File.delete(TEST_OUT_NAME) if File.exists? TEST_OUT_NAME - end - - def test_extractDirectory - extractTestDir - assert(File.directory? TEST_OUT_NAME) - end - - def test_extractDirectoryExistsAsDir - Dir.mkdir TEST_OUT_NAME - extractTestDir - assert(File.directory? TEST_OUT_NAME) - end - - def test_extractDirectoryExistsAsFile - File.open(TEST_OUT_NAME, "w") { |f| f.puts "something" } - assert_exception(ZipDestinationFileExistsError) { extractTestDir } - end - - def test_extractDirectoryExistsAsFileOverwrite - File.open(TEST_OUT_NAME, "w") { |f| f.puts "something" } - gotCalled = false - extractTestDir { - |entry, destPath| - gotCalled = true - assert_equals(TEST_OUT_NAME, destPath) - assert(entry.isDirectory) - true - } - assert(gotCalled) - assert(File.directory? TEST_OUT_NAME) - end -end - - -TestFiles::createTestFiles(ARGV.index("recreate") != nil || - ARGV.index("recreateonly") != nil) -TestZipFile::createTestZips(ARGV.index("recreate") != nil || - ARGV.index("recreateonly") != nil) -exit if ARGV.index("recreateonly") != nil - -#require 'runit/cui/testrunner' -#RUNIT::CUI::TestRunner.run(ZipFileTest.suite) - -# Copyright (C) 2002 Thomas Sondergaard -# rubyzip is free software; you can redistribute it and/or -# modify it under the terms of the ruby license. diff --git a/vendor/rubyzip-0.5.8/test/data/notzippedruby.rb b/vendor/rubyzip-0.5.8/test/data/notzippedruby.rb deleted file mode 100644 index 036d25e9..00000000 --- a/vendor/rubyzip-0.5.8/test/data/notzippedruby.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby - -class NotZippedRuby - def returnTrue - true - end -end diff --git a/vendor/rubyzip-0.5.8/test/data/rubycode.zip b/vendor/rubyzip-0.5.8/test/data/rubycode.zip deleted file mode 100644 index 8a68560e638088df79cd3bf68973013e5421a138..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 617 zcmWIWW@Zs#U|`^2*ef_ihj&#AyDyLz4#a#6q6}4;1qG=oMWsoVhI&Owp&^_M%*Qqz zusOT^fK6xx3qz{5pk{E`6@6X3Oa7XQ6aq^YrF$udom<7Oc6lM6}=RDLT(4ef%v0bc!4h^8y1W zF(|b-zqBYhRj;I?1ROS-fZ>81HlI)HpFDBKJKSTf$2lEFL!-|k4N6D3GG|(@>;ig~ zkx85xSJ3kU?ONSo@jDa*vNRhlwoTaWDdGpXl_l7YYQ5=Tcy zrKJm6mDneFo%MeBlu4K&z?+dtoEeupd4aBFU| zA4oGE-6BAHIKZ|xRwx*G19_o9EQG2%Ei)(8(9jU>1duaeP7pnEkh8&nhxJ1B@*nf6 zHmC3$*O)cQq4xsI(%Y*)R4Bgs(PD5T$>)hP`&4@^Uu)sOHmP%+3H(JZ*Tj$A;8upFq4-#D)-_!rOo zz!GmJQzzjm|Ki#?1CQIcEI2yj#PYsPrf+proq4ajTwpGhS;Rkm%D0A)zZ8EJcxCc?6yCYU#-$Z+V)|>29qyQgrU)ZKDMG0hH6=mA&`2McB8;FZB0rGW z^aM>2Fx?OquacTrK4QqJHwn1X`eeKbzSH2tf ze~@$y7Fr=VYr&WAVTm&&(+zp%a4xxL^+-`ycmB2e%C1^V4FwljSkE~#@%Fi*%OZ!K zJ;>Ryr7T6HD!}#Rvky$Dk$dY_Uj ZipEntry.new("zf.zip", "a"))) - assert_equal(1, (ZipEntry.new("zf.zip", "b") <=> ZipEntry.new("zf.zip", "a"))) - assert_equal(-1, (ZipEntry.new("zf.zip", "a") <=> ZipEntry.new("zf.zip", "b"))) - - entries = [ - ZipEntry.new("zf.zip", "5"), - ZipEntry.new("zf.zip", "1"), - ZipEntry.new("zf.zip", "3"), - ZipEntry.new("zf.zip", "4"), - ZipEntry.new("zf.zip", "0"), - ZipEntry.new("zf.zip", "2") - ] - - entries.sort! - assert_equal("0", entries[0].to_s) - assert_equal("1", entries[1].to_s) - assert_equal("2", entries[2].to_s) - assert_equal("3", entries[3].to_s) - assert_equal("4", entries[4].to_s) - assert_equal("5", entries[5].to_s) - end - - def test_parentAsString - entry1 = ZipEntry.new("zf.zip", "aa") - entry2 = ZipEntry.new("zf.zip", "aa/") - entry3 = ZipEntry.new("zf.zip", "aa/bb") - entry4 = ZipEntry.new("zf.zip", "aa/bb/") - entry5 = ZipEntry.new("zf.zip", "aa/bb/cc") - entry6 = ZipEntry.new("zf.zip", "aa/bb/cc/") - - assert_equal(nil, entry1.parent_as_string) - assert_equal(nil, entry2.parent_as_string) - assert_equal("aa/", entry3.parent_as_string) - assert_equal("aa/", entry4.parent_as_string) - assert_equal("aa/bb/", entry5.parent_as_string) - assert_equal("aa/bb/", entry6.parent_as_string) - end - - def test_entry_name_cannot_start_with_slash - assert_raise(ZipEntryNameError) { ZipEntry.new("zf.zip", "/hej/der") } - end -end - -module IOizeString - attr_reader :tell - - def read(count = nil) - @tell ||= 0 - count = size unless count - retVal = slice(@tell, count) - @tell += count - return retVal - end - - def seek(index, offset) - @tell ||= 0 - case offset - when IO::SEEK_END - newPos = size + index - when IO::SEEK_SET - newPos = index - when IO::SEEK_CUR - newPos = @tell + index - else - raise "Error in test method IOizeString::seek" - end - if (newPos < 0 || newPos >= size) - raise Errno::EINVAL - else - @tell=newPos - end - end - - def reset - @tell = 0 - end -end - -class ZipLocalEntryTest < Test::Unit::TestCase - def test_read_local_entryHeaderOfFirstTestZipEntry - File.open(TestZipFile::TEST_ZIP3.zip_name, "rb") { - |file| - entry = ZipEntry.read_local_entry(file) - - assert_equal("", entry.comment) - # Differs from windows and unix because of CR LF - # assert_equal(480, entry.compressed_size) - # assert_equal(0x2a27930f, entry.crc) - # extra field is 21 bytes long - # probably contains some unix attrutes or something - # disabled: assert_equal(nil, entry.extra) - assert_equal(ZipEntry::DEFLATED, entry.compression_method) - assert_equal(TestZipFile::TEST_ZIP3.entry_names[0], entry.name) - assert_equal(File.size(TestZipFile::TEST_ZIP3.entry_names[0]), entry.size) - assert(! entry.is_directory) - } - end - - def test_readDateTime - File.open("data/rubycode.zip", "rb") { - |file| - entry = ZipEntry.read_local_entry(file) - assert_equal("zippedruby1.rb", entry.name) - assert_equal(Time.at(1019261638), entry.time) - } - end - - def test_read_local_entryFromNonZipFile - File.open("data/file2.txt") { - |file| - assert_equal(nil, ZipEntry.read_local_entry(file)) - } - end - - def test_read_local_entryFromTruncatedZipFile - zipFragment="" - File.open(TestZipFile::TEST_ZIP2.zip_name) { |f| zipFragment = f.read(12) } # local header is at least 30 bytes - zipFragment.extend(IOizeString).reset - entry = ZipEntry.new - entry.read_local_entry(zipFragment) - fail "ZipError expected" - rescue ZipError - end - - def test_writeEntry - entry = ZipEntry.new("file.zip", "entryName", "my little comment", - "thisIsSomeExtraInformation", 100, 987654, - ZipEntry::DEFLATED, 400) - write_to_file("localEntryHeader.bin", "centralEntryHeader.bin", entry) - entryReadLocal, entryReadCentral = read_from_file("localEntryHeader.bin", "centralEntryHeader.bin") - compare_local_entry_headers(entry, entryReadLocal) - compare_c_dir_entry_headers(entry, entryReadCentral) - end - - private - def compare_local_entry_headers(entry1, entry2) - assert_equal(entry1.compressed_size , entry2.compressed_size) - assert_equal(entry1.crc , entry2.crc) - assert_equal(entry1.extra , entry2.extra) - assert_equal(entry1.compression_method, entry2.compression_method) - assert_equal(entry1.name , entry2.name) - assert_equal(entry1.size , entry2.size) - assert_equal(entry1.localHeaderOffset, entry2.localHeaderOffset) - end - - def compare_c_dir_entry_headers(entry1, entry2) - compare_local_entry_headers(entry1, entry2) - assert_equal(entry1.comment, entry2.comment) - end - - def write_to_file(localFileName, centralFileName, entry) - File.open(localFileName, "wb") { |f| entry.write_local_entry(f) } - File.open(centralFileName, "wb") { |f| entry.write_c_dir_entry(f) } - end - - def read_from_file(localFileName, centralFileName) - localEntry = nil - cdirEntry = nil - File.open(localFileName, "rb") { |f| localEntry = ZipEntry.read_local_entry(f) } - File.open(centralFileName, "rb") { |f| cdirEntry = ZipEntry.read_c_dir_entry(f) } - return [localEntry, cdirEntry] - end -end - - -module DecompressorTests - # expects @refText, @refLines and @decompressor - - TEST_FILE="data/file1.txt" - - def setup - @refText="" - File.open(TEST_FILE) { |f| @refText = f.read } - @refLines = @refText.split($/) - end - - def test_readEverything - assert_equal(@refText, @decompressor.read) - end - - def test_readInChunks - chunkSize = 5 - while (decompressedChunk = @decompressor.read(chunkSize)) - assert_equal(@refText.slice!(0, chunkSize), decompressedChunk) - end - assert_equal(0, @refText.size) - end - - def test_mixingReadsAndProduceInput - # Just some preconditions to make sure we have enough data for this test - assert(@refText.length > 1000) - assert(@refLines.length > 40) - - - assert_equal(@refText[0...100], @decompressor.read(100)) - - assert(! @decompressor.input_finished?) - buf = @decompressor.produce_input - assert_equal(@refText[100...(100+buf.length)], buf) - end -end - -class InflaterTest < Test::Unit::TestCase - include DecompressorTests - - def setup - super - @file = File.new("data/file1.txt.deflatedData", "rb") - @decompressor = Inflater.new(@file) - end - - def teardown - @file.close - end -end - - -class PassThruDecompressorTest < Test::Unit::TestCase - include DecompressorTests - def setup - super - @file = File.new(TEST_FILE) - @decompressor = PassThruDecompressor.new(@file, File.size(TEST_FILE)) - end - - def teardown - @file.close - end -end - - -module AssertEntry - def assert_next_entry(filename, zis) - assert_entry(filename, zis, zis.get_next_entry.name) - end - - def assert_entry(filename, zis, entryName) - assert_equal(filename, entryName) - assert_entryContentsForStream(filename, zis, entryName) - end - - def assert_entryContentsForStream(filename, zis, entryName) - File.open(filename, "rb") { - |file| - expected = file.read - actual = zis.read - if (expected != actual) - if ((expected && actual) && (expected.length > 400 || actual.length > 400)) - zipEntryFilename=entryName+".zipEntry" - File.open(zipEntryFilename, "wb") { |file| file << actual } - fail("File '#{filename}' is different from '#{zipEntryFilename}'") - else - assert_equal(expected, actual) - end - end - } - end - - def AssertEntry.assert_contents(filename, aString) - fileContents = "" - File.open(filename, "rb") { |f| fileContents = f.read } - if (fileContents != aString) - if (fileContents.length > 400 || aString.length > 400) - stringFile = filename + ".other" - File.open(stringFile, "wb") { |f| f << aString } - fail("File '#{filename}' is different from contents of string stored in '#{stringFile}'") - else - assert_equal(fileContents, aString) - end - end - end - - def assert_stream_contents(zis, testZipFile) - assert(zis != nil) - testZipFile.entry_names.each { - |entryName| - assert_next_entry(entryName, zis) - } - assert_equal(nil, zis.get_next_entry) - end - - def assert_test_zip_contents(testZipFile) - ZipInputStream.open(testZipFile.zip_name) { - |zis| - assert_stream_contents(zis, testZipFile) - } - end - - def assert_entryContents(zipFile, entryName, filename = entryName.to_s) - zis = zipFile.get_input_stream(entryName) - assert_entryContentsForStream(filename, zis, entryName) - ensure - zis.close if zis - end -end - - - -class ZipInputStreamTest < Test::Unit::TestCase - include AssertEntry - - def test_new - zis = ZipInputStream.new(TestZipFile::TEST_ZIP2.zip_name) - assert_stream_contents(zis, TestZipFile::TEST_ZIP2) - zis.close - end - - def test_openWithBlock - ZipInputStream.open(TestZipFile::TEST_ZIP2.zip_name) { - |zis| - assert_stream_contents(zis, TestZipFile::TEST_ZIP2) - } - end - - def test_openWithoutBlock - zis = ZipInputStream.open(TestZipFile::TEST_ZIP2.zip_name) - assert_stream_contents(zis, TestZipFile::TEST_ZIP2) - end - - def test_incompleteReads - ZipInputStream.open(TestZipFile::TEST_ZIP2.zip_name) { - |zis| - entry = zis.get_next_entry - assert_equal(TestZipFile::TEST_ZIP2.entry_names[0], entry.name) - assert zis.gets.length > 0 - entry = zis.get_next_entry - assert_equal(TestZipFile::TEST_ZIP2.entry_names[1], entry.name) - assert_equal(0, entry.size) - assert_equal(nil, zis.gets) - entry = zis.get_next_entry - assert_equal(TestZipFile::TEST_ZIP2.entry_names[2], entry.name) - assert zis.gets.length > 0 - entry = zis.get_next_entry - assert_equal(TestZipFile::TEST_ZIP2.entry_names[3], entry.name) - assert zis.gets.length > 0 - } - end - - def test_rewind - ZipInputStream.open(TestZipFile::TEST_ZIP2.zip_name) { - |zis| - e = zis.get_next_entry - assert_equal(TestZipFile::TEST_ZIP2.entry_names[0], e.name) - - # Do a little reading - buf = "" - buf << zis.read(100) - buf << (zis.gets || "") - buf << (zis.gets || "") - - zis.rewind - - buf2 = "" - buf2 << zis.read(100) - buf2 << (zis.gets || "") - buf2 << (zis.gets || "") - - assert_equal(buf, buf2) - - zis.rewind - - assert_entry(e.name, zis, e.name) - } - end - -end - - -module CrcTest - - class TestOutputStream - include IOExtras::AbstractOutputStream - - attr_accessor :buffer - - def initialize - @buffer = "" - end - - def << (data) - @buffer << data - self - end - end - - def run_crc_test(compressorClass) - str = "Here's a nice little text to compute the crc for! Ho hum, it is nice nice nice nice indeed." - fakeOut = TestOutputStream.new - - deflater = compressorClass.new(fakeOut) - deflater << str - assert_equal(0x919920fc, deflater.crc) - end -end - - - -class PassThruCompressorTest < Test::Unit::TestCase - include CrcTest - - def test_size - File.open("dummy.txt", "wb") { - |file| - compressor = PassThruCompressor.new(file) - - assert_equal(0, compressor.size) - - t1 = "hello world" - t2 = "" - t3 = "bingo" - - compressor << t1 - assert_equal(compressor.size, t1.size) - - compressor << t2 - assert_equal(compressor.size, t1.size + t2.size) - - compressor << t3 - assert_equal(compressor.size, t1.size + t2.size + t3.size) - } - end - - def test_crc - run_crc_test(PassThruCompressor) - end -end - -class DeflaterTest < Test::Unit::TestCase - include CrcTest - - def test_outputOperator - txt = load_file("data/file2.txt") - deflate(txt, "deflatertest.bin") - inflatedTxt = inflate("deflatertest.bin") - assert_equal(txt, inflatedTxt) - end - - private - def load_file(fileName) - txt = nil - File.open(fileName, "rb") { |f| txt = f.read } - end - - def deflate(data, fileName) - File.open(fileName, "wb") { - |file| - deflater = Deflater.new(file) - deflater << data - deflater.finish - assert_equal(deflater.size, data.size) - file << "trailing data for zlib with -MAX_WBITS" - } - end - - def inflate(fileName) - txt = nil - File.open(fileName, "rb") { - |file| - inflater = Inflater.new(file) - txt = inflater.read - } - end - - def test_crc - run_crc_test(Deflater) - end -end - -class ZipOutputStreamTest < Test::Unit::TestCase - include AssertEntry - - TEST_ZIP = TestZipFile::TEST_ZIP2.clone - TEST_ZIP.zip_name = "output.zip" - - def test_new - zos = ZipOutputStream.new(TEST_ZIP.zip_name) - zos.comment = TEST_ZIP.comment - write_test_zip(zos) - zos.close - assert_test_zip_contents(TEST_ZIP) - end - - def test_open - ZipOutputStream.open(TEST_ZIP.zip_name) { - |zos| - zos.comment = TEST_ZIP.comment - write_test_zip(zos) - } - assert_test_zip_contents(TEST_ZIP) - end - - def test_writingToClosedStream - assert_i_o_error_in_closed_stream { |zos| zos << "hello world" } - assert_i_o_error_in_closed_stream { |zos| zos.puts "hello world" } - assert_i_o_error_in_closed_stream { |zos| zos.write "hello world" } - end - - def test_cannotOpenFile - name = TestFiles::EMPTY_TEST_DIR - begin - zos = ZipOutputStream.open(name) - rescue Exception - assert($!.kind_of?(Errno::EISDIR) || # Linux - $!.kind_of?(Errno::EEXIST) || # Windows/cygwin - $!.kind_of?(Errno::EACCES), # Windows - "Expected Errno::EISDIR (or on win/cygwin: Errno::EEXIST), but was: #{$!.class}") - end - end - - def assert_i_o_error_in_closed_stream - assert_raise(IOError) { - zos = ZipOutputStream.new("test_putOnClosedStream.zip") - zos.close - yield zos - } - end - - def write_test_zip(zos) - TEST_ZIP.entry_names.each { - |entryName| - zos.put_next_entry(entryName) - File.open(entryName, "rb") { |f| zos.write(f.read) } - } - end -end - - - -module Enumerable - def compare_enumerables(otherEnumerable) - otherAsArray = otherEnumerable.to_a - index=0 - each_with_index { - |element, index| - return false unless yield(element, otherAsArray[index]) - } - return index+1 == otherAsArray.size - end -end - - -class ZipCentralDirectoryEntryTest < Test::Unit::TestCase - - def test_read_from_stream - File.open("data/testDirectory.bin", "rb") { - |file| - entry = ZipEntry.read_c_dir_entry(file) - - assert_equal("longAscii.txt", entry.name) - assert_equal(ZipEntry::DEFLATED, entry.compression_method) - assert_equal(106490, entry.size) - assert_equal(3784, entry.compressed_size) - assert_equal(0xfcd1799c, entry.crc) - assert_equal("", entry.comment) - - entry = ZipEntry.read_c_dir_entry(file) - assert_equal("empty.txt", entry.name) - assert_equal(ZipEntry::STORED, entry.compression_method) - assert_equal(0, entry.size) - assert_equal(0, entry.compressed_size) - assert_equal(0x0, entry.crc) - assert_equal("", entry.comment) - - entry = ZipEntry.read_c_dir_entry(file) - assert_equal("short.txt", entry.name) - assert_equal(ZipEntry::STORED, entry.compression_method) - assert_equal(6, entry.size) - assert_equal(6, entry.compressed_size) - assert_equal(0xbb76fe69, entry.crc) - assert_equal("", entry.comment) - - entry = ZipEntry.read_c_dir_entry(file) - assert_equal("longBinary.bin", entry.name) - assert_equal(ZipEntry::DEFLATED, entry.compression_method) - assert_equal(1000024, entry.size) - assert_equal(70847, entry.compressed_size) - assert_equal(0x10da7d59, entry.crc) - assert_equal("", entry.comment) - - entry = ZipEntry.read_c_dir_entry(file) - assert_equal(nil, entry) -# Fields that are not check by this test: -# version made by 2 bytes -# version needed to extract 2 bytes -# general purpose bit flag 2 bytes -# last mod file time 2 bytes -# last mod file date 2 bytes -# compressed size 4 bytes -# uncompressed size 4 bytes -# disk number start 2 bytes -# internal file attributes 2 bytes -# external file attributes 4 bytes -# relative offset of local header 4 bytes - -# file name (variable size) -# extra field (variable size) -# file comment (variable size) - - } - end - - def test_ReadEntryFromTruncatedZipFile - fragment="" - File.open("data/testDirectory.bin") { |f| fragment = f.read(12) } # cdir entry header is at least 46 bytes - fragment.extend(IOizeString) - entry = ZipEntry.new - entry.read_c_dir_entry(fragment) - fail "ZipError expected" - rescue ZipError - end - -end - - -class ZipEntrySetTest < Test::Unit::TestCase - ZIP_ENTRIES = [ - ZipEntry.new("zipfile.zip", "name1", "comment1"), - ZipEntry.new("zipfile.zip", "name2", "comment1"), - ZipEntry.new("zipfile.zip", "name3", "comment1"), - ZipEntry.new("zipfile.zip", "name4", "comment1"), - ZipEntry.new("zipfile.zip", "name5", "comment1"), - ZipEntry.new("zipfile.zip", "name6", "comment1") - ] - - def setup - @zipEntrySet = ZipEntrySet.new(ZIP_ENTRIES) - end - - def test_include - assert(@zipEntrySet.include?(ZIP_ENTRIES.first)) - assert(! @zipEntrySet.include?(ZipEntry.new("different.zip", "different", "aComment"))) - end - - def test_size - assert_equal(ZIP_ENTRIES.size, @zipEntrySet.size) - assert_equal(ZIP_ENTRIES.size, @zipEntrySet.length) - @zipEntrySet << ZipEntry.new("a", "b", "c") - assert_equal(ZIP_ENTRIES.size + 1, @zipEntrySet.length) - end - - def test_add - zes = ZipEntrySet.new - entry1 = ZipEntry.new("zf.zip", "name1") - entry2 = ZipEntry.new("zf.zip", "name2") - zes << entry1 - assert(zes.include?(entry1)) - zes.push(entry2) - assert(zes.include?(entry2)) - end - - def test_delete - assert_equal(ZIP_ENTRIES.size, @zipEntrySet.size) - entry = @zipEntrySet.delete(ZIP_ENTRIES.first) - assert_equal(ZIP_ENTRIES.size - 1, @zipEntrySet.size) - assert_equal(ZIP_ENTRIES.first, entry) - - entry = @zipEntrySet.delete(ZIP_ENTRIES.first) - assert_equal(ZIP_ENTRIES.size - 1, @zipEntrySet.size) - assert_nil(entry) - end - - def test_each - # Tested indirectly via each_with_index - count = 0 - @zipEntrySet.each_with_index { - |entry, index| - assert(ZIP_ENTRIES.include?(entry)) - count = count.succ - } - assert_equal(ZIP_ENTRIES.size, count) - end - - def test_entries - assert_equal(ZIP_ENTRIES.sort, @zipEntrySet.entries.sort) - end - - def test_compound - newEntry = ZipEntry.new("zf.zip", "new entry", "new entry's comment") - assert_equal(ZIP_ENTRIES.size, @zipEntrySet.size) - @zipEntrySet << newEntry - assert_equal(ZIP_ENTRIES.size + 1, @zipEntrySet.size) - assert(@zipEntrySet.include?(newEntry)) - - @zipEntrySet.delete(newEntry) - assert_equal(ZIP_ENTRIES.size, @zipEntrySet.size) - end - - def test_dup - copy = @zipEntrySet.dup - assert_equal(@zipEntrySet, copy) - - # demonstrate that this is a deep copy - copy.entries[0].name = "a totally different name" - assert(@zipEntrySet != copy) - end - - def test_parent - entries = [ - ZipEntry.new("zf.zip", "a"), - ZipEntry.new("zf.zip", "a/"), - ZipEntry.new("zf.zip", "a/b"), - ZipEntry.new("zf.zip", "a/b/"), - ZipEntry.new("zf.zip", "a/b/c"), - ZipEntry.new("zf.zip", "a/b/c/") - ] - entrySet = ZipEntrySet.new(entries) - - assert_equal(nil, entrySet.parent(entries[0])) - assert_equal(nil, entrySet.parent(entries[1])) - assert_equal(entries[1], entrySet.parent(entries[2])) - assert_equal(entries[1], entrySet.parent(entries[3])) - assert_equal(entries[3], entrySet.parent(entries[4])) - assert_equal(entries[3], entrySet.parent(entries[5])) - end -end - - -class ZipCentralDirectoryTest < Test::Unit::TestCase - - def test_read_from_stream - File.open(TestZipFile::TEST_ZIP2.zip_name, "rb") { - |zipFile| - cdir = ZipCentralDirectory.read_from_stream(zipFile) - - assert_equal(TestZipFile::TEST_ZIP2.entry_names.size, cdir.size) - assert(cdir.entries.sort.compare_enumerables(TestZipFile::TEST_ZIP2.entry_names.sort) { - |cdirEntry, testEntryName| - cdirEntry.name == testEntryName - }) - assert_equal(TestZipFile::TEST_ZIP2.comment, cdir.comment) - } - end - - def test_readFromInvalidStream - File.open("data/file2.txt", "rb") { - |zipFile| - cdir = ZipCentralDirectory.new - cdir.read_from_stream(zipFile) - } - fail "ZipError expected!" - rescue ZipError - end - - def test_ReadFromTruncatedZipFile - fragment="" - File.open("data/testDirectory.bin") { |f| fragment = f.read } - fragment.slice!(12) # removed part of first cdir entry. eocd structure still complete - fragment.extend(IOizeString) - entry = ZipCentralDirectory.new - entry.read_from_stream(fragment) - fail "ZipError expected" - rescue ZipError - end - - def test_write_to_stream - entries = [ ZipEntry.new("file.zip", "flimse", "myComment", "somethingExtra"), - ZipEntry.new("file.zip", "secondEntryName"), - ZipEntry.new("file.zip", "lastEntry.txt", "Has a comment too") ] - cdir = ZipCentralDirectory.new(entries, "my zip comment") - File.open("cdirtest.bin", "wb") { |f| cdir.write_to_stream(f) } - cdirReadback = ZipCentralDirectory.new - File.open("cdirtest.bin", "rb") { |f| cdirReadback.read_from_stream(f) } - - assert_equal(cdir.entries.sort, cdirReadback.entries.sort) - end - - def test_equality - cdir1 = ZipCentralDirectory.new([ ZipEntry.new("file.zip", "flimse", nil, - "somethingExtra"), - ZipEntry.new("file.zip", "secondEntryName"), - ZipEntry.new("file.zip", "lastEntry.txt") ], - "my zip comment") - cdir2 = ZipCentralDirectory.new([ ZipEntry.new("file.zip", "flimse", nil, - "somethingExtra"), - ZipEntry.new("file.zip", "secondEntryName"), - ZipEntry.new("file.zip", "lastEntry.txt") ], - "my zip comment") - cdir3 = ZipCentralDirectory.new([ ZipEntry.new("file.zip", "flimse", nil, - "somethingExtra"), - ZipEntry.new("file.zip", "secondEntryName"), - ZipEntry.new("file.zip", "lastEntry.txt") ], - "comment?") - cdir4 = ZipCentralDirectory.new([ ZipEntry.new("file.zip", "flimse", nil, - "somethingExtra"), - ZipEntry.new("file.zip", "lastEntry.txt") ], - "comment?") - assert_equal(cdir1, cdir1) - assert_equal(cdir1, cdir2) - - assert(cdir1 != cdir3) - assert(cdir2 != cdir3) - assert(cdir2 != cdir3) - assert(cdir3 != cdir4) - - assert(cdir3 != "hello") - end -end - - -class BasicZipFileTest < Test::Unit::TestCase - include AssertEntry - - def setup - @zipFile = ZipFile.new(TestZipFile::TEST_ZIP2.zip_name) - @testEntryNameIndex=0 - end - - def test_entries - assert_equal(TestZipFile::TEST_ZIP2.entry_names.sort, - @zipFile.entries.entries.sort.map {|e| e.name} ) - end - - def test_each - count = 0 - visited = {} - @zipFile.each { - |entry| - assert(TestZipFile::TEST_ZIP2.entry_names.include?(entry.name)) - assert(! visited.include?(entry.name)) - visited[entry.name] = nil - count = count.succ - } - assert_equal(TestZipFile::TEST_ZIP2.entry_names.length, count) - end - - def test_foreach - count = 0 - visited = {} - ZipFile.foreach(TestZipFile::TEST_ZIP2.zip_name) { - |entry| - assert(TestZipFile::TEST_ZIP2.entry_names.include?(entry.name)) - assert(! visited.include?(entry.name)) - visited[entry.name] = nil - count = count.succ - } - assert_equal(TestZipFile::TEST_ZIP2.entry_names.length, count) - end - - def test_get_input_stream - count = 0 - visited = {} - @zipFile.each { - |entry| - assert_entry(entry.name, @zipFile.get_input_stream(entry), entry.name) - assert(! visited.include?(entry.name)) - visited[entry.name] = nil - count = count.succ - } - assert_equal(TestZipFile::TEST_ZIP2.entry_names.length, count) - end - - def test_get_input_streamBlock - fileAndEntryName = @zipFile.entries.first.name - @zipFile.get_input_stream(fileAndEntryName) { - |zis| - assert_entryContentsForStream(fileAndEntryName, - zis, - fileAndEntryName) - } - end -end - -module CommonZipFileFixture - include AssertEntry - - EMPTY_FILENAME = "emptyZipFile.zip" - - TEST_ZIP = TestZipFile::TEST_ZIP2.clone - TEST_ZIP.zip_name = "4entry_copy.zip" - - def setup - File.delete(EMPTY_FILENAME) if File.exists?(EMPTY_FILENAME) - File.copy(TestZipFile::TEST_ZIP2.zip_name, TEST_ZIP.zip_name) - end -end - -class ZipFileTest < Test::Unit::TestCase - include CommonZipFileFixture - - def test_createFromScratch - comment = "a short comment" - - zf = ZipFile.new(EMPTY_FILENAME, ZipFile::CREATE) - zf.get_output_stream("myFile") { |os| os.write "myFile contains just this" } - zf.mkdir("dir1") - zf.comment = comment - zf.close - - zfRead = ZipFile.new(EMPTY_FILENAME) - assert_equal(comment, zfRead.comment) - assert_equal(2, zfRead.entries.length) - end - - def test_get_output_stream - entryCount = nil - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - entryCount = zf.size - zf.get_output_stream('newEntry.txt') { - |os| - os.write "Putting stuff in newEntry.txt" - } - assert_equal(entryCount+1, zf.size) - assert_equal("Putting stuff in newEntry.txt", zf.read("newEntry.txt")) - - zf.get_output_stream(zf.get_entry('data/generated/empty.txt')) { - |os| - os.write "Putting stuff in data/generated/empty.txt" - } - assert_equal(entryCount+1, zf.size) - assert_equal("Putting stuff in data/generated/empty.txt", zf.read("data/generated/empty.txt")) - - } - - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - assert_equal(entryCount+1, zf.size) - assert_equal("Putting stuff in newEntry.txt", zf.read("newEntry.txt")) - assert_equal("Putting stuff in data/generated/empty.txt", zf.read("data/generated/empty.txt")) - } - end - - def test_add - srcFile = "data/file2.txt" - entryName = "newEntryName.rb" - assert(File.exists?(srcFile)) - zf = ZipFile.new(EMPTY_FILENAME, ZipFile::CREATE) - zf.add(entryName, srcFile) - zf.close - - zfRead = ZipFile.new(EMPTY_FILENAME) - assert_equal("", zfRead.comment) - assert_equal(1, zfRead.entries.length) - assert_equal(entryName, zfRead.entries.first.name) - AssertEntry.assert_contents(srcFile, - zfRead.get_input_stream(entryName) { |zis| zis.read }) - end - - def test_addExistingEntryName - assert_raise(ZipEntryExistsError) { - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - zf.add(zf.entries.first.name, "data/file2.txt") - } - } - end - - def test_addExistingEntryNameReplace - gotCalled = false - replacedEntry = nil - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - replacedEntry = zf.entries.first.name - zf.add(replacedEntry, "data/file2.txt") { gotCalled = true; true } - } - assert(gotCalled) - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - assert_contains(zf, replacedEntry, "data/file2.txt") - } - end - - def test_addDirectory - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - zf.add(TestFiles::EMPTY_TEST_DIR, TestFiles::EMPTY_TEST_DIR) - } - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - dirEntry = zf.entries.detect { |e| e.name == TestFiles::EMPTY_TEST_DIR+"/" } - assert(dirEntry.is_directory) - } - end - - def test_remove - entryToRemove, *remainingEntries = TEST_ZIP.entry_names - - File.copy(TestZipFile::TEST_ZIP2.zip_name, TEST_ZIP.zip_name) - - zf = ZipFile.new(TEST_ZIP.zip_name) - assert(zf.entries.map { |e| e.name }.include?(entryToRemove)) - zf.remove(entryToRemove) - assert(! zf.entries.map { |e| e.name }.include?(entryToRemove)) - assert_equal(zf.entries.map {|x| x.name }.sort, remainingEntries.sort) - zf.close - - zfRead = ZipFile.new(TEST_ZIP.zip_name) - assert(! zfRead.entries.map { |e| e.name }.include?(entryToRemove)) - assert_equal(zfRead.entries.map {|x| x.name }.sort, remainingEntries.sort) - zfRead.close - end - - - def test_rename - entryToRename, *remainingEntries = TEST_ZIP.entry_names - - zf = ZipFile.new(TEST_ZIP.zip_name) - assert(zf.entries.map { |e| e.name }.include?(entryToRename)) - - newName = "changed name" - assert(! zf.entries.map { |e| e.name }.include?(newName)) - - zf.rename(entryToRename, newName) - assert(zf.entries.map { |e| e.name }.include?(newName)) - - zf.close - - zfRead = ZipFile.new(TEST_ZIP.zip_name) - assert(zfRead.entries.map { |e| e.name }.include?(newName)) - zfRead.close - end - - def test_renameToExistingEntry - oldEntries = nil - ZipFile.open(TEST_ZIP.zip_name) { |zf| oldEntries = zf.entries } - - assert_raise(ZipEntryExistsError) { - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - zf.rename(zf.entries[0], zf.entries[1].name) - } - } - - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - assert_equal(oldEntries.sort.map{ |e| e.name }, zf.entries.sort.map{ |e| e.name }) - } - end - - def test_renameToExistingEntryOverwrite - oldEntries = nil - ZipFile.open(TEST_ZIP.zip_name) { |zf| oldEntries = zf.entries } - - gotCalled = false - renamedEntryName = nil - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - renamedEntryName = zf.entries[0].name - zf.rename(zf.entries[0], zf.entries[1].name) { gotCalled = true; true } - } - - assert(gotCalled) - oldEntries.delete_if { |e| e.name == renamedEntryName } - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - assert_equal(oldEntries.sort.map{ |e| e.name }, - zf.entries.sort.map{ |e| e.name }) - } - end - - def test_renameNonEntry - nonEntry = "bogusEntry" - target_entry = "target_entryName" - zf = ZipFile.new(TEST_ZIP.zip_name) - assert(! zf.entries.include?(nonEntry)) - assert_raise(Errno::ENOENT) { - zf.rename(nonEntry, target_entry) - } - zf.commit - assert(! zf.entries.include?(target_entry)) - ensure - zf.close - end - - def test_renameEntryToExistingEntry - entry1, entry2, *remaining = TEST_ZIP.entry_names - zf = ZipFile.new(TEST_ZIP.zip_name) - assert_raise(ZipEntryExistsError) { - zf.rename(entry1, entry2) - } - ensure - zf.close - end - - def test_replace - entryToReplace = TEST_ZIP.entry_names[2] - newEntrySrcFilename = "data/file2.txt" - zf = ZipFile.new(TEST_ZIP.zip_name) - zf.replace(entryToReplace, newEntrySrcFilename) - - zf.close - zfRead = ZipFile.new(TEST_ZIP.zip_name) - AssertEntry::assert_contents(newEntrySrcFilename, - zfRead.get_input_stream(entryToReplace) { |is| is.read }) - AssertEntry::assert_contents(TEST_ZIP.entry_names[0], - zfRead.get_input_stream(TEST_ZIP.entry_names[0]) { |is| is.read }) - AssertEntry::assert_contents(TEST_ZIP.entry_names[1], - zfRead.get_input_stream(TEST_ZIP.entry_names[1]) { |is| is.read }) - AssertEntry::assert_contents(TEST_ZIP.entry_names[3], - zfRead.get_input_stream(TEST_ZIP.entry_names[3]) { |is| is.read }) - zfRead.close - end - - def test_replaceNonEntry - entryToReplace = "nonExistingEntryname" - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - assert_raise(Errno::ENOENT) { - zf.replace(entryToReplace, "data/file2.txt") - } - } - end - - def test_commit - newName = "renamedFirst" - zf = ZipFile.new(TEST_ZIP.zip_name) - oldName = zf.entries.first - zf.rename(oldName, newName) - zf.commit - - zfRead = ZipFile.new(TEST_ZIP.zip_name) - assert(zfRead.entries.detect { |e| e.name == newName } != nil) - assert(zfRead.entries.detect { |e| e.name == oldName } == nil) - zfRead.close - - zf.close - end - - # This test tests that after commit, you - # can delete the file you used to add the entry to the zip file - # with - def test_commitUseZipEntry - File.copy(TestFiles::RANDOM_ASCII_FILE1, "okToDelete.txt") - zf = ZipFile.open(TEST_ZIP.zip_name) - zf.add("okToDelete.txt", "okToDelete.txt") - assert_contains(zf, "okToDelete.txt") - zf.commit - File.move("okToDelete.txt", "okToDeleteMoved.txt") - assert_contains(zf, "okToDelete.txt", "okToDeleteMoved.txt") - end - -# def test_close -# zf = ZipFile.new(TEST_ZIP.zip_name) -# zf.close -# assert_raise(IOError) { -# zf.extract(TEST_ZIP.entry_names.first, "hullubullu") -# } -# end - - def test_compound1 - renamedName = "renamedName" - originalEntries = [] - begin - zf = ZipFile.new(TEST_ZIP.zip_name) - originalEntries = zf.entries.dup - - assert_not_contains(zf, TestFiles::RANDOM_ASCII_FILE1) - zf.add(TestFiles::RANDOM_ASCII_FILE1, - TestFiles::RANDOM_ASCII_FILE1) - assert_contains(zf, TestFiles::RANDOM_ASCII_FILE1) - - zf.rename(zf.entries[0], renamedName) - assert_contains(zf, renamedName) - - TestFiles::BINARY_TEST_FILES.each { - |filename| - zf.add(filename, filename) - assert_contains(zf, filename) - } - - assert_contains(zf, originalEntries.last.to_s) - zf.remove(originalEntries.last.to_s) - assert_not_contains(zf, originalEntries.last.to_s) - - ensure - zf.close - end - begin - zfRead = ZipFile.new(TEST_ZIP.zip_name) - assert_contains(zfRead, TestFiles::RANDOM_ASCII_FILE1) - assert_contains(zfRead, renamedName) - TestFiles::BINARY_TEST_FILES.each { - |filename| - assert_contains(zfRead, filename) - } - assert_not_contains(zfRead, originalEntries.last.to_s) - ensure - zfRead.close - end - end - - def test_compound2 - begin - zf = ZipFile.new(TEST_ZIP.zip_name) - originalEntries = zf.entries.dup - - originalEntries.each { - |entry| - zf.remove(entry) - assert_not_contains(zf, entry) - } - assert(zf.entries.empty?) - - TestFiles::ASCII_TEST_FILES.each { - |filename| - zf.add(filename, filename) - assert_contains(zf, filename) - } - assert_equal(zf.entries.sort.map { |e| e.name }, TestFiles::ASCII_TEST_FILES) - - zf.rename(TestFiles::ASCII_TEST_FILES[0], "newName") - assert_not_contains(zf, TestFiles::ASCII_TEST_FILES[0]) - assert_contains(zf, "newName") - ensure - zf.close - end - begin - zfRead = ZipFile.new(TEST_ZIP.zip_name) - asciiTestFiles = TestFiles::ASCII_TEST_FILES.dup - asciiTestFiles.shift - asciiTestFiles.each { - |filename| - assert_contains(zf, filename) - } - - assert_contains(zf, "newName") - ensure - zfRead.close - end - end - - private - def assert_contains(zf, entryName, filename = entryName) - assert(zf.entries.detect { |e| e.name == entryName} != nil, "entry #{entryName} not in #{zf.entries.join(', ')} in zip file #{zf}") - assert_entryContents(zf, entryName, filename) if File.exists?(filename) - end - - def assert_not_contains(zf, entryName) - assert(zf.entries.detect { |e| e.name == entryName} == nil, "entry #{entryName} in #{zf.entries.join(', ')} in zip file #{zf}") - end -end - -class ZipFileExtractTest < Test::Unit::TestCase - include CommonZipFileFixture - EXTRACTED_FILENAME = "extEntry" - ENTRY_TO_EXTRACT, *REMAINING_ENTRIES = TEST_ZIP.entry_names.reverse - - def setup - super - File.delete(EXTRACTED_FILENAME) if File.exists?(EXTRACTED_FILENAME) - end - - def test_extract - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - zf.extract(ENTRY_TO_EXTRACT, EXTRACTED_FILENAME) - - assert(File.exists?(EXTRACTED_FILENAME)) - AssertEntry::assert_contents(EXTRACTED_FILENAME, - zf.get_input_stream(ENTRY_TO_EXTRACT) { |is| is.read }) - } - end - - def test_extractExists - writtenText = "written text" - File.open(EXTRACTED_FILENAME, "w") { |f| f.write(writtenText) } - - assert_raise(ZipDestinationFileExistsError) { - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - zf.extract(zf.entries.first, EXTRACTED_FILENAME) - } - } - File.open(EXTRACTED_FILENAME, "r") { - |f| - assert_equal(writtenText, f.read) - } - end - - def test_extractExistsOverwrite - writtenText = "written text" - File.open(EXTRACTED_FILENAME, "w") { |f| f.write(writtenText) } - - gotCalledCorrectly = false - ZipFile.open(TEST_ZIP.zip_name) { - |zf| - zf.extract(zf.entries.first, EXTRACTED_FILENAME) { - |entry, extractLoc| - gotCalledCorrectly = zf.entries.first == entry && - extractLoc == EXTRACTED_FILENAME - true - } - } - - assert(gotCalledCorrectly) - File.open(EXTRACTED_FILENAME, "r") { - |f| - assert(writtenText != f.read) - } - end - - def test_extractNonEntry - zf = ZipFile.new(TEST_ZIP.zip_name) - assert_raise(Errno::ENOENT) { zf.extract("nonExistingEntry", "nonExistingEntry") } - ensure - zf.close if zf - end - - def test_extractNonEntry2 - outFile = "outfile" - assert_raise(Errno::ENOENT) { - zf = ZipFile.new(TEST_ZIP.zip_name) - nonEntry = "hotdog-diddelidoo" - assert(! zf.entries.include?(nonEntry)) - zf.extract(nonEntry, outFile) - zf.close - } - assert(! File.exists?(outFile)) - end - -end - -class ZipFileExtractDirectoryTest < Test::Unit::TestCase - include CommonZipFileFixture - TEST_OUT_NAME = "emptyOutDir" - - def open_zip(&aProc) - assert(aProc != nil) - ZipFile.open(TestZipFile::TEST_ZIP4.zip_name, &aProc) - end - - def extract_test_dir(&aProc) - open_zip { - |zf| - zf.extract(TestFiles::EMPTY_TEST_DIR, TEST_OUT_NAME, &aProc) - } - end - - def setup - super - - Dir.rmdir(TEST_OUT_NAME) if File.directory? TEST_OUT_NAME - File.delete(TEST_OUT_NAME) if File.exists? TEST_OUT_NAME - end - - def test_extractDirectory - extract_test_dir - assert(File.directory?(TEST_OUT_NAME)) - end - - def test_extractDirectoryExistsAsDir - Dir.mkdir TEST_OUT_NAME - extract_test_dir - assert(File.directory?(TEST_OUT_NAME)) - end - - def test_extractDirectoryExistsAsFile - File.open(TEST_OUT_NAME, "w") { |f| f.puts "something" } - assert_raise(ZipDestinationFileExistsError) { extract_test_dir } - end - - def test_extractDirectoryExistsAsFileOverwrite - File.open(TEST_OUT_NAME, "w") { |f| f.puts "something" } - gotCalled = false - extract_test_dir { - |entry, destPath| - gotCalled = true - assert_equal(TEST_OUT_NAME, destPath) - assert(entry.is_directory) - true - } - assert(gotCalled) - assert(File.directory?(TEST_OUT_NAME)) - end -end - -class ZipStreamableFileTest < Test::Unit::TestCase - def test_equality - zipEntry1 = ZipEntry.new("zf.zip", "entryname1", "comment") - zipEntry2 = ZipEntry.new("zf.zip", "entryname2", "comment") - - zipStreamableFile1 = ZipStreamableFile.new(zipEntry1, "path") - zipStreamableFile2 = ZipStreamableFile.new(zipEntry1, "path") - zipStreamableFile3 = ZipStreamableFile.new(zipEntry1, "anotherPath") - zipStreamableFile4 = ZipStreamableFile.new(zipEntry2, "path") - - assert_equal(zipStreamableFile1, zipStreamableFile1) - assert_equal(zipStreamableFile1, zipStreamableFile2) - assert(zipStreamableFile1 != zipStreamableFile3) - assert(zipStreamableFile1 != zipStreamableFile4) - assert(zipStreamableFile1 != zipEntry1) - assert(zipStreamableFile1 != "hej") - end -end - -class ZipExtraFieldTest < Test::Unit::TestCase - def test_new - extra_pure = ZipExtraField.new("") - extra_withstr = ZipExtraField.new("foo") - assert_instance_of(ZipExtraField, extra_pure) - assert_instance_of(ZipExtraField, extra_withstr) - end - - def test_unknownfield - extra = ZipExtraField.new("foo") - assert_equal(extra["Unknown"], "foo") - extra.merge("a") - assert_equal(extra["Unknown"], "fooa") - extra.merge("barbaz") - assert_equal(extra.to_s, "fooabarbaz") - end - - - def test_merge - str = "UT\x5\0\x3\250$\r@Ux\0\0" - extra1 = ZipExtraField.new("") - extra2 = ZipExtraField.new(str) - assert(! extra1.member?("UniversalTime")) - assert(extra2.member?("UniversalTime")) - extra1.merge(str) - assert_equal(extra1["UniversalTime"].mtime, extra2["UniversalTime"].mtime) - end - - def test_length - str = "UT\x5\0\x3\250$\r@Ux\0\0Te\0\0testit" - extra = ZipExtraField.new(str) - assert_equal(extra.local_length, extra.to_local_bin.length) - assert_equal(extra.c_dir_length, extra.to_c_dir_bin.length) - extra.merge("foo") - assert_equal(extra.local_length, extra.to_local_bin.length) - assert_equal(extra.c_dir_length, extra.to_c_dir_bin.length) - end - - - def test_to_s - str = "UT\x5\0\x3\250$\r@Ux\0\0Te\0\0testit" - extra = ZipExtraField.new(str) - assert_instance_of(String, extra.to_s) - - s = extra.to_s - extra.merge("foo") - assert_equal(s.length + 3, extra.to_s.length) - end - - def test_equality - str = "UT\x5\0\x3\250$\r@" - extra1 = ZipExtraField.new(str) - extra2 = ZipExtraField.new(str) - extra3 = ZipExtraField.new(str) - assert_equal(extra1, extra2) - - extra2["UniversalTime"].mtime = Time.now - assert(extra1 != extra2) - - extra3.create("IUnix") - assert(extra1 != extra3) - - extra1.create("IUnix") - assert_equal(extra1, extra3) - end - -end - -# Copyright (C) 2002, 2003 Thomas Sondergaard -# rubyzip is free software; you can redistribute it and/or -# modify it under the terms of the ruby license.