rake 0.9.2 → 0.9.2.2

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.

Files changed (75) hide show
  1. data/CHANGES +13 -0
  2. data/README.rdoc +12 -15
  3. data/Rakefile +8 -44
  4. data/bin/rake +1 -0
  5. data/lib/rake.rb +4 -0
  6. data/lib/rake/application.rb +9 -3
  7. data/lib/rake/classic_namespace.rb +2 -0
  8. data/lib/rake/clean.rb +1 -0
  9. data/lib/rake/contrib/publisher.rb +10 -6
  10. data/lib/rake/contrib/sshpublisher.rb +5 -0
  11. data/lib/rake/dsl_definition.rb +13 -4
  12. data/lib/rake/ext/time.rb +3 -3
  13. data/lib/rake/file_utils.rb +9 -7
  14. data/lib/rake/file_utils_ext.rb +4 -1
  15. data/lib/rake/gempackagetask.rb +2 -0
  16. data/lib/rake/rake_test_loader.rb +15 -6
  17. data/lib/rake/rdoctask.rb +5 -1
  18. data/lib/rake/task_arguments.rb +4 -0
  19. data/lib/rake/version.rb +5 -7
  20. data/test/file_creation.rb +2 -2
  21. data/test/helper.rb +460 -12
  22. data/test/test_rake.rb +3 -1
  23. data/test/test_rake_application.rb +250 -125
  24. data/test/test_rake_application_options.rb +146 -193
  25. data/test/test_rake_clean.rb +2 -0
  26. data/test/test_rake_definitions.rb +6 -6
  27. data/test/test_rake_directory_task.rb +26 -35
  28. data/test/test_rake_dsl.rb +4 -0
  29. data/test/test_rake_file_creation_task.rb +1 -7
  30. data/test/test_rake_file_list.rb +128 -133
  31. data/test/test_rake_file_task.rb +1 -3
  32. data/test/test_rake_file_utils.rb +123 -70
  33. data/test/test_rake_functional.rb +234 -252
  34. data/test/test_rake_makefile_loader.rb +22 -1
  35. data/test/test_rake_package_task.rb +10 -9
  36. data/test/test_rake_path_map_explode.rb +3 -0
  37. data/test/test_rake_pseudo_status.rb +3 -2
  38. data/test/test_rake_rake_test_loader.rb +21 -0
  39. data/test/test_rake_rdoc_task.rb +5 -3
  40. data/test/test_rake_require.rb +8 -3
  41. data/test/test_rake_rules.rb +56 -75
  42. data/test/test_rake_task.rb +5 -9
  43. data/test/test_rake_task_argument_parsing.rb +33 -46
  44. data/test/test_rake_task_arguments.rb +2 -0
  45. data/test/test_rake_task_manager.rb +12 -0
  46. data/test/test_rake_task_with_arguments.rb +11 -0
  47. data/test/test_rake_test_task.rb +55 -57
  48. data/test/test_rake_top_level_functions.rb +52 -17
  49. data/test/test_rake_win32.rb +31 -42
  50. metadata +6 -52
  51. data/RRR +0 -9
  52. data/test/check_expansion.rb +0 -5
  53. data/test/check_no_expansion.rb +0 -5
  54. data/test/data/access/Rakefile +0 -35
  55. data/test/data/chains/Rakefile +0 -15
  56. data/test/data/comments/Rakefile +0 -18
  57. data/test/data/default/Rakefile +0 -17
  58. data/test/data/deprecated_import/Rakefile +0 -1
  59. data/test/data/dryrun/Rakefile +0 -22
  60. data/test/data/extra/Rakefile +0 -1
  61. data/test/data/file_creation_task/Rakefile +0 -31
  62. data/test/data/imports/Rakefile +0 -19
  63. data/test/data/imports/deps.mf +0 -1
  64. data/test/data/multidesc/Rakefile +0 -15
  65. data/test/data/namespace/Rakefile +0 -64
  66. data/test/data/rakelib/test1.rb +0 -4
  67. data/test/data/rbext/rakefile.rb +0 -3
  68. data/test/data/sample.mf +0 -14
  69. data/test/data/statusreturn/Rakefile +0 -6
  70. data/test/data/unittest/Rakefile +0 -1
  71. data/test/data/verbose/Rakefile +0 -34
  72. data/test/in_environment.rb +0 -35
  73. data/test/reqfile.rb +0 -3
  74. data/test/reqfile2.rb +0 -3
  75. data/test/shellcommand.rb +0 -3
data/CHANGES CHANGED
@@ -1,5 +1,18 @@
1
1
  = Rake Changelog
2
2
 
3
+ == Master (for 0.9.3)
4
+
5
+ * The rake test loader now removes arguments it has processed. Issue #51
6
+ * Rake::TaskArguments now responds to #values_at
7
+ * RakeFileUtils.verbose_flag = nil silences output the same as 0.8.7
8
+ * Rake tests are now directory-independent
9
+ * Rake tests are no longer require flexmock
10
+ * Commands constant is no longer polluting top level namespace.
11
+
12
+ == Version 0.9.2
13
+
14
+ * Unknown
15
+
3
16
  == Version 0.9.1
4
17
 
5
18
  * Added deprecation warnings to the Rake DSL methods.
@@ -1,9 +1,7 @@
1
1
  = RAKE -- Ruby Make
2
2
 
3
- Supporting Rake version: 0.8.7.
4
-
5
- This package contains Rake, a simple ruby build program with
6
- capabilities similar to make.
3
+ This package contains Rake, a simple ruby build program with capabilities
4
+ similar to make.
7
5
 
8
6
  Rake has the following features:
9
7
 
@@ -19,16 +17,17 @@ Rake has the following features:
19
17
  file names and paths.
20
18
 
21
19
  * A library of prepackaged tasks to make building rakefiles easier. For example,
22
- tasks for building tarballs, gems and RDoc output are provided.
20
+ tasks for building tarballs and publishing to FTP or SSH sites. (Formerly
21
+ tasks for building RDoc and Gems were included in rake but they're now
22
+ available in RDoc and RubyGems respectively.)
23
23
 
24
24
  * Supports parallel execution of tasks.
25
25
 
26
-
27
26
  == Installation
28
27
 
29
28
  === Gem Installation
30
29
 
31
- Download and install rake with the following.
30
+ Download and install rake with the following.
32
31
 
33
32
  gem install rake
34
33
 
@@ -114,12 +113,9 @@ If you wish to run the unit and functional tests that come with Rake:
114
113
 
115
114
  Feature requests and bug reports can be made here
116
115
 
117
- * http://onestepback.org/cgi-bin/bugs.cgi?project=rake
118
-
119
- No account is needed for posting requests. Or you can send me an
120
- email (at jim dot weirich at gmail dot com)
116
+ * https://github.com/jimweirich/rake/issues
121
117
 
122
- Issues and bug reports can be tracked here:
118
+ Issues and bug reports can also be tracked here:
123
119
 
124
120
  * http://www.pivotaltracker.com/projects/28469
125
121
 
@@ -133,11 +129,12 @@ Issues and bug reports can be tracked here:
133
129
  * Rake Source Code Repo: http://github.com/jimweirich/rake
134
130
  * Rake Git Repo Clone URL: git://github.com/jimweirich/rake.git
135
131
  * Rake Issue Tracking: http://www.pivotaltracker.com/projects/28469
136
- * Rake Bug Reports: http://onestepback.org/cgi-bin/bugs.cgi?project=rake
132
+ * Rake Bug Reports: https://github.com/jimweirich/rake/issues
137
133
 
138
134
  === Presentations and Articles about Rake
139
135
 
140
- * Jim Weirich's 2003 RubyConf presentation: http://onestepback.org/articles/buildingwithrake/
136
+ * Jim Weirich's 2003 RubyConf presentation:
137
+ http://onestepback.org/articles/buildingwithrake/
141
138
  * Martin Fowler's article on Rake: http://martinfowler.com/articles/rake.html
142
139
 
143
140
  == Other Make Reinvisionings ...
@@ -187,7 +184,7 @@ jim dot weirich at gmail.com.
187
184
  = Other stuff
188
185
 
189
186
  Author:: Jim Weirich <jim.weirich@gmail.com>
190
- Requires:: Ruby 1.8.0 or later
187
+ Requires:: Ruby 1.8.6 or later
191
188
  License:: Copyright 2003-2008 by Jim Weirich.
192
189
  Released under an MIT-style license. See the LICENSE file
193
190
  included in the distribution.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ require 'rubygems'
12
12
  system_rake = File.join RbConfig::CONFIG['rubylibdir'], 'rake.rb'
13
13
 
14
14
  # Use our rake, not the installed rake from system
15
- if $".include? system_rake then
15
+ if $".include? system_rake or $".grep(/rake\/name_space\.rb$/).empty? then
16
16
  exec Gem.ruby, '-Ilib', 'bin/rake', *ARGV
17
17
  end
18
18
 
@@ -28,11 +28,7 @@ rescue Gem::LoadError
28
28
  end
29
29
 
30
30
  CLEAN.include('**/*.o', '*.dot', '**/*.rbc')
31
- CLOBBER.include('doc/example/main', 'testdata')
32
- CLOBBER.include('test/data/**/temp_*')
33
- CLOBBER.include('test/data/chains/play.*')
34
- CLOBBER.include('test/data/file_creation_task/build')
35
- CLOBBER.include('test/data/file_creation_task/src')
31
+ CLOBBER.include('doc/example/main')
36
32
  CLOBBER.include('TAGS')
37
33
  CLOBBER.include('coverage', 'rcov_aggregate')
38
34
 
@@ -107,9 +103,6 @@ rescue LoadError
107
103
  end
108
104
  end
109
105
 
110
- directory 'testdata'
111
- task :test => ['testdata']
112
-
113
106
  # CVS Tasks ----------------------------------------------------------
114
107
 
115
108
  # Install rake using the standard install.rb script.
@@ -149,13 +142,9 @@ PKG_FILES = FileList[
149
142
  '.gemtest',
150
143
  'install.rb',
151
144
  '[A-Z]*',
152
- 'bin/**/*',
145
+ 'bin/rake',
153
146
  'lib/**/*.rb',
154
147
  'test/**/*.rb',
155
- 'test/**/*.rf',
156
- 'test/**/*.mf',
157
- 'test/**/Rakefile',
158
- 'test/**/subdir',
159
148
  'doc/**/*'
160
149
  ]
161
150
  PKG_FILES.exclude('doc/example/*.o')
@@ -163,44 +152,25 @@ PKG_FILES.exclude('TAGS')
163
152
  PKG_FILES.exclude(%r{doc/example/main$})
164
153
 
165
154
  if ! defined?(Gem)
166
- puts "Package Target requires RubyGEMs"
155
+ puts "Package Target requires RubyGems"
167
156
  else
168
157
  SPEC = Gem::Specification.new do |s|
169
-
170
- #### Basic information.
171
-
172
158
  s.name = 'rake'
173
159
  s.version = $package_version
174
160
  s.summary = "Ruby based make-like utility."
175
- s.description = <<-EOF
176
- Rake is a Make-like program implemented in Ruby. Tasks
177
- and dependencies are specified in standard Ruby syntax.
161
+ s.description = <<-EOF.delete "\n"
162
+ Rake is a Make-like program implemented in Ruby. Tasks and dependencies are
163
+ specified in standard Ruby syntax.
178
164
  EOF
179
165
 
180
- #### Dependencies and requirements.
181
-
166
+ s.required_ruby_version = '>= 1.8.6'
182
167
  s.required_rubygems_version = '>= 1.3.2'
183
168
  s.add_development_dependency 'minitest', '~> 2.1'
184
- s.add_development_dependency 'session', '~> 2.4'
185
- s.add_development_dependency 'flexmock', '~> 0.8.11'
186
-
187
- #### Which files are to be included in this gem? Everything! (Except CVS directories.)
188
169
 
189
170
  s.files = PKG_FILES.to_a
190
171
 
191
- #### C code extensions.
192
-
193
- #s.extensions << "ext/rmagic/extconf.rb"
194
-
195
- #### Load-time details: library and application (you will need one or both).
196
-
197
- s.require_path = 'lib' # Use these for libraries.
198
-
199
- s.bindir = "bin" # Use these for applications.
200
172
  s.executables = ["rake"]
201
173
 
202
- #### Documentation and testing.
203
-
204
174
  s.extra_rdoc_files = FileList[
205
175
  'README.rdoc',
206
176
  'MIT-LICENSE',
@@ -211,16 +181,10 @@ else
211
181
 
212
182
  s.rdoc_options = BASE_RDOC_OPTIONS
213
183
 
214
- #### Author and project details.
215
-
216
184
  s.author = "Jim Weirich"
217
185
  s.email = "jim@weirichhouse.org"
218
186
  s.homepage = "http://rake.rubyforge.org"
219
187
  s.rubyforge_project = "rake"
220
- # if ENV['CERT_DIR']
221
- # s.signing_key = File.join(ENV['CERT_DIR'], 'gem-private_key.pem')
222
- # s.cert_chain = [File.join(ENV['CERT_DIR'], 'gem-public_cert.pem')]
223
- # end
224
188
  end
225
189
 
226
190
  Gem::PackageTask.new(SPEC) do |pkg|
data/bin/rake CHANGED
@@ -24,6 +24,7 @@
24
24
 
25
25
  begin
26
26
  require 'rubygems'
27
+ gem 'rake'
27
28
  rescue LoadError
28
29
  end
29
30
 
@@ -23,7 +23,9 @@
23
23
 
24
24
  require 'rake/version'
25
25
 
26
+ # :stopdoc:
26
27
  RAKEVERSION = Rake::VERSION
28
+ # :startdoc:
27
29
 
28
30
  require 'rbconfig'
29
31
  require 'fileutils'
@@ -59,6 +61,8 @@ require 'rake/application'
59
61
 
60
62
  $trace = false
61
63
 
64
+ # :stopdoc:
65
+ #
62
66
  # Some top level Constants.
63
67
 
64
68
  FileList = Rake::FileList
@@ -22,6 +22,9 @@ module Rake
22
22
  # Name of the actual rakefile used.
23
23
  attr_reader :rakefile
24
24
 
25
+ # Number of columns on the terminal
26
+ attr_accessor :terminal_columns
27
+
25
28
  # List of the top level task names (task names from the command line).
26
29
  attr_reader :top_level_tasks
27
30
 
@@ -43,6 +46,7 @@ module Rake
43
46
  add_loader('rf', DefaultLoader.new)
44
47
  add_loader('rake', DefaultLoader.new)
45
48
  @tty_output = STDOUT.tty?
49
+ @terminal_columns = ENV['RAKE_COLUMNS'].to_i
46
50
  end
47
51
 
48
52
  # Run the Rake application. The run method performs the following
@@ -198,7 +202,7 @@ module Rake
198
202
  # We will truncate output if we are outputting to a TTY or if we've been
199
203
  # given an explicit column width to honor
200
204
  def truncate_output?
201
- tty_output? || ENV['RAKE_COLUMNS']
205
+ tty_output? || @terminal_columns.nonzero?
202
206
  end
203
207
 
204
208
  # Display the tasks and comments.
@@ -210,6 +214,7 @@ module Rake
210
214
  when :tasks
211
215
  width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10
212
216
  max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil
217
+
213
218
  displayable_tasks.each do |t|
214
219
  printf "#{name} %-#{width}s # %s\n",
215
220
  t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment
@@ -234,8 +239,8 @@ module Rake
234
239
  end
235
240
 
236
241
  def terminal_width
237
- if ENV['RAKE_COLUMNS']
238
- result = ENV['RAKE_COLUMNS'].to_i
242
+ if @terminal_columns.nonzero?
243
+ result = @terminal_columns
239
244
  else
240
245
  result = unix? ? dynamic_width : 80
241
246
  end
@@ -343,6 +348,7 @@ module Rake
343
348
  ],
344
349
  ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
345
350
  "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
351
+ # HACK Use File::PATH_SEPARATOR
346
352
  lambda { |value| options.rakelib = value.split(':') }
347
353
  ],
348
354
  ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
@@ -3,7 +3,9 @@
3
3
  # referenced Task from the top level.
4
4
 
5
5
  warn "WARNING: Classic namespaces are deprecated and will be removed from future versions of Rake."
6
+ # :stopdoc:
6
7
  Task = Rake::Task
7
8
  FileTask = Rake::FileTask
8
9
  FileCreationTask = Rake::FileCreationTask
9
10
  RakeApp = Rake::Application
11
+ # :startdoc:
@@ -13,6 +13,7 @@
13
13
 
14
14
  require 'rake'
15
15
 
16
+ # :stopdoc:
16
17
  CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
17
18
  CLEAN.clear_exclude.exclude { |fn|
18
19
  fn.pathmap("%f") == 'core' && File.directory?(fn)
@@ -1,15 +1,19 @@
1
1
  # Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
2
2
  # All rights reserved.
3
3
 
4
+ # :stopdoc:
5
+
4
6
  # Configuration information about an upload host system.
5
- # * name :: Name of host system.
6
- # * webdir :: Base directory for the web information for the
7
- # application. The application name (APP) is appended to
8
- # this directory before using.
9
- # * pkgdir :: Directory on the host system where packages can be
10
- # placed.
7
+ # name :: Name of host system.
8
+ # webdir :: Base directory for the web information for the
9
+ # application. The application name (APP) is appended to
10
+ # this directory before using.
11
+ # pkgdir :: Directory on the host system where packages can be
12
+ # placed.
11
13
  HostInfo = Struct.new(:name, :webdir, :pkgdir)
12
14
 
15
+ # :startdoc:
16
+
13
17
  # Manage several publishers as a single entity.
14
18
  class CompositePublisher
15
19
  def initialize
@@ -1,3 +1,4 @@
1
+ require 'rake/dsl_definition'
1
2
  require 'rake/contrib/compositepublisher'
2
3
 
3
4
  module Rake
@@ -5,6 +6,8 @@ module Rake
5
6
  # Publish an entire directory to an existing remote directory using
6
7
  # SSH.
7
8
  class SshDirPublisher
9
+ include Rake::DSL
10
+
8
11
  def initialize(host, remote_dir, local_dir)
9
12
  @host = host
10
13
  @remote_dir = remote_dir
@@ -27,6 +30,8 @@ module Rake
27
30
 
28
31
  # Publish a list of files to an existing remote directory.
29
32
  class SshFilePublisher
33
+ include Rake::DSL
34
+
30
35
  # Create a publisher using the give host information.
31
36
  def initialize(host, remote_dir, local_dir, *files)
32
37
  @host = host
@@ -2,11 +2,18 @@
2
2
  require 'rake/file_utils_ext'
3
3
 
4
4
  module Rake
5
+
6
+ ##
7
+ # DSL is a module that provides #task, #desc, #namespace, etc. Use this
8
+ # when you'd like to use rake outside the top level scope.
9
+
5
10
  module DSL
6
11
 
12
+ #--
7
13
  # Include the FileUtils file manipulation functions in the top
8
14
  # level module, but mark them private so that they don't
9
15
  # unintentionally define methods on other objects.
16
+ #++
10
17
 
11
18
  include FileUtilsExt
12
19
  private(*FileUtils.instance_methods(false))
@@ -137,10 +144,12 @@ module Rake
137
144
  Rake.application.add_import(fn)
138
145
  end
139
146
  end
147
+
140
148
  end
141
149
 
142
- module DeprecatedObjectDSL
143
- Commands = Object.new.extend DSL
150
+ DeprecatedCommands = Object.new.extend(DSL)
151
+
152
+ module DeprecatedObjectDSL # :nodoc:
144
153
  DSL.private_instance_methods(false).each do |name|
145
154
  line = __LINE__+1
146
155
  class_eval %{
@@ -153,8 +162,8 @@ module Rake
153
162
  end
154
163
  $stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}"
155
164
  end
156
- Rake::DeprecatedObjectDSL::Commands.send(:#{name}, *args, &block)
157
- end
165
+ Rake::DeprecatedCommands.send(:#{name}, *args, &block)
166
+ end
158
167
  private :#{name}
159
168
  }, __FILE__, line
160
169
  end
@@ -1,6 +1,6 @@
1
- # ###########################################################################
1
+ #--
2
2
  # Extensions to time to allow comparisons with an early time class.
3
- #
3
+
4
4
  class Time
5
5
  alias rake_original_time_compare :<=>
6
6
  def <=>(other)
@@ -10,5 +10,5 @@ class Time
10
10
  rake_original_time_compare(other)
11
11
  end
12
12
  end
13
- end # class Time
13
+ end
14
14
 
@@ -1,10 +1,9 @@
1
1
  require 'rbconfig'
2
2
  require 'fileutils'
3
3
 
4
- # ###########################################################################
4
+ #--
5
5
  # This a FileUtils extension that defines several additional commands to be
6
6
  # added to the FileUtils utility functions.
7
- #
8
7
  module FileUtils
9
8
  # Path to the currently running Ruby program
10
9
  RUBY = File.join(
@@ -38,6 +37,7 @@ module FileUtils
38
37
  options[:noop] ||= Rake::FileUtilsExt.nowrite_flag
39
38
  Rake.rake_check_options options, :noop, :verbose
40
39
  Rake.rake_output_message cmd.join(" ") if options[:verbose]
40
+
41
41
  unless options[:noop]
42
42
  res = rake_system(*cmd)
43
43
  status = $?
@@ -46,7 +46,7 @@ module FileUtils
46
46
  end
47
47
  end
48
48
 
49
- def create_shell_runner(cmd)
49
+ def create_shell_runner(cmd) # :nodoc:
50
50
  show_command = cmd.join(" ")
51
51
  show_command = show_command[0,42] + "..." unless $trace
52
52
  lambda { |ok, status|
@@ -55,14 +55,16 @@ module FileUtils
55
55
  end
56
56
  private :create_shell_runner
57
57
 
58
- def set_verbose_option(options)
59
- if options[:verbose].nil?
60
- options[:verbose] = Rake::FileUtilsExt.verbose_flag.nil? || Rake::FileUtilsExt.verbose_flag
58
+ def set_verbose_option(options) # :nodoc:
59
+ unless options.key? :verbose
60
+ options[:verbose] =
61
+ Rake::FileUtilsExt.verbose_flag == Rake::FileUtilsExt::DEFAULT ||
62
+ Rake::FileUtilsExt.verbose_flag
61
63
  end
62
64
  end
63
65
  private :set_verbose_option
64
66
 
65
- def rake_system(*cmd)
67
+ def rake_system(*cmd) # :nodoc:
66
68
  Rake::AltSystem.system(*cmd)
67
69
  end
68
70
  private :rake_system