drake 0.8.1.10.0.1 → 0.8.1.11.0.1

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.
data/CHANGES CHANGED
@@ -53,6 +53,10 @@
53
53
  However, if RAKE_COLUMNS is explicitly set, it will be honored in
54
54
  any case. (Patch provided by Gavin Stark).
55
55
 
56
+ * Numerous fixes for running under windows. A big thanks to Bheeshmar
57
+ Redheendran for spending a good part of the afternoon at the
58
+ Lonestar Ruby Conference to help me work out these issues.
59
+
56
60
  == Version 0.8.1
57
61
 
58
62
  * Removed requires on parsedate.rb (in Ftptools)
data/CHANGES.drake ADDED
@@ -0,0 +1,7 @@
1
+
2
+ = Drake Changelog
3
+
4
+ == Version 0.8.11.0.1
5
+
6
+ * Initial release.
7
+
data/README CHANGED
@@ -6,13 +6,24 @@ A branch of Rake supporting parallel task execution.
6
6
 
7
7
  Run up to three tasks in parallel:
8
8
 
9
+ % drake -j3
10
+
11
+ or equivalently,
12
+
9
13
  % drake --threads 3
10
14
 
11
15
  == Installation
12
16
 
13
17
  % gem install drake
14
18
 
15
- == Important Notes
19
+ == Notes
20
+
21
+ === Compatibility
22
+
23
+ Drake is 100% compatible with Rake. The code path for
24
+ <tt>--threads=1</tt> is effectively identical to that of Rake's.
25
+ Drake passes all of Rake's unit tests, with any number of threads from
26
+ 1 to 1000 (that's the most I tested).
16
27
 
17
28
  === Dependencies
18
29
 
@@ -21,12 +32,11 @@ dependency tree has not been properly defined. Consider
21
32
 
22
33
  task :a => [:x, :y, :z]
23
34
 
24
- With single-threaded +rake+, _x_,_y_,_z_ will be invoked <em>in that
35
+ With single-threaded Rake, _x_,_y_,_z_ will be invoked <em>in that
25
36
  order</em> before _a_ is invoked. However with
26
37
  <code>drake --threads=N</code> (for N > 1), one should not expect any
27
38
  particular order of execution. Since there is no dependency specified
28
- between _x_,_y_,_z_ above, <code>drake</code> is free to execute them
29
- in any order.
39
+ between _x_,_y_,_z_ above, Drake is free to run them in any order.
30
40
 
31
41
  If you wish _x_,_y_,_z_ to be invoked sequentially, then write
32
42
 
@@ -43,46 +53,34 @@ complete; can't do _z_ until _y_ is complete; can't do _y_ until _x_
43
53
  is complete; therefore do _x_." In this fashion the sequence
44
54
  _x_,_y_,_z_ is enforced.
45
55
 
46
- === MultiTask
47
-
48
- The use of 'multitask' is now deprecated. Tasks which may properly be
49
- run in parallel will be run in parallel; those which cannot, will not.
50
- It is not the user's job to decide.
56
+ The problem of insufficient dependencies plagues Makefiles as well.
57
+ Package maintainers affectionately call it "not j-safe."
51
58
 
52
- === Compatibility
53
-
54
- Except for the addition of 'seq' and the removal of 'multitask'
55
- described above, Drake is codewise identical to Rake when
56
- <tt>--threads=1</tt>. No new code is executed unless threads > 1.
57
-
58
- Drake passes all of Rake's unit tests for any number of threads
59
- (presumably; I tested various numbers up to 1000).
60
-
61
- === Installation Notes
59
+ === MultiTask
62
60
 
63
- Despite outward appearances, Drake is internally the same as Rake,
64
- down to using the same file names with top-level module named 'Rake'.
65
- This is to make a mainline merge easier, if Jim decides to do so. The
66
- fork stems from the latest Rake repository.
61
+ The use of +multitask+ is deprecated. Tasks which may properly be run
62
+ in parallel will be run in parallel; those which cannot, will not. It
63
+ is not the user's job to decide.
67
64
 
68
- Since Rubygems installs each gem in separate directory, it it safe to
69
- have Rake and Drake installed at the same time. You can check this
70
- with a test Rakefile,
65
+ Drake's +multitask+ is an alias of +task+.
71
66
 
72
- task :default do
73
- puts $LOAD_PATH
74
- end
67
+ === Task#invoke inside Task#invoke
75
68
 
76
- When +rake+ is executed, it will list the lib directory inside the
77
- rake gem. When +drake+ is executed, the drake lib will appear.
69
+ Parallelizing code means surrendering control over the
70
+ micro-management of its execution. Manually invoking tasks inside
71
+ other tasks is rather contrary to this notion, throwing a monkey
72
+ wrench into the system. An exception will be raised when this is
73
+ attempted in non-single-threaded mode.
78
74
 
79
- == Download
75
+ == Links
80
76
 
81
- * http://rubyforge.org/frs/?group_id=6530
77
+ * Download: * http://rubyforge.org/frs/?group_id=6530
78
+ * Rubyforge home: http://rubyforge.org/projects/drake
79
+ * Repository: http://github.com/quix/rake
82
80
 
83
- == Repository
81
+ == Author
84
82
 
85
- * http://github.com/quix/rake
83
+ * James M. Lawrence <quixoticsycophant@gmail.com>
86
84
 
87
85
  == License
88
86
 
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ require 'rake/clean'
16
16
  require 'rake/testtask'
17
17
  require 'rake/rdoctask'
18
18
 
19
- CLEAN.include('**/*.o', '*.dot', '**/*.rbc')
19
+ CLEAN.include('**/*.o', '*.dot', '**/.*.rbc')
20
20
  CLOBBER.include('doc/example/main', 'testdata')
21
21
  CLOBBER.include('test/data/**/temp_*')
22
22
  CLOBBER.include('test/data/chains/play.*')
@@ -49,6 +49,8 @@ SRC_RB = FileList['lib/**/*.rb']
49
49
  desc "Default Task"
50
50
  task :default => :test_all
51
51
 
52
+ load 'Rakefile.drake'
53
+
52
54
  # Test Tasks ---------------------------------------------------------
53
55
  task :dbg do |t|
54
56
  puts "Arguments are: #{t.args.join(', ')}"
@@ -221,7 +223,7 @@ else
221
223
 
222
224
  #### Author and project details.
223
225
 
224
- s.author = "Jim Weirich, James M. Lawrence"
226
+ s.author = "James M. Lawrence"
225
227
  s.email = "quixoticsycophant@gmail.com"
226
228
  s.homepage = "http://drake.rubyforge.org"
227
229
  s.rubyforge_project = "drake"
@@ -432,107 +434,3 @@ desc "Where is the current directory. This task displays\nthe current rake dire
432
434
  task :where_am_i do
433
435
  puts Rake.original_dir
434
436
  end
435
-
436
- ######################################################################
437
- # repackage files from contrib/
438
-
439
- $LOAD_PATH.unshift "./contrib/comp_tree/contrib/quix/lib"
440
- require 'quix/subpackager'
441
- require 'quix/fileutils'
442
-
443
- task :generate_rb do
444
- packages = {
445
- :rake => {
446
- :name_in_ruby => "Rake",
447
- :lib_dir => "./lib",
448
- :subpackages => {
449
- :comp_tree => {
450
- :name_in_ruby => "CompTree",
451
- :sources => [
452
- "driver",
453
- "node",
454
- "task_node",
455
- "error",
456
- "bucket_ipc",
457
- "algorithm",
458
- "retriable_fork",
459
- "quix/diagnostic",
460
- "quix/kernel",
461
- "quix/builtin/kernel/tap",
462
- ],
463
- :lib_dir => "./contrib/comp_tree/lib",
464
- :ignore_root_rb => true,
465
- },
466
- },
467
- },
468
- }
469
- Quix::Subpackager.run(packages)
470
- end
471
-
472
- ######################################################################
473
- # git
474
-
475
- def git(*args)
476
- cmd = ["git"] + args
477
- sh(*cmd)
478
- end
479
-
480
- task :add_contrib_first_time => :init_contrib do
481
- git(*%w!merge --squash -s ours --no-commit comp_tree/master!)
482
- git(*%w!read-tree --prefix=contrib/comp_tree -u comp_tree/master!)
483
- git("commit", "-m", "add comp_tree package")
484
- end
485
-
486
- task :init_contrib do
487
- unless `git remote`.split.include? "comp_tree"
488
- git(*%w!remote add -f comp_tree git@github.com:quix/comp_tree.git!)
489
- end
490
- end
491
-
492
- task :run_pull_contrib => :init_contrib do
493
- git(*%w!pull --no-commit -s subtree comp_tree master!)
494
- end
495
-
496
- task :pull_mainline do
497
- git(*%w!pull --no-commit
498
- git://github.com/jimweirich/rake.git
499
- refs/heads/master:refs/heads/origin!)
500
- end
501
-
502
- task :pull_contrib => [ :init_contrib, :run_pull_contrib, :generate_rb ]
503
-
504
- ######################################################################
505
- # drake_release
506
-
507
- require 'fileutils'
508
-
509
- task :drake_prerelease do
510
- rm_rf("html")
511
- rm_rf("pkg")
512
- end
513
-
514
- task :drake_publish => :rdoc do
515
- Dir.chdir(rd.rdoc_dir) {
516
- sh(*%w(scp -r . quix@rubyforge.org:/var/www/gforge-projects/drake))
517
- }
518
- end
519
-
520
- task :drake_upload do
521
- %w(gem tgz).each_with_index { |ext, index|
522
- sh("rubyforge",
523
- (index == 0 ? "add_release" : "add_file"),
524
- SPEC.rubyforge_project,
525
- SPEC.rubyforge_project,
526
- SPEC.version.to_s,
527
- "pkg/#{SPEC.name}-#{SPEC.version}.#{ext}")
528
- }
529
- end
530
-
531
- task :drake_release =>
532
- [
533
- :test_all,
534
- :drake_prerelease,
535
- :drake_publish,
536
- :package,
537
- :drake_upload,
538
- ]
data/Rakefile.drake ADDED
@@ -0,0 +1,108 @@
1
+
2
+ $LOAD_PATH.unshift "./contrib/comp_tree/contrib/quix/lib"
3
+
4
+ require 'quix/subpackager'
5
+ require 'quix/fileutils'
6
+ require 'fileutils'
7
+
8
+ ######################################################################
9
+ # repackage files from contrib/
10
+
11
+ task :generate_rb do
12
+ packages = {
13
+ :rake => {
14
+ :name_in_ruby => "Rake",
15
+ :lib_dir => "./lib",
16
+ :subpackages => {
17
+ :comp_tree => {
18
+ :name_in_ruby => "CompTree",
19
+ :sources => [
20
+ "driver",
21
+ "node",
22
+ "task_node",
23
+ "error",
24
+ "bucket_ipc",
25
+ "algorithm",
26
+ "retriable_fork",
27
+ "quix/diagnostic",
28
+ "quix/kernel",
29
+ "quix/builtin/kernel/tap",
30
+ ],
31
+ :lib_dir => "./contrib/comp_tree/lib",
32
+ :ignore_root_rb => true,
33
+ },
34
+ },
35
+ },
36
+ }
37
+ Quix::Subpackager.run(packages)
38
+ end
39
+
40
+ ######################################################################
41
+ # git
42
+
43
+ def git(*args)
44
+ cmd = ["git"] + args
45
+ sh(*cmd)
46
+ end
47
+
48
+ task :add_contrib_first_time => :init_contrib do
49
+ git(*%w!merge --squash -s ours --no-commit comp_tree/master!)
50
+ git(*%w!read-tree --prefix=contrib/comp_tree -u comp_tree/master!)
51
+ git("commit", "-m", "add comp_tree package")
52
+ end
53
+
54
+ task :init_contrib do
55
+ unless `git remote`.split.include? "comp_tree"
56
+ git(*%w!remote add -f comp_tree git@github.com:quix/comp_tree.git!)
57
+ end
58
+ end
59
+
60
+ task :run_pull_contrib => :init_contrib do
61
+ git(*%w!pull --no-commit -s subtree comp_tree master!)
62
+ end
63
+
64
+ task :pull_mainline do
65
+ git(*%w!pull --no-commit
66
+ git://github.com/jimweirich/rake.git
67
+ refs/heads/master:refs/heads/origin!)
68
+ end
69
+
70
+ task :pull_contrib => [ :init_contrib, :run_pull_contrib, :generate_rb ]
71
+
72
+ ######################################################################
73
+ # drake_release
74
+
75
+ task :drake_prerelease => :clean do
76
+ rm_rf("html")
77
+ rm_rf("pkg")
78
+ unless `git status` =~ %r!nothing to commit \(working directory clean\)!
79
+ raise "Directory not clean"
80
+ end
81
+ end
82
+
83
+ task :drake_publish => :rdoc do
84
+ Dir.chdir("html") {
85
+ sh(*%w(scp -r . quix@rubyforge.org:/var/www/gforge-projects/drake))
86
+ }
87
+ end
88
+
89
+ task :drake_finish_release do
90
+ sh("rubyforge",
91
+ "add_release",
92
+ SPEC.rubyforge_project,
93
+ SPEC.rubyforge_project,
94
+ SPEC.version.to_s,
95
+ "pkg/#{SPEC.name}-#{SPEC.version}.gem")
96
+ git("tag", SPEC.version.to_s)
97
+ git("push")
98
+ end
99
+
100
+ task :drake_release =>
101
+ [
102
+ :drake_prerelease,
103
+ :gem,
104
+ :test_all,
105
+ :drake_publish,
106
+ :drake_finish_release,
107
+ ]
108
+
@@ -159,5 +159,7 @@ otherwise helpful comments. Thanks to ...
159
159
  * Adam Majer
160
160
  * Emanuel Inderm�hle
161
161
  * Ittay Dror
162
+ * Bheeshmar Redheendran (for spending an afternoon with me debugging
163
+ windows issues)
162
164
 
163
165
  -- Jim Weirich
@@ -97,7 +97,7 @@ module Rake::CompTree
97
97
  # driver.define_area :width, :height, :offset, %{
98
98
  # width*height - offset
99
99
  # }
100
- # Note the '%' before the brace. The eval form creates a lambda for you.
100
+ # (Note the '%' before the brace.)
101
101
  #
102
102
  # The raw form:
103
103
  # driver.define(:area, :width, :height, :offset) { |width, height, offset|
data/lib/rake.rb CHANGED
@@ -29,7 +29,7 @@
29
29
  # as a library via a require statement, but it can be distributed
30
30
  # independently as an application.
31
31
 
32
- RAKEVERSION = '0.8.1.10.0.1'
32
+ RAKEVERSION = '0.8.1.11.0.1'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'getoptlong'
@@ -565,16 +565,23 @@ module Rake
565
565
 
566
566
  # Invoke the task if it is needed. Prerequites are invoked first.
567
567
  def invoke(*args)
568
- task_args = TaskArguments.new(arg_names, args)
569
-
570
- if application.num_threads > 1
571
- application.parallel_tasks = Hash.new
572
- end
573
-
574
- invoke_with_call_chain(task_args, InvocationChain::EMPTY)
568
+ run_invoke = lambda {
569
+ invoke_with_call_chain(
570
+ TaskArguments.new(arg_names, args),
571
+ InvocationChain::EMPTY)
572
+ }
575
573
 
576
- if application.num_threads > 1
577
- application.invoke_parallel_tasks
574
+ if application.num_threads == 1
575
+ run_invoke.call
576
+ else
577
+ if application.parallel_lock.locked?
578
+ raise "Calling Task#invoke within a task is not allowed."
579
+ end
580
+ application.parallel_lock.synchronize {
581
+ application.parallel_tasks.clear
582
+ run_invoke.call
583
+ application.invoke_parallel_tasks
584
+ }
578
585
  end
579
586
  end
580
587
 
@@ -758,6 +765,10 @@ module Rake
758
765
  end # class << Rake::Task
759
766
  end # class Rake::Task
760
767
 
768
+ #
769
+ # DEPRECATED: do not use MultiTask
770
+ #
771
+ MultiTask = Task
761
772
 
762
773
  # #########################################################################
763
774
  # A FileTask is a task that includes time based dependencies. If any of a
@@ -821,13 +832,6 @@ module Rake
821
832
  Rake::EARLY
822
833
  end
823
834
  end
824
-
825
- # #########################################################################
826
- # REMOVED: use command-line option '--threads N' or
827
- # Rake.application.num_threads = N
828
- #
829
- class MultiTask < Task
830
- end
831
835
  end # module Rake
832
836
 
833
837
  # ###########################################################################
@@ -844,6 +848,12 @@ def task(*args, &block)
844
848
  Rake::Task.define_task(*args, &block)
845
849
  end
846
850
 
851
+ #
852
+ # DEPRECATED: Do not use 'multitask'
853
+ #
854
+ def multitask(*args, &block)
855
+ task(*args, &block)
856
+ end
847
857
 
848
858
  # Declare a file task.
849
859
  #
@@ -881,14 +891,6 @@ def directory(dir)
881
891
  end
882
892
  end
883
893
 
884
- #
885
- # REMOVED: use command-line option '--threads N' or
886
- # Rake.application.num_threads = N
887
- #
888
- def multitask(args, &block)
889
- Rake::MultiTask.define_task(args, &block)
890
- end
891
-
892
894
  # Create a new rake namespace and use it for evaluating the given block.
893
895
  # Returns a NameSpace object that can be used to lookup tasks defined in the
894
896
  # namespace.
@@ -947,7 +949,7 @@ def import(*fns)
947
949
  end
948
950
 
949
951
  #
950
- # seq -- Force tasks to be executed sequentially.
952
+ # +seq+ : Force tasks to be executed sequentially.
951
953
  #
952
954
  (class << self ; self ; end).class_eval {
953
955
  # use this form to cleanly hide the lambda
@@ -1702,7 +1704,8 @@ module Rake
1702
1704
  alias :last_comment :last_description # Backwards compatibility
1703
1705
 
1704
1706
  attr_accessor :num_threads
1705
- attr_accessor :parallel_tasks #:nodoc:
1707
+ attr_reader :parallel_tasks #:nodoc:
1708
+ attr_reader :parallel_lock #:nodoc:
1706
1709
 
1707
1710
  def initialize
1708
1711
  super
@@ -1710,7 +1713,10 @@ module Rake
1710
1713
  @rules = Array.new
1711
1714
  @scope = Array.new
1712
1715
  @last_description = nil
1716
+
1713
1717
  @num_threads = 1
1718
+ @parallel_tasks = Hash.new
1719
+ @parallel_lock = Mutex.new
1714
1720
  end
1715
1721
 
1716
1722
  def create_rule(*args, &block)
@@ -2399,7 +2405,7 @@ module Rake
2399
2405
  (options.load_system || rakefile.nil?) &&
2400
2406
  directory?(system_dir)
2401
2407
  puts "(in #{Dir.pwd})" unless options.silent
2402
- Dir["#{system_dir}/*.rake"].each do |name|
2408
+ glob("#{system_dir}/*.rake") do |name|
2403
2409
  add_import name
2404
2410
  end
2405
2411
  else
@@ -2410,13 +2416,20 @@ module Rake
2410
2416
  puts "(in #{Dir.pwd})" unless options.silent
2411
2417
  $rakefile = @rakefile if options.classic_namespace
2412
2418
  load File.expand_path(@rakefile) if @rakefile && @rakefile != ''
2413
- end
2414
- options.rakelib.each do |rlib|
2415
- Dir["#{rlib}/*.rake"].each do |name| add_import name end
2419
+ options.rakelib.each do |rlib|
2420
+ glob("#{rlib}/*.rake") do |name|
2421
+ add_import name
2422
+ end
2423
+ end
2416
2424
  end
2417
2425
  load_imports
2418
2426
  end
2419
2427
 
2428
+ def glob(path, &block)
2429
+ Dir[path.gsub("\\", '/')].each(&block)
2430
+ end
2431
+ private :glob
2432
+
2420
2433
  # The directory path containing the system wide rakefiles.
2421
2434
  def system_dir
2422
2435
  if ENV['RAKE_SYSTEM']
@@ -102,6 +102,20 @@ class FunctionalTest < Test::Unit::TestCase
102
102
  assert_match %r{^SYS1}, @out
103
103
  end
104
104
 
105
+ def test_system_excludes_rakelib_files_too
106
+ in_environment('RAKE_SYSTEM' => 'test/data/sys') do
107
+ rake '-g', "sys1", '-T', 'extra'
108
+ end
109
+ assert_no_match %r{extra:extra}, @out
110
+ end
111
+
112
+ def test_by_default_rakelib_files_are_include
113
+ in_environment('RAKE_SYSTEM' => 'test/data/sys') do
114
+ rake '-T', 'extra'
115
+ end
116
+ assert_match %r{extra:extra}, @out
117
+ end
118
+
105
119
  def test_implicit_system
106
120
  in_environment('RAKE_SYSTEM' => File.expand_path('test/data/sys'), "PWD" => "/") do
107
121
  rake "sys1", "--trace"
@@ -320,5 +334,4 @@ class FunctionalTest < Test::Unit::TestCase
320
334
  def assert_status(expected_status=0)
321
335
  assert_equal expected_status, @status
322
336
  end
323
-
324
337
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1.10.0.1
4
+ version: 0.8.1.11.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Jim Weirich, James M. Lawrence
7
+ - James M. Lawrence
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-08 00:00:00 -04:00
12
+ date: 2008-09-09 00:00:00 -04:00
13
13
  default_executable: drake
14
14
  dependencies: []
15
15
 
@@ -43,9 +43,11 @@ extra_rdoc_files:
43
43
  files:
44
44
  - install.rb
45
45
  - CHANGES
46
+ - CHANGES.drake
46
47
  - MIT-LICENSE
47
48
  - README
48
49
  - Rakefile
50
+ - Rakefile.drake
49
51
  - TODO
50
52
  - bin/drake
51
53
  - bin/rake