rake 0.9.2.2 → 0.9.3.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/CHANGES CHANGED
@@ -8,6 +8,8 @@
8
8
  * Rake tests are now directory-independent
9
9
  * Rake tests are no longer require flexmock
10
10
  * Commands constant is no longer polluting top level namespace.
11
+ * Show only the interesting portion of the backtrace by default (James M. Lawrence).
12
+ * Added --reduce-compat optiont to remove backward compatible DSL hacks (James M. Lawrence).
11
13
 
12
14
  == Version 0.9.2
13
15
 
data/Rakefile CHANGED
@@ -141,7 +141,11 @@ end
141
141
  PKG_FILES = FileList[
142
142
  '.gemtest',
143
143
  'install.rb',
144
- '[A-Z]*',
144
+ 'CHANGES',
145
+ 'MIT-LICENSE',
146
+ 'README.rdoc',
147
+ 'Rakefile',
148
+ 'TODO',
145
149
  'bin/rake',
146
150
  'lib/**/*.rb',
147
151
  'test/**/*.rb',
data/bin/rake CHANGED
@@ -28,6 +28,10 @@ begin
28
28
  rescue LoadError
29
29
  end
30
30
 
31
+ module Rake
32
+ REDUCE_COMPAT = true if ARGV.include?("--reduce-compat")
33
+ end
34
+
31
35
  require 'rake'
32
36
 
33
37
  Rake.application.run
@@ -58,6 +58,7 @@ require 'rake/early_time'
58
58
  require 'rake/name_space'
59
59
  require 'rake/task_manager'
60
60
  require 'rake/application'
61
+ require 'rake/backtrace'
61
62
 
62
63
  $trace = false
63
64
 
@@ -85,14 +85,12 @@ module Rake
85
85
 
86
86
  # Run the top level tasks of a Rake application.
87
87
  def top_level
88
- standard_exception_handling do
89
- if options.show_tasks
90
- display_tasks_and_comments
91
- elsif options.show_prereqs
92
- display_prerequisites
93
- else
94
- top_level_tasks.each { |task_name| invoke_task(task_name) }
95
- end
88
+ if options.show_tasks
89
+ display_tasks_and_comments
90
+ elsif options.show_prereqs
91
+ display_prerequisites
92
+ else
93
+ top_level_tasks.each { |task_name| invoke_task(task_name) }
96
94
  end
97
95
  end
98
96
 
@@ -151,7 +149,7 @@ module Rake
151
149
  if options.trace
152
150
  $stderr.puts ex.backtrace.join("\n")
153
151
  else
154
- $stderr.puts rakefile_location(ex.backtrace)
152
+ $stderr.puts Backtrace.collapse(ex.backtrace)
155
153
  end
156
154
  $stderr.puts "Tasks: #{ex.chain}" if has_chain?(ex)
157
155
  $stderr.puts "(See full trace by running task with --trace)" unless options.trace
@@ -351,6 +349,11 @@ module Rake
351
349
  # HACK Use File::PATH_SEPARATOR
352
350
  lambda { |value| options.rakelib = value.split(':') }
353
351
  ],
352
+ ['--reduce-compat', "Remove DSL in Object; remove Module#const_missing which defines ::Task etc.",
353
+ # Load-time option.
354
+ # Handled in bin/rake where Rake::REDUCE_COMPAT is defined (or not).
355
+ lambda { |_| }
356
+ ],
354
357
  ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
355
358
  lambda { |value|
356
359
  begin
@@ -0,0 +1,15 @@
1
+ module Rake
2
+ module Backtrace
3
+ SUPPRESSED_PATHS = [
4
+ RbConfig::CONFIG["prefix"],
5
+ File.join(File.dirname(__FILE__), ".."),
6
+ ].map { |f| Regexp.quote(File.expand_path(f)) }
7
+
8
+ SUPPRESS_PATTERN = %r!(\A#{SUPPRESSED_PATHS.join('|')}|bin/rake:\d+)!
9
+
10
+ # Elide backtrace elements which match one of SUPPRESS_PATHS.
11
+ def self.collapse(backtrace)
12
+ backtrace.reject { |elem| elem =~ SUPPRESS_PATTERN }
13
+ end
14
+ end
15
+ end
@@ -167,10 +167,10 @@ module Rake
167
167
  private :#{name}
168
168
  }, __FILE__, line
169
169
  end
170
- end
170
+ end unless defined? Rake::REDUCE_COMPAT
171
171
 
172
172
  extend FileUtilsExt
173
173
  end
174
174
 
175
175
  self.extend Rake::DSL
176
- include Rake::DeprecatedObjectDSL
176
+ include Rake::DeprecatedObjectDSL unless defined? Rake::REDUCE_COMPAT
@@ -36,4 +36,4 @@ class Module
36
36
  rake_original_const_missing(const_name)
37
37
  end
38
38
  end
39
- end
39
+ end unless defined? Rake::REDUCE_COMPAT
@@ -1,8 +1,8 @@
1
1
  module Rake
2
- VERSION = '0.9.2.2'
2
+ VERSION = '0.9.3.beta.1'
3
3
 
4
4
  module Version # :nodoc: all
5
- MAJOR, MINOR, BUILD, PATCH = VERSION.split('.')
6
- NUMBERS = [ MAJOR, MINOR, BUILD, PATCH ]
5
+ MAJOR, MINOR, BUILD = VERSION.split '.'
6
+ NUMBERS = [ MAJOR, MINOR, BUILD ]
7
7
  end
8
8
  end
@@ -0,0 +1,49 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+ require 'open3'
3
+
4
+ class TestRakeBacktrace < Rake::TestCase
5
+ # TODO: factor out similar code in test_rake_functional.rb
6
+ def rake(*args)
7
+ lib = File.join(@orig_PWD, "lib")
8
+ bin_rake = File.join(@orig_PWD, "bin", "rake")
9
+ Open3.popen3(RUBY, "-I", lib, bin_rake, *args) { |_, _, err, _| err.read }
10
+ end
11
+
12
+ def invoke(task_name)
13
+ rake task_name.to_s
14
+ end
15
+
16
+ def test_single_collapse
17
+ rakefile %q{
18
+ task :foo do
19
+ raise "foooo!"
20
+ end
21
+ }
22
+
23
+ lines = invoke(:foo).split("\n")
24
+
25
+ assert_equal "rake aborted!", lines[0]
26
+ assert_equal "foooo!", lines[1]
27
+ assert_match %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!, lines[2]
28
+ assert_match %r!\ATasks:!, lines[3]
29
+ end
30
+
31
+ def test_multi_collapse
32
+ rakefile %q{
33
+ task :foo do
34
+ Rake.application.invoke_task(:bar)
35
+ end
36
+ task :bar do
37
+ raise "barrr!"
38
+ end
39
+ }
40
+
41
+ lines = invoke(:foo).split("\n")
42
+
43
+ assert_equal "rake aborted!", lines[0]
44
+ assert_equal "barrr!", lines[1]
45
+ assert_match %r!\A#{Regexp.quote Dir.pwd}/Rakefile:6!, lines[2]
46
+ assert_match %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!, lines[3]
47
+ assert_match %r!\ATasks:!, lines[4]
48
+ end
49
+ end
@@ -0,0 +1,65 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+ require 'open3'
3
+
4
+ class TestRakeReduceCompat < Rake::TestCase
5
+ # TODO: factor out similar code in test_rake_functional.rb
6
+ def rake(*args)
7
+ lib = File.join(@orig_PWD, "lib")
8
+ bin_rake = File.join(@orig_PWD, "bin", "rake")
9
+ Open3.popen3(RUBY, "-I", lib, bin_rake, *args) { |_, out, _, _| out.read }
10
+ end
11
+
12
+ def invoke_normal(task_name)
13
+ rake task_name.to_s
14
+ end
15
+
16
+ def invoke_reduce_compat(task_name)
17
+ rake "--reduce-compat", task_name.to_s
18
+ end
19
+
20
+ def test_no_deprecated_dsl
21
+ rakefile %q{
22
+ task :check_task do
23
+ Module.new { p defined?(task) }
24
+ end
25
+
26
+ task :check_file do
27
+ Module.new { p defined?(file) }
28
+ end
29
+ }
30
+
31
+ assert_equal %{"method"}, invoke_normal(:check_task).chomp
32
+ assert_equal %{"method"}, invoke_normal(:check_file).chomp
33
+
34
+ assert_equal "nil", invoke_reduce_compat(:check_task).chomp
35
+ assert_equal "nil", invoke_reduce_compat(:check_file).chomp
36
+ end
37
+
38
+ def test_no_classic_namespace
39
+ rakefile %q{
40
+ task :check_task do
41
+ begin
42
+ Task
43
+ print "present"
44
+ rescue NameError
45
+ print "absent"
46
+ end
47
+ end
48
+
49
+ task :check_file_task do
50
+ begin
51
+ FileTask
52
+ print "present"
53
+ rescue NameError
54
+ print "absent"
55
+ end
56
+ end
57
+ }
58
+
59
+ assert_equal "present", invoke_normal(:check_task)
60
+ assert_equal "present", invoke_normal(:check_file_task)
61
+
62
+ assert_equal "absent", invoke_reduce_compat(:check_task)
63
+ assert_equal "absent", invoke_reduce_compat(:check_file_task)
64
+ end
65
+ end
metadata CHANGED
@@ -1,35 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rake
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.9.2.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.3.beta.1
5
+ prerelease: 6
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Jim Weirich
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-10-22 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: minitest
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70183536931420 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
18
+ requirements:
21
19
  - - ~>
22
- - !ruby/object:Gem::Version
23
- version: "2.1"
20
+ - !ruby/object:Gem::Version
21
+ version: '2.1'
24
22
  type: :development
25
- version_requirements: *id001
26
- description: Rake is a Make-like program implemented in Ruby. Tasks and dependencies arespecified in standard Ruby syntax.
23
+ prerelease: false
24
+ version_requirements: *70183536931420
25
+ description: Rake is a Make-like program implemented in Ruby. Tasks and dependencies
26
+ arespecified in standard Ruby syntax.
27
27
  email: jim@weirichhouse.org
28
- executables:
28
+ executables:
29
29
  - rake
30
30
  extensions: []
31
-
32
- extra_rdoc_files:
31
+ extra_rdoc_files:
33
32
  - README.rdoc
34
33
  - MIT-LICENSE
35
34
  - TODO
@@ -59,17 +58,18 @@ extra_rdoc_files:
59
58
  - doc/release_notes/rake-0.9.0.rdoc
60
59
  - doc/release_notes/rake-0.9.1.rdoc
61
60
  - doc/release_notes/rake-0.9.2.rdoc
62
- files:
61
+ files:
63
62
  - .gemtest
64
63
  - install.rb
65
64
  - CHANGES
66
65
  - MIT-LICENSE
67
- - Rakefile
68
66
  - README.rdoc
67
+ - Rakefile
69
68
  - TODO
70
69
  - bin/rake
71
70
  - lib/rake/alt_system.rb
72
71
  - lib/rake/application.rb
72
+ - lib/rake/backtrace.rb
73
73
  - lib/rake/classic_namespace.rb
74
74
  - lib/rake/clean.rb
75
75
  - lib/rake/cloneable.rb
@@ -120,6 +120,7 @@ files:
120
120
  - test/test_rake.rb
121
121
  - test/test_rake_application.rb
122
122
  - test/test_rake_application_options.rb
123
+ - test/test_rake_backtrace.rb
123
124
  - test/test_rake_clean.rb
124
125
  - test/test_rake_definitions.rb
125
126
  - test/test_rake_directory_task.rb
@@ -144,6 +145,7 @@ files:
144
145
  - test/test_rake_pseudo_status.rb
145
146
  - test/test_rake_rake_test_loader.rb
146
147
  - test/test_rake_rdoc_task.rb
148
+ - test/test_rake_reduce_compat.rb
147
149
  - test/test_rake_require.rb
148
150
  - test/test_rake_rules.rb
149
151
  - test/test_rake_task.rb
@@ -191,35 +193,32 @@ files:
191
193
  - doc/release_notes/rake-0.9.2.rdoc
192
194
  homepage: http://rake.rubyforge.org
193
195
  licenses: []
194
-
195
196
  post_install_message:
196
- rdoc_options:
197
+ rdoc_options:
197
198
  - --line-numbers
198
199
  - --show-hash
199
200
  - --main
200
201
  - README.rdoc
201
202
  - --title
202
203
  - Rake -- Ruby Make
203
- require_paths:
204
+ require_paths:
204
205
  - lib
205
- required_ruby_version: !ruby/object:Gem::Requirement
206
+ required_ruby_version: !ruby/object:Gem::Requirement
206
207
  none: false
207
- requirements:
208
- - - ">="
209
- - !ruby/object:Gem::Version
208
+ requirements:
209
+ - - ! '>='
210
+ - !ruby/object:Gem::Version
210
211
  version: 1.8.6
211
- required_rubygems_version: !ruby/object:Gem::Requirement
212
+ required_rubygems_version: !ruby/object:Gem::Requirement
212
213
  none: false
213
- requirements:
214
- - - ">="
215
- - !ruby/object:Gem::Version
214
+ requirements:
215
+ - - ! '>='
216
+ - !ruby/object:Gem::Version
216
217
  version: 1.3.2
217
218
  requirements: []
218
-
219
219
  rubyforge_project: rake
220
- rubygems_version: 1.8.11
220
+ rubygems_version: 1.8.7
221
221
  signing_key:
222
222
  specification_version: 3
223
223
  summary: Ruby based make-like utility.
224
224
  test_files: []
225
-