jimweirich-rake 0.8.3.1 → 0.8.3.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rake/rdoctask.rb CHANGED
@@ -10,7 +10,7 @@ module Rake
10
10
  #
11
11
  # The RDocTask will create the following targets:
12
12
  #
13
- # [<b><em>rdoc</em></b>]
13
+ # [<b>:<em>rdoc</em></b>]
14
14
  # Main task for this RDOC task.
15
15
  #
16
16
  # [<b>:clobber_<em>rdoc</em></b>]
@@ -21,13 +21,18 @@ module Rake
21
21
  # Rebuild the rdoc files from scratch, even if they are not out
22
22
  # of date.
23
23
  #
24
- # Simple Example:
24
+ # Simple example:
25
25
  #
26
26
  # Rake::RDocTask.new do |rd|
27
27
  # rd.main = "README.rdoc"
28
28
  # rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
29
29
  # end
30
30
  #
31
+ # The +rd+ object passed to the block is an RDocTask object. See the
32
+ # attributes list for the RDocTask class for available customization options.
33
+ #
34
+ # == Specifying different task names
35
+ #
31
36
  # You may wish to give the task a different name, such as if you are
32
37
  # generating two sets of documentation. For instance, if you want to have a
33
38
  # development set of documentation including private methods:
@@ -39,7 +44,17 @@ module Rake
39
44
  # end
40
45
  #
41
46
  # The tasks would then be named :<em>rdoc_dev</em>, :clobber_<em>rdoc_dev</em>, and
42
- # :re<em>rdoc_dev</em>.
47
+ # :re<em>rdoc_dev</em>.
48
+ #
49
+ # If you wish to have completely different task names, then pass a Hash as
50
+ # first argument. With the <tt>:rdoc</tt>, <tt>:clobber_rdoc</tt> and
51
+ # <tt>:rerdoc</tt> options, you can customize the task names to your liking.
52
+ # For example:
53
+ #
54
+ # Rake::RDocTask.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force")
55
+ #
56
+ # This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc_clean</tt> and
57
+ # <tt>:rdoc:force</tt>.
43
58
  #
44
59
  class RDocTask < TaskLib
45
60
  # Name of the main, top level task. (default is :rdoc)
@@ -48,7 +63,7 @@ module Rake
48
63
  # Name of directory to receive the html output files. (default is "html")
49
64
  attr_accessor :rdoc_dir
50
65
 
51
- # Title of RDoc documentation. (default is none)
66
+ # Title of RDoc documentation. (defaults to rdoc's default)
52
67
  attr_accessor :title
53
68
 
54
69
  # Name of file to be used as the main, top level file of the
@@ -61,14 +76,24 @@ module Rake
61
76
  # List of files to be included in the rdoc generation. (default is [])
62
77
  attr_accessor :rdoc_files
63
78
 
64
- # List of options to be passed rdoc. (default is [])
79
+ # Additional list of options to be passed rdoc. (default is [])
65
80
  attr_accessor :options
66
81
 
67
- # Run the rdoc process as an external shell (default is false)
82
+ # Whether to run the rdoc process as an external shell (default is false)
68
83
  attr_accessor :external
69
-
70
- # Create an RDoc task named <em>rdoc</em>. Default task name is +rdoc+.
71
- def initialize(name=:rdoc) # :yield: self
84
+
85
+ attr_accessor :inline_source
86
+
87
+ # Create an RDoc task with the given name. See the RDocTask class overview
88
+ # for documentation.
89
+ def initialize(name = :rdoc) # :yield: self
90
+ if name.is_a?(Hash)
91
+ invalid_options = name.keys.map { |k| k.to_sym } - [:rdoc, :clobber_rdoc, :rerdoc]
92
+ if !invalid_options.empty?
93
+ raise ArgumentError, "Invalid option(s) passed to RDocTask.new: #{invalid_options.join(", ")}"
94
+ end
95
+ end
96
+
72
97
  @name = name
73
98
  @rdoc_files = Rake::FileList.new
74
99
  @rdoc_dir = 'html'
@@ -76,6 +101,7 @@ module Rake
76
101
  @title = nil
77
102
  @template = nil
78
103
  @external = false
104
+ @inline_source = true
79
105
  @options = []
80
106
  yield self if block_given?
81
107
  define
@@ -83,27 +109,28 @@ module Rake
83
109
 
84
110
  # Create the tasks defined by this task lib.
85
111
  def define
86
- if name.to_s != "rdoc"
112
+ if rdoc_task_name != "rdoc"
87
113
  desc "Build the RDOC HTML Files"
114
+ else
115
+ desc "Build the #{rdoc_task_name} HTML Files"
88
116
  end
89
-
90
- desc "Build the #{name} HTML Files"
91
- task name
117
+ task rdoc_task_name
92
118
 
93
119
  desc "Force a rebuild of the RDOC files"
94
- task "re#{name}" => ["clobber_#{name}", name]
120
+ task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
95
121
 
96
122
  desc "Remove rdoc products"
97
- task "clobber_#{name}" do
123
+ task clobber_task_name do
98
124
  rm_r rdoc_dir rescue nil
99
125
  end
100
126
 
101
- task :clobber => ["clobber_#{name}"]
127
+ task :clobber => [clobber_task_name]
102
128
 
103
129
  directory @rdoc_dir
104
- task name => [rdoc_target]
130
+ task rdoc_task_name => [rdoc_target]
105
131
  file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
106
132
  rm_r @rdoc_dir rescue nil
133
+ @before_running_rdoc.call if @before_running_rdoc
107
134
  args = option_list + @rdoc_files
108
135
  if @external
109
136
  argstring = args.join(' ')
@@ -122,6 +149,7 @@ module Rake
122
149
  result << "--main" << quote(main) if main
123
150
  result << "--title" << quote(title) if title
124
151
  result << "-T" << quote(template) if template
152
+ result << "--inline-source" if inline_source && !@options.include?("--inline-source") && !@options.include?("-S")
125
153
  result
126
154
  end
127
155
 
@@ -136,12 +164,46 @@ module Rake
136
164
  def option_string
137
165
  option_list.join(' ')
138
166
  end
167
+
168
+ # The block passed to this method will be called just before running the
169
+ # RDoc generator. It is allowed to modify RDocTask attributes inside the
170
+ # block.
171
+ def before_running_rdoc(&block)
172
+ @before_running_rdoc = block
173
+ end
139
174
 
140
175
  private
141
-
176
+
142
177
  def rdoc_target
143
178
  "#{rdoc_dir}/index.html"
144
179
  end
180
+
181
+ def rdoc_task_name
182
+ case name
183
+ when Hash
184
+ (name[:rdoc] || "rdoc").to_s
185
+ else
186
+ name.to_s
187
+ end
188
+ end
189
+
190
+ def clobber_task_name
191
+ case name
192
+ when Hash
193
+ (name[:clobber_rdoc] || "clobber_rdoc").to_s
194
+ else
195
+ "clobber_#{name}"
196
+ end
197
+ end
198
+
199
+ def rerdoc_task_name
200
+ case name
201
+ when Hash
202
+ (name[:rerdoc] || "rerdoc").to_s
203
+ else
204
+ "re#{name}"
205
+ end
206
+ end
145
207
 
146
208
  end
147
209
  end
data/lib/rake/testtask.rb CHANGED
@@ -95,7 +95,7 @@ module Rake
95
95
 
96
96
  # Create the tasks defined by this task lib.
97
97
  def define
98
- lib_path = @libs.join(File::PATH_SEPARATOR)
98
+ lib_path = @libs.collect {|path| "-I\"#{File.expand_path(path)}\""}.join(' ')
99
99
  desc "Run tests" + (@name==:test ? "" : " for #{@name}")
100
100
  task @name do
101
101
  run_code = ''
@@ -109,7 +109,7 @@ module Rake
109
109
  when :rake
110
110
  rake_loader
111
111
  end
112
- @ruby_opts.unshift( "-I#{lib_path}" )
112
+ @ruby_opts.unshift( lib_path )
113
113
  @ruby_opts.unshift( "-w" ) if @warning
114
114
  ruby @ruby_opts.join(" ") +
115
115
  " \"#{run_code}\" " +
data/lib/rake/win32.rb CHANGED
@@ -12,7 +12,7 @@ module Rake
12
12
  class << self
13
13
  # True if running on a windows system.
14
14
  def windows?
15
- Config::CONFIG['host_os'] =~ /mswin/
15
+ Config::CONFIG['host_os'] =~ /mswin|mingw/
16
16
  end
17
17
 
18
18
  # Run a command line on windows.
@@ -28,22 +28,25 @@ module Rake
28
28
  # Win 32 systems. Try the following environment variables (in
29
29
  # order):
30
30
  #
31
- # * APPDATA
31
+ # * HOME
32
32
  # * HOMEDRIVE + HOMEPATH
33
+ # * APPDATA
33
34
  # * USERPROFILE
34
35
  #
35
36
  # If the above are not defined, the return nil.
36
37
  def win32_system_dir #:nodoc:
37
- win32_shared_path = ENV['APPDATA']
38
+ win32_shared_path = ENV['HOME']
38
39
  if win32_shared_path.nil? && ENV['HOMEDRIVE'] && ENV['HOMEPATH']
39
40
  win32_shared_path = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
40
41
  end
42
+
43
+ win32_shared_path ||= ENV['APPDATA']
41
44
  win32_shared_path ||= ENV['USERPROFILE']
42
45
  raise Win32HomeError, "Unable to determine home path environment variable." if
43
46
  win32_shared_path.nil? or win32_shared_path.empty?
44
47
  normalize(File.join(win32_shared_path, 'Rake'))
45
48
  end
46
-
49
+
47
50
  # Normalize a win32 path so that the slashes are all forward slashes.
48
51
  def normalize(path)
49
52
  path.gsub(/\\/, '/')
data/lib/rake.rb CHANGED
@@ -29,7 +29,7 @@
29
29
  # as a library via a require statement, but it can be distributed
30
30
  # independently as an application.
31
31
 
32
- RAKEVERSION = '0.8.3.1'
32
+ RAKEVERSION = '0.8.3.99'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'fileutils'
@@ -749,9 +749,7 @@ module Rake
749
749
  # Is this file task needed? Yes if it doesn't exist, or if its time stamp
750
750
  # is out of date.
751
751
  def needed?
752
- return true unless File.exist?(name)
753
- return true if out_of_date?(timestamp)
754
- false
752
+ ! File.exist?(name) || out_of_date?(timestamp)
755
753
  end
756
754
 
757
755
  # Time stamp for file task.
@@ -1650,9 +1648,9 @@ module Rake
1650
1648
  @task_manager.lookup(name, @scope)
1651
1649
  end
1652
1650
 
1653
- # Return the list of tasks defined in this namespace.
1651
+ # Return the list of tasks defined in this and nested namespaces.
1654
1652
  def tasks
1655
- @task_manager.tasks
1653
+ @task_manager.tasks_in_scope(@scope)
1656
1654
  end
1657
1655
  end # NameSpace
1658
1656
 
@@ -1797,6 +1795,15 @@ module Rake
1797
1795
  @tasks.values.sort_by { |t| t.name }
1798
1796
  end
1799
1797
 
1798
+ # List of all the tasks defined in the given scope (and its
1799
+ # sub-scopes).
1800
+ def tasks_in_scope(scope)
1801
+ prefix = scope.join(":")
1802
+ tasks.select { |t|
1803
+ /^#{prefix}:/ =~ t.name
1804
+ }
1805
+ end
1806
+
1800
1807
  # Clear all tasks in this application.
1801
1808
  def clear
1802
1809
  @tasks.clear
@@ -1975,7 +1982,8 @@ module Rake
1975
1982
  def init(app_name='rake')
1976
1983
  standard_exception_handling do
1977
1984
  @name = app_name
1978
- collect_tasks handle_options
1985
+ handle_options
1986
+ collect_tasks
1979
1987
  end
1980
1988
  end
1981
1989
 
@@ -2058,7 +2066,10 @@ module Rake
2058
2066
  # If a match is found, it is copied into @rakefile.
2059
2067
  def have_rakefile
2060
2068
  @rakefiles.each do |fn|
2061
- if File.exist?(fn) || fn == ''
2069
+ if File.exist?(fn)
2070
+ others = Dir.glob(fn, File::FNM_CASEFOLD)
2071
+ return others.size == 1 ? others.first : fn
2072
+ elsif fn == ''
2062
2073
  return fn
2063
2074
  end
2064
2075
  end
@@ -2275,18 +2286,18 @@ module Rake
2275
2286
  def handle_options
2276
2287
  options.rakelib = ['rakelib']
2277
2288
 
2278
- opts = OptionParser.new
2279
- opts.banner = "rake [-f rakefile] {options} targets..."
2280
- opts.separator ""
2281
- opts.separator "Options are ..."
2282
-
2283
- opts.on_tail("-h", "--help", "-H", "Display this help message.") do
2284
- puts opts
2285
- exit
2286
- end
2287
-
2288
- standard_rake_options.each { |args| opts.on(*args) }
2289
- parsed_argv = opts.parse(ARGV)
2289
+ OptionParser.new do |opts|
2290
+ opts.banner = "rake [-f rakefile] {options} targets..."
2291
+ opts.separator ""
2292
+ opts.separator "Options are ..."
2293
+
2294
+ opts.on_tail("-h", "--help", "-H", "Display this help message.") do
2295
+ puts opts
2296
+ exit
2297
+ end
2298
+
2299
+ standard_rake_options.each { |args| opts.on(*args) }
2300
+ end.parse!
2290
2301
 
2291
2302
  # If class namespaces are requested, set the global options
2292
2303
  # according to the values in the options structure.
@@ -2297,7 +2308,6 @@ module Rake
2297
2308
  $dryrun = options.dryrun
2298
2309
  $silent = options.silent
2299
2310
  end
2300
- parsed_argv
2301
2311
  end
2302
2312
 
2303
2313
  # Similar to the regular Ruby +require+ command, but will check
@@ -2384,9 +2394,9 @@ module Rake
2384
2394
  # Collect the list of tasks on the command line. If no tasks are
2385
2395
  # given, return a list containing only the default task.
2386
2396
  # Environmental assignments are processed at this time as well.
2387
- def collect_tasks(argv)
2397
+ def collect_tasks
2388
2398
  @top_level_tasks = []
2389
- argv.each do |arg|
2399
+ ARGV.each do |arg|
2390
2400
  if arg =~ /^(\w+)=(.*)$/
2391
2401
  ENV[$1] = $2
2392
2402
  else
data/test/data/sample.mf CHANGED
@@ -10,3 +10,5 @@ c: c1
10
10
  d: d1 d2 \
11
11
 
12
12
  e f : e1 f1
13
+
14
+ g\ 0: g1 g\ 2 g\ 3 g4
@@ -8,3 +8,17 @@ rescue LoadError
8
8
  end
9
9
 
10
10
  require 'flexmock/test_unit'
11
+
12
+ if RUBY_VERSION >= "1.9.0"
13
+ class Test::Unit::TestCase
14
+ # def passed?
15
+ # true
16
+ # end
17
+ end
18
+ end
19
+
20
+ module TestMethods
21
+ def assert_exception(ex, msg=nil, &block)
22
+ assert_raise(ex, msg, &block)
23
+ end
24
+ end
@@ -8,6 +8,7 @@ require 'test/unit'
8
8
  require 'fileutils'
9
9
  require 'session'
10
10
  require 'test/in_environment'
11
+ require 'test/rake_test_setup'
11
12
 
12
13
  # Version 2.1.9 of session has a bug where the @debug instance
13
14
  # variable is not initialized, causing warning messages. This snippet
@@ -24,6 +25,7 @@ end
24
25
 
25
26
  class FunctionalTest < Test::Unit::TestCase
26
27
  include InEnvironment
28
+ include TestMethods
27
29
 
28
30
  RUBY_COMMAND = 'ruby'
29
31
 
@@ -18,6 +18,7 @@ TESTING_REQUIRE = [ ]
18
18
  class TestApplication < Test::Unit::TestCase
19
19
  include CaptureStdout
20
20
  include InEnvironment
21
+ include TestMethods
21
22
 
22
23
  def setup
23
24
  @app = Rake::Application.new
@@ -109,7 +110,7 @@ class TestApplication < Test::Unit::TestCase
109
110
  end
110
111
 
111
112
  def test_finding_rakefile
112
- assert_match(/[Rr]akefile/, @app.instance_eval { have_rakefile })
113
+ assert_match(/Rakefile/i, @app.instance_eval { have_rakefile })
113
114
  end
114
115
 
115
116
  def test_not_finding_rakefile
@@ -148,7 +149,7 @@ class TestApplication < Test::Unit::TestCase
148
149
  handle_options
149
150
  options.silent = true
150
151
  end
151
- ex = assert_raise(RuntimeError) do
152
+ ex = assert_exception(RuntimeError) do
152
153
  @app.instance_eval do raw_load_rakefile end
153
154
  end
154
155
  assert_match(/no rakefile found/i, ex.message)
@@ -162,6 +163,7 @@ class TestApplication < Test::Unit::TestCase
162
163
  handle_options
163
164
  options.silent = true
164
165
  options.load_system = true
166
+ options.rakelib = []
165
167
  load_rakefile
166
168
  end
167
169
  assert_equal "test/data/sys", @app.system_dir
@@ -170,9 +172,9 @@ class TestApplication < Test::Unit::TestCase
170
172
  end
171
173
 
172
174
  def test_load_from_system_rakefile_on_unix
173
- flexmock(@app, :windows? => false,
174
- :win32_system_dir => nil,
175
- :load => nil)
175
+ flexmock(Rake::Win32, :windows? => false,
176
+ :win32_system_dir => nil)
177
+ flexmock(@app, :load => nil)
176
178
  flexmock(File).should_receive(:expand_path).with("~").and_return("/HOME")
177
179
  flexmock(File).should_receive(:expand_path).and_return { |fn| fn }
178
180
 
@@ -182,6 +184,7 @@ class TestApplication < Test::Unit::TestCase
182
184
  handle_options
183
185
  options.silent = true
184
186
  options.load_system = true
187
+ options.rakelib = []
185
188
  load_rakefile
186
189
  end
187
190
  assert_equal "/HOME/.rake", @app.system_dir
@@ -195,17 +198,18 @@ class TestApplication < Test::Unit::TestCase
195
198
  def test_load_from_system_rakefile_on_windows
196
199
  flexmock(Rake::Win32, :windows? => true)
197
200
  flexmock(@app, :standard_system_dir => "XX")
198
- flexmock(@app).should_receive(:directory?).with("/AD/Rake").and_return(true)
199
201
  flexmock(@app).should_receive(:load).and_return(nil)
200
- in_environment('RAKE_SYSTEM' => nil, 'APPDATA' => '/AD') do
202
+ flexmock(File).should_receive(:directory?).with("D:/AD/Rake").and_return(true)
203
+ in_environment('RAKE_SYSTEM' => nil, 'HOME' => nil, 'HOMEDRIVE' => 'D:', 'HOMEPATH' => '\\AD') do
201
204
  @app.options.rakelib = []
202
205
  @app.instance_eval do
203
206
  handle_options
204
207
  options.silent = true
205
208
  options.load_system = true
209
+ options.rakelib = []
206
210
  load_rakefile
207
211
  end
208
- assert_equal "/AD/Rake", @app.system_dir
212
+ assert_equal "D:/AD/Rake", @app.system_dir
209
213
  end
210
214
  end
211
215
 
@@ -231,6 +235,19 @@ class TestApplication < Test::Unit::TestCase
231
235
  end
232
236
  end
233
237
 
238
+ def test_handle_options__should_strip_options_from_ARGV
239
+ assert !@app.options.trace
240
+
241
+ valid_option = '--trace'
242
+ ARGV.clear
243
+ ARGV << valid_option
244
+
245
+ @app.handle_options
246
+
247
+ assert !ARGV.include?(valid_option)
248
+ assert @app.options.trace
249
+ end
250
+
234
251
  def test_good_run
235
252
  ran = false
236
253
  ARGV.clear
@@ -279,7 +296,7 @@ class TestApplication < Test::Unit::TestCase
279
296
  @app.intern(Rake::Task, "default").enhance { fail }
280
297
  ARGV.clear
281
298
  ARGV << '-f' << '-s' << '--rakelib=""'
282
- assert_raise(SystemExit) {
299
+ assert_exception(SystemExit) {
283
300
  err = capture_stderr { @app.run }
284
301
  assert_match(/see full trace/, err)
285
302
  }
@@ -291,7 +308,7 @@ class TestApplication < Test::Unit::TestCase
291
308
  @app.intern(Rake::Task, "default").enhance { fail }
292
309
  ARGV.clear
293
310
  ARGV << '-f' << '-s' << '-t'
294
- assert_raise(SystemExit) {
311
+ assert_exception(SystemExit) {
295
312
  err = capture_stderr { capture_stdout { @app.run } }
296
313
  assert_no_match(/see full trace/, err)
297
314
  }
@@ -303,7 +320,7 @@ class TestApplication < Test::Unit::TestCase
303
320
  @app.intern(Rake::Task, "default").enhance { fail }
304
321
  ARGV.clear
305
322
  ARGV << '-f' << '-s' << '--xyzzy'
306
- assert_raise(SystemExit) {
323
+ assert_exception(SystemExit) {
307
324
  err = capture_stderr { capture_stdout { @app.run } }
308
325
  }
309
326
  ensure
@@ -315,6 +332,7 @@ end
315
332
  ######################################################################
316
333
  class TestApplicationOptions < Test::Unit::TestCase
317
334
  include CaptureStdout
335
+ include TestMethods
318
336
 
319
337
  def setup
320
338
  clear_argv
@@ -447,7 +465,7 @@ class TestApplicationOptions < Test::Unit::TestCase
447
465
  end
448
466
 
449
467
  def test_missing_require
450
- ex = assert_raises(LoadError) do
468
+ ex = assert_exception(LoadError) do
451
469
  flags(['--require', 'test/missing']) do |opts|
452
470
  end
453
471
  end
@@ -546,7 +564,7 @@ class TestApplicationOptions < Test::Unit::TestCase
546
564
 
547
565
  def test_bad_option
548
566
  capture_stderr do
549
- ex = assert_raise(OptionParser::InvalidOption) do
567
+ ex = assert_exception(OptionParser::InvalidOption) do
550
568
  flags('--bad-option')
551
569
  end
552
570
  if ex.message =~ /^While/ # Ruby 1.9 error message
@@ -594,7 +612,8 @@ class TestApplicationOptions < Test::Unit::TestCase
594
612
  throw :system_exit, :exit
595
613
  end
596
614
  @app.instance_eval do
597
- collect_tasks handle_options
615
+ handle_options
616
+ collect_tasks
598
617
  end
599
618
  @tasks = @app.top_level_tasks
600
619
  @app.options
@@ -4,10 +4,13 @@ require 'test/unit'
4
4
  require 'fileutils'
5
5
  require 'rake'
6
6
  require 'test/filecreation'
7
+ require 'test/rake_test_setup'
7
8
 
8
9
  ######################################################################
9
10
  class TestDefinitions < Test::Unit::TestCase
10
11
  include Rake
12
+ include TestMethods
13
+
11
14
  EXISTINGFILE = "testdata/existing"
12
15
 
13
16
  def setup
@@ -58,7 +61,7 @@ class TestDefinitions < Test::Unit::TestCase
58
61
 
59
62
  def test_missing_dependencies
60
63
  task :x => ["testdata/missing"]
61
- assert_raises(RuntimeError) { Task[:x].invoke }
64
+ assert_exception(RuntimeError) { Task[:x].invoke }
62
65
  end
63
66
 
64
67
  def test_implicit_file_dependencies
@@ -4,11 +4,13 @@ require 'test/unit'
4
4
  require 'fileutils'
5
5
  require 'rake'
6
6
  require 'test/filecreation'
7
+ require 'test/rake_test_setup'
7
8
 
8
9
  ######################################################################
9
10
  class TestFileTask < Test::Unit::TestCase
10
11
  include Rake
11
12
  include FileCreation
13
+ include TestMethods
12
14
 
13
15
  def setup
14
16
  Task.clear
@@ -118,22 +120,24 @@ class TestDirectoryTask < Test::Unit::TestCase
118
120
  assert ! File.exist?("testdata/a/b/c")
119
121
  end
120
122
 
121
- def test_directory_win32
122
- desc "WIN32 DESC"
123
- FileUtils.mkdir_p("testdata")
124
- Dir.chdir("testdata") do
125
- directory 'c:/testdata/a/b/c'
126
- assert_equal FileCreationTask, Task['c:/testdata'].class
127
- assert_equal FileCreationTask, Task['c:/testdata/a'].class
128
- assert_equal FileCreationTask, Task['c:/testdata/a/b/c'].class
129
- assert_nil Task['c:/testdata'].comment
130
- assert_equal "WIN32 DESC", Task['c:/testdata/a/b/c'].comment
131
- assert_nil Task['c:/testdata/a/b'].comment
132
- verbose(false) {
133
- Task['c:/testdata/a/b'].invoke
134
- }
135
- assert File.exist?('c:/testdata/a/b')
136
- assert ! File.exist?('c:/testdata/a/b/c')
123
+ if Rake::Win32.windows?
124
+ def test_directory_win32
125
+ desc "WIN32 DESC"
126
+ FileUtils.mkdir_p("testdata")
127
+ Dir.chdir("testdata") do
128
+ directory 'c:/testdata/a/b/c'
129
+ assert_equal FileCreationTask, Task['c:/testdata'].class
130
+ assert_equal FileCreationTask, Task['c:/testdata/a'].class
131
+ assert_equal FileCreationTask, Task['c:/testdata/a/b/c'].class
132
+ assert_nil Task['c:/testdata'].comment
133
+ assert_equal "WIN32 DESC", Task['c:/testdata/a/b/c'].comment
134
+ assert_nil Task['c:/testdata/a/b'].comment
135
+ verbose(false) {
136
+ Task['c:/testdata/a/b'].invoke
137
+ }
138
+ assert File.exist?('c:/testdata/a/b')
139
+ assert ! File.exist?('c:/testdata/a/b/c')
140
+ end
137
141
  end
138
142
  end
139
143
  end
@@ -4,10 +4,12 @@ require 'test/unit'
4
4
  require 'rake'
5
5
 
6
6
  require 'test/capture_stdout'
7
+ require 'test/rake_test_setup'
7
8
 
8
9
  class TestFileList < Test::Unit::TestCase
9
10
  FileList = Rake::FileList
10
11
  include CaptureStdout
12
+ include TestMethods
11
13
 
12
14
  def setup
13
15
  create_test_data
@@ -442,7 +444,7 @@ class TestFileList < Test::Unit::TestCase
442
444
  a = FileList['a', 'b', 'c']
443
445
  a.freeze
444
446
  c = a.clone
445
- assert_raise(TypeError, RuntimeError) do
447
+ assert_exception(TypeError, RuntimeError) do
446
448
  c << 'more'
447
449
  end
448
450
  end