rake 0.9.6 → 10.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rake might be problematic. Click here for more details.
- data/README.rdoc +12 -0
- data/Rakefile +0 -1
- data/doc/command_line_usage.rdoc +17 -60
- data/doc/release_notes/rake-0.9.3.rdoc +23 -70
- data/lib/rake.rb +0 -1
- data/lib/rake/application.rb +23 -63
- data/lib/rake/backtrace.rb +2 -3
- data/lib/rake/contrib/ftptools.rb +2 -2
- data/lib/rake/dsl_definition.rb +0 -26
- data/lib/rake/ext/module.rb +0 -39
- data/lib/rake/ext/string.rb +1 -2
- data/lib/rake/ext/time.rb +1 -2
- data/lib/rake/file_list.rb +1 -8
- data/lib/rake/file_utils.rb +1 -1
- data/lib/rake/phony.rb +2 -4
- data/lib/rake/rake_module.rb +7 -0
- data/lib/rake/ruby182_test_unit_fix.rb +0 -0
- data/lib/rake/runtest.rb +1 -2
- data/lib/rake/task.rb +8 -9
- data/lib/rake/task_manager.rb +0 -11
- data/lib/rake/testtask.rb +1 -4
- data/lib/rake/thread_history_display.rb +4 -7
- data/lib/rake/thread_pool.rb +76 -42
- data/lib/rake/version.rb +6 -7
- data/test/helper.rb +4 -44
- data/test/test_rake_application.rb +0 -47
- data/test/test_rake_application_options.rb +6 -39
- data/test/test_rake_backtrace.rb +11 -33
- data/test/test_rake_dsl.rb +0 -37
- data/test/test_rake_file_task.rb +4 -4
- data/test/test_rake_functional.rb +8 -32
- data/test/test_rake_rake_test_loader.rb +1 -1
- data/test/test_rake_reduce_compat.rb +5 -33
- data/test/test_rake_task_manager_argument_resolution.rb +0 -5
- data/test/test_rake_task_with_arguments.rb +6 -17
- data/test/test_rake_thread_pool.rb +24 -1
- data/test/test_rake_top_level_functions.rb +0 -40
- data/test/test_thread_history_display.rb +14 -14
- metadata +3 -22
- data/doc/release_notes/rake-0.9.2.2.rdoc +0 -55
- data/doc/release_notes/rake-0.9.4.rdoc +0 -110
- data/doc/release_notes/rake-0.9.5.rdoc +0 -114
- data/doc/release_notes/rake-0.9.6.rdoc +0 -127
- data/lib/rake/classic_namespace.rb +0 -11
- data/lib/rake/contrib/sys.rb +0 -192
- data/lib/rake/gempackagetask.rb +0 -15
- data/lib/rake/private_reader.rb +0 -20
- data/lib/rake/promise.rb +0 -99
- data/lib/rake/rdoctask.rb +0 -234
- data/lib/rake/trace_output.rb +0 -19
- data/test/test_private_reader.rb +0 -42
- data/test/test_rake_rdoc_task.rb +0 -83
- data/test/test_sys.rb +0 -20
- data/test/test_trace_output.rb +0 -43
@@ -1,110 +0,0 @@
|
|
1
|
-
= Rake 0.9.4 Released
|
2
|
-
|
3
|
-
Rake version 0.9.4 contains a number of bug fixes.
|
4
|
-
|
5
|
-
== Changes
|
6
|
-
|
7
|
-
=== New Features (in 0.9.3)
|
8
|
-
|
9
|
-
* Multitask tasks now use a thread pool. Use -j to limit the number of
|
10
|
-
available threads.
|
11
|
-
|
12
|
-
* Use -m to turn regular tasks into multitasks (use at your own risk).
|
13
|
-
|
14
|
-
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
|
15
|
-
programatically add rake task libraries.
|
16
|
-
|
17
|
-
* You can specific backtrace suppression patterns (see
|
18
|
-
--supress-backtrace)
|
19
|
-
|
20
|
-
* Directory tasks can now take prerequisites and actions
|
21
|
-
|
22
|
-
* Use --backtrace to request a full backtrace without the task trace.
|
23
|
-
|
24
|
-
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
|
25
|
-
output to standard output rather than standard error.
|
26
|
-
|
27
|
-
* Optional 'phony' target (enable with 'require 'rake/phony'") for
|
28
|
-
special purpose builds.
|
29
|
-
|
30
|
-
* Task#clear now clears task comments as well as actions and
|
31
|
-
prerequisites. Task#clear_comment will specifically target comments.
|
32
|
-
|
33
|
-
* The --all option will force -T and -D to consider all the tasks,
|
34
|
-
with and without descriptions.
|
35
|
-
|
36
|
-
=== Bug Fixes (0.9.3)
|
37
|
-
|
38
|
-
* Semi-colons in windows rakefile paths now work.
|
39
|
-
|
40
|
-
* Improved Control-C support when invoking multiple test suites.
|
41
|
-
|
42
|
-
* egrep method now reads files in text mode (better support for
|
43
|
-
Windows)
|
44
|
-
|
45
|
-
* Better deprecation line number reporting.
|
46
|
-
|
47
|
-
* The -W option now works with all tasks, whether they have a
|
48
|
-
description or not.
|
49
|
-
|
50
|
-
* File globs in rake should not be sorted alphabetically, independent
|
51
|
-
of file system and platform.
|
52
|
-
|
53
|
-
* Numerous internal improvements.
|
54
|
-
|
55
|
-
* Documentation typos and fixes.
|
56
|
-
|
57
|
-
=== Bug Fixes (0.9.4)
|
58
|
-
|
59
|
-
* Exit status with failing tests is not correctly set to non-zero.
|
60
|
-
|
61
|
-
* Simplified syntax for phony task (for older versions of RDoc).
|
62
|
-
|
63
|
-
* Stand alone FileList usage gets glob function (without loading in
|
64
|
-
extra dependencies)
|
65
|
-
|
66
|
-
== What is Rake
|
67
|
-
|
68
|
-
Rake is a build tool similar to the make program in many ways. But
|
69
|
-
instead of cryptic make recipes, Rake uses standard Ruby code to
|
70
|
-
declare tasks and dependencies. You have the full power of a modern
|
71
|
-
scripting language built right into your build tool.
|
72
|
-
|
73
|
-
== Availability
|
74
|
-
|
75
|
-
The easiest way to get and install rake is via RubyGems ...
|
76
|
-
|
77
|
-
gem install rake (you may need root/admin privileges)
|
78
|
-
|
79
|
-
Otherwise, you can get it from the more traditional places:
|
80
|
-
|
81
|
-
Home Page:: http://github.com/jimweirich/rake
|
82
|
-
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
83
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
84
|
-
|
85
|
-
== Thanks
|
86
|
-
|
87
|
-
As usual, it was input from users that drove a alot of these changes. The
|
88
|
-
following people either contributed patches, made suggestions or made
|
89
|
-
otherwise helpful comments. Thanks to ...
|
90
|
-
|
91
|
-
* Aaron Patterson
|
92
|
-
* Dylan Smith
|
93
|
-
* Jo Liss
|
94
|
-
* Jonas Pfenniger
|
95
|
-
* Kazuki Tsujimoto
|
96
|
-
* Michael Bishop
|
97
|
-
* Michael Elufimov
|
98
|
-
* NAKAMURA Usaku
|
99
|
-
* Ryan Davis
|
100
|
-
* Sam Grönblom
|
101
|
-
* Sam Phippen
|
102
|
-
* Sergio Wong
|
103
|
-
* Tay Ray Chuan
|
104
|
-
* grosser
|
105
|
-
* quix
|
106
|
-
|
107
|
-
Also, many thanks to Eric Hodel for assisting with getting this release
|
108
|
-
out the door.
|
109
|
-
|
110
|
-
-- Jim Weirich
|
@@ -1,114 +0,0 @@
|
|
1
|
-
= Rake 0.9.5 Released
|
2
|
-
|
3
|
-
Rake version 0.9.5 contains a number of bug fixes.
|
4
|
-
|
5
|
-
== Changes
|
6
|
-
|
7
|
-
=== New Features (in 0.9.3)
|
8
|
-
|
9
|
-
* Multitask tasks now use a thread pool. Use -j to limit the number of
|
10
|
-
available threads.
|
11
|
-
|
12
|
-
* Use -m to turn regular tasks into multitasks (use at your own risk).
|
13
|
-
|
14
|
-
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
|
15
|
-
programatically add rake task libraries.
|
16
|
-
|
17
|
-
* You can specific backtrace suppression patterns (see
|
18
|
-
--supress-backtrace)
|
19
|
-
|
20
|
-
* Directory tasks can now take prerequisites and actions
|
21
|
-
|
22
|
-
* Use --backtrace to request a full backtrace without the task trace.
|
23
|
-
|
24
|
-
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
|
25
|
-
output to standard output rather than standard error.
|
26
|
-
|
27
|
-
* Optional 'phony' target (enable with 'require 'rake/phony'") for
|
28
|
-
special purpose builds.
|
29
|
-
|
30
|
-
* Task#clear now clears task comments as well as actions and
|
31
|
-
prerequisites. Task#clear_comment will specifically target comments.
|
32
|
-
|
33
|
-
* The --all option will force -T and -D to consider all the tasks,
|
34
|
-
with and without descriptions.
|
35
|
-
|
36
|
-
=== Bug Fixes (0.9.3)
|
37
|
-
|
38
|
-
* Semi-colons in windows rakefile paths now work.
|
39
|
-
|
40
|
-
* Improved Control-C support when invoking multiple test suites.
|
41
|
-
|
42
|
-
* egrep method now reads files in text mode (better support for
|
43
|
-
Windows)
|
44
|
-
|
45
|
-
* Better deprecation line number reporting.
|
46
|
-
|
47
|
-
* The -W option now works with all tasks, whether they have a
|
48
|
-
description or not.
|
49
|
-
|
50
|
-
* File globs in rake should not be sorted alphabetically, independent
|
51
|
-
of file system and platform.
|
52
|
-
|
53
|
-
* Numerous internal improvements.
|
54
|
-
|
55
|
-
* Documentation typos and fixes.
|
56
|
-
|
57
|
-
=== Bug Fixes (0.9.4)
|
58
|
-
|
59
|
-
* Exit status with failing tests is not correctly set to non-zero.
|
60
|
-
|
61
|
-
* Simplified syntax for phony task (for older versions of RDoc).
|
62
|
-
|
63
|
-
* Stand alone FileList usage gets glob function (without loading in
|
64
|
-
extra dependencies)
|
65
|
-
|
66
|
-
=== Bug Fixes (0.9.5)
|
67
|
-
|
68
|
-
* --trace and --backtrace no longer swallow following task names.
|
69
|
-
|
70
|
-
== What is Rake
|
71
|
-
|
72
|
-
Rake is a build tool similar to the make program in many ways. But
|
73
|
-
instead of cryptic make recipes, Rake uses standard Ruby code to
|
74
|
-
declare tasks and dependencies. You have the full power of a modern
|
75
|
-
scripting language built right into your build tool.
|
76
|
-
|
77
|
-
== Availability
|
78
|
-
|
79
|
-
The easiest way to get and install rake is via RubyGems ...
|
80
|
-
|
81
|
-
gem install rake (you may need root/admin privileges)
|
82
|
-
|
83
|
-
Otherwise, you can get it from the more traditional places:
|
84
|
-
|
85
|
-
Home Page:: http://github.com/jimweirich/rake
|
86
|
-
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
87
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
88
|
-
|
89
|
-
== Thanks
|
90
|
-
|
91
|
-
As usual, it was input from users that drove a alot of these changes. The
|
92
|
-
following people either contributed patches, made suggestions or made
|
93
|
-
otherwise helpful comments. Thanks to ...
|
94
|
-
|
95
|
-
* Aaron Patterson
|
96
|
-
* Dylan Smith
|
97
|
-
* Jo Liss
|
98
|
-
* Jonas Pfenniger
|
99
|
-
* Kazuki Tsujimoto
|
100
|
-
* Michael Bishop
|
101
|
-
* Michael Elufimov
|
102
|
-
* NAKAMURA Usaku
|
103
|
-
* Ryan Davis
|
104
|
-
* Sam Grönblom
|
105
|
-
* Sam Phippen
|
106
|
-
* Sergio Wong
|
107
|
-
* Tay Ray Chuan
|
108
|
-
* grosser
|
109
|
-
* quix
|
110
|
-
|
111
|
-
Also, many thanks to Eric Hodel for assisting with getting this release
|
112
|
-
out the door.
|
113
|
-
|
114
|
-
-- Jim Weirich
|
@@ -1,127 +0,0 @@
|
|
1
|
-
= Rake 0.9.6 Released
|
2
|
-
|
3
|
-
Rake version 0.9.6 contains a number of fixes mainly for merging
|
4
|
-
Rake into the Ruby source tree and fixing tests.
|
5
|
-
|
6
|
-
== Changes
|
7
|
-
|
8
|
-
=== New Features (in 0.9.3)
|
9
|
-
|
10
|
-
* Multitask tasks now use a thread pool. Use -j to limit the number of
|
11
|
-
available threads.
|
12
|
-
|
13
|
-
* Use -m to turn regular tasks into multitasks (use at your own risk).
|
14
|
-
|
15
|
-
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
|
16
|
-
programatically add rake task libraries.
|
17
|
-
|
18
|
-
* You can specific backtrace suppression patterns (see
|
19
|
-
--supress-backtrace)
|
20
|
-
|
21
|
-
* Directory tasks can now take prerequisites and actions
|
22
|
-
|
23
|
-
* Use --backtrace to request a full backtrace without the task trace.
|
24
|
-
|
25
|
-
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
|
26
|
-
output to standard output rather than standard error.
|
27
|
-
|
28
|
-
* Optional 'phony' target (enable with 'require 'rake/phony'") for
|
29
|
-
special purpose builds.
|
30
|
-
|
31
|
-
* Task#clear now clears task comments as well as actions and
|
32
|
-
prerequisites. Task#clear_comment will specifically target comments.
|
33
|
-
|
34
|
-
* The --all option will force -T and -D to consider all the tasks,
|
35
|
-
with and without descriptions.
|
36
|
-
|
37
|
-
=== Bug Fixes (0.9.3)
|
38
|
-
|
39
|
-
* Semi-colons in windows rakefile paths now work.
|
40
|
-
|
41
|
-
* Improved Control-C support when invoking multiple test suites.
|
42
|
-
|
43
|
-
* egrep method now reads files in text mode (better support for
|
44
|
-
Windows)
|
45
|
-
|
46
|
-
* Better deprecation line number reporting.
|
47
|
-
|
48
|
-
* The -W option now works with all tasks, whether they have a
|
49
|
-
description or not.
|
50
|
-
|
51
|
-
* File globs in rake should not be sorted alphabetically, independent
|
52
|
-
of file system and platform.
|
53
|
-
|
54
|
-
* Numerous internal improvements.
|
55
|
-
|
56
|
-
* Documentation typos and fixes.
|
57
|
-
|
58
|
-
=== Bug Fixes (0.9.4)
|
59
|
-
|
60
|
-
* Exit status with failing tests is not correctly set to non-zero.
|
61
|
-
|
62
|
-
* Simplified syntax for phony task (for older versions of RDoc).
|
63
|
-
|
64
|
-
* Stand alone FileList usage gets glob function (without loading in
|
65
|
-
extra dependencies)
|
66
|
-
|
67
|
-
=== Bug Fixes (0.9.5)
|
68
|
-
|
69
|
-
* --trace and --backtrace no longer swallow following task names.
|
70
|
-
|
71
|
-
=== Bug Fixes (0.9.6)
|
72
|
-
|
73
|
-
* Better trace output when using a multi-threaded Rakefile.
|
74
|
-
* Arg parsing is now consistent for tasks and multitasks.
|
75
|
-
* Skip exit code test in versions of Ruby that don't support it well.
|
76
|
-
|
77
|
-
Changes for better integration with the Ruby source tree:
|
78
|
-
|
79
|
-
* Fix version literal for Ruby source tree build.
|
80
|
-
* Better loading of libraries for testing in Ruby build.
|
81
|
-
* Use the ruby version provided by Ruby's tests.
|
82
|
-
|
83
|
-
== What is Rake
|
84
|
-
|
85
|
-
Rake is a build tool similar to the make program in many ways. But
|
86
|
-
instead of cryptic make recipes, Rake uses standard Ruby code to
|
87
|
-
declare tasks and dependencies. You have the full power of a modern
|
88
|
-
scripting language built right into your build tool.
|
89
|
-
|
90
|
-
== Availability
|
91
|
-
|
92
|
-
The easiest way to get and install rake is via RubyGems ...
|
93
|
-
|
94
|
-
gem install rake (you may need root/admin privileges)
|
95
|
-
|
96
|
-
Otherwise, you can get it from the more traditional places:
|
97
|
-
|
98
|
-
Home Page:: http://github.com/jimweirich/rake
|
99
|
-
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
100
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
101
|
-
|
102
|
-
== Thanks
|
103
|
-
|
104
|
-
As usual, it was input from users that drove a alot of these changes. The
|
105
|
-
following people either contributed patches, made suggestions or made
|
106
|
-
otherwise helpful comments. Thanks to ...
|
107
|
-
|
108
|
-
* Aaron Patterson
|
109
|
-
* Dylan Smith
|
110
|
-
* Jo Liss
|
111
|
-
* Jonas Pfenniger
|
112
|
-
* Kazuki Tsujimoto
|
113
|
-
* Michael Bishop
|
114
|
-
* Michael Elufimov
|
115
|
-
* NAKAMURA Usaku
|
116
|
-
* Ryan Davis
|
117
|
-
* Sam Grönblom
|
118
|
-
* Sam Phippen
|
119
|
-
* Sergio Wong
|
120
|
-
* Tay Ray Chuan
|
121
|
-
* grosser
|
122
|
-
* quix
|
123
|
-
|
124
|
-
Also, many thanks to Eric Hodel for assisting with getting this release
|
125
|
-
out the door.
|
126
|
-
|
127
|
-
-- Jim Weirich
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# The following classes used to be in the top level namespace.
|
2
|
-
# Loading this file enables compatibility with older Rakefile that
|
3
|
-
# referenced Task from the top level.
|
4
|
-
|
5
|
-
warn "WARNING: Classic namespaces are deprecated and will be removed from future versions of Rake."
|
6
|
-
# :stopdoc:
|
7
|
-
Task = Rake::Task
|
8
|
-
FileTask = Rake::FileTask
|
9
|
-
FileCreationTask = Rake::FileCreationTask
|
10
|
-
RakeApp = Rake::Application
|
11
|
-
# :startdoc:
|
data/lib/rake/contrib/sys.rb
DELETED
@@ -1,192 +0,0 @@
|
|
1
|
-
warn 'Sys has been deprecated in favor of FileUtils'
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
|
5
|
-
# All rights reserved.
|
6
|
-
#++
|
7
|
-
#
|
8
|
-
begin
|
9
|
-
require 'ftools'
|
10
|
-
rescue LoadError
|
11
|
-
end
|
12
|
-
require 'rbconfig'
|
13
|
-
require 'rake/file_list'
|
14
|
-
|
15
|
-
######################################################################
|
16
|
-
# Sys provides a number of file manipulation tools for the convenience
|
17
|
-
# of writing Rakefiles. All commands in this module will announce
|
18
|
-
# their activity on standard output if the $verbose flag is set
|
19
|
-
# ($verbose = true is the default). You can control this by globally
|
20
|
-
# setting $verbose or by using the +verbose+ and +quiet+ methods.
|
21
|
-
#
|
22
|
-
# Sys has been deprecated in favor of the FileUtils module available
|
23
|
-
# in Ruby 1.8.
|
24
|
-
#
|
25
|
-
module Sys
|
26
|
-
RUBY = RbConfig::CONFIG['ruby_install_name']
|
27
|
-
|
28
|
-
# Install all the files matching +wildcard+ into the +dest_dir+
|
29
|
-
# directory. The permission mode is set to +mode+.
|
30
|
-
def install(wildcard, dest_dir, mode)
|
31
|
-
FileList.glob(wildcard).each do |fn|
|
32
|
-
File.install(fn, dest_dir, mode, $verbose)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Run the system command +cmd+.
|
37
|
-
def run(cmd)
|
38
|
-
log cmd
|
39
|
-
system(cmd) or fail "Command Failed: [#{cmd}]"
|
40
|
-
end
|
41
|
-
|
42
|
-
# Run a Ruby interpreter with the given arguments.
|
43
|
-
def ruby(*args)
|
44
|
-
run "#{RUBY} #{args.join(' ')}"
|
45
|
-
end
|
46
|
-
|
47
|
-
# Copy a single file from +file_name+ to +dest_file+.
|
48
|
-
def copy(file_name, dest_file)
|
49
|
-
log "Copying file #{file_name} to #{dest_file}"
|
50
|
-
File.copy(file_name, dest_file)
|
51
|
-
end
|
52
|
-
|
53
|
-
# Copy all files matching +wildcard+ into the directory +dest_dir+.
|
54
|
-
def copy_files(wildcard, dest_dir)
|
55
|
-
for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }
|
56
|
-
end
|
57
|
-
|
58
|
-
# Link +file_name+ to +dest_file+.
|
59
|
-
def link(file_name, dest_file)
|
60
|
-
log "Linking file #{file_name} to #{dest_file}"
|
61
|
-
File.link(file_name, dest_file)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Link all files matching +wildcard+ into the directory +dest_dir+.
|
65
|
-
def link_files(wildcard, dest_dir)
|
66
|
-
for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
|
67
|
-
end
|
68
|
-
|
69
|
-
# Symlink +file_name+ to +dest_file+.
|
70
|
-
def symlink(file_name, dest_file)
|
71
|
-
log "Symlinking file #{file_name} to #{dest_file}"
|
72
|
-
File.symlink(file_name, dest_file)
|
73
|
-
end
|
74
|
-
|
75
|
-
# Symlink all files matching +wildcard+ into the directory +dest_dir+.
|
76
|
-
def symlink_files(wildcard, dest_dir)
|
77
|
-
for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
|
78
|
-
end
|
79
|
-
|
80
|
-
# Remove all files matching +wildcard+. If a matching file is a
|
81
|
-
# directory, it must be empty to be removed. used +delete_all+ to
|
82
|
-
# recursively delete directories.
|
83
|
-
def delete(*wildcards)
|
84
|
-
wildcards.each do |wildcard|
|
85
|
-
FileList.glob(wildcard).each do |fn|
|
86
|
-
if File.directory?(fn)
|
87
|
-
log "Deleting directory #{fn}"
|
88
|
-
Dir.delete(fn)
|
89
|
-
else
|
90
|
-
log "Deleting file #{fn}"
|
91
|
-
File.delete(fn)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# Recursively delete all files and directories matching +wildcard+.
|
98
|
-
def delete_all(*wildcards)
|
99
|
-
wildcards.each do |wildcard|
|
100
|
-
FileList.glob(wildcard).each do |fn|
|
101
|
-
next if ! File.exist?(fn)
|
102
|
-
if File.directory?(fn)
|
103
|
-
FileList.glob("#{fn}/*").each do |subfn|
|
104
|
-
next if subfn=='.' || subfn=='..'
|
105
|
-
delete_all(subfn)
|
106
|
-
end
|
107
|
-
log "Deleting directory #{fn}"
|
108
|
-
Dir.delete(fn)
|
109
|
-
else
|
110
|
-
log "Deleting file #{fn}"
|
111
|
-
File.delete(fn)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# Make the directories given in +dirs+.
|
118
|
-
def makedirs(*dirs)
|
119
|
-
dirs.each do |fn|
|
120
|
-
log "Making directory #{fn}"
|
121
|
-
File.makedirs(fn)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
# Make +dir+ the current working directory for the duration of
|
126
|
-
# executing the given block.
|
127
|
-
def indir(dir)
|
128
|
-
olddir = Dir.pwd
|
129
|
-
Dir.chdir(dir)
|
130
|
-
yield
|
131
|
-
ensure
|
132
|
-
Dir.chdir(olddir)
|
133
|
-
end
|
134
|
-
|
135
|
-
# Split a file path into individual directory names.
|
136
|
-
#
|
137
|
-
# For example:
|
138
|
-
# split_all("a/b/c") => ['a', 'b', 'c']
|
139
|
-
def split_all(path)
|
140
|
-
head, tail = File.split(path)
|
141
|
-
return [tail] if head == '.' || tail == '/'
|
142
|
-
return [head, tail] if head == '/'
|
143
|
-
return split_all(head) + [tail]
|
144
|
-
end
|
145
|
-
|
146
|
-
# Write a message to standard error if $verbose is enabled.
|
147
|
-
def log(msg)
|
148
|
-
print " " if $trace && $verbose
|
149
|
-
$stderr.puts msg if $verbose
|
150
|
-
end
|
151
|
-
|
152
|
-
# Perform a block with $verbose disabled.
|
153
|
-
def quiet(&block)
|
154
|
-
with_verbose(false, &block)
|
155
|
-
end
|
156
|
-
|
157
|
-
# Perform a block with $verbose enabled.
|
158
|
-
def verbose(&block)
|
159
|
-
with_verbose(true, &block)
|
160
|
-
end
|
161
|
-
|
162
|
-
# Perform a block with each file matching a set of wildcards.
|
163
|
-
def for_files(*wildcards)
|
164
|
-
wildcards.each do |wildcard|
|
165
|
-
FileList.glob(wildcard).each do |fn|
|
166
|
-
yield(fn)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
extend(self)
|
172
|
-
|
173
|
-
private # ----------------------------------------------------------
|
174
|
-
|
175
|
-
def for_matching_files(wildcard, dest_dir)
|
176
|
-
FileList.glob(wildcard).each do |fn|
|
177
|
-
dest_file = File.join(dest_dir, fn)
|
178
|
-
parent = File.dirname(dest_file)
|
179
|
-
makedirs(parent) if ! File.directory?(parent)
|
180
|
-
yield(fn, dest_file)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
def with_verbose(v)
|
185
|
-
oldverbose = $verbose
|
186
|
-
$verbose = v
|
187
|
-
yield
|
188
|
-
ensure
|
189
|
-
$verbose = oldverbose
|
190
|
-
end
|
191
|
-
|
192
|
-
end
|