jimweirich-rake 0.8.1.5 → 0.8.1.6

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
@@ -18,7 +18,7 @@
18
18
  Emanuel Inderm�hle)
19
19
 
20
20
  * Switched from getoptlong to optparse (patches supplied by Edwin
21
- Pratomo (edpratomo@yahoo.co.id))
21
+ Pratomo)
22
22
 
23
23
  * The -T option will now attempt to dynamically sense the size of the
24
24
  terminal. RAKE_COLUMNS will override any dynamic sensing.
@@ -31,6 +31,23 @@
31
31
 
32
32
  * Added the ability to reenable a task to be invoked a second time.
33
33
 
34
+ * Changed RDoc test task to have no default template. This makes it
35
+ easier for the tempate to pick up the template from the environment.
36
+
37
+ * Changed from using Mutex to Monitor. Evidently Mutex causes thread
38
+ join errors when Ruby is compiled with -disable-pthreads. (Patch
39
+ supplied by Ittay Dror)
40
+
41
+ * Fixed bug in makefile parser that had problems with extra spaces in
42
+ file task names. (Patch supplied by Ittay Dror)
43
+
44
+ * Added a performance patch for reading large makefile dependency
45
+ files. (Patch supplied by Ittay Dror)
46
+
47
+ * Default values for task arguments can easily be specified with the
48
+ :with_defaults method. (Idea for default argument merging supplied
49
+ by (Adam Q. Salter)
50
+
34
51
  == Version 0.8.1
35
52
 
36
53
  * Removed requires on parsedate.rb (in Ftptools)
data/Rakefile CHANGED
@@ -221,6 +221,7 @@ else
221
221
  open(t.name, "w") { |f| f.puts SPEC.to_yaml }
222
222
  end
223
223
 
224
+ desc "Create a stand-alone gemspec"
224
225
  task :gemspec => "rake.gemspec"
225
226
  end
226
227
 
data/lib/rake.rb CHANGED
@@ -29,13 +29,13 @@
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.5'
32
+ RAKEVERSION = '0.8.1.6'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'getoptlong'
36
36
  require 'fileutils'
37
37
  require 'singleton'
38
- require 'thread'
38
+ require 'monitor'
39
39
  require 'optparse'
40
40
  require 'ostruct'
41
41
 
@@ -293,12 +293,15 @@ module Rake
293
293
 
294
294
  attr_reader :names
295
295
 
296
+ # Create a TaskArgument object with a list of named arguments
297
+ # (given by :names) and a set of associated values (given by
298
+ # :values). :parent is the parent argument object.
296
299
  def initialize(names, values, parent=nil)
297
300
  @names = names
298
301
  @parent = parent
299
302
  @hash = {}
300
303
  names.each_with_index { |name, i|
301
- @hash[name.to_sym] = values[i]
304
+ @hash[name.to_sym] = values[i] unless values[i].nil?
302
305
  }
303
306
  end
304
307
 
@@ -314,6 +317,13 @@ module Rake
314
317
  lookup(index.to_sym)
315
318
  end
316
319
 
320
+ # Specify a hash of default values for task arguments. Use the
321
+ # defaults only if there is no specific value for the given
322
+ # argument.
323
+ def with_defaults(defaults)
324
+ @hash = defaults.merge(@hash)
325
+ end
326
+
317
327
  def each(&block)
318
328
  @hash.each(&block)
319
329
  end
@@ -456,12 +466,12 @@ module Rake
456
466
  # +enhance+ to add actions and prerequisites.
457
467
  def initialize(task_name, app)
458
468
  @name = task_name.to_s
459
- @prerequisites = FileList[]
469
+ @prerequisites = []
460
470
  @actions = []
461
471
  @already_invoked = false
462
472
  @full_comment = nil
463
473
  @comment = nil
464
- @lock = Mutex.new
474
+ @lock = Monitor.new
465
475
  @application = app
466
476
  @scope = app.current_scope
467
477
  @arg_names = nil
@@ -2081,6 +2091,21 @@ module Rake
2081
2091
  options.show_task_pattern = Regexp.new(value || '')
2082
2092
  }
2083
2093
  ],
2094
+ ['--execute', '-e CODE', "Execute some Ruby code and exit.",
2095
+ lambda { |value|
2096
+ eval(value)
2097
+ exit
2098
+ }
2099
+ ],
2100
+ ['--execute-print', '-p CODE', "Execute some Ruby code, print, then exit.",
2101
+ lambda { |value|
2102
+ puts eval(value)
2103
+ exit
2104
+ }
2105
+ ],
2106
+ ['--execute-continue', '-E', "Execute some Ruby code, then run tasks.",
2107
+ lambda { |value| eval(value) }
2108
+ ],
2084
2109
  ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
2085
2110
  lambda { |value|
2086
2111
  value ||= ''
@@ -7,21 +7,14 @@ module Rake
7
7
 
8
8
  # Load the makefile dependencies in +fn+.
9
9
  def load(fn)
10
- buffer = ''
11
10
  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
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)
22
16
  end
23
17
  end
24
- process_line(buffer) if buffer != ''
25
18
  end
26
19
 
27
20
  private
@@ -30,6 +23,7 @@ module Rake
30
23
  def process_line(line)
31
24
  file_task, args = line.split(':')
32
25
  return if args.nil?
26
+ file_task.strip!
33
27
  dependents = args.split
34
28
  file file_task => dependents
35
29
  end
data/lib/rake/rdoctask.rb CHANGED
@@ -55,7 +55,7 @@ module Rake
55
55
  # RDoc. (default is none)
56
56
  attr_accessor :main
57
57
 
58
- # Name of template to be used by rdoc. (default is 'html')
58
+ # Name of template to be used by rdoc. (defaults to rdoc's default)
59
59
  attr_accessor :template
60
60
 
61
61
  # List of files to be included in the rdoc generation. (default is [])
@@ -74,7 +74,7 @@ module Rake
74
74
  @rdoc_dir = 'html'
75
75
  @main = nil
76
76
  @title = nil
77
- @template = 'html'
77
+ @template = nil
78
78
  @external = false
79
79
  @options = []
80
80
  yield self if block_given?
data/test/data/sample.mf CHANGED
@@ -4,6 +4,7 @@ b: b1 b2 b3 \
4
4
  b4 b5 b6\
5
5
  # Mid: Comment
6
6
  b7
7
- a: a5 a6 a7
7
+
8
+ a : a5 a6 a7
8
9
  c: c1
9
10
  d: d1 d2 \
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
7
7
  class TestMakefileLoader < Test::Unit::TestCase
8
8
  include Rake
9
9
 
10
- def test_create
10
+ def test_parse
11
11
  Task.clear
12
12
  loader = Rake::MakefileLoader.new
13
13
  loader.load("test/data/sample.mf")
@@ -61,7 +61,7 @@ class TestTaskArguments < Test::Unit::TestCase
61
61
  def test_creating_new_argument_scopes
62
62
  parent = Rake::TaskArguments.new(['p'], [1])
63
63
  child = parent.new_scope(['c', 'p'])
64
- assert_equal({:c => nil, :p=>1}, child.to_hash)
64
+ assert_equal({:p=>1}, child.to_hash)
65
65
  assert_equal 1, child.p
66
66
  assert_equal 1, child["p"]
67
67
  assert_equal 1, child[:p]
@@ -73,4 +73,17 @@ class TestTaskArguments < Test::Unit::TestCase
73
73
  child = Rake::TaskArguments.new(['aa'], [2], parent)
74
74
  assert_equal 2, child.aa
75
75
  end
76
+
77
+ def test_default_arguments_values_can_be_merged
78
+ ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
79
+ ta.with_defaults({ :aa => 'default_val' })
80
+ assert_equal 'default_val', ta[:aa]
81
+ assert_equal 'original_val', ta[:bb]
82
+ end
83
+
84
+ def test_default_arguements_that_dont_match_names_are_ignored
85
+ ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
86
+ ta.with_defaults({ "cc" => "default_val" })
87
+ assert_nil ta[:cc]
88
+ end
76
89
  end
data/test/test_tasks.rb CHANGED
@@ -20,7 +20,6 @@ class TestTask < Test::Unit::TestCase
20
20
  t = task(:name) { |task| arg = task; 1234 }
21
21
  assert_equal "name", t.name
22
22
  assert_equal [], t.prerequisites
23
- assert t.prerequisites.is_a?(FileList)
24
23
  assert t.needed?
25
24
  t.execute(0)
26
25
  assert_equal t, arg
@@ -364,7 +363,7 @@ class TestTaskWithArguments < Test::Unit::TestCase
364
363
 
365
364
  def test_args_not_passed_if_no_arg_names
366
365
  pre = task(:pre, :rev) { |t, args|
367
- assert_equal({ :rev => nil }, args.to_hash)
366
+ assert_equal({}, args.to_hash)
368
367
  }
369
368
  t = task(:t, :needs => [:pre])
370
369
  t.invoke("bill", "1.2")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jimweirich-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1.5
4
+ version: 0.8.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-06 21:00:00 -07:00
12
+ date: 2008-08-09 21:00:00 -07:00
13
13
  default_executable: rake
14
14
  dependencies: []
15
15