rake 0.4.12 → 0.4.13

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/CHANGES CHANGED
@@ -1,6 +1,16 @@
1
1
  = Rake Changelog
2
2
 
3
- == pre Version 0.4.11
3
+ == Version 0.4.13
4
+
5
+ * Fixed the dry-run flag so it is operating again.
6
+ * Multiple arguments to sh and ruby commands will not be interpreted
7
+ by the shell (patch provided by Jonathan Paisley).
8
+
9
+ == Version 0.4.12
10
+
11
+ * Added --silent (-s) to suppress the (in directory) rake message.
12
+
13
+ == Version 0.4.11
4
14
 
5
15
  * Changed the "don't know how to rake" message (finally)
6
16
  * Changes references to a literal "Rakefile" to reference the global
data/Rakefile CHANGED
@@ -32,11 +32,20 @@ SRC_RB = FileList['lib/**/*.rb']
32
32
  # The default task is run if rake is given no explicit arguments.
33
33
 
34
34
  desc "Default Task"
35
- task :default => :test
35
+ task :default => :testall
36
36
 
37
37
  # Test Tasks ---------------------------------------------------------
38
38
 
39
- Rake::TestTask.new do |t|
39
+ Rake::TestTask.new(:testall) do |t|
40
+ t.test_files = FileList[
41
+ 'test/test*.rb',
42
+ 'test/contrib/test*.rb',
43
+ 'test/fun*.rb'
44
+ ]
45
+ t.verbose = true
46
+ end
47
+
48
+ Rake::TestTask.new(:test) do |t|
40
49
  t.test_files = FileList['test/test*.rb']
41
50
  t.verbose = true
42
51
  end
@@ -54,8 +63,6 @@ end
54
63
  directory 'testdata'
55
64
  task :test => ['testdata']
56
65
 
57
- desc "Run all test targets"
58
- task :testall => [:test, :testcontrib, :testfun]
59
66
 
60
67
  # Abbreviations
61
68
 
@@ -29,7 +29,7 @@
29
29
  # referenced as a library via a require statement, but it can be
30
30
  # distributed independently as an application.
31
31
 
32
- RAKEVERSION = '0.4.12'
32
+ RAKEVERSION = '0.4.13'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'ftools'
@@ -111,7 +111,13 @@ class Task
111
111
 
112
112
  # Execute the actions associated with this task.
113
113
  def execute
114
- puts "** Execute #{name}" if $trace
114
+ if $dryrun
115
+ puts "** Execute (dry run) #{name}"
116
+ return
117
+ end
118
+ if $trace
119
+ puts "** Execute #{name}"
120
+ end
115
121
  self.class.enhance_with_matching_rule(name) if @actions.empty?
116
122
  @actions.each { |act| result = act.call(self) }
117
123
  end
@@ -360,11 +366,15 @@ module FileUtils
360
366
  OPT_TABLE['sh'] = %w(noop verbose)
361
367
  OPT_TABLE['ruby'] = %w(noop verbose)
362
368
 
363
- # Run the system command +cmd+.
369
+ # Run the system command +cmd+. If multiple arguments are given
370
+ # the command is not run with the shell (same semantics as
371
+ # Kernel::exec and Kernel::system).
364
372
  #
365
373
  # Example:
366
374
  # sh %{ls -ltr}
367
375
  #
376
+ # sh 'ls', 'file with spaces'
377
+ #
368
378
  # # check exit status after command runs
369
379
  # sh %{grep pattern file} do |ok, res|
370
380
  # if ! ok
@@ -372,16 +382,21 @@ module FileUtils
372
382
  # end
373
383
  # end
374
384
  #
375
- def sh(cmd, options={}, &block)
385
+ def sh(*cmd, &block)
386
+ if Hash === cmd.last then
387
+ options = cmd.pop
388
+ else
389
+ options = {}
390
+ end
376
391
  unless block_given?
377
392
  block = lambda { |ok, status|
378
- ok or fail "Command failed with status (#{status.exitstatus}): [#{cmd}]"
393
+ ok or fail "Command failed with status (#{status.exitstatus}): [#{cmd.join(" ")}]"
379
394
  }
380
395
  end
381
396
  fu_check_options options, :noop, :verbose
382
- fu_output_message cmd if options[:verbose]
397
+ fu_output_message cmd.join(" ") if options[:verbose]
383
398
  unless options[:noop]
384
- res = system(cmd)
399
+ res = system(*cmd)
385
400
  block.call(res, $?)
386
401
  end
387
402
  end
@@ -391,13 +406,17 @@ module FileUtils
391
406
  # Example:
392
407
  # ruby %{-pe '$_.upcase!' <README}
393
408
  #
394
- def ruby(*args)
409
+ def ruby(*args,&block)
395
410
  if Hash === args.last
396
411
  options = args.pop
397
412
  else
398
413
  options = {}
399
414
  end
400
- sh "#{RUBY} #{args.join(' ')}", options
415
+ if args.length > 1 then
416
+ sh *([RUBY] + args + [options]), &block
417
+ else
418
+ sh "#{RUBY} #{args}", options, &block
419
+ end
401
420
  end
402
421
 
403
422
  LN_SUPPORTED = [true]
@@ -60,9 +60,18 @@ class FunctionalTest < Test::Unit::TestCase
60
60
  assert_match %r{^No Rakefile found}, @out
61
61
  end
62
62
 
63
+ def test_dry_run
64
+ Dir.chdir("test/data/default") do rake "-n", "other" end
65
+ assert_match %r{Execute \(dry run\) default}, @out
66
+ assert_match %r{Execute \(dry run\) other}, @out
67
+ assert_no_match %r{DEFAULT}, @out
68
+ assert_no_match %r{OTHER}, @out
69
+ end
70
+
63
71
  private
64
72
 
65
- def rake(options="")
73
+ def rake(*option_list)
74
+ options = option_list.join(' ')
66
75
  shell = Session::Shell.new
67
76
  command = "ruby #{@ruby_options} #{@rake_path} #{options}"
68
77
  puts "COMMAND: [#{command}]" if @verbose
@@ -56,6 +56,17 @@ class TestFileUtils < Test::Unit::TestCase
56
56
  verbose(false) { sh %{test/shellcommand.rb} }
57
57
  assert true, "should not fail"
58
58
  end
59
+
60
+ def test_sh_multiple_arguments
61
+ ENV['RAKE_TEST_SH'] = 'someval'
62
+ # This one gets expanded by the shell
63
+ verbose(false) { sh %{test $RAKE_TEST_SH = someval} }
64
+ assert true, "should not fail"
65
+ assert_raises(RuntimeError) {
66
+ # This one does not get expanded
67
+ verbose(false) { sh 'test','$RAKE_TEST_SH', '=', 'someval' }
68
+ }
69
+ end
59
70
 
60
71
  def test_sh_failure
61
72
  assert_raises(RuntimeError) {
@@ -78,6 +89,22 @@ class TestFileUtils < Test::Unit::TestCase
78
89
  end
79
90
  }
80
91
  assert_equal 2, count, "Block count should be 2"
81
- end
92
+ end
93
+
94
+ def test_ruby
95
+ verbose(false) do
96
+ ENV['RAKE_TEST_RUBY'] = "123"
97
+ # This one gets expanded by the shell
98
+ ruby %{-e "exit $RAKE_TEST_RUBY"} do |ok, status|
99
+ assert(!ok)
100
+ assert_equal 123, status.exitstatus
101
+ end
102
+ # This one does not get expanded
103
+ ruby '-e', 'exit "$RAKE_TEST_RUBY".length' do |ok, status|
104
+ assert(!ok)
105
+ assert_equal 15, status.exitstatus
106
+ end
107
+ end
108
+ end
82
109
 
83
110
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.1.2
2
+ rubygems_version: 0.8.3
3
3
  specification_version: 1
4
4
  name: rake
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.12
7
- date: 2004-12-03
6
+ version: 0.4.13
7
+ date: 2004-12-22
8
8
  summary: Ruby based make-like utility.
9
9
  require_paths:
10
10
  - lib