drake 0.8.1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGES +386 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +396 -0
  4. data/Rakefile +505 -0
  5. data/TODO +20 -0
  6. data/bin/drake +31 -0
  7. data/bin/rake +31 -0
  8. data/doc/example/Rakefile1 +38 -0
  9. data/doc/example/Rakefile2 +35 -0
  10. data/doc/example/a.c +6 -0
  11. data/doc/example/b.c +6 -0
  12. data/doc/example/main.c +11 -0
  13. data/doc/glossary.rdoc +51 -0
  14. data/doc/jamis.rb +591 -0
  15. data/doc/proto_rake.rdoc +127 -0
  16. data/doc/rake.1.gz +0 -0
  17. data/doc/rakefile.rdoc +534 -0
  18. data/doc/rational.rdoc +151 -0
  19. data/doc/release_notes/rake-0.4.14.rdoc +23 -0
  20. data/doc/release_notes/rake-0.4.15.rdoc +35 -0
  21. data/doc/release_notes/rake-0.5.0.rdoc +53 -0
  22. data/doc/release_notes/rake-0.5.3.rdoc +78 -0
  23. data/doc/release_notes/rake-0.5.4.rdoc +46 -0
  24. data/doc/release_notes/rake-0.6.0.rdoc +141 -0
  25. data/doc/release_notes/rake-0.7.0.rdoc +119 -0
  26. data/doc/release_notes/rake-0.7.1.rdoc +59 -0
  27. data/doc/release_notes/rake-0.7.2.rdoc +121 -0
  28. data/doc/release_notes/rake-0.7.3.rdoc +47 -0
  29. data/doc/release_notes/rake-0.8.0.rdoc +114 -0
  30. data/doc/release_notes/rake-0.8.2.rdoc +163 -0
  31. data/install.rb +88 -0
  32. data/lib/rake.rb +2538 -0
  33. data/lib/rake/classic_namespace.rb +8 -0
  34. data/lib/rake/clean.rb +33 -0
  35. data/lib/rake/comp_tree/algorithm.rb +234 -0
  36. data/lib/rake/comp_tree/bucket_ipc.rb +175 -0
  37. data/lib/rake/comp_tree/driver.rb +291 -0
  38. data/lib/rake/comp_tree/error.rb +51 -0
  39. data/lib/rake/comp_tree/node.rb +189 -0
  40. data/lib/rake/comp_tree/quix/builtin/kernel/tap.rb +57 -0
  41. data/lib/rake/comp_tree/quix/diagnostic.rb +92 -0
  42. data/lib/rake/comp_tree/quix/kernel.rb +109 -0
  43. data/lib/rake/comp_tree/retriable_fork.rb +66 -0
  44. data/lib/rake/comp_tree/task_node.rb +46 -0
  45. data/lib/rake/contrib/compositepublisher.rb +24 -0
  46. data/lib/rake/contrib/ftptools.rb +153 -0
  47. data/lib/rake/contrib/publisher.rb +75 -0
  48. data/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  49. data/lib/rake/contrib/sshpublisher.rb +47 -0
  50. data/lib/rake/contrib/sys.rb +209 -0
  51. data/lib/rake/gempackagetask.rb +103 -0
  52. data/lib/rake/loaders/makefile.rb +35 -0
  53. data/lib/rake/packagetask.rb +185 -0
  54. data/lib/rake/parallel.rb +54 -0
  55. data/lib/rake/rake_test_loader.rb +5 -0
  56. data/lib/rake/rdoctask.rb +147 -0
  57. data/lib/rake/ruby182_test_unit_fix.rb +23 -0
  58. data/lib/rake/runtest.rb +23 -0
  59. data/lib/rake/tasklib.rb +23 -0
  60. data/lib/rake/testtask.rb +161 -0
  61. data/test/capture_stdout.rb +26 -0
  62. data/test/check_expansion.rb +5 -0
  63. data/test/contrib/test_sys.rb +47 -0
  64. data/test/data/chains/Rakefile +15 -0
  65. data/test/data/default/Rakefile +19 -0
  66. data/test/data/dryrun/Rakefile +22 -0
  67. data/test/data/file_creation_task/Rakefile +33 -0
  68. data/test/data/imports/Rakefile +19 -0
  69. data/test/data/imports/deps.mf +1 -0
  70. data/test/data/multidesc/Rakefile +17 -0
  71. data/test/data/namespace/Rakefile +57 -0
  72. data/test/data/rakelib/test1.rb +3 -0
  73. data/test/data/rbext/rakefile.rb +3 -0
  74. data/test/data/sample.mf +12 -0
  75. data/test/data/statusreturn/Rakefile +8 -0
  76. data/test/data/unittest/Rakefile +1 -0
  77. data/test/filecreation.rb +32 -0
  78. data/test/functional.rb +15 -0
  79. data/test/in_environment.rb +30 -0
  80. data/test/parallel.rb +3 -0
  81. data/test/rake_test_setup.rb +5 -0
  82. data/test/reqfile.rb +3 -0
  83. data/test/reqfile2.rb +3 -0
  84. data/test/session_functional.rb +324 -0
  85. data/test/shellcommand.rb +3 -0
  86. data/test/single_threaded.rb +2 -0
  87. data/test/test_application.rb +714 -0
  88. data/test/test_clean.rb +14 -0
  89. data/test/test_definitions.rb +82 -0
  90. data/test/test_earlytime.rb +35 -0
  91. data/test/test_extension.rb +63 -0
  92. data/test/test_file_creation_task.rb +62 -0
  93. data/test/test_file_task.rb +139 -0
  94. data/test/test_filelist.rb +618 -0
  95. data/test/test_fileutils.rb +250 -0
  96. data/test/test_ftp.rb +59 -0
  97. data/test/test_invocation_chain.rb +75 -0
  98. data/test/test_makefile_loader.rb +25 -0
  99. data/test/test_namespace.rb +36 -0
  100. data/test/test_package_task.rb +116 -0
  101. data/test/test_parallel.rb +47 -0
  102. data/test/test_pathmap.rb +209 -0
  103. data/test/test_rake.rb +41 -0
  104. data/test/test_require.rb +33 -0
  105. data/test/test_rules.rb +348 -0
  106. data/test/test_task_arguments.rb +89 -0
  107. data/test/test_task_manager.rb +172 -0
  108. data/test/test_tasklib.rb +12 -0
  109. data/test/test_tasks.rb +373 -0
  110. data/test/test_test_task.rb +75 -0
  111. data/test/test_top_level_functions.rb +84 -0
  112. metadata +190 -0
@@ -0,0 +1,35 @@
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
+ open(fn) do |mf|
11
+ lines = mf.read
12
+ lines.gsub!(/#[^\n]*\n/m, "")
13
+ lines.gsub!(/\\\n/, ' ')
14
+ lines.split("\n").each do |line|
15
+ process_line(line)
16
+ end
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ # Process one logical line of makefile data.
23
+ def process_line(line)
24
+ file_tasks, args = line.split(':')
25
+ return if args.nil?
26
+ dependents = args.split
27
+ file_tasks.strip.split.each do |file_task|
28
+ file file_task => dependents
29
+ end
30
+ end
31
+ end
32
+
33
+ # Install the handler
34
+ Rake.application.add_loader('mf', MakefileLoader.new)
35
+ end
@@ -0,0 +1,185 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Define a package task libarary to aid in the definition of
4
+ # redistributable package files.
5
+
6
+ require 'rake'
7
+ require 'rake/tasklib'
8
+
9
+ module Rake
10
+
11
+ # Create a packaging task that will package the project into
12
+ # distributable files (e.g zip archive or tar files).
13
+ #
14
+ # The PackageTask will create the following targets:
15
+ #
16
+ # [<b>:package</b>]
17
+ # Create all the requested package files.
18
+ #
19
+ # [<b>:clobber_package</b>]
20
+ # Delete all the package files. This target is automatically
21
+ # added to the main clobber target.
22
+ #
23
+ # [<b>:repackage</b>]
24
+ # Rebuild the package files from scratch, even if they are not out
25
+ # of date.
26
+ #
27
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tgz"</b>]
28
+ # Create a gzipped tar package (if <em>need_tar</em> is true).
29
+ #
30
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.gz"</b>]
31
+ # Create a gzipped tar package (if <em>need_tar_gz</em> is true).
32
+ #
33
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.bz2"</b>]
34
+ # Create a bzip2'd tar package (if <em>need_tar_bz2</em> is true).
35
+ #
36
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.zip"</b>]
37
+ # Create a zip package archive (if <em>need_zip</em> is true).
38
+ #
39
+ # Example:
40
+ #
41
+ # Rake::PackageTask.new("rake", "1.2.3") do |p|
42
+ # p.need_tar = true
43
+ # p.package_files.include("lib/**/*.rb")
44
+ # end
45
+ #
46
+ class PackageTask < TaskLib
47
+ # Name of the package (from the GEM Spec).
48
+ attr_accessor :name
49
+
50
+ # Version of the package (e.g. '1.3.2').
51
+ attr_accessor :version
52
+
53
+ # Directory used to store the package files (default is 'pkg').
54
+ attr_accessor :package_dir
55
+
56
+ # True if a gzipped tar file (tgz) should be produced (default is false).
57
+ attr_accessor :need_tar
58
+
59
+ # True if a gzipped tar file (tar.gz) should be produced (default is false).
60
+ attr_accessor :need_tar_gz
61
+
62
+ # True if a bzip2'd tar file (tar.bz2) should be produced (default is false).
63
+ attr_accessor :need_tar_bz2
64
+
65
+ # True if a zip file should be produced (default is false)
66
+ attr_accessor :need_zip
67
+
68
+ # List of files to be included in the package.
69
+ attr_accessor :package_files
70
+
71
+ # Tar command for gzipped or bzip2ed archives. The default is 'tar'.
72
+ attr_accessor :tar_command
73
+
74
+ # Zip command for zipped archives. The default is 'zip'.
75
+ attr_accessor :zip_command
76
+
77
+ # Create a Package Task with the given name and version.
78
+ def initialize(name=nil, version=nil)
79
+ init(name, version)
80
+ yield self if block_given?
81
+ define unless name.nil?
82
+ end
83
+
84
+ # Initialization that bypasses the "yield self" and "define" step.
85
+ def init(name, version)
86
+ @name = name
87
+ @version = version
88
+ @package_files = Rake::FileList.new
89
+ @package_dir = 'pkg'
90
+ @need_tar = false
91
+ @need_tar_gz = false
92
+ @need_tar_bz2 = false
93
+ @need_zip = false
94
+ @tar_command = 'tar'
95
+ @zip_command = 'zip'
96
+ end
97
+
98
+ # Create the tasks defined by this task library.
99
+ def define
100
+ fail "Version required (or :noversion)" if @version.nil?
101
+ @version = nil if :noversion == @version
102
+
103
+ desc "Build all the packages"
104
+ task :package
105
+
106
+ desc "Force a rebuild of the package files"
107
+ task :repackage => [:clobber_package, :package]
108
+
109
+ desc "Remove package products"
110
+ task :clobber_package do
111
+ rm_r package_dir rescue nil
112
+ end
113
+
114
+ task :clobber => [:clobber_package]
115
+
116
+ [
117
+ [need_tar, tgz_file, "z"],
118
+ [need_tar_gz, tar_gz_file, "z"],
119
+ [need_tar_bz2, tar_bz2_file, "j"]
120
+ ].each do |(need, file, flag)|
121
+ if need
122
+ task :package => ["#{package_dir}/#{file}"]
123
+ file "#{package_dir}/#{file}" => [package_dir_path] + package_files do
124
+ chdir(package_dir) do
125
+ sh %{env}
126
+ sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}}
127
+ end
128
+ end
129
+ end
130
+ end
131
+
132
+ if need_zip
133
+ task :package => ["#{package_dir}/#{zip_file}"]
134
+ file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do
135
+ chdir(package_dir) do
136
+ sh %{#{@zip_command} -r #{zip_file} #{package_name}}
137
+ end
138
+ end
139
+ end
140
+
141
+ directory package_dir
142
+
143
+ file package_dir_path => @package_files do
144
+ mkdir_p package_dir rescue nil
145
+ @package_files.each do |fn|
146
+ f = File.join(package_dir_path, fn)
147
+ fdir = File.dirname(f)
148
+ mkdir_p(fdir) if !File.exist?(fdir)
149
+ if File.directory?(fn)
150
+ mkdir_p(f)
151
+ else
152
+ rm_f f
153
+ safe_ln(fn, f)
154
+ end
155
+ end
156
+ end
157
+ self
158
+ end
159
+
160
+ def package_name
161
+ @version ? "#{@name}-#{@version}" : @name
162
+ end
163
+
164
+ def package_dir_path
165
+ "#{package_dir}/#{package_name}"
166
+ end
167
+
168
+ def tgz_file
169
+ "#{package_name}.tgz"
170
+ end
171
+
172
+ def tar_gz_file
173
+ "#{package_name}.tar.gz"
174
+ end
175
+
176
+ def tar_bz2_file
177
+ "#{package_name}.tar.bz2"
178
+ end
179
+
180
+ def zip_file
181
+ "#{package_name}.zip"
182
+ end
183
+ end
184
+
185
+ end
@@ -0,0 +1,54 @@
1
+
2
+ module Rake ; end
3
+
4
+ require 'rake/comp_tree/driver'
5
+
6
+ module Rake
7
+ module TaskManager
8
+ # :nodoc:
9
+ def invoke_parallel_tasks
10
+ parent_names = parallel_tasks.keys.map { |name|
11
+ name.to_sym
12
+ }
13
+
14
+ root_name = "computation_root__#{Process.pid}__#{rand}".to_sym
15
+
16
+ CompTree::Driver.new(:discard_result => true) { |driver|
17
+ #
18
+ # Define the root computation node.
19
+ #
20
+ # Top-level tasks are immediate children of the root.
21
+ #
22
+ driver.define(root_name, *parent_names) {
23
+ }
24
+
25
+ #
26
+ # build the rest of the computation tree from task prereqs
27
+ #
28
+ parallel_tasks.each_pair { |task_name, task_args|
29
+ task = self[task_name]
30
+ children_names = task.prerequisites.map { |child|
31
+ child.to_sym
32
+ }
33
+ driver.define(task_name.to_sym, *children_names) {
34
+ task.execute(task_args)
35
+ }
36
+ }
37
+
38
+ #
39
+ # Mark computation nodes without a function as computed.
40
+ #
41
+ driver.nodes[root_name].each_downward { |node|
42
+ unless node.function
43
+ node.result = true
44
+ end
45
+ }
46
+
47
+ #
48
+ # launch the computation
49
+ #
50
+ driver.compute(root_name, :threads => num_threads, :fork => false)
51
+ }
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Load the test files from the command line.
4
+
5
+ ARGV.each { |f| load f unless f =~ /^-/ }
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rake'
4
+ require 'rake/tasklib'
5
+
6
+ module Rake
7
+
8
+ # Create a documentation task that will generate the RDoc files for
9
+ # a project.
10
+ #
11
+ # The RDocTask will create the following targets:
12
+ #
13
+ # [<b><em>rdoc</em></b>]
14
+ # Main task for this RDOC task.
15
+ #
16
+ # [<b>:clobber_<em>rdoc</em></b>]
17
+ # Delete all the rdoc files. This target is automatically
18
+ # added to the main clobber target.
19
+ #
20
+ # [<b>:re<em>rdoc</em></b>]
21
+ # Rebuild the rdoc files from scratch, even if they are not out
22
+ # of date.
23
+ #
24
+ # Simple Example:
25
+ #
26
+ # Rake::RDocTask.new do |rd|
27
+ # rd.main = "README.rdoc"
28
+ # rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
29
+ # end
30
+ #
31
+ # You may wish to give the task a different name, such as if you are
32
+ # generating two sets of documentation. For instance, if you want to have a
33
+ # development set of documentation including private methods:
34
+ #
35
+ # Rake::RDocTask.new(:rdoc_dev) do |rd|
36
+ # rd.main = "README.doc"
37
+ # rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
38
+ # rd.options << "--all"
39
+ # end
40
+ #
41
+ # The tasks would then be named :<em>rdoc_dev</em>, :clobber_<em>rdoc_dev</em>, and
42
+ # :re<em>rdoc_dev</em>.
43
+ #
44
+ class RDocTask < TaskLib
45
+ # Name of the main, top level task. (default is :rdoc)
46
+ attr_accessor :name
47
+
48
+ # Name of directory to receive the html output files. (default is "html")
49
+ attr_accessor :rdoc_dir
50
+
51
+ # Title of RDoc documentation. (default is none)
52
+ attr_accessor :title
53
+
54
+ # Name of file to be used as the main, top level file of the
55
+ # RDoc. (default is none)
56
+ attr_accessor :main
57
+
58
+ # Name of template to be used by rdoc. (defaults to rdoc's default)
59
+ attr_accessor :template
60
+
61
+ # List of files to be included in the rdoc generation. (default is [])
62
+ attr_accessor :rdoc_files
63
+
64
+ # List of options to be passed rdoc. (default is [])
65
+ attr_accessor :options
66
+
67
+ # Run the rdoc process as an external shell (default is false)
68
+ 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
72
+ @name = name
73
+ @rdoc_files = Rake::FileList.new
74
+ @rdoc_dir = 'html'
75
+ @main = nil
76
+ @title = nil
77
+ @template = nil
78
+ @external = false
79
+ @options = []
80
+ yield self if block_given?
81
+ define
82
+ end
83
+
84
+ # Create the tasks defined by this task lib.
85
+ def define
86
+ if name.to_s != "rdoc"
87
+ desc "Build the RDOC HTML Files"
88
+ end
89
+
90
+ desc "Build the #{name} HTML Files"
91
+ task name
92
+
93
+ desc "Force a rebuild of the RDOC files"
94
+ task "re#{name}" => ["clobber_#{name}", name]
95
+
96
+ desc "Remove rdoc products"
97
+ task "clobber_#{name}" do
98
+ rm_r rdoc_dir rescue nil
99
+ end
100
+
101
+ task :clobber => ["clobber_#{name}"]
102
+
103
+ directory @rdoc_dir
104
+ task name => [rdoc_target]
105
+ file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
106
+ rm_r @rdoc_dir rescue nil
107
+ args = option_list + @rdoc_files
108
+ if @external
109
+ argstring = args.join(' ')
110
+ sh %{ruby -Ivendor vender/rd #{argstring}}
111
+ else
112
+ require 'rdoc/rdoc'
113
+ RDoc::RDoc.new.document(args)
114
+ end
115
+ end
116
+ self
117
+ end
118
+
119
+ def option_list
120
+ result = @options.dup
121
+ result << "-o" << @rdoc_dir
122
+ result << "--main" << quote(main) if main
123
+ result << "--title" << quote(title) if title
124
+ result << "-T" << quote(template) if template
125
+ result
126
+ end
127
+
128
+ def quote(str)
129
+ if @external
130
+ "'#{str}'"
131
+ else
132
+ str
133
+ end
134
+ end
135
+
136
+ def option_string
137
+ option_list.join(' ')
138
+ end
139
+
140
+ private
141
+
142
+ def rdoc_target
143
+ "#{rdoc_dir}/index.html"
144
+ end
145
+
146
+ end
147
+ end
@@ -0,0 +1,23 @@
1
+ module Test
2
+ module Unit
3
+ module Collector
4
+ class Dir
5
+ undef collect_file
6
+ def collect_file(name, suites, already_gathered)
7
+ # loadpath = $:.dup
8
+ dir = File.dirname(File.expand_path(name))
9
+ $:.unshift(dir) unless $:.first == dir
10
+ if(@req)
11
+ @req.require(name)
12
+ else
13
+ require(name)
14
+ end
15
+ find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
16
+ ensure
17
+ # $:.replace(loadpath)
18
+ $:.delete_at $:.rindex(dir)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end