diff options
Diffstat (limited to 'lib/rake')
| -rw-r--r-- | lib/rake/classic_namespace.rb | 8 | ||||
| -rw-r--r-- | lib/rake/clean.rb | 31 | ||||
| -rw-r--r-- | lib/rake/contrib/compositepublisher.rb | 20 | ||||
| -rw-r--r-- | lib/rake/contrib/ftptools.rb | 150 | ||||
| -rw-r--r-- | lib/rake/contrib/publisher.rb | 73 | ||||
| -rw-r--r-- | lib/rake/contrib/rubyforgepublisher.rb | 16 | ||||
| -rw-r--r-- | lib/rake/contrib/sshpublisher.rb | 45 | ||||
| -rw-r--r-- | lib/rake/gempackagetask.rb | 95 | ||||
| -rw-r--r-- | lib/rake/loaders/makefile.rb | 38 | ||||
| -rw-r--r-- | lib/rake/packagetask.rb | 182 | ||||
| -rw-r--r-- | lib/rake/rake_test_loader.rb | 5 | ||||
| -rw-r--r-- | lib/rake/rdoctask.rb | 4 | ||||
| -rw-r--r-- | lib/rake/runtest.rb | 21 | ||||
| -rw-r--r-- | lib/rake/tasklib.rb | 21 | ||||
| -rw-r--r-- | lib/rake/testtask.rb | 150 | ||||
| -rw-r--r-- | lib/rake/win32.rb | 46 |
16 files changed, 0 insertions, 905 deletions
diff --git a/lib/rake/classic_namespace.rb b/lib/rake/classic_namespace.rb deleted file mode 100644 index feb7569966..0000000000 --- a/lib/rake/classic_namespace.rb +++ /dev/null @@ -1,8 +0,0 @@ -# The following classes used to be in the top level namespace. -# Loading this file enables compatibility with older Rakefile that -# referenced Task from the top level. - -Task = Rake::Task -FileTask = Rake::FileTask -FileCreationTask = Rake::FileCreationTask -RakeApp = Rake::Application diff --git a/lib/rake/clean.rb b/lib/rake/clean.rb deleted file mode 100644 index 62f27d5751..0000000000 --- a/lib/rake/clean.rb +++ /dev/null @@ -1,31 +0,0 @@ -# The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and -# two rake tasks (:clean and :clobber). -# -# [:clean] Clean up the project by deleting scratch files and backup -# files. Add files to the CLEAN file list to have the :clean -# target handle them. -# -# [:clobber] Clobber all generated and non-source files in a project. -# The task depends on :clean, so all the clean files will -# be deleted as well as files in the CLOBBER file list. -# The intent of this task is to return a project to its -# pristine, just unpacked state. - -require 'rake' - -CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"] -CLEAN.clear_exclude.exclude { |fn| - fn.pathmap("%f") == 'core' && File.directory?(fn) -} - -desc "Remove any temporary products." -task :clean do - CLEAN.each { |fn| rm_r fn rescue nil } -end - -CLOBBER = Rake::FileList.new - -desc "Remove any generated file." -task :clobber => [:clean] do - CLOBBER.each { |fn| rm_r fn rescue nil } -end diff --git a/lib/rake/contrib/compositepublisher.rb b/lib/rake/contrib/compositepublisher.rb deleted file mode 100644 index 31ef080dd7..0000000000 --- a/lib/rake/contrib/compositepublisher.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Rake - - # Manage several publishers as a single entity. - class CompositePublisher - def initialize - @publishers = [] - end - - # Add a publisher to the composite. - def add(pub) - @publishers << pub - end - - # Upload all the individual publishers. - def upload - @publishers.each { |p| p.upload } - end - end - -end diff --git a/lib/rake/contrib/ftptools.rb b/lib/rake/contrib/ftptools.rb deleted file mode 100644 index 12e4ff25de..0000000000 --- a/lib/rake/contrib/ftptools.rb +++ /dev/null @@ -1,150 +0,0 @@ -# = Tools for FTP uploading. -# -# This file is still under development and is not released for general -# use. - -require 'date' -require 'net/ftp' - -module Rake # :nodoc: - - #################################################################### - # <b>Note:</b> <em> Not released for general use.</em> - class FtpFile - attr_reader :name, :size, :owner, :group, :time - - def self.date - @date_class ||= Date - end - - def self.time - @time_class ||= Time - end - - def initialize(path, entry) - @path = path - @mode, _, @owner, @group, size, d1, d2, d3, @name = entry.split(' ') - @size = size.to_i - @time = determine_time(d1, d2, d3) - end - - def path - File.join(@path, @name) - end - - def directory? - @mode[0] == ?d - end - - def mode - parse_mode(@mode) - end - - def symlink? - @mode[0] == ?l - end - - private # -------------------------------------------------------- - - def parse_mode(m) - result = 0 - (1..9).each do |i| - result = 2*result + ((m[i]==?-) ? 0 : 1) - end - result - end - - def determine_time(d1, d2, d3) - now = self.class.time.now - if /:/ =~ d3 - result = Time.parse("#{d1} #{d2} #{now.year} #{d3}") - if result > now - result = Time.parse("#{d1} #{d2} #{now.year-1} #{d3}") - end - else - result = Time.parse("#{d1} #{d2} #{d3}") - end - result -# elements = ParseDate.parsedate("#{d1} #{d2} #{d3}") -# if elements[0].nil? -# today = self.class.date.today -# if elements[1] > today.month -# elements[0] = today.year - 1 -# else -# elements[0] = today.year -# end -# end -# elements = elements.collect { |el| el.nil? ? 0 : el } -# Time.mktime(*elements[0,7]) - end - end - - #################################################################### - # Manage the uploading of files to an FTP account. - class FtpUploader - - # Log uploads to standard output when true. - attr_accessor :verbose - - class << FtpUploader - # Create an uploader and pass it to the given block as +up+. - # When the block is complete, close the uploader. - def connect(path, host, account, password) - up = self.new(path, host, account, password) - begin - yield(up) - ensure - up.close - end - end - end - - # Create an FTP uploader targetting the directory +path+ on +host+ - # using the given account and password. +path+ will be the root - # path of the uploader. - def initialize(path, host, account, password) - @created = Hash.new - @path = path - @ftp = Net::FTP.new(host, account, password) - makedirs(@path) - @ftp.chdir(@path) - end - - # Create the directory +path+ in the uploader root path. - def makedirs(path) - route = [] - File.split(path).each do |dir| - route << dir - current_dir = File.join(route) - if @created[current_dir].nil? - @created[current_dir] = true - puts "Creating Directory #{current_dir}" if @verbose - @ftp.mkdir(current_dir) rescue nil - end - end - end - - # Upload all files matching +wildcard+ to the uploader's root - # path. - def upload_files(wildcard) - Dir[wildcard].each do |fn| - upload(fn) - end - end - - # Close the uploader. - def close - @ftp.close - end - - private # -------------------------------------------------------- - - # Upload a single file to the uploader's root path. - def upload(file) - puts "Uploading #{file}" if @verbose - dir = File.dirname(file) - makedirs(dir) - @ftp.putbinaryfile(file, file) unless File.directory?(file) - end - end -end diff --git a/lib/rake/contrib/publisher.rb b/lib/rake/contrib/publisher.rb deleted file mode 100644 index 7f69d3a654..0000000000 --- a/lib/rake/contrib/publisher.rb +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2003, 2004, 2005, 2006, 2007, 2008 by Jim Weirich (jim@weirichhouse.org) -# All rights reserved. - -# Permission is granted for use, copying, modification, distribution, -# and distribution of modified versions of this work as long as the -# above copyright notice is included. - -# Configuration information about an upload host system. -# * name :: Name of host system. -# * webdir :: Base directory for the web information for the -# application. The application name (APP) is appended to -# this directory before using. -# * pkgdir :: Directory on the host system where packages can be -# placed. -HostInfo = Struct.new(:name, :webdir, :pkgdir) - -# Manage several publishers as a single entity. -class CompositePublisher - def initialize - @publishers = [] - end - - # Add a publisher to the composite. - def add(pub) - @publishers << pub - end - - # Upload all the individual publishers. - def upload - @publishers.each { |p| p.upload } - end -end - -# Publish an entire directory to an existing remote directory using -# SSH. -class SshDirPublisher - def initialize(host, remote_dir, local_dir) - @host = host - @remote_dir = remote_dir - @local_dir = local_dir - end - - def upload - run %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}} - end -end - -# Publish an entire directory to a fresh remote directory using SSH. -class SshFreshDirPublisher < SshDirPublisher - def upload - run %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil - run %{ssh #{@host} mkdir #{@remote_dir}} - super - end -end - -# Publish a list of files to an existing remote directory. -class SshFilePublisher - # Create a publisher using the give host information. - def initialize(host, remote_dir, local_dir, *files) - @host = host - @remote_dir = remote_dir - @local_dir = local_dir - @files = files - end - - # Upload the local directory to the remote directory. - def upload - @files.each do |fn| - run %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}} - end - end -end diff --git a/lib/rake/contrib/rubyforgepublisher.rb b/lib/rake/contrib/rubyforgepublisher.rb deleted file mode 100644 index a4b96936c8..0000000000 --- a/lib/rake/contrib/rubyforgepublisher.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'rake/contrib/sshpublisher' - -module Rake - - class RubyForgePublisher < SshDirPublisher - attr_reader :project, :proj_id, :user - - def initialize(projname, user) - super( - "#{user}@rubyforge.org", - "/var/www/gforge-projects/#{projname}", - "html") - end - end - -end diff --git a/lib/rake/contrib/sshpublisher.rb b/lib/rake/contrib/sshpublisher.rb deleted file mode 100644 index e679716c7b..0000000000 --- a/lib/rake/contrib/sshpublisher.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'rake/contrib/compositepublisher' - -module Rake - - # Publish an entire directory to an existing remote directory using - # SSH. - class SshDirPublisher - def initialize(host, remote_dir, local_dir) - @host = host - @remote_dir = remote_dir - @local_dir = local_dir - end - - def upload - sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}} - end - end - - # Publish an entire directory to a fresh remote directory using SSH. - class SshFreshDirPublisher < SshDirPublisher - def upload - sh %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil - sh %{ssh #{@host} mkdir #{@remote_dir}} - super - end - end - - # Publish a list of files to an existing remote directory. - class SshFilePublisher - # Create a publisher using the give host information. - def initialize(host, remote_dir, local_dir, *files) - @host = host - @remote_dir = remote_dir - @local_dir = local_dir - @files = files - end - - # Upload the local directory to the remote directory. - def upload - @files.each do |fn| - sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}} - end - end - end -end diff --git a/lib/rake/gempackagetask.rb b/lib/rake/gempackagetask.rb deleted file mode 100644 index 3a99ff2b87..0000000000 --- a/lib/rake/gempackagetask.rb +++ /dev/null @@ -1,95 +0,0 @@ -# Define a package task library to aid in the definition of GEM -# packages. - -require 'rubygems' -require 'rake' -require 'rake/packagetask' -require 'rubygems/user_interaction' -require 'rubygems/builder' - -module Rake - - # Create a package based upon a Gem spec. Gem packages, as well as - # zip files and tar/gzipped packages can be produced by this task. - # - # In addition to the Rake targets generated by PackageTask, a - # GemPackageTask will also generate the following tasks: - # - # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.gem"</b>] - # Create a Ruby GEM package with the given name and version. - # - # Example using a Ruby GEM spec: - # - # require 'rubygems' - # - # spec = Gem::Specification.new do |s| - # s.platform = Gem::Platform::RUBY - # s.summary = "Ruby based make-like utility." - # s.name = 'rake' - # s.version = PKG_VERSION - # s.requirements << 'none' - # s.require_path = 'lib' - # s.autorequire = 'rake' - # s.files = PKG_FILES - # s.description = <<EOF - # Rake is a Make-like program implemented in Ruby. Tasks - # and dependencies are specified in standard Ruby syntax. - # EOF - # end - # - # Rake::GemPackageTask.new(spec) do |pkg| - # pkg.need_zip = true - # pkg.need_tar = true - # end - # - class GemPackageTask < PackageTask - # Ruby GEM spec containing the metadata for this package. The - # name, version and package_files are automatically determined - # from the GEM spec and don't need to be explicitly provided. - attr_accessor :gem_spec - - # Create a GEM Package task library. Automatically define the gem - # if a block is given. If no block is supplied, then +define+ - # needs to be called to define the task. - def initialize(gem_spec) - init(gem_spec) - yield self if block_given? - define if block_given? - end - - # Initialization tasks without the "yield self" or define - # operations. - def init(gem) - super(gem.name, gem.version) - @gem_spec = gem - @package_files += gem_spec.files if gem_spec.files - end - - # Create the Rake tasks and actions specified by this - # GemPackageTask. (+define+ is automatically called if a block is - # given to +new+). - def define - super - task :package => [:gem] - desc "Build the gem file #{gem_file}" - task :gem => ["#{package_dir}/#{gem_file}"] - file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do - when_writing("Creating GEM") { - Gem::Builder.new(gem_spec).build - verbose(true) { - mv gem_file, "#{package_dir}/#{gem_file}" - } - } - end - end - - def gem_file - if @gem_spec.platform == Gem::Platform::RUBY - "#{package_name}.gem" - else - "#{package_name}-#{@gem_spec.platform}.gem" - end - end - - end -end diff --git a/lib/rake/loaders/makefile.rb b/lib/rake/loaders/makefile.rb deleted file mode 100644 index 9a2ac8090e..0000000000 --- a/lib/rake/loaders/makefile.rb +++ /dev/null @@ -1,38 +0,0 @@ -module Rake - - # Makefile loader to be used with the import file loader. - class MakefileLoader - SPACE_MARK = "\0" - - # Load the makefile dependencies in +fn+. - def load(fn) - lines = open(fn) {|mf| mf.read} - lines.gsub!(/\\ /, SPACE_MARK) - lines.gsub!(/#[^\n]*\n/m, "") - lines.gsub!(/\\\n/, ' ') - lines.each_line do |line| - process_line(line) - end - end - - private - - # Process one logical line of makefile data. - def process_line(line) - file_tasks, args = line.split(':', 2) - return if args.nil? - dependents = args.split.map {|arg| respace(arg)} - file_tasks.scan(/\S+/) do |file_task| - file_task = respace(file_task) - file file_task => dependents - end - end - - def respace(str) - str.tr(SPACE_MARK, ' ') - end - end - - # Install the handler - Rake.application.add_loader('mf', MakefileLoader.new) -end diff --git a/lib/rake/packagetask.rb b/lib/rake/packagetask.rb deleted file mode 100644 index e77345c198..0000000000 --- a/lib/rake/packagetask.rb +++ /dev/null @@ -1,182 +0,0 @@ -# Define a package task library to aid in the definition of -# redistributable package files. - -require 'rake' -require 'rake/tasklib' - -module Rake - - # Create a packaging task that will package the project into - # distributable files (e.g zip archive or tar files). - # - # The PackageTask will create the following targets: - # - # [<b>:package</b>] - # Create all the requested package files. - # - # [<b>:clobber_package</b>] - # Delete all the package files. This target is automatically - # added to the main clobber target. - # - # [<b>:repackage</b>] - # Rebuild the package files from scratch, even if they are not out - # of date. - # - # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tgz"</b>] - # Create a gzipped tar package (if <em>need_tar</em> is true). - # - # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.gz"</b>] - # Create a gzipped tar package (if <em>need_tar_gz</em> is true). - # - # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.bz2"</b>] - # Create a bzip2'd tar package (if <em>need_tar_bz2</em> is true). - # - # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.zip"</b>] - # Create a zip package archive (if <em>need_zip</em> is true). - # - # Example: - # - # Rake::PackageTask.new("rake", "1.2.3") do |p| - # p.need_tar = true - # p.package_files.include("lib/**/*.rb") - # end - # - class PackageTask < TaskLib - # Name of the package (from the GEM Spec). - attr_accessor :name - - # Version of the package (e.g. '1.3.2'). - attr_accessor :version - - # Directory used to store the package files (default is 'pkg'). - attr_accessor :package_dir - - # True if a gzipped tar file (tgz) should be produced (default is false). - attr_accessor :need_tar - - # True if a gzipped tar file (tar.gz) should be produced (default is false). - attr_accessor :need_tar_gz - - # True if a bzip2'd tar file (tar.bz2) should be produced (default is false). - attr_accessor :need_tar_bz2 - - # True if a zip file should be produced (default is false) - attr_accessor :need_zip - - # List of files to be included in the package. - attr_accessor :package_files - - # Tar command for gzipped or bzip2ed archives. The default is 'tar'. - attr_accessor :tar_command - - # Zip command for zipped archives. The default is 'zip'. - attr_accessor :zip_command - - # Create a Package Task with the given name and version. - def initialize(name=nil, version=nil) - init(name, version) - yield self if block_given? - define unless name.nil? - end - - # Initialization that bypasses the "yield self" and "define" step. - def init(name, version) - @name = name - @version = version - @package_files = Rake::FileList.new - @package_dir = 'pkg' - @need_tar = false - @need_tar_gz = false - @need_tar_bz2 = false - @need_zip = false - @tar_command = 'tar' - @zip_command = 'zip' - end - - # Create the tasks defined by this task library. - def define - fail "Version required (or :noversion)" if @version.nil? - @version = nil if :noversion == @version - - desc "Build all the packages" - task :package - - desc "Force a rebuild of the package files" - task :repackage => [:clobber_package, :package] - - desc "Remove package products" - task :clobber_package do - rm_r package_dir rescue nil - end - - task :clobber => [:clobber_package] - - [ - [need_tar, tgz_file, "z"], - [need_tar_gz, tar_gz_file, "z"], - [need_tar_bz2, tar_bz2_file, "j"] - ].each do |(need, file, flag)| - if need - task :package => ["#{package_dir}/#{file}"] - file "#{package_dir}/#{file}" => [package_dir_path] + package_files do - chdir(package_dir) do - sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}} - end - end - end - end - - if need_zip - task :package => ["#{package_dir}/#{zip_file}"] - file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do - chdir(package_dir) do - sh %{#{@zip_command} -r #{zip_file} #{package_name}} - end - end - end - - directory package_dir - - file package_dir_path => @package_files do - mkdir_p package_dir rescue nil - @package_files.each do |fn| - f = File.join(package_dir_path, fn) - fdir = File.dirname(f) - mkdir_p(fdir) if !File.exist?(fdir) - if File.directory?(fn) - mkdir_p(f) - else - rm_f f - safe_ln(fn, f) - end - end - end - self - end - - def package_name - @version ? "#{@name}-#{@version}" : @name - end - - def package_dir_path - "#{package_dir}/#{package_name}" - end - - def tgz_file - "#{package_name}.tgz" - end - - def tar_gz_file - "#{package_name}.tar.gz" - end - - def tar_bz2_file - "#{package_name}.tar.bz2" - end - - def zip_file - "#{package_name}.zip" - end - end - -end diff --git a/lib/rake/rake_test_loader.rb b/lib/rake/rake_test_loader.rb deleted file mode 100644 index 8d7dad3c94..0000000000 --- a/lib/rake/rake_test_loader.rb +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env ruby - -# Load the test files from the command line. - -ARGV.each { |f| load f unless f =~ /^-/ } diff --git a/lib/rake/rdoctask.rb b/lib/rake/rdoctask.rb deleted file mode 100644 index 59758b85cd..0000000000 --- a/lib/rake/rdoctask.rb +++ /dev/null @@ -1,4 +0,0 @@ -warn 'rake/rdoctask is deprecated. Use rdoc/task instead' - -require 'rdoc/task' - diff --git a/lib/rake/runtest.rb b/lib/rake/runtest.rb deleted file mode 100644 index f6928d57b8..0000000000 --- a/lib/rake/runtest.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'test/unit' -require 'test/unit/assertions' - -module Rake - include Test::Unit::Assertions - - def run_tests(pattern='test/test*.rb', log_enabled=false) - Dir["#{pattern}"].each { |fn| - puts fn if log_enabled - begin - load fn - rescue Exception => ex - puts "Error in #{fn}: #{ex.message}" - puts ex.backtrace - assert false - end - } - end - - extend self -end diff --git a/lib/rake/tasklib.rb b/lib/rake/tasklib.rb deleted file mode 100644 index a5a4494369..0000000000 --- a/lib/rake/tasklib.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'rake' - -module Rake - - # Base class for Task Libraries. - class TaskLib - include Cloneable - - # Make a symbol by pasting two strings together. - # - # NOTE: DEPRECATED! This method is kinda stupid. I don't know why - # I didn't just use string interpolation. But now other task - # libraries depend on this so I can't remove it without breaking - # other people's code. So for now it stays for backwards - # compatibility. BUT DON'T USE IT. - def paste(a,b) # :nodoc: - (a.to_s + b.to_s).intern - end - end - -end diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb deleted file mode 100644 index c400205ff3..0000000000 --- a/lib/rake/testtask.rb +++ /dev/null @@ -1,150 +0,0 @@ -# Define a task library for running unit tests. - -require 'rake' -require 'rake/tasklib' - -module Rake - - # Create a task that runs a set of tests. - # - # Example: - # - # Rake::TestTask.new do |t| - # t.libs << "test" - # t.test_files = FileList['test/test*.rb'] - # t.verbose = true - # end - # - # If rake is invoked with a "TEST=filename" command line option, - # then the list of test files will be overridden to include only the - # filename specified on the command line. This provides an easy way - # to run just one test. - # - # If rake is invoked with a "TESTOPTS=options" command line option, - # then the given options are passed to the test process after a - # '--'. This allows Test::Unit options to be passed to the test - # suite. - # - # Examples: - # - # rake test # run tests normally - # rake test TEST=just_one_file.rb # run just one test file. - # rake test TESTOPTS="-v" # run in verbose mode - # rake test TESTOPTS="--runner=fox" # use the fox test runner - # - class TestTask < TaskLib - - # Name of test task. (default is :test) - attr_accessor :name - - # List of directories to added to $LOAD_PATH before running the - # tests. (default is 'lib') - attr_accessor :libs - - # True if verbose test output desired. (default is false) - attr_accessor :verbose - - # Test options passed to the test suite. An explicit - # TESTOPTS=opts on the command line will override this. (default - # is NONE) - attr_accessor :options - - # Request that the tests be run with the warning flag set. - # E.g. warning=true implies "ruby -w" used to run the tests. - attr_accessor :warning - - # Glob pattern to match test files. (default is 'test/test*.rb') - attr_accessor :pattern - - # Style of test loader to use. Options are: - # - # * :rake -- Rake provided test loading script (default). - # * :testrb -- Ruby provided test loading script. - # * :direct -- Load tests using command line loader. - # - attr_accessor :loader - - # Array of commandline options to pass to ruby when running test loader. - attr_accessor :ruby_opts - - # Explicitly define the list of test files to be included in a - # test. +list+ is expected to be an array of file names (a - # FileList is acceptable). If both +pattern+ and +test_files+ are - # used, then the list of test files is the union of the two. - def test_files=(list) - @test_files = list - end - - # Create a testing task. - def initialize(name=:test) - @name = name - @libs = ["lib"] - @pattern = nil - @options = nil - @test_files = nil - @verbose = false - @warning = false - @loader = :rake - @ruby_opts = [] - yield self if block_given? - @pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil? - define - end - - # Create the tasks defined by this task lib. - def define - lib_path = @libs.join(File::PATH_SEPARATOR) - desc "Run tests" + (@name==:test ? "" : " for #{@name}") - task @name do - run_code = '' - RakeFileUtils.verbose(@verbose) do - run_code = - case @loader - when :direct - "-e 'ARGV.each{|f| load f}'" - when :testrb - "-S testrb" - when :rake - rake_loader - end - @ruby_opts.unshift( "-I\"#{lib_path}\"" ) - @ruby_opts.unshift( "-w" ) if @warning - ruby @ruby_opts.join(" ") + - " \"#{run_code}\" " + - file_list.collect { |fn| "\"#{fn}\"" }.join(' ') + - " #{option_list}" - end - end - self - end - - def option_list # :nodoc: - ENV['TESTOPTS'] || @options || "" - end - - def file_list # :nodoc: - if ENV['TEST'] - FileList[ ENV['TEST'] ] - else - result = [] - result += @test_files.to_a if @test_files - result += FileList[ @pattern ].to_a if @pattern - FileList[result] - end - end - - def rake_loader # :nodoc: - find_file('rake/rake_test_loader') or - fail "unable to find rake test loader" - end - - def find_file(fn) # :nodoc: - $LOAD_PATH.each do |path| - file_path = File.join(path, "#{fn}.rb") - return file_path if File.exist? file_path - end - nil - end - - end -end diff --git a/lib/rake/win32.rb b/lib/rake/win32.rb deleted file mode 100644 index 0ab31c2822..0000000000 --- a/lib/rake/win32.rb +++ /dev/null @@ -1,46 +0,0 @@ -module Rake - - # Win 32 interface methods for Rake. Windows specific functionality - # will be placed here to collect that knowledge in one spot. - module Win32 - class << self - # True if running on a windows system. - if File::ALT_SEPARATOR == '\\' # assume other DOSish systems are extinct. - def windows?; true end - else - def windows?; false end - end - end - - class << self - # The standard directory containing system wide rake files on - # Win 32 systems. Try the following environment variables (in - # order): - # - # * APPDATA - # * HOME - # * HOMEDRIVE + HOMEPATH - # * USERPROFILE - # - # If the above are not defined, retruns the personal folder. - def win32_system_dir #:nodoc: - win32_shared_path = ENV['APPDATA'] - if !win32_shared_path or win32_shared_path.empty? - win32_shared_path = '~' - end - File.expand_path('Rake', win32_shared_path) - end - - # Normalize a win32 path so that the slashes are all forward slashes. - def normalize(path) - path.tr('\\', '/') - end - end if windows? - end - - if Win32.windows? - def standard_system_dir - Win32.win32_system_dir - end - end -end |
