[DRE-commits] [rake] 01/06: Imported Upstream version 10.4.2
zeha at debian.org
zeha at debian.org
Fri Jul 31 06:46:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
zeha pushed a commit to branch master
in repository rake.
commit 2193f7a18ad96bbce4ac0a7d19d75610a0dd73f8
Author: Christian Hofstaedtler <zeha at debian.org>
Date: Fri Jul 31 08:29:02 2015 +0200
Imported Upstream version 10.4.2
---
CONTRIBUTING.rdoc | 6 +-
History.rdoc | 42 ++++++++++
Manifest.txt | 6 +-
README.rdoc | 7 +-
Rakefile | 4 +-
checksums.yaml.gz | Bin 269 -> 0 bytes
checksums.yaml.gz.sig | 2 -
data.tar.gz.sig | Bin 256 -> 0 bytes
doc/rake.1 | 141 ++++++++++++++++++++++++++++++++
doc/rake.1.gz | Bin 1369 -> 0 bytes
lib/rake.rb | 3 +-
lib/rake/application.rb | 19 +++--
lib/rake/backtrace.rb | 2 +-
lib/rake/cloneable.rb | 2 +-
lib/rake/contrib/.document | 1 +
lib/rake/contrib/sshpublisher.rb | 8 +-
lib/rake/cpu_counter.rb | 30 +++++--
lib/rake/dsl_definition.rb | 5 +-
lib/rake/ext/module.rb | 1 +
lib/rake/ext/pathname.rb | 25 ++++++
lib/rake/ext/string.rb | 2 +-
lib/rake/ext/time.rb | 5 +-
lib/rake/file_list.rb | 22 ++++-
lib/rake/file_task.rb | 4 +-
lib/rake/file_utils.rb | 20 ++++-
lib/rake/invocation_chain.rb | 2 +-
lib/rake/late_time.rb | 17 ++++
lib/rake/packagetask.rb | 9 +-
lib/rake/task_manager.rb | 4 +-
metadata.gz.sig | Bin 256 -> 0 bytes
metadata.yml | 49 ++++-------
test/helper.rb | 7 +-
test/support/rakefile_definitions.rb | 2 +-
test/support/ruby_runner.rb | 11 +--
test/test_rake_application.rb | 8 +-
test/test_rake_application_options.rb | 4 +-
test/test_rake_backtrace.rb | 2 +-
test/test_rake_clean.rb | 8 +-
test/test_rake_cpu_counter.rb | 74 ++++++++++-------
test/test_rake_definitions.rb | 5 ++
test/test_rake_directory_task.rb | 13 +++
test/test_rake_file_list.rb | 28 +++++++
test/test_rake_file_task.rb | 27 ++++--
test/test_rake_late_time.rb | 18 ++++
test/test_rake_multi_task.rb | 6 ++
test/test_rake_pathname_extensions.rb | 15 ++++
test/test_rake_task.rb | 3 +-
test/test_rake_task_argument_parsing.rb | 10 +++
test/test_rake_task_with_arguments.rb | 1 +
test/test_rake_test_task.rb | 19 +++--
test/test_rake_thread_pool.rb | 5 +-
51 files changed, 559 insertions(+), 145 deletions(-)
diff --git a/CONTRIBUTING.rdoc b/CONTRIBUTING.rdoc
index 0a962e0..243cfe8 100644
--- a/CONTRIBUTING.rdoc
+++ b/CONTRIBUTING.rdoc
@@ -1,9 +1,9 @@
= Source Repository
Rake is currently hosted at github. The github web page is
-http://github.com/jimweirich/rake . The public git clone URL is
+http://github.com/ruby/rake . The public git clone URL is
- git://github.com/jimweirich/rake.git
+ git://github.com/ruby/rake.git
= Running the Rake Test Suite
@@ -30,5 +30,5 @@ addressed your issue.
When submitting pull requests please check the rake Travis-CI page for test
failures:
- https://travis-ci.org/jimweirich/rake
+ https://travis-ci.org/ruby/rake
diff --git a/History.rdoc b/History.rdoc
index 7ffdb06..e50d237 100644
--- a/History.rdoc
+++ b/History.rdoc
@@ -1,3 +1,45 @@
+=== 10.4.2 / 2014-12-02
+
+Bug fixes:
+
+* Rake no longer edits ARGV. This allows you to re-exec rake from a rake
+ task. Pull requset #9 by Matt Palmer.
+* Documented how Rake::DSL#desc handles sentences in task descriptions.
+ Issue #7 by Raza Sayed.
+* Fixed test error on 1.9.3 with legacy RubyGems. Issue #8 by Matt Palmer.
+* Deleted duplicated History entry. Pull request #10 by Yuji Yamamoto.
+
+=== 10.4.1 / 2014-12-01
+
+Bug fixes:
+
+* Reverted fix for #277 as it caused numerous issues for rake users.
+ rails/spring issue #366 by Gustavo Dutra.
+
+=== 10.4.0 / 2014-11-22
+
+Enhancements:
+
+* Upgraded to minitest 5. Pull request #292 by Teo Ljungberg.
+* Added support for Pathname in rake tasks. Pull request #271 by Randy
+ Coulman.
+* Rake now ignores falsy dependencies which allows for easier programmatic
+ creation of tasks. Pull request #273 by Manav.
+* Rake no longer edits ARGV. This allows you to re-exec rake from a rake
+ task. Issue #277 by Matt Palmer.
+* Etc.nprocessors is used for counting the number of CPUs.
+
+Bug fixes:
+
+* Updated rake manpage. Issue #283 by Nathan Long, pull request #291 by
+ skittleys.
+* Add Rake::LATE to allow rebuilding of files that depend on deleted files.
+ Bug #286, pull request #287 by David Grayson.
+* Fix relinking of files when repackaging. Bug #276 by Muenze.
+* Fixed some typos. Pull request #280 by Jed Northridge.
+* Try counting CPUs via cpuinfo if host_os was not matched. Pull request
+ #282 by Edouard B.
+
=== 10.3.2 / 2014-05-15
Bug fixes:
diff --git a/Manifest.txt b/Manifest.txt
index 53ae991..a7829c9 100644
--- a/Manifest.txt
+++ b/Manifest.txt
@@ -17,7 +17,7 @@ doc/example/main.c
doc/glossary.rdoc
doc/jamis.rb
doc/proto_rake.rdoc
-doc/rake.1.gz
+doc/rake.1
doc/rakefile.rdoc
doc/rational.rdoc
doc/release_notes/rake-0.4.14.rdoc
@@ -69,6 +69,7 @@ lib/rake/dsl_definition.rb
lib/rake/early_time.rb
lib/rake/ext/core.rb
lib/rake/ext/module.rb
+lib/rake/ext/pathname.rb
lib/rake/ext/string.rb
lib/rake/ext/time.rb
lib/rake/file_creation_task.rb
@@ -79,6 +80,7 @@ lib/rake/file_utils_ext.rb
lib/rake/gempackagetask.rb
lib/rake/invocation_chain.rb
lib/rake/invocation_exception_mixin.rb
+lib/rake/late_time.rb
lib/rake/linked_list.rb
lib/rake/loaders/makefile.rb
lib/rake/multi_task.rb
@@ -133,6 +135,7 @@ test/test_rake_file_utils.rb
test/test_rake_ftp_file.rb
test/test_rake_functional.rb
test/test_rake_invocation_chain.rb
+test/test_rake_late_time.rb
test/test_rake_linked_list.rb
test/test_rake_makefile_loader.rb
test/test_rake_multi_task.rb
@@ -141,6 +144,7 @@ test/test_rake_package_task.rb
test/test_rake_path_map.rb
test/test_rake_path_map_explode.rb
test/test_rake_path_map_partial.rb
+test/test_rake_pathname_extensions.rb
test/test_rake_pseudo_status.rb
test/test_rake_rake_test_loader.rb
test/test_rake_reduce_compat.rb
diff --git a/README.rdoc b/README.rdoc
index 72ca2be..683e0c0 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -1,7 +1,7 @@
= RAKE -- Ruby Make
-home :: https://github.com/jimweirich/rake
-bugs :: https://github.com/jimweirich/rake/issues
+home :: https://github.com/ruby/rake
+bugs :: https://github.com/ruby/rake/issues
docs :: http://docs.seattlerb.org/rake
== Description
@@ -86,6 +86,9 @@ Type "rake --help" for all available options.
2. {Rake File Lists}[http://devblog.avdi.org/2014/04/22/rake-part-2-file-lists/]
3. {Rake Rules}[http://devblog.avdi.org/2014/04/23/rake-part-3-rules/]
4. {Rake Pathmap}[http://devblog.avdi.org/2014/04/24/rake-part-4-pathmap/]
+ 5. {File Operations}[http://devblog.avdi.org/2014/04/25/rake-part-5-file-operations/]
+ 6. {Clean and Clobber}[http://devblog.avdi.org/2014/04/28/rake-part-6-clean-and-clobber/]
+ 7. {MultiTask}[http://devblog.avdi.org/2014/04/29/rake-part-7-multitask/]
* Jim Weirich's 2003 RubyConf presentation:
http://onestepback.org/articles/buildingwithrake/
* Martin Fowler's article on Rake: http://martinfowler.com/articles/rake.html
diff --git a/Rakefile b/Rakefile
index d92b2d4..375ca88 100644
--- a/Rakefile
+++ b/Rakefile
@@ -28,7 +28,7 @@ hoe = Hoe.spec 'rake' do
require_ruby_version '>= 1.8.7'
require_rubygems_version '>= 1.3.2'
- dependency 'minitest', '~> 4.0', :developer
+ dependency 'minitest', '~> 5.0', :developer
license "MIT"
@@ -54,7 +54,7 @@ hoe = Hoe.spec 'rake' do
]
end
-hoe.test_prelude = 'gem "minitest", "~> 4.0"'
+hoe.test_prelude = 'gem "minitest", "~> 5.0"'
# Use custom rdoc task due to existence of doc directory
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
deleted file mode 100644
index 1236103..0000000
Binary files a/checksums.yaml.gz and /dev/null differ
diff --git a/checksums.yaml.gz.sig b/checksums.yaml.gz.sig
deleted file mode 100644
index 33b4fc6..0000000
--- a/checksums.yaml.gz.sig
+++ /dev/null
@@ -1,2 +0,0 @@
-T�*=��S�A;$�k
-^����Qޯ���
���4�����]Eg��m���{�X�������"-�o_9#���Cp/p|�xv���'��B�kC�/���l,�J�p2%ۧ0��`0������ըX����:�a��_1c�Y��h�&�t+�yO�Z�����}ʙ��3LS!O�
7�Z���ln/��"�)��ё����DUfN�t�5�$P�4F���ɣ��
���
�<�����������7Qe���
�Z
�A�O
\ No newline at end of file
diff --git a/data.tar.gz.sig b/data.tar.gz.sig
deleted file mode 100644
index 8295066..0000000
Binary files a/data.tar.gz.sig and /dev/null differ
diff --git a/doc/rake.1 b/doc/rake.1
new file mode 100644
index 0000000..b63ed49
--- /dev/null
+++ b/doc/rake.1
@@ -0,0 +1,141 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH RAKE 1 "August 27, 2014" "rake 10.3.2" "Rake User Commands"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+rake \- a make-like build utility for Ruby
+.SH SYNOPSIS
+\fBrake\fR [\fI\-f rakefile\fR] {\fIOPTIONS\fR} \fITARGETS...\fR
+.br
+.SH DESCRIPTION
+.B rake
+is a make-like build utility for Ruby. Tasks and dependencies are specified in
+standard Ruby syntax.
+.SH OPTIONS
+.TP
+\fB\-m\fR, \fB\-\-multitask\fR
+Treat all tasks as multitasks.
+.TP
+\fB\-B\fR, \fB\-\-build\-all\fR
+Build all prerequisites, including those which are up\-to\-date.
+
+.TP
+\fB\-j\fR, \fB\-\-jobs\fR [\fINUMBER\fR]
+Specifies the maximum number of tasks to execute in parallel (default is number of CPU cores + 4).
+
+.SS Modules
+.TP
+\fB\-I\fR, \fB\-\-libdir\fR \fILIBDIR\fR
+Include \fILIBDIR\fR in the search path for required modules.
+.TP
+\fB\-r\fR, \fB\-\-require\fR \fIMODULE\fR
+Require \fIMODULE\fR before executing rakefile.
+
+.SS Rakefile location
+.TP
+\fB\-f\fR, \fB\-\-rakefile\fR [\fIFILENAME\fR]
+Use \fIFILENAME\fR as the rakefile to search for.
+.TP
+\fB\-N\fR, \fB\-\-no\-search\fR, \fB\-\-nosearch\fR
+Do not search parent directories for the Rakefile.
+.TP
+\fB\-G\fR, \fB\-\-no\-system\fR, \fB\-\-nosystem\fR
+Use standard project Rakefile search paths, ignore system wide rakefiles.
+.TP
+\fB\-R\fR, \fB\-\-rakelibdir\fR \fIRAKELIBDIR\fR
+Auto\-import any .rake files in \fIRAKELIBDIR\fR (default is 'rakelib')
+.HP
+\fB\-\-rakelib\fR
+.TP
+\fB\-g\fR, \fB\-\-system\fR
+Using system wide (global) rakefiles (usually '\fI~/.rake/*.rake\fR').
+
+.SS Debugging
+.TP
+\fB\-\-backtrace\fR=\fI\,[OUT]\/\fR
+Enable full backtrace. \fIOUT\fR can be stderr (default) or stdout.
+.TP
+\fB\-t\fR, \fB\-\-trace\fR=\fI\,[OUT]\/\fR
+Turn on invoke/execute tracing, enable full backtrace. \fIOUT\fR can be stderr (default) or stdout.
+.TP
+\fB\-\-suppress\-backtrace\fR \fIPATTERN\fR
+Suppress backtrace lines matching regexp \fIPATTERN\fR. Ignored if \fI\-\-trace\fR is on.
+.TP
+\fB\-\-rules\fR
+Trace the rules resolution.
+
+.TP
+\fB\-n\fR, \fB\-\-dry\-run\fR
+Do a dry run without executing actions.
+.TP
+\fB\-T\fR, \fB\-\-tasks\fR [\fIPATTERN\fR]
+Display the tasks (matching optional \fIPATTERN\fR) with descriptions, then exit.
+.TP
+\fB\-D\fR, \fB\-\-describe\fR [\fIPATTERN\fR]
+Describe the tasks (matching optional \fIPATTERN\fR), then exit.
+.TP
+\fB\-W\fR, \fB\-\-where\fR [\fIPATTERN\fR]
+Describe the tasks (matching optional \fIPATTERN\fR), then exit.
+.TP
+\fB\-P\fR, \fB\-\-prereqs\fR
+Display the tasks and dependencies, then exit.
+
+.TP
+\fB\-e\fR, \fB\-\-execute\fR \fICODE\fR
+Execute some Ruby code and exit.
+.TP
+\fB\-p\fR, \fB\-\-execute\-print\fR \fICODE\fR
+Execute some Ruby code, print the result, then exit.
+.TP
+\fB\-E\fR, \fB\-\-execute\-continue\fR \fICODE\fR
+Execute some Ruby code, then continue with normal task processing.
+
+.SS Information
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Log message to standard output.
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Do not log messages to standard output.
+.TP
+\fB\-s\fR, \fB\-\-silent\fR
+Like \fB\-\-quiet\fR, but also suppresses the 'in directory' announcement.
+.TP
+\fB\-X\fR, \fB\-\-no\-deprecation\-warnings\fR
+Disable the deprecation warnings.
+.TP
+\fB\-\-comments\fR
+Show commented tasks only
+.TP
+\fB\-A\fR, \fB\-\-all\fR
+Show all tasks, even uncommented ones (in combination with \fB\-T\fR or \fB\-D\fR)
+.TP
+\fB\-\-job\-stats\fR [\fILEVEL\fR]
+Display job statistics. \fILEVEL=history\fR displays a complete job list
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Display the program version.
+.TP
+\fB\-h\fR, \fB\-H\fR, \fB\-\-help\fR
+Display a help message.
+
+.SH SEE ALSO
+The complete documentation for \fBrake\fR has been installed at \fI/usr/share/doc/rake-doc/html/index.html\fR. It is also available online at \fIhttp://docs.seattlerb.org/rake\fR.
+.SH AUTHOR
+.B rake
+was written by Jim Weirich <jim at weirichhouse.org>
+.PP
+This manual was created by Caitlin Matos <caitlin.matos at zoho.com> for the Debian project (but may be used by others). It was inspired by the manual by Jani Monoses <jani at iv.ro> for the Ubuntu project.
diff --git a/doc/rake.1.gz b/doc/rake.1.gz
deleted file mode 100644
index d323267..0000000
Binary files a/doc/rake.1.gz and /dev/null differ
diff --git a/lib/rake.rb b/lib/rake.rb
index 47cce17..7366862 100644
--- a/lib/rake.rb
+++ b/lib/rake.rb
@@ -21,7 +21,7 @@
#++
module Rake
- VERSION = '10.3.2'
+ VERSION = '10.4.2'
end
require 'rake/version'
@@ -63,6 +63,7 @@ require 'rake/file_utils_ext'
require 'rake/file_list'
require 'rake/default_loader'
require 'rake/early_time'
+require 'rake/late_time'
require 'rake/name_space'
require 'rake/task_manager'
require 'rake/application'
diff --git a/lib/rake/application.rb b/lib/rake/application.rb
index 795b468..bd72a2e 100644
--- a/lib/rake/application.rb
+++ b/lib/rake/application.rb
@@ -83,8 +83,8 @@ module Rake
def init(app_name='rake')
standard_exception_handling do
@name = app_name
- handle_options
- collect_command_line_tasks
+ args = handle_options
+ collect_command_line_tasks(args)
end
end
@@ -616,7 +616,9 @@ module Rake
end
private :select_trace_output
- # Read and handle the command line options.
+ # Read and handle the command line options. Returns the command line
+ # arguments that we didn't understand, which should (in theory) be just
+ # task names and env vars.
def handle_options # :nodoc:
options.rakelib = ['rakelib']
options.trace_output = $stderr
@@ -633,7 +635,7 @@ module Rake
standard_rake_options.each { |args| opts.on(*args) }
opts.environment('RAKEOPT')
- end.parse!
+ end.parse(ARGV)
end
# Similar to the regular Ruby +require+ command, but will check
@@ -727,9 +729,14 @@ module Rake
# Collect the list of tasks on the command line. If no tasks are
# given, return a list containing only the default task.
# Environmental assignments are processed at this time as well.
- def collect_command_line_tasks # :nodoc:
+ #
+ # `args` is the list of arguments to peruse to get the list of tasks.
+ # It should be the command line that was given to rake, less any
+ # recognised command-line options, which OptionParser.parse will
+ # have taken care of already.
+ def collect_command_line_tasks(args) # :nodoc:
@top_level_tasks = []
- ARGV.each do |arg|
+ args.each do |arg|
if arg =~ /^(\w+)=(.*)$/m
ENV[$1] = $2
else
diff --git a/lib/rake/backtrace.rb b/lib/rake/backtrace.rb
index 439255d..dc18773 100644
--- a/lib/rake/backtrace.rb
+++ b/lib/rake/backtrace.rb
@@ -1,6 +1,6 @@
module Rake
module Backtrace # :nodoc: all
- SYS_KEYS = RbConfig::CONFIG.keys.grep(/(prefix|libdir)/)
+ SYS_KEYS = RbConfig::CONFIG.keys.grep(/(?:[a-z]prefix|libdir)\z/)
SYS_PATHS = RbConfig::CONFIG.values_at(*SYS_KEYS).uniq +
[ File.join(File.dirname(__FILE__), "..") ]
diff --git a/lib/rake/cloneable.rb b/lib/rake/cloneable.rb
index cd19cd3..d53645f 100644
--- a/lib/rake/cloneable.rb
+++ b/lib/rake/cloneable.rb
@@ -3,7 +3,7 @@ module Rake
# Mixin for creating easily cloned objects.
module Cloneable # :nodoc:
- # The hook that invoked by 'clone' and 'dup' methods.
+ # The hook that is invoked by 'clone' and 'dup' methods.
def initialize_copy(source)
super
source.instance_variables.each do |var|
diff --git a/lib/rake/contrib/.document b/lib/rake/contrib/.document
index e69de29..8b13789 100644
--- a/lib/rake/contrib/.document
+++ b/lib/rake/contrib/.document
@@ -0,0 +1 @@
+
diff --git a/lib/rake/contrib/sshpublisher.rb b/lib/rake/contrib/sshpublisher.rb
index 44bb8c5..64f5770 100644
--- a/lib/rake/contrib/sshpublisher.rb
+++ b/lib/rake/contrib/sshpublisher.rb
@@ -20,7 +20,7 @@ module Rake
# Uploads the files
def upload
- sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
+ sh "scp", "-rq", "#{@local_dir}/*", "#{@host}:#{@remote_dir}"
end
end
@@ -30,8 +30,8 @@ module Rake
# Uploads the files after removing the existing remote directory.
def upload
- sh %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
- sh %{ssh #{@host} mkdir #{@remote_dir}}
+ sh "ssh", @host, "rm", "-rf", @remote_dir rescue nil
+ sh "ssh", @host, "mkdir", @remote_dir
super
end
end
@@ -54,7 +54,7 @@ module Rake
def upload
@files.each do |fn|
- sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
+ sh "scp", "-q", "#{@local_dir}/#{fn}", "#{@host}:#{@remote_dir}"
end
end
end
diff --git a/lib/rake/cpu_counter.rb b/lib/rake/cpu_counter.rb
index c05b69b..f29778e 100644
--- a/lib/rake/cpu_counter.rb
+++ b/lib/rake/cpu_counter.rb
@@ -1,8 +1,3 @@
-require 'rbconfig'
-
-# TODO: replace with IO.popen using array-style arguments in Rake 11
-require 'open3'
-
module Rake
# Based on a script at:
@@ -18,6 +13,26 @@ module Rake
default
end
+ begin
+ require 'etc'
+ rescue LoadError
+ else
+ if Etc.respond_to?(:nprocessors)
+ def count
+ return Etc.nprocessors
+ end
+ end
+ end
+ end
+end
+
+unless Rake::CpuCounter.method_defined?(:count)
+ Rake::CpuCounter.class_eval <<-'end;', __FILE__, __LINE__+1
+ require 'rbconfig'
+
+ # TODO: replace with IO.popen using array-style arguments in Rake 11
+ require 'open3'
+
def count
if defined?(Java::Java)
count_via_java_runtime
@@ -38,7 +53,8 @@ module Rake
count_via_win32 ||
count_via_sysctl ||
count_via_hwprefs_thread_count ||
- count_via_hwprefs_cpu_count
+ count_via_hwprefs_cpu_count ||
+ count_via_cpuinfo
end
end
end
@@ -105,5 +121,5 @@ module Rake
out.eof? ? nil : command
end
end
- end
+ end;
end
diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb
index 8420de7..26f4ca8 100644
--- a/lib/rake/dsl_definition.rb
+++ b/lib/rake/dsl_definition.rb
@@ -98,6 +98,7 @@ module Rake
def directory(*args, &block) # :doc:
result = file_create(*args, &block)
dir, _ = *Rake.application.resolve_args(args)
+ dir = Rake.from_pathname(dir)
Rake.each_dir_parent(dir) do |d|
file_create d do |t|
mkdir_p t.name unless File.exist?(t.name)
@@ -150,7 +151,7 @@ module Rake
#
# Example:
# rule '.o' => '.c' do |t|
- # sh %{cc -o #{t.name} #{t.source}}
+ # sh 'cc', '-o', t.name, t.source
# end
#
def rule(*args, &block) # :doc:
@@ -158,6 +159,8 @@ module Rake
end
# Describes the next rake task. Duplicate descriptions are discarded.
+ # Descriptions are shown with <code>rake -T</code> (up to the first
+ # sentence) and <code>rake -D</code> (the entire description).
#
# Example:
# desc "Run the Unit Tests"
diff --git a/lib/rake/ext/module.rb b/lib/rake/ext/module.rb
index 34c83b0..3ee155f 100644
--- a/lib/rake/ext/module.rb
+++ b/lib/rake/ext/module.rb
@@ -1 +1,2 @@
+
# TODO: remove in Rake 11
diff --git a/lib/rake/ext/pathname.rb b/lib/rake/ext/pathname.rb
new file mode 100644
index 0000000..49e2cd4
--- /dev/null
+++ b/lib/rake/ext/pathname.rb
@@ -0,0 +1,25 @@
+require 'rake/ext/core'
+require 'pathname'
+
+class Pathname
+
+ rake_extension("ext") do
+ # Return a new Pathname with <tt>String#ext</tt> applied to it.
+ #
+ # This Pathname extension comes from Rake
+ def ext(newext='')
+ Pathname.new(Rake.from_pathname(self).ext(newext))
+ end
+ end
+
+ rake_extension("pathmap") do
+ # Apply the pathmap spec to the Pathname, returning a
+ # new Pathname with the modified paths. (See String#pathmap for
+ # details.)
+ #
+ # This Pathname extension comes from Rake
+ def pathmap(spec=nil, &block)
+ Pathname.new(Rake.from_pathname(self).pathmap(spec, &block))
+ end
+ end
+end
diff --git a/lib/rake/ext/string.rb b/lib/rake/ext/string.rb
index 34ee328..b47b055 100644
--- a/lib/rake/ext/string.rb
+++ b/lib/rake/ext/string.rb
@@ -49,7 +49,7 @@ class String
end
protected :pathmap_partial
- # Preform the pathmap replacement operations on the given path. The
+ # Perform the pathmap replacement operations on the given path. The
# patterns take the form 'pat1,rep1;pat2,rep2...'.
#
# This String extension comes from Rake
diff --git a/lib/rake/ext/time.rb b/lib/rake/ext/time.rb
index c058649..d3b8cf9 100644
--- a/lib/rake/ext/time.rb
+++ b/lib/rake/ext/time.rb
@@ -1,12 +1,13 @@
#--
-# Extensions to time to allow comparisons with an early time class.
+# Extensions to time to allow comparisons with early and late time classes.
require 'rake/early_time'
+require 'rake/late_time'
class Time # :nodoc: all
alias rake_original_time_compare :<=>
def <=>(other)
- if Rake::EarlyTime === other
+ if Rake::EarlyTime === other || Rake::LateTime === other
- other.<=>(self)
else
rake_original_time_compare(other)
diff --git a/lib/rake/file_list.rb b/lib/rake/file_list.rb
index b01dbbb..006ec77 100644
--- a/lib/rake/file_list.rb
+++ b/lib/rake/file_list.rb
@@ -49,7 +49,7 @@ module Rake
# List of methods that should not be delegated here (we define special
# versions of them explicitly below).
- MUST_NOT_DEFINE = %w[to_a to_ary partition *]
+ MUST_NOT_DEFINE = %w[to_a to_ary partition * <<]
# List of delegated methods that return new array values which need
# wrapping.
@@ -119,7 +119,7 @@ module Rake
if fn.respond_to? :to_ary
include(*fn.to_ary)
else
- @pending_add << fn
+ @pending_add << Rake.from_pathname(fn)
end
end
@pending = true
@@ -149,7 +149,7 @@ module Rake
#
def exclude(*patterns, &block)
patterns.each do |pat|
- @exclude_patterns << pat
+ @exclude_patterns << Rake.from_pathname(pat)
end
@exclude_procs << block if block_given?
resolve_exclude unless @pending
@@ -196,6 +196,12 @@ module Rake
end
end
+ def <<(obj)
+ resolve
+ @items << Rake.from_pathname(obj)
+ self
+ end
+
# Resolve all the pending adds now.
def resolve
if @pending
@@ -346,7 +352,7 @@ module Rake
# Should the given file name be excluded from the list?
#
- # NOTE: This method was formally named "exclude?", but Rails
+ # NOTE: This method was formerly named "exclude?", but Rails
# introduced an exclude? method as an array method and setup a
# conflict with file list. We renamed the method to avoid
# confusion. If you were using "FileList#exclude?" in your user
@@ -410,5 +416,13 @@ module Rake
dir = File.dirname(dir)
end
end
+
+ # Convert Pathname and Pathname-like objects to strings;
+ # leave everything else alone
+ def from_pathname(path) # :nodoc:
+ path = path.to_path if path.respond_to?(:to_path)
+ path = path.to_str if path.respond_to?(:to_str)
+ path
+ end
end
end # module Rake
diff --git a/lib/rake/file_task.rb b/lib/rake/file_task.rb
index 03e26d9..4c9b040 100644
--- a/lib/rake/file_task.rb
+++ b/lib/rake/file_task.rb
@@ -21,7 +21,7 @@ module Rake
if File.exist?(name)
File.mtime(name.to_s)
else
- Rake::EARLY
+ Rake::LATE
end
end
@@ -39,7 +39,7 @@ module Rake
# Apply the scope to the task name according to the rules for this kind
# of task. File based tasks ignore the scope when creating the name.
def scope_name(scope, task_name)
- task_name
+ Rake.from_pathname(task_name)
end
end
end
diff --git a/lib/rake/file_utils.rb b/lib/rake/file_utils.rb
index 0f7f459..27f4e2e 100644
--- a/lib/rake/file_utils.rb
+++ b/lib/rake/file_utils.rb
@@ -14,12 +14,24 @@ module FileUtils
OPT_TABLE['sh'] = %w(noop verbose)
OPT_TABLE['ruby'] = %w(noop verbose)
- # Run the system command +cmd+. If multiple arguments are given the command
- # is not run with the shell (same semantics as Kernel::exec and
+ # Run the system command +cmd+. If multiple arguments are given the command
+ # is run directly (without the shell, same semantics as Kernel::exec and
# Kernel::system).
#
- # Example:
- # sh %{ls -ltr}
+ # It is recommended you use the multiple argument form over interpolating
+ # user input for both usability and security reasons. With the multiple
+ # argument form you can easily process files with spaces or other shell
+ # reserved characters in them. With the multiple argument form your rake
+ # tasks are not vulnerable to users providing an argument like
+ # <code>; rm # -rf /</code>.
+ #
+ # If a block is given, upon command completion the block is called with an
+ # OK flag (true on a zero exit status) and a Process::Status object.
+ # Without a block a RuntimeError is raised when the command exits non-zero.
+ #
+ # Examples:
+ #
+ # sh 'ls -ltr'
#
# sh 'ls', 'file with spaces'
#
diff --git a/lib/rake/invocation_chain.rb b/lib/rake/invocation_chain.rb
index 6904351..5406289 100644
--- a/lib/rake/invocation_chain.rb
+++ b/lib/rake/invocation_chain.rb
@@ -31,7 +31,7 @@ module Rake
private
def prefix
- "#{tail.to_s} => "
+ "#{tail} => "
end
# Null object for an empty chain.
diff --git a/lib/rake/late_time.rb b/lib/rake/late_time.rb
new file mode 100644
index 0000000..d959a78
--- /dev/null
+++ b/lib/rake/late_time.rb
@@ -0,0 +1,17 @@
+module Rake
+ # LateTime is a fake timestamp that occurs _after_ any other time value.
+ class LateTime
+ include Comparable
+ include Singleton
+
+ def <=>(other)
+ 1
+ end
+
+ def to_s
+ '<LATE TIME>'
+ end
+ end
+
+ LATE = LateTime.instance
+end
diff --git a/lib/rake/packagetask.rb b/lib/rake/packagetask.rb
index 0c0678b..249ee72 100644
--- a/lib/rake/packagetask.rb
+++ b/lib/rake/packagetask.rb
@@ -127,7 +127,7 @@ module Rake
file "#{package_dir}/#{file}" =>
[package_dir_path] + package_files do
chdir(package_dir) do
- sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}}
+ sh @tar_command, "#{flag}cvf", file, package_name
end
end
end
@@ -138,15 +138,12 @@ module Rake
file "#{package_dir}/#{zip_file}" =>
[package_dir_path] + package_files do
chdir(package_dir) do
- sh %{#{@zip_command} -r #{zip_file} #{package_name}}
+ 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
+ directory package_dir_path => @package_files do
@package_files.each do |fn|
f = File.join(package_dir_path, fn)
fdir = File.dirname(f)
diff --git a/lib/rake/task_manager.rb b/lib/rake/task_manager.rb
index af53e3f..cbb9f5e 100644
--- a/lib/rake/task_manager.rb
+++ b/lib/rake/task_manager.rb
@@ -35,7 +35,7 @@ module Rake
task_name = task_class.scope_name(@scope, task_name)
deps = [deps] unless deps.respond_to?(:to_ary)
- deps = deps.map { |d| d.to_s }
+ deps = deps.map { |d| Rake.from_pathname(d).to_s }
task = intern(task_class, task_name)
task.set_arg_names(arg_names) unless arg_names.empty?
if Rake::TaskManager.record_task_metadata
@@ -111,7 +111,7 @@ module Rake
if args.empty?
task_name = key
arg_names = []
- deps = value
+ deps = value || []
else
task_name = args.shift
arg_names = key
diff --git a/metadata.gz.sig b/metadata.gz.sig
deleted file mode 100644
index be3fa54..0000000
Binary files a/metadata.gz.sig and /dev/null differ
diff --git a/metadata.yml b/metadata.yml
index ba38123..cab39bf 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,36 +1,15 @@
--- !ruby/object:Gem::Specification
name: rake
version: !ruby/object:Gem::Version
- version: 10.3.2
+ version: 10.4.2
platform: ruby
authors:
- Eric Hodel
- Jim Weirich
autorequire:
bindir: bin
-cert_chain:
-- |
- -----BEGIN CERTIFICATE-----
- MIIDNjCCAh6gAwIBAgIBAjANBgkqhkiG9w0BAQUFADBBMRAwDgYDVQQDDAdkcmJy
- YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
- ZXQwHhcNMTQwMzI0MjEwNTQ1WhcNMTUwMzI0MjEwNTQ1WjBBMRAwDgYDVQQDDAdk
- cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
- FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
- LV/cvxdEzCuYuS3oG9PrSZnuDweySUfdp/so0cDq+j8bqy6OzZSw07gdjwFMSd6J
- U5ddZCVywn5nnAQ+Ui7jMW54CYt5/H6f2US6U0hQOjJR6cpfiymgxGdfyTiVcvTm
- Gj/okWrQl0NjYOYBpDi+9PPmaH2RmLJu0dB/NylsDnW5j6yN1BEI8MfJRR+HRKZY
- mUtgzBwF1V4KIZQ8EuL6I/nHVu07i6IkrpAgxpXUfdJQJi0oZAqXurAV3yTxkFwd
- g62YrrW26mDe+pZBzR6bpLE+PmXCzz7UxUq3AE0gPHbiMXie3EFE0oxnsU3lIduh
- sCANiQ8BAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
- BBS5k4Z75VSpdM0AclG2UvzFA/VW5DANBgkqhkiG9w0BAQUFAAOCAQEACQFPYbmk
- P51YZtd2sTMJkwhMs3RtLy+MqFpITMoPUjK1gvPw6NyzotvW0WkiU3KXIOem4l8s
- lDqWPIGobRf+Hvzp92hX/CEDGOSMbVBzuLZ4NAQftpvF91FE8KYCvrO+Nj8ei2X/
- +R7biySvcvWhCsIuBawVW6RxZdxaEHVZrbTX9cqGTAfnWhOIpsGJ/vNOofu1jIrw
- dAwolOAbVCvXy7lPI7oFtVzGu18RT7NW6Q4frd28V0Qs4shmW+ckdlneSzN1hVft
- pfkQPF5Ezsi73pEpFN93Fy21NKCYQH1jCwWeKUF29MIMGd6kE3ZmHW/7fz5GwKIM
- Ls5SgY48a0l7Hw==
- -----END CERTIFICATE-----
-date: 2014-05-16 00:00:00.000000000 Z
+cert_chain: []
+date: 2014-12-03 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: minitest
@@ -38,14 +17,14 @@ dependencies:
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '5.2'
+ version: '5.4'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '5.2'
+ version: '5.4'
- !ruby/object:Gem::Dependency
name: rdoc
requirement: !ruby/object:Gem::Requirement
@@ -66,14 +45,14 @@ dependencies:
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '3.7'
+ version: '3.13'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '3.7'
+ version: '3.13'
description: |-
Rake is a Make-like program implemented in Ruby. Tasks and dependencies are
specified in standard Ruby syntax.
@@ -165,7 +144,7 @@ files:
- doc/glossary.rdoc
- doc/jamis.rb
- doc/proto_rake.rdoc
-- doc/rake.1.gz
+- doc/rake.1
- doc/rakefile.rdoc
- doc/rational.rdoc
- doc/release_notes/rake-0.4.14.rdoc
@@ -217,6 +196,7 @@ files:
- lib/rake/early_time.rb
- lib/rake/ext/core.rb
- lib/rake/ext/module.rb
+- lib/rake/ext/pathname.rb
- lib/rake/ext/string.rb
- lib/rake/ext/time.rb
- lib/rake/file_creation_task.rb
@@ -227,6 +207,7 @@ files:
- lib/rake/gempackagetask.rb
- lib/rake/invocation_chain.rb
- lib/rake/invocation_exception_mixin.rb
+- lib/rake/late_time.rb
- lib/rake/linked_list.rb
- lib/rake/loaders/makefile.rb
- lib/rake/multi_task.rb
@@ -281,6 +262,7 @@ files:
- test/test_rake_ftp_file.rb
- test/test_rake_functional.rb
- test/test_rake_invocation_chain.rb
+- test/test_rake_late_time.rb
- test/test_rake_linked_list.rb
- test/test_rake_makefile_loader.rb
- test/test_rake_multi_task.rb
@@ -289,6 +271,7 @@ files:
- test/test_rake_path_map.rb
- test/test_rake_path_map_explode.rb
- test/test_rake_path_map_partial.rb
+- test/test_rake_pathname_extensions.rb
- test/test_rake_pseudo_status.rb
- test/test_rake_rake_test_loader.rb
- test/test_rake_reduce_compat.rb
@@ -308,7 +291,7 @@ files:
- test/test_rake_win32.rb
- test/test_thread_history_display.rb
- test/test_trace_output.rb
-homepage: https://github.com/jimweirich/rake
+homepage: https://github.com/ruby/rake
licenses:
- MIT
metadata: {}
@@ -329,8 +312,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
- !ruby/object:Gem::Version
version: 1.3.2
requirements: []
-rubyforge_project: rake
-rubygems_version: 2.2.2
+rubyforge_project:
+rubygems_version: 2.4.2
signing_key:
specification_version: 4
summary: Rake is a Make-like program implemented in Ruby
@@ -355,6 +338,7 @@ test_files:
- test/test_rake_ftp_file.rb
- test/test_rake_functional.rb
- test/test_rake_invocation_chain.rb
+- test/test_rake_late_time.rb
- test/test_rake_linked_list.rb
- test/test_rake_makefile_loader.rb
- test/test_rake_multi_task.rb
@@ -363,6 +347,7 @@ test_files:
- test/test_rake_path_map.rb
- test/test_rake_path_map_explode.rb
- test/test_rake_path_map_partial.rb
+- test/test_rake_pathname_extensions.rb
- test/test_rake_pseudo_status.rb
- test/test_rake_rake_test_loader.rb
- test/test_rake_reduce_compat.rb
diff --git a/test/helper.rb b/test/helper.rb
index 07a45a6..2ff599e 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,7 +1,10 @@
require 'rubygems'
$:.unshift File.expand_path('../../lib', __FILE__)
-gem 'minitest', '~> 4'
+begin
+ gem 'minitest', '~> 5'
+rescue Gem::LoadError
+end
require 'minitest/autorun'
require 'rake'
@@ -19,7 +22,7 @@ rescue NoMethodError, LoadError
require 'test/support/rakefile_definitions'
end
-class Rake::TestCase < MiniTest::Unit::TestCase
+class Rake::TestCase < Minitest::Test
include FileCreation
include Rake::DSL
diff --git a/test/support/rakefile_definitions.rb b/test/support/rakefile_definitions.rb
index d431142..a637c7e 100644
--- a/test/support/rakefile_definitions.rb
+++ b/test/support/rakefile_definitions.rb
@@ -460,7 +460,7 @@ end
TEST_TASK
open 'a_test.rb', 'w' do |io|
io << "require 'minitest/autorun'\n"
- io << "class ExitTaskTest < MiniTest::Unit::TestCase\n"
+ io << "class ExitTaskTest < Minitest::Test\n"
io << " def test_exit\n"
io << " assert false, 'this should fail'\n"
io << " end\n"
diff --git a/test/support/ruby_runner.rb b/test/support/ruby_runner.rb
index 404e61a..d51dd24 100644
--- a/test/support/ruby_runner.rb
+++ b/test/support/ruby_runner.rb
@@ -18,12 +18,13 @@ module RubyRunner
def run_ruby(option_list)
puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
- inn, out, err, wait = Open3.popen3(RUBY, *option_list)
- inn.close
+ Open3.popen3(RUBY, *option_list) {|inn, out, err, wait|
+ inn.close
- @exit = wait ? wait.value : $?
- @out = out.read
- @err = err.read
+ @exit = wait ? wait.value : $?
+ @out = out.read
+ @err = err.read
+ }
puts "OUTPUT: [#{@out}]" if @verbose
puts "ERROR: [#{@err}]" if @verbose
diff --git a/test/test_rake_application.rb b/test/test_rake_application.rb
index 1532be1..c010889 100644
--- a/test/test_rake_application.rb
+++ b/test/test_rake_application.rb
@@ -17,8 +17,10 @@ class TestRakeApplication < Rake::TestCase
end
def test_display_exception_details
+ obj = Object.new
+ obj.instance_eval("def #{__method__}; raise 'test'; end", "ruby")
begin
- raise 'test'
+ obj.__send__(__method__)
rescue => ex
end
@@ -368,7 +370,7 @@ class TestRakeApplication < Rake::TestCase
# HACK no assertions
end
- def test_handle_options_should_strip_options_from_argv
+ def test_handle_options_should_not_strip_options_from_argv
assert !@app.options.trace
valid_option = '--trace'
@@ -376,7 +378,7 @@ class TestRakeApplication < Rake::TestCase
@app.handle_options
- assert !ARGV.include?(valid_option)
+ assert ARGV.include?(valid_option)
assert @app.options.trace
end
diff --git a/test/test_rake_application_options.rb b/test/test_rake_application_options.rb
index a9ae4d9..37adfac 100644
--- a/test/test_rake_application_options.rb
+++ b/test/test_rake_application_options.rb
@@ -457,8 +457,8 @@ class TestRakeApplicationOptions < Rake::TestCase
throw :system_exit, :exit
end
@app.instance_eval do
- handle_options
- collect_command_line_tasks
+ args = handle_options
+ collect_command_line_tasks(args)
end
@tasks = @app.top_level_tasks
@app.options
diff --git a/test/test_rake_backtrace.rb b/test/test_rake_backtrace.rb
index a60f251..78eaa8d 100644
--- a/test/test_rake_backtrace.rb
+++ b/test/test_rake_backtrace.rb
@@ -42,7 +42,7 @@ class TestRakeBacktrace < Rake::TestCase
super
skip 'tmpdir is suppressed in backtrace' if
- Dir.pwd =~ Rake::Backtrace::SUPPRESS_PATTERN
+ Rake::Backtrace::SUPPRESS_PATTERN =~ Dir.pwd
end
def invoke(*args)
diff --git a/test/test_rake_clean.rb b/test/test_rake_clean.rb
index 1e8eb49..0bce7bc 100644
--- a/test/test_rake_clean.rb
+++ b/test/test_rake_clean.rb
@@ -41,7 +41,13 @@ class TestRakeClean < Rake::TestCase
FileUtils.touch(file_name)
FileUtils.chmod(0, file_name)
FileUtils.chmod(0, dir_name)
- file_name
+ begin
+ FileUtils.chmod(0644, file_name)
+ rescue
+ file_name
+ else
+ skip "Permission to delete files is different on thie system"
+ end
end
def remove_undeletable_file
diff --git a/test/test_rake_cpu_counter.rb b/test/test_rake_cpu_counter.rb
index ccf21d8..87d0601 100644
--- a/test/test_rake_cpu_counter.rb
+++ b/test/test_rake_cpu_counter.rb
@@ -8,43 +8,61 @@ class TestRakeCpuCounter < Rake::TestCase
@cpu_counter = Rake::CpuCounter.new
end
- def test_count_via_win32
- if Rake::Win32.windows? then
- assert_kind_of Numeric, @cpu_counter.count_via_win32
- else
- assert_nil @cpu_counter.count_via_win32
- end
+ def test_count
+ num = @cpu_counter.count
+ skip 'cannot count CPU' if num == nil
+ assert_kind_of Numeric, num
+ assert_operator num, :>=, 1
end
- def test_in_path_command
- with_ruby_in_path do |ruby|
- assert_equal ruby, @cpu_counter.in_path_command(ruby)
- end
- rescue Errno::ENOENT => e
- raise unless e.message =~ /\bwhich\b/
+ def test_count_with_default_nil
+ def @cpu_counter.count; nil; end
+ assert_equal(8, @cpu_counter.count_with_default(8))
+ assert_equal(4, @cpu_counter.count_with_default)
+ end
- skip 'cannot find which for this test'
+ def test_count_with_default_raise
+ def @cpu_counter.count; raise; end
+ assert_equal(8, @cpu_counter.count_with_default(8))
+ assert_equal(4, @cpu_counter.count_with_default)
end
- def test_run
- with_ruby_in_path do |ruby|
- assert_equal 7, @cpu_counter.run(ruby, '-e', 'puts 3 + 4')
+ class TestClassMethod < Rake::TestCase
+ def setup
+ super
+
+ @klass = Class.new(Rake::CpuCounter)
end
- end
- def with_ruby_in_path
- ruby = File.basename Gem.ruby
- ruby_dir = File.dirname Gem.ruby
+ def test_count
+ @klass.class_eval do
+ def count; 8; end
+ end
+ assert_equal(8, @klass.count)
+ end
- begin
- orig_path, ENV['PATH'] =
- ENV['PATH'], [ruby_dir, *ENV['PATH']].join(File::PATH_SEPARATOR)
+ def test_count_nil
+ counted = false
+ @klass.class_eval do
+ define_method(:count) do
+ counted = true
+ nil
+ end
+ end
+ assert_equal(4, @klass.count)
+ assert_equal(true, counted)
+ end
- yield ruby
- ensure
- ENV['PATH'] = orig_path
+ def test_count_raise
+ counted = false
+ @klass.class_eval do
+ define_method(:count) do
+ counted = true
+ raise
+ end
+ end
+ assert_equal(4, @klass.count)
+ assert_equal(true, counted)
end
end
-
end
-
diff --git a/test/test_rake_definitions.rb b/test/test_rake_definitions.rb
index 4b2de9d..ee474cb 100644
--- a/test/test_rake_definitions.rb
+++ b/test/test_rake_definitions.rb
@@ -59,6 +59,11 @@ class TestRakeDefinitions < Rake::TestCase
assert_raises(RuntimeError) { Task[:x].invoke }
end
+ def test_falsey_dependencies
+ task :x => nil
+ assert_equal [], Task[:x].prerequisites
+ end
+
def test_implicit_file_dependencies
runs = []
create_existing_file
diff --git a/test/test_rake_directory_task.rb b/test/test_rake_directory_task.rb
index c8275e6..0014d1c 100644
--- a/test/test_rake_directory_task.rb
+++ b/test/test_rake_directory_task.rb
@@ -1,5 +1,6 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
+require 'pathname'
class TestRakeDirectoryTask < Rake::TestCase
include Rake
@@ -60,4 +61,16 @@ class TestRakeDirectoryTask < Rake::TestCase
assert_equal ["t2", "a/b/c"], runlist
assert File.directory?("a/b/c")
end
+
+ def test_can_use_pathname
+ directory Pathname.new "a/b/c"
+
+ assert_equal FileCreationTask, Task["a/b/c"].class
+
+ verbose(false) {
+ Task['a/b/c'].invoke
+ }
+
+ assert File.directory?("a/b/c")
+ end
end
diff --git a/test/test_rake_file_list.rb b/test/test_rake_file_list.rb
index 899f3bc..c1b4c92 100644
--- a/test/test_rake_file_list.rb
+++ b/test/test_rake_file_list.rb
@@ -1,4 +1,5 @@
require File.expand_path('../helper', __FILE__)
+require 'pathname'
class TestRakeFileList < Rake::TestCase
FileList = Rake::FileList
@@ -46,6 +47,12 @@ class TestRakeFileList < Rake::TestCase
fl.sort
end
+ def test_create_with_pathname
+ fl = FileList.new(Pathname.new("*.c"))
+ assert_equal ["abc.c", "x.c", "xyz.c"].sort,
+ fl.sort
+ end
+
def test_create_with_block
fl = FileList.new { |f| f.include("x") }
assert_equal ["x"], fl.resolve
@@ -74,12 +81,24 @@ class TestRakeFileList < Rake::TestCase
fl.sort
end
+ def test_include_with_pathname
+ fl = FileList.new.include(Pathname.new("*.c"))
+ assert_equal ["abc.c", "x.c", "xyz.c"].sort,
+ fl.sort
+ end
+
def test_append
fl = FileList.new
fl << "a.rb" << "b.rb"
assert_equal ['a.rb', 'b.rb'], fl
end
+ def test_append_pathname
+ fl = FileList.new
+ fl << Pathname.new("a.rb")
+ assert_equal ['a.rb'], fl
+ end
+
def test_add_many
fl = FileList.new
fl.include %w(a d c)
@@ -163,6 +182,15 @@ class TestRakeFileList < Rake::TestCase
assert_equal [], fl
end
+ def test_exclude_pathname
+ fl = FileList['x.c', 'abc.c', 'other']
+ fl.each { |fn| touch fn, :verbose => false }
+
+ fl.exclude(Pathname.new('*.c'))
+
+ assert_equal ['other'], fl
+ end
+
def test_excluding_via_block
fl = FileList['a.c', 'b.c', 'xyz.c']
fl.exclude { |fn| fn.pathmap('%n') == 'xyz' }
diff --git a/test/test_rake_file_task.rb b/test/test_rake_file_task.rb
index ae828c9..a249511 100644
--- a/test/test_rake_file_task.rb
+++ b/test/test_rake_file_task.rb
@@ -1,5 +1,6 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
+require 'pathname'
class TestRakeFileTask < Rake::TestCase
include Rake
@@ -23,6 +24,7 @@ class TestRakeFileTask < Rake::TestCase
File.delete(ftask.name) rescue nil
assert ftask.needed?, "file should be needed"
+ assert_equal Rake::LATE, ftask.timestamp
open(ftask.name, "w") { |f| f.puts "HI" }
@@ -83,19 +85,14 @@ class TestRakeFileTask < Rake::TestCase
end
def test_existing_file_depends_on_non_existing_file
- @ran = false
-
create_file(OLDFILE)
delete_file(NEWFILE)
- file NEWFILE do
- @ran = true
- end
-
- file OLDFILE => NEWFILE
+ file NEWFILE do |t| @runs << t.name end
+ file OLDFILE => NEWFILE do |t| @runs << t.name end
Task[OLDFILE].invoke
- assert @ran
+ assert_equal [NEWFILE, OLDFILE], @runs
end
def test_needed_eh_build_all
@@ -162,6 +159,20 @@ class TestRakeFileTask < Rake::TestCase
assert_equal ["preqA", "preqB"], t.sources
end
+ def test_task_can_be_pathname
+ name = "dummy"
+ file Pathname.new name
+
+ ftask = Task[name]
+
+ assert_equal name.to_s, ftask.name
+ end
+
+ def test_prerequisite_can_be_pathname
+ t = file :f => Pathname.new("preq")
+ assert_equal "preq", t.source
+ end
+
# I have currently disabled this test. I'm not convinced that
# deleting the file target on failure is always the proper thing to
# do. I'm willing to hear input on this topic.
diff --git a/test/test_rake_late_time.rb b/test/test_rake_late_time.rb
new file mode 100644
index 0000000..4b910a7
--- /dev/null
+++ b/test/test_rake_late_time.rb
@@ -0,0 +1,18 @@
+require File.expand_path('../helper', __FILE__)
+
+class TestRakeLateTime < Rake::TestCase
+ def test_late_time_comparisons
+ late = Rake::LATE
+ assert_equal late, late
+ assert late >= Time.now
+ assert late > Time.now
+ assert late != Time.now
+ assert Time.now < late
+ assert Time.now <= late
+ assert Time.now != late
+ end
+
+ def test_to_s
+ assert_equal '<LATE TIME>', Rake::LATE.to_s
+ end
+end
diff --git a/test/test_rake_multi_task.rb b/test/test_rake_multi_task.rb
index fe10caf..9f8fed6 100644
--- a/test/test_rake_multi_task.rb
+++ b/test/test_rake_multi_task.rb
@@ -13,6 +13,12 @@ class TestRakeMultiTask < Rake::TestCase
@mutex = Mutex.new
end
+ def teardown
+ Rake.application.thread_pool.join
+
+ super
+ end
+
def add_run(obj)
@mutex.synchronize do
@runs << obj
diff --git a/test/test_rake_pathname_extensions.rb b/test/test_rake_pathname_extensions.rb
new file mode 100644
index 0000000..7da702d
--- /dev/null
+++ b/test/test_rake_pathname_extensions.rb
@@ -0,0 +1,15 @@
+require File.expand_path('../helper', __FILE__)
+require 'rake/ext/pathname'
+
+class TestRakePathnameExtensions < Rake::TestCase
+ def test_ext_works_on_pathnames
+ pathname = Pathname.new("abc.foo")
+ assert_equal Pathname.new("abc.bar"), pathname.ext("bar")
+ end
+
+ def test_path_map_works_on_pathnames
+ pathname = Pathname.new("this/is/a/dir/abc.rb")
+ assert_equal Pathname.new("abc.rb"), pathname.pathmap("%f")
+ assert_equal Pathname.new("this/is/a/dir"), pathname.pathmap("%d")
+ end
+end
diff --git a/test/test_rake_task.rb b/test/test_rake_task.rb
index c6edaad..d7f14ef 100644
--- a/test/test_rake_task.rb
+++ b/test/test_rake_task.rb
@@ -13,6 +13,7 @@ class TestRakeTask < Rake::TestCase
def teardown
Rake::TaskManager.record_task_metadata = false
+ Rake.application.thread_pool.join
super
end
@@ -270,7 +271,7 @@ class TestRakeTask < Rake::TestCase
result = []
t_a = task(:a) do |t|
- sleep 0.02
+ sleep 0.2
mx.synchronize { result << t.name }
end
diff --git a/test/test_rake_task_argument_parsing.rb b/test/test_rake_task_argument_parsing.rb
index 0294a9f..3cb5d9c 100644
--- a/test/test_rake_task_argument_parsing.rb
+++ b/test/test_rake_task_argument_parsing.rb
@@ -49,6 +49,16 @@ class TestRakeTaskArgumentParsing < Rake::TestCase
assert_equal ["one", "two", "three_a, three_b", "four"], args
end
+ def test_treat_blank_arg_as_empty_string
+ name, args = @app.parse_task_string("name[one,]")
+ assert_equal "name", name
+ assert_equal ["one", ""], args
+
+ name, args = @app.parse_task_string("name[one,,two]")
+ assert_equal "name", name
+ assert_equal ["one", "", "two"], args
+ end
+
def test_terminal_width_using_env
app = Rake::Application.new
app.terminal_columns = 1234
diff --git a/test/test_rake_task_with_arguments.rb b/test/test_rake_task_with_arguments.rb
index 9d56ffb..8646fc0 100644
--- a/test/test_rake_task_with_arguments.rb
+++ b/test/test_rake_task_with_arguments.rb
@@ -12,6 +12,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
def teardown
Rake::TaskManager.record_task_metadata = false
+ Rake.application.thread_pool.join
super
end
diff --git a/test/test_rake_test_task.rb b/test/test_rake_test_task.rb
index 9b500dc..5c4be79 100644
--- a/test/test_rake_test_task.rb
+++ b/test/test_rake_test_task.rb
@@ -97,17 +97,22 @@ class TestRakeTestTask < Rake::TestCase
end
def test_run_code_rake_default_gem
+ skip 'this ruby does not have default gems' unless
+ Gem::Specification.method_defined? :default_specifications_dir
+
default_spec = Gem::Specification.new 'rake', 0
default_spec.loaded_from = File.join Gem::Specification.default_specifications_dir, 'rake-0.gemspec'
- rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], default_spec
+ begin
+ rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], default_spec
- test_task = Rake::TestTask.new do |t|
- t.loader = :rake
- end
+ test_task = Rake::TestTask.new do |t|
+ t.loader = :rake
+ end
- assert_match(/\A ".*?"\Z/, test_task.run_code)
- ensure
- Gem.loaded_specs['rake'] = rake
+ assert_match(/\A(-I".*?" *)* ".*?"\Z/, test_task.run_code)
+ ensure
+ Gem.loaded_specs['rake'] = rake
+ end
end
def test_run_code_testrb_ruby_1_8_2
diff --git a/test/test_rake_thread_pool.rb b/test/test_rake_thread_pool.rb
index 93f32fb..35a1fe9 100644
--- a/test/test_rake_thread_pool.rb
+++ b/test/test_rake_thread_pool.rb
@@ -1,6 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'rake/thread_pool'
-require 'test/unit/assertions'
class TestRakeTestThreadPool < Rake::TestCase
include Rake
@@ -33,6 +32,8 @@ class TestRakeTestThreadPool < Rake::TestCase
refute_equal threads[0], threads[1]
refute_equal Thread.current, threads[0]
refute_equal Thread.current, threads[1]
+ ensure
+ pool.join
end
def test_pool_creates_the_correct_number_of_threads
@@ -95,6 +96,8 @@ class TestRakeTestThreadPool < Rake::TestCase
assert_raises(CustomError) do
pool.future(2, &deep_exception_block).value
end
+ ensure
+ pool.join
end
def test_pool_prevents_deadlock
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/rake.git
More information about the Pkg-ruby-extras-commits
mailing list