rake 0.4.8 → 0.7.3

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.
Files changed (77) hide show
  1. data/CHANGES +183 -0
  2. data/README +47 -14
  3. data/Rakefile +212 -44
  4. data/bin/rake +2 -3
  5. data/doc/jamis.rb +591 -0
  6. data/doc/rake.1.gz +0 -0
  7. data/doc/rakefile.rdoc +180 -3
  8. data/doc/release_notes/rake-0.4.14.rdoc +23 -0
  9. data/doc/release_notes/rake-0.4.15.rdoc +35 -0
  10. data/doc/release_notes/rake-0.5.0.rdoc +53 -0
  11. data/doc/release_notes/rake-0.5.3.rdoc +78 -0
  12. data/doc/release_notes/rake-0.5.4.rdoc +46 -0
  13. data/doc/release_notes/rake-0.6.0.rdoc +141 -0
  14. data/doc/release_notes/rake-0.7.0.rdoc +119 -0
  15. data/doc/release_notes/rake-0.7.1.rdoc +59 -0
  16. data/doc/release_notes/rake-0.7.2.rdoc +121 -0
  17. data/doc/release_notes/rake-0.7.3.rdoc +47 -0
  18. data/lib/rake/classic_namespace.rb +8 -0
  19. data/lib/rake/clean.rb +3 -1
  20. data/lib/rake/contrib/ftptools.rb +21 -21
  21. data/lib/rake/contrib/rubyforgepublisher.rb +3 -3
  22. data/lib/rake/contrib/sshpublisher.rb +1 -1
  23. data/lib/rake/contrib/sys.rb +20 -21
  24. data/lib/rake/gempackagetask.rb +12 -9
  25. data/lib/rake/loaders/makefile.rb +40 -0
  26. data/lib/rake/packagetask.rb +65 -33
  27. data/lib/rake/rake_test_loader.rb +5 -0
  28. data/lib/rake/rdoctask.rb +34 -15
  29. data/lib/rake/ruby182_test_unit_fix.rb +23 -0
  30. data/lib/rake/runtest.rb +4 -4
  31. data/lib/rake/tasklib.rb +3 -9
  32. data/lib/rake/testtask.rb +67 -24
  33. data/lib/rake.rb +1600 -552
  34. data/test/capture_stdout.rb +26 -0
  35. data/test/data/chains/Rakefile +15 -0
  36. data/test/data/default/Rakefile +19 -0
  37. data/test/data/dryrun/Rakefile +22 -0
  38. data/test/data/file_creation_task/Rakefile +30 -0
  39. data/test/data/imports/Rakefile +19 -0
  40. data/test/data/imports/deps.mf +1 -0
  41. data/test/data/multidesc/Rakefile +14 -0
  42. data/test/data/namespace/Rakefile +57 -0
  43. data/test/data/rakelib/test1.rb +3 -0
  44. data/test/data/sample.mf +9 -0
  45. data/test/data/unittest/Rakefile +1 -0
  46. data/test/filecreation.rb +18 -10
  47. data/test/functional.rb +3 -72
  48. data/test/reqfile.rb +3 -0
  49. data/test/reqfile2.rb +3 -0
  50. data/test/session_functional.rb +218 -0
  51. data/test/shellcommand.rb +3 -0
  52. data/test/test_application.rb +425 -0
  53. data/test/{testclean.rb → test_clean.rb} +1 -0
  54. data/test/test_definitions.rb +82 -0
  55. data/test/test_earlytime.rb +35 -0
  56. data/test/test_file_creation_task.rb +62 -0
  57. data/test/test_file_task.rb +139 -0
  58. data/test/test_filelist.rb +574 -0
  59. data/test/test_fileutils.rb +230 -0
  60. data/test/test_makefile_loader.rb +23 -0
  61. data/test/test_multitask.rb +45 -0
  62. data/test/test_namespace.rb +32 -0
  63. data/test/test_package_task.rb +130 -0
  64. data/test/test_pathmap.rb +188 -0
  65. data/test/test_rake.rb +34 -0
  66. data/test/test_require.rb +33 -0
  67. data/test/test_rules.rb +305 -0
  68. data/test/test_task_manager.rb +148 -0
  69. data/test/test_tasks.rb +146 -0
  70. data/test/{testtesttask.rb → test_test_task.rb} +5 -0
  71. data/test/test_top_level_functions.rb +79 -0
  72. metadata +134 -68
  73. data/test/testfilelist.rb +0 -255
  74. data/test/testfileutils.rb +0 -55
  75. data/test/testpackagetask.rb +0 -81
  76. data/test/testtasks.rb +0 -371
  77. /data/test/{testftp.rb → test_ftp.rb} +0 -0
@@ -0,0 +1,119 @@
1
+ = Rake 0.7.0 Released
2
+
3
+ These changes for Rake have been brewing for a long time. Here they
4
+ are, I hope you enjoy them.
5
+
6
+ == Changes
7
+
8
+ === New Features
9
+
10
+ * Name space support for task names (see below).
11
+
12
+ * Prerequisites can be executed in parallel (see below).
13
+
14
+ * Added safe_ln support for openAFS (via Ludvig Omholt).
15
+
16
+ * RDoc defaults to internal (in-process) invocation. The old behavior
17
+ is still available by setting the +external+ flag to true.
18
+
19
+ * Rakefiles are now loaded with the expanded path to prevent
20
+ accidental polution from the Ruby load path.
21
+
22
+ * Task objects my now be used in prerequisite lists directly.
23
+
24
+ * Task objects (in addition to task names) may now be included in the
25
+ prerequisite list of a task.
26
+
27
+ * Internals cleanup and refactoring.
28
+
29
+ === Bug Fixes
30
+
31
+ * Compatibility fixes for Ruby 1.8.4 FileUtils changes.
32
+
33
+ === Namespaces
34
+
35
+ Tasks can now be nested inside their own namespaces. Tasks within one
36
+ namespace will not accidently interfer with tasks named in a different
37
+ namespace.
38
+
39
+ For example:
40
+
41
+ namespace "main" do
42
+ task :build do
43
+ # Build the main program
44
+ end
45
+ end
46
+
47
+ namespace "samples" do
48
+ task :build do
49
+ # Build the sample programs
50
+ end
51
+ end
52
+
53
+ task :build_all => ["main:build", "samples:build"]
54
+
55
+ Even though both tasks are named :build, they are separate tasks in
56
+ their own namespaces. The :build_all task (defined in the toplevel
57
+ namespace) references both build tasks in its prerequisites.
58
+
59
+ You may invoke each of the individual build tasks with the following
60
+ commands:
61
+
62
+ rake main:build
63
+ rake samples:build
64
+
65
+ Or invoke both via the :build_all command:
66
+
67
+ rake build_all
68
+
69
+ Namespaces may be nested arbitrarily. Since the name of file tasks
70
+ correspond to the name of a file in the external file system,
71
+ FileTasks are not affected by the namespaces.
72
+
73
+ See the Rakefile format documentation (in the Rake API documents) for
74
+ more information.
75
+
76
+ === Parallel Tasks
77
+
78
+ Sometimes you have several tasks that can be executed in parallel. By
79
+ specifying these tasks as prerequisites to a +multitask+ task.
80
+
81
+ In the following example the tasks copy_src, copy_doc and copy_bin
82
+ will all execute in parallel in their own thread.
83
+
84
+ multitask :copy_files => [:copy_src, :copy_doc, :copy_bin] do
85
+ puts "All Copies Complete"
86
+ end
87
+
88
+ == What is Rake
89
+
90
+ Rake is a build tool similar to the make program in many ways. But
91
+ instead of cryptic make recipes, Rake uses standard Ruby code to
92
+ declare tasks and dependencies. You have the full power of a modern
93
+ scripting language built right into your build tool.
94
+
95
+ == Availability
96
+
97
+ The easiest way to get and install rake is via RubyGems ...
98
+
99
+ gem install rake (you may need root/admin privileges)
100
+
101
+ Otherwise, you can get it from the more traditional places:
102
+
103
+ Home Page:: http://rake.rubyforge.org/
104
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
105
+
106
+ == Thanks
107
+
108
+ As usual, it was input from users that drove a alot of these changes.
109
+ The following people either contributed patches, made suggestions or
110
+ made otherwise helpful comments. Thanks to ...
111
+
112
+ * Doug Young (inspriation for the parallel task)
113
+
114
+ * David Heinemeier Hansson (for --trace message enhancement and for
115
+ pushing for namespace support).
116
+
117
+ * Ludvig Omholt (for the openAFS fix)
118
+
119
+ -- Jim Weirich
@@ -0,0 +1,59 @@
1
+ = Rake 0.7.1 Released
2
+
3
+ Version 0.7.1 supplies a bug fix and a few minor enhancements.
4
+
5
+ == Changes
6
+
7
+ === Bug Fixes in 0.7.1
8
+
9
+ * Changes in the exception reported for the FileUtils.ln caused
10
+ safe_ln to fail with a NotImplementedError. Rake 0.7.1 will now
11
+ catch that error or any StandardError and properly fall back to
12
+ using +cp+.
13
+
14
+ === New Features in 0.7.1
15
+
16
+ * You can filter the results of the --task option by supplying an
17
+ optional regular expression. This allows the user to easily find a
18
+ particular task name in a long list of possible names.
19
+
20
+ * Transforming procs in a rule may now return a list of prerequisites.
21
+ This allows more flexible rule formation.
22
+
23
+ * FileList and String now support a +pathmap+ melthod that makes the
24
+ transforming paths a bit easier. See the API docs for +pathmap+ for
25
+ details.
26
+
27
+ * The -f option without a value will disable the search for a
28
+ Rakefile. This allows the Rakefile to be defined entirely in a
29
+ library (and loaded with the -r option). The current working
30
+ directory is not changed when this is done.
31
+
32
+ == What is Rake
33
+
34
+ Rake is a build tool similar to the make program in many ways. But
35
+ instead of cryptic make recipes, Rake uses standard Ruby code to
36
+ declare tasks and dependencies. You have the full power of a modern
37
+ scripting language built right into your build tool.
38
+
39
+ == Availability
40
+
41
+ The easiest way to get and install rake is via RubyGems ...
42
+
43
+ gem install rake (you may need root/admin privileges)
44
+
45
+ Otherwise, you can get it from the more traditional places:
46
+
47
+ Home Page:: http://rake.rubyforge.org/
48
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
49
+
50
+ == Thanks
51
+
52
+ As usual, it was input from users that drove a alot of these changes.
53
+ The following people either contributed patches, made suggestions or
54
+ made otherwise helpful comments. Thanks to ...
55
+
56
+ * James Britt and Assaph Mehr for reporting and helping to debug the
57
+ safe_ln issue.
58
+
59
+ -- Jim Weirich
@@ -0,0 +1,121 @@
1
+ = Rake 0.7.2 Released
2
+
3
+ Version 0.7.2 supplies a bug fix and a few minor enhancements. In
4
+ particular, the new version fixes an incompatibility with the soon to
5
+ be released Ruby 1.8.6. We strongly recommend upgrading to Rake 0.7.2
6
+ in order to be compatible with the new version of Ruby.
7
+
8
+ == Changes
9
+
10
+ === Bug Fixes in 0.7.2
11
+
12
+ There are quite a number of bug fixes in the new 0.7.2 version of
13
+ Rake:
14
+
15
+ * Removed dependency on internal fu_xxx functions from FileUtils.
16
+
17
+ * Error messages are now send to stderr rather than stdout (from
18
+ Payton Quackenbush).
19
+
20
+ * Better error handling on invalid command line arguments (from Payton
21
+ Quackenbush).
22
+
23
+ * Fixed some bugs where the application object was going to the global
24
+ appliation instead of using its own data.
25
+
26
+ * Fixed the method name leak from FileUtils (bug found by Glenn
27
+ Vanderburg).
28
+
29
+ * Added test for noop, bad_option and verbose flags to sh command.
30
+
31
+ * Added a description to the gem task in GemPackageTask.
32
+
33
+ * Fixed a bug when rules have multiple prerequisites (patch by Joel
34
+ VanderWerf)
35
+
36
+ * Added the handful of RakeFileUtils to the private method as well.
37
+
38
+ === New Features in 0.7.2
39
+
40
+ The following new features are available in Rake version 0.7.2:
41
+
42
+ * Added square and curly bracket patterns to FileList#include (Tilman
43
+ Sauerbeck).
44
+
45
+ * FileLists can now pass a block to FileList#exclude to exclude files
46
+ based on calculated values.
47
+
48
+ * Added plain filename support to rule dependents (suggested by Nobu
49
+ Nakada).
50
+
51
+ * Added pathmap support to rule dependents. In other words, if a
52
+ pathmap format (beginning with a '%') is given as a Rake rule
53
+ dependent, then the name of the depend will be the name of the
54
+ target with the pathmap format applied.
55
+
56
+ * Added a 'tasks' method to a namespace to get a list of tasks
57
+ associated with the namespace.
58
+
59
+ * Added tar_command and zip_command options to the Package task.
60
+
61
+ * The clean task will no longer delete 'core' if it is a directory.
62
+
63
+ === Internal Rake Improvements
64
+
65
+ The following changes will are mainly internal improvements and
66
+ refactorings and have little effect on the end user. But they may be
67
+ of interest to the general public.
68
+
69
+ * Added rcov task and updated unit testing for better code coverage.
70
+
71
+ * Added a 'shame' task to the Rakefile.
72
+
73
+ * Added rake_extension to handle detection of extension collisions.
74
+
75
+ * Added a protected 'require "rubygems"' to test/test_application to
76
+ unbreak cruisecontrol.rb.
77
+
78
+ * Removed rake_dup. Now we just simply rescue a bad dup.
79
+
80
+ * Refactored the FileList reject logic to remove duplication.
81
+
82
+ * Removed if __FILE__ at the end of the rake.rb file.
83
+
84
+ == What is Rake
85
+
86
+ Rake is a build tool similar to the make program in many ways. But
87
+ instead of cryptic make recipes, Rake uses standard Ruby code to
88
+ declare tasks and dependencies. You have the full power of a modern
89
+ scripting language built right into your build tool.
90
+
91
+ == Availability
92
+
93
+ The easiest way to get and install rake is via RubyGems ...
94
+
95
+ gem install rake (you may need root/admin privileges)
96
+
97
+ Otherwise, you can get it from the more traditional places:
98
+
99
+ Home Page:: http://rake.rubyforge.org/
100
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
101
+
102
+ == Thanks
103
+
104
+ As usual, it was input from users that drove a alot of these changes.
105
+ The following people either contributed patches, made suggestions or
106
+ made otherwise helpful comments. Thanks to ...
107
+
108
+ * Payton Quackenbush -- For several error handling improvements.
109
+
110
+ * Glenn Vanderburg -- For finding and fixing the method name leak from
111
+ FileUtils.
112
+
113
+ * Joel VanderWerf -- for finding and fixing a bug in the handling of
114
+ multiple prerequisites.
115
+
116
+ * Tilman Sauerbeck -- For some enhancing FileList to support more
117
+ advanced file globbing.
118
+
119
+ * Nobu Nakada -- For suggesting plain file name support to rule dependents.
120
+
121
+ -- Jim Weirich
@@ -0,0 +1,47 @@
1
+ = Rake 0.7.3 Released
2
+
3
+ Rake version 0.7.3 is a minor release that includes some refactoring to better
4
+ support custom Rake applications.
5
+
6
+ == Changes
7
+
8
+ === New Features in Version 0.7.3
9
+
10
+ * Added the +init+ and +top_level+ methods to make the creation of custom Rake applications a bit easier. E.g.
11
+
12
+ gem 'rake', ">= 0.7.3"
13
+ require 'rake'
14
+
15
+ Rake.application.init('myrake')
16
+
17
+ task :default do
18
+ something_interesting
19
+ end
20
+
21
+ Rake.application.top_level
22
+
23
+ == What is Rake
24
+
25
+ Rake is a build tool similar to the make program in many ways. But instead of
26
+ cryptic make recipes, Rake uses standard Ruby code to declare tasks and
27
+ dependencies. You have the full power of a modern scripting language built
28
+ right into your build tool.
29
+
30
+ == Availability
31
+
32
+ The easiest way to get and install rake is via RubyGems ...
33
+
34
+ gem install rake (you may need root/admin privileges)
35
+
36
+ Otherwise, you can get it from the more traditional places:
37
+
38
+ Home Page:: http://rake.rubyforge.org/
39
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
40
+
41
+ == Thanks
42
+
43
+ As usual, it was input from users that drove a alot of these changes. The
44
+ following people either contributed patches, made suggestions or made
45
+ otherwise helpful comments. Thanks to ...
46
+
47
+ -- Jim Weirich
@@ -0,0 +1,8 @@
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
+ Task = Rake::Task
6
+ FileTask = Rake::FileTask
7
+ FileCreationTask = Rake::FileCreationTask
8
+ RakeApp = Rake::Application
data/lib/rake/clean.rb CHANGED
@@ -16,7 +16,9 @@
16
16
  require 'rake'
17
17
 
18
18
  CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
19
- CLEAN.clear_exclude
19
+ CLEAN.clear_exclude.exclude { |fn|
20
+ fn.pathmap("%f") == 'core' && File.directory?(fn)
21
+ }
20
22
 
21
23
  desc "Remove any temporary products."
22
24
  task :clean do
@@ -48,7 +48,7 @@ module Rake # :nodoc:
48
48
  def parse_mode(m)
49
49
  result = 0
50
50
  (1..9).each do |i|
51
- result = 2*result + ((m[i]==?-) ? 0 : 1)
51
+ result = 2*result + ((m[i]==?-) ? 0 : 1)
52
52
  end
53
53
  result
54
54
  end
@@ -56,12 +56,12 @@ module Rake # :nodoc:
56
56
  def determine_time(d1, d2, d3)
57
57
  elements = ParseDate.parsedate("#{d1} #{d2} #{d3}")
58
58
  if elements[0].nil?
59
- today = self.class.date.today
60
- if elements[1] > today.month
61
- elements[0] = today.year - 1
62
- else
63
- elements[0] = today.year
64
- end
59
+ today = self.class.date.today
60
+ if elements[1] > today.month
61
+ elements[0] = today.year - 1
62
+ else
63
+ elements[0] = today.year
64
+ end
65
65
  end
66
66
  elements = elements.collect { |el| el.nil? ? 0 : el }
67
67
  Time.mktime(*elements[0,7])
@@ -79,12 +79,12 @@ module Rake # :nodoc:
79
79
  # Create an uploader and pass it to the given block as +up+.
80
80
  # When the block is complete, close the uploader.
81
81
  def connect(path, host, account, password)
82
- up = self.new(path, host, account, password)
83
- begin
84
- yield(up)
85
- ensure
86
- up.close
87
- end
82
+ up = self.new(path, host, account, password)
83
+ begin
84
+ yield(up)
85
+ ensure
86
+ up.close
87
+ end
88
88
  end
89
89
  end
90
90
 
@@ -103,13 +103,13 @@ module Rake # :nodoc:
103
103
  def makedirs(path)
104
104
  route = []
105
105
  File.split(path).each do |dir|
106
- route << dir
107
- current_dir = File.join(route)
108
- if @created[current_dir].nil?
109
- @created[current_dir] = true
110
- puts "Creating Directory #{current_dir}" if @verbose
111
- @ftp.mkdir(current_dir) rescue nil
112
- end
106
+ route << dir
107
+ current_dir = File.join(route)
108
+ if @created[current_dir].nil?
109
+ @created[current_dir] = true
110
+ puts "Creating Directory #{current_dir}" if @verbose
111
+ @ftp.mkdir(current_dir) rescue nil
112
+ end
113
113
  end
114
114
  end
115
115
 
@@ -117,7 +117,7 @@ module Rake # :nodoc:
117
117
  # path.
118
118
  def upload_files(wildcard)
119
119
  Dir[wildcard].each do |fn|
120
- upload(fn)
120
+ upload(fn)
121
121
  end
122
122
  end
123
123
 
@@ -9,9 +9,9 @@ module Rake
9
9
 
10
10
  def initialize(projname, user)
11
11
  super(
12
- "#{user}@rubyforge.org",
13
- "/var/www/gforge-projects/#{projname}",
14
- "html")
12
+ "#{user}@rubyforge.org",
13
+ "/var/www/gforge-projects/#{projname}",
14
+ "html")
15
15
  end
16
16
  end
17
17
 
@@ -40,7 +40,7 @@ module Rake
40
40
  # Upload the local directory to the remote directory.
41
41
  def upload
42
42
  @files.each do |fn|
43
- sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
43
+ sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
44
44
  end
45
45
  end
46
46
  end
@@ -97,13 +97,13 @@ module Sys
97
97
  def delete(*wildcards)
98
98
  wildcards.each do |wildcard|
99
99
  Dir[wildcard].each do |fn|
100
- if File.directory?(fn)
101
- log "Deleting directory #{fn}"
102
- Dir.delete(fn)
103
- else
104
- log "Deleting file #{fn}"
105
- File.delete(fn)
106
- end
100
+ if File.directory?(fn)
101
+ log "Deleting directory #{fn}"
102
+ Dir.delete(fn)
103
+ else
104
+ log "Deleting file #{fn}"
105
+ File.delete(fn)
106
+ end
107
107
  end
108
108
  end
109
109
  end
@@ -112,18 +112,18 @@ module Sys
112
112
  def delete_all(*wildcards)
113
113
  wildcards.each do |wildcard|
114
114
  Dir[wildcard].each do |fn|
115
- next if ! File.exist?(fn)
116
- if File.directory?(fn)
117
- Dir["#{fn}/*"].each do |subfn|
118
- next if subfn=='.' || subfn=='..'
119
- delete_all(subfn)
120
- end
121
- log "Deleting directory #{fn}"
122
- Dir.delete(fn)
123
- else
124
- log "Deleting file #{fn}"
125
- File.delete(fn)
126
- end
115
+ next if ! File.exist?(fn)
116
+ if File.directory?(fn)
117
+ Dir["#{fn}/*"].each do |subfn|
118
+ next if subfn=='.' || subfn=='..'
119
+ delete_all(subfn)
120
+ end
121
+ log "Deleting directory #{fn}"
122
+ Dir.delete(fn)
123
+ else
124
+ log "Deleting file #{fn}"
125
+ File.delete(fn)
126
+ end
127
127
  end
128
128
  end
129
129
  end
@@ -177,7 +177,7 @@ module Sys
177
177
  def for_files(*wildcards)
178
178
  wildcards.each do |wildcard|
179
179
  Dir[wildcard].each do |fn|
180
- yield(fn)
180
+ yield(fn)
181
181
  end
182
182
  end
183
183
  end
@@ -204,4 +204,3 @@ module Sys
204
204
  end
205
205
 
206
206
  end
207
-
@@ -77,21 +77,24 @@ module Rake
77
77
  def define
78
78
  super
79
79
  task :package => [:gem]
80
+ desc "Build the gem file #{gem_file}"
80
81
  task :gem => ["#{package_dir}/#{gem_file}"]
81
82
  file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do
82
- when_writing("Creating GEM") {
83
- Gem::Builder.new(gem_spec).build
84
- verbose(true) {
85
- mv gem_file, "#{package_dir}/#{gem_file}"
86
- }
87
- }
83
+ when_writing("Creating GEM") {
84
+ Gem::Builder.new(gem_spec).build
85
+ verbose(true) {
86
+ mv gem_file, "#{package_dir}/#{gem_file}"
87
+ }
88
+ }
88
89
  end
89
90
  end
90
91
 
91
- private
92
-
93
92
  def gem_file
94
- "#{package_name}.gem"
93
+ if @gem_spec.platform == Gem::Platform::RUBY
94
+ "#{package_name}.gem"
95
+ else
96
+ "#{package_name}-#{@gem_spec.platform}.gem"
97
+ end
95
98
  end
96
99
 
97
100
  end
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ module Rake
4
+
5
+ # Makefile loader to be used with the import file loader.
6
+ class MakefileLoader
7
+
8
+ # Load the makefile dependencies in +fn+.
9
+ def load(fn)
10
+ buffer = ''
11
+ open(fn) do |mf|
12
+ mf.each do |line|
13
+ next if line =~ /^\s*#/
14
+ buffer << line
15
+ if buffer =~ /\\$/
16
+ buffer.sub!(/\\\n/, ' ')
17
+ state = :append
18
+ else
19
+ process_line(buffer)
20
+ buffer = ''
21
+ end
22
+ end
23
+ end
24
+ process_line(buffer) if buffer != ''
25
+ end
26
+
27
+ private
28
+
29
+ # Process one logical line of makefile data.
30
+ def process_line(line)
31
+ file_task, args = line.split(':')
32
+ return if args.nil?
33
+ dependents = args.split
34
+ file file_task => dependents
35
+ end
36
+ end
37
+
38
+ # Install the handler
39
+ Rake.application.add_loader('mf', MakefileLoader.new)
40
+ end