spline 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/bin/spline +11 -9
  3. data/lib/spline/version.rb +1 -1
  4. data/lib/spline.rb +1 -8
  5. data/vendor/bundle/ruby/2.1.0/bin/rake +23 -0
  6. data/vendor/bundle/ruby/2.1.0/bin/spline +23 -0
  7. data/vendor/bundle/ruby/2.1.0/build_info/rake-10.3.2.info +1 -0
  8. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.autotest +7 -0
  9. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.gemtest +0 -0
  10. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.rubocop.yml +27 -0
  11. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.togglerc +7 -0
  12. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/CONTRIBUTING.rdoc +34 -0
  13. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/History.rdoc +609 -0
  14. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/MIT-LICENSE +21 -0
  15. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/Manifest.txt +162 -0
  16. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/README.rdoc +137 -0
  17. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/Rakefile +81 -0
  18. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/bin/rake +33 -0
  19. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/alt_system.rb +110 -0
  20. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb +783 -0
  21. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/backtrace.rb +23 -0
  22. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/clean.rb +76 -0
  23. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cloneable.rb +16 -0
  24. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/.document +0 -0
  25. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/compositepublisher.rb +21 -0
  26. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/ftptools.rb +137 -0
  27. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/publisher.rb +81 -0
  28. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  29. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sshpublisher.rb +61 -0
  30. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sys.rb +4 -0
  31. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cpu_counter.rb +109 -0
  32. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/default_loader.rb +14 -0
  33. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/dsl_definition.rb +198 -0
  34. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/early_time.rb +21 -0
  35. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/core.rb +25 -0
  36. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/module.rb +1 -0
  37. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/string.rb +173 -0
  38. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/time.rb +15 -0
  39. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_creation_task.rb +24 -0
  40. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_list.rb +414 -0
  41. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_task.rb +46 -0
  42. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils.rb +116 -0
  43. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils_ext.rb +144 -0
  44. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/gempackagetask.rb +4 -0
  45. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_chain.rb +56 -0
  46. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_exception_mixin.rb +16 -0
  47. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/linked_list.rb +103 -0
  48. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/loaders/makefile.rb +40 -0
  49. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/multi_task.rb +13 -0
  50. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/name_space.rb +38 -0
  51. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/packagetask.rb +202 -0
  52. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pathmap.rb +3 -0
  53. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/phony.rb +15 -0
  54. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/private_reader.rb +20 -0
  55. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/promise.rb +99 -0
  56. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pseudo_status.rb +29 -0
  57. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb +38 -0
  58. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_test_loader.rb +22 -0
  59. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rdoctask.rb +4 -0
  60. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ruby182_test_unit_fix.rb +29 -0
  61. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
  62. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/runtest.rb +27 -0
  63. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/scope.rb +42 -0
  64. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb +383 -0
  65. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_argument_error.rb +7 -0
  66. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_arguments.rb +98 -0
  67. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_manager.rb +310 -0
  68. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/tasklib.rb +24 -0
  69. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/testtask.rb +212 -0
  70. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_history_display.rb +48 -0
  71. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_pool.rb +164 -0
  72. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/trace_output.rb +22 -0
  73. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/version.rb +7 -0
  74. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/win32.rb +56 -0
  75. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake.rb +78 -0
  76. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/rakelib/publish.rake +20 -0
  77. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/rakelib/test_times.rake +25 -0
  78. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/file_creation.rb +34 -0
  79. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/helper.rb +127 -0
  80. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/support/rakefile_definitions.rb +478 -0
  81. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/support/ruby_runner.rb +33 -0
  82. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_private_reader.rb +42 -0
  83. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake.rb +40 -0
  84. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application.rb +641 -0
  85. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application_options.rb +466 -0
  86. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_backtrace.rb +119 -0
  87. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_clean.rb +55 -0
  88. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_cpu_counter.rb +50 -0
  89. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_definitions.rb +79 -0
  90. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_directory_task.rb +63 -0
  91. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_dsl.rb +40 -0
  92. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_early_time.rb +31 -0
  93. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_extension.rb +59 -0
  94. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_creation_task.rb +56 -0
  95. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list.rb +627 -0
  96. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list_path_map.rb +8 -0
  97. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_task.rb +186 -0
  98. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_utils.rb +309 -0
  99. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_ftp_file.rb +74 -0
  100. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_functional.rb +482 -0
  101. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_invocation_chain.rb +64 -0
  102. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_linked_list.rb +84 -0
  103. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_makefile_loader.rb +46 -0
  104. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_multi_task.rb +58 -0
  105. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_name_space.rb +57 -0
  106. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_package_task.rb +79 -0
  107. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map.rb +168 -0
  108. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_explode.rb +34 -0
  109. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_partial.rb +18 -0
  110. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_pseudo_status.rb +21 -0
  111. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rake_test_loader.rb +20 -0
  112. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_reduce_compat.rb +26 -0
  113. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_require.rb +40 -0
  114. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rules.rb +388 -0
  115. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_scope.rb +44 -0
  116. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task.rb +392 -0
  117. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_argument_parsing.rb +109 -0
  118. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_arguments.rb +127 -0
  119. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_lib.rb +9 -0
  120. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager.rb +178 -0
  121. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager_argument_resolution.rb +19 -0
  122. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_with_arguments.rb +171 -0
  123. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_test_task.rb +141 -0
  124. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_thread_pool.rb +142 -0
  125. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_top_level_functions.rb +71 -0
  126. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_win32.rb +72 -0
  127. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_thread_history_display.rb +101 -0
  128. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_trace_output.rb +52 -0
  129. data/vendor/bundle/ruby/2.1.0/specifications/rake-10.3.2.gemspec +45 -0
  130. metadata +127 -2
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+
3
+ # Load the test files from the command line.
4
+ argv = ARGV.select do |argument|
5
+ case argument
6
+ when /^-/ then
7
+ argument
8
+ when /\*/ then
9
+ FileList[argument].to_a.each do |file|
10
+ require File.expand_path file
11
+ end
12
+
13
+ false
14
+ else
15
+ require File.expand_path argument
16
+
17
+ false
18
+ end
19
+ end
20
+
21
+ ARGV.replace argv
22
+
@@ -0,0 +1,4 @@
1
+ # TODO: Remove in Rake 11
2
+
3
+ fail "ERROR: 'rake/rdoctask' is obsolete and no longer supported. " +
4
+ "Use 'rdoc/task' (available in RDoc 2.4.2+) instead."
@@ -0,0 +1,29 @@
1
+ # TODO: Remove in rake 11
2
+
3
+ # Local Rake override to fix bug in Ruby 0.8.2
4
+ module Test # :nodoc:
5
+ # Local Rake override to fix bug in Ruby 0.8.2
6
+ module Unit # :nodoc:
7
+ # Local Rake override to fix bug in Ruby 0.8.2
8
+ module Collector # :nodoc:
9
+ # Local Rake override to fix bug in Ruby 0.8.2
10
+ class Dir # :nodoc:
11
+ undef collect_file
12
+ def collect_file(name, suites, already_gathered) # :nodoc:
13
+ dir = File.dirname(File.expand_path(name))
14
+ $:.unshift(dir) unless $:.first == dir
15
+ if @req
16
+ @req.require(name)
17
+ else
18
+ require(name)
19
+ end
20
+ find_test_cases(already_gathered).each do |t|
21
+ add_suite(suites, t.suite)
22
+ end
23
+ ensure
24
+ $:.delete_at $:.rindex(dir)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+
2
+ module Rake
3
+
4
+ # Error indicating a recursion overflow error in task selection.
5
+ class RuleRecursionOverflowError < StandardError
6
+ def initialize(*args)
7
+ super
8
+ @targets = []
9
+ end
10
+
11
+ def add_target(target)
12
+ @targets << target
13
+ end
14
+
15
+ def message
16
+ super + ": [" + @targets.reverse.join(' => ') + "]"
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,27 @@
1
+ require 'test/unit'
2
+ require 'test/unit/assertions'
3
+ require 'rake/file_list'
4
+
5
+ module Rake
6
+ include Test::Unit::Assertions
7
+
8
+ ##
9
+ # Deprecated way of running tests in process, but only for Test::Unit.
10
+ #--
11
+ # TODO: Remove in rake 11
12
+
13
+ def run_tests(pattern='test/test*.rb', log_enabled=false) # :nodoc:
14
+ FileList.glob(pattern).each do |fn|
15
+ $stderr.puts fn if log_enabled
16
+ begin
17
+ require fn
18
+ rescue Exception => ex
19
+ $stderr.puts "Error in #{fn}: #{ex.message}"
20
+ $stderr.puts ex.backtrace
21
+ assert false
22
+ end
23
+ end
24
+ end
25
+
26
+ extend self
27
+ end
@@ -0,0 +1,42 @@
1
+ module Rake
2
+ class Scope < LinkedList # :nodoc: all
3
+
4
+ # Path for the scope.
5
+ def path
6
+ map { |item| item.to_s }.reverse.join(":")
7
+ end
8
+
9
+ # Path for the scope + the named path.
10
+ def path_with_task_name(task_name)
11
+ "#{path}:#{task_name}"
12
+ end
13
+
14
+ # Trim +n+ innermost scope levels from the scope. In no case will
15
+ # this trim beyond the toplevel scope.
16
+ def trim(n)
17
+ result = self
18
+ while n > 0 && ! result.empty?
19
+ result = result.tail
20
+ n -= 1
21
+ end
22
+ result
23
+ end
24
+
25
+ # Scope lists always end with an EmptyScope object. See Null
26
+ # Object Pattern)
27
+ class EmptyScope < EmptyLinkedList
28
+ @parent = Scope
29
+
30
+ def path
31
+ ""
32
+ end
33
+
34
+ def path_with_task_name(task_name)
35
+ task_name
36
+ end
37
+ end
38
+
39
+ # Singleton null object for an empty scope.
40
+ EMPTY = EmptyScope.new
41
+ end
42
+ end
@@ -0,0 +1,383 @@
1
+ require 'rake/invocation_exception_mixin'
2
+
3
+ module Rake
4
+
5
+ ##
6
+ # A Task is the basic unit of work in a Rakefile. Tasks have associated
7
+ # actions (possibly more than one) and a list of prerequisites. When
8
+ # invoked, a task will first ensure that all of its prerequisites have an
9
+ # opportunity to run and then it will execute its own actions.
10
+ #
11
+ # Tasks are not usually created directly using the new method, but rather
12
+ # use the +file+ and +task+ convenience methods.
13
+ #
14
+ class Task
15
+ # List of prerequisites for a task.
16
+ attr_reader :prerequisites
17
+
18
+ # List of actions attached to a task.
19
+ attr_reader :actions
20
+
21
+ # Application owning this task.
22
+ attr_accessor :application
23
+
24
+ # Array of nested namespaces names used for task lookup by this task.
25
+ attr_reader :scope
26
+
27
+ # File/Line locations of each of the task definitions for this
28
+ # task (only valid if the task was defined with the detect
29
+ # location option set).
30
+ attr_reader :locations
31
+
32
+ # Return task name
33
+ def to_s
34
+ name
35
+ end
36
+
37
+ def inspect # :nodoc:
38
+ "<#{self.class} #{name} => [#{prerequisites.join(', ')}]>"
39
+ end
40
+
41
+ # List of sources for task.
42
+ attr_writer :sources
43
+ def sources
44
+ if defined?(@sources)
45
+ @sources
46
+ else
47
+ prerequisites
48
+ end
49
+ end
50
+
51
+ # List of prerequisite tasks
52
+ def prerequisite_tasks
53
+ prerequisites.map { |pre| lookup_prerequisite(pre) }
54
+ end
55
+
56
+ def lookup_prerequisite(prerequisite_name) # :nodoc:
57
+ application[prerequisite_name, @scope]
58
+ end
59
+ private :lookup_prerequisite
60
+
61
+ # List of all unique prerequisite tasks including prerequisite tasks'
62
+ # prerequisites.
63
+ # Includes self when cyclic dependencies are found.
64
+ def all_prerequisite_tasks
65
+ seen = {}
66
+ collect_prerequisites(seen)
67
+ seen.values
68
+ end
69
+
70
+ def collect_prerequisites(seen) # :nodoc:
71
+ prerequisite_tasks.each do |pre|
72
+ next if seen[pre.name]
73
+ seen[pre.name] = pre
74
+ pre.collect_prerequisites(seen)
75
+ end
76
+ end
77
+ protected :collect_prerequisites
78
+
79
+ # First source from a rule (nil if no sources)
80
+ def source
81
+ sources.first
82
+ end
83
+
84
+ # Create a task named +task_name+ with no actions or prerequisites. Use
85
+ # +enhance+ to add actions and prerequisites.
86
+ def initialize(task_name, app)
87
+ @name = task_name.to_s
88
+ @prerequisites = []
89
+ @actions = []
90
+ @already_invoked = false
91
+ @comments = []
92
+ @lock = Monitor.new
93
+ @application = app
94
+ @scope = app.current_scope
95
+ @arg_names = nil
96
+ @locations = []
97
+ end
98
+
99
+ # Enhance a task with prerequisites or actions. Returns self.
100
+ def enhance(deps=nil, &block)
101
+ @prerequisites |= deps if deps
102
+ @actions << block if block_given?
103
+ self
104
+ end
105
+
106
+ # Name of the task, including any namespace qualifiers.
107
+ def name
108
+ @name.to_s
109
+ end
110
+
111
+ # Name of task with argument list description.
112
+ def name_with_args # :nodoc:
113
+ if arg_description
114
+ "#{name}#{arg_description}"
115
+ else
116
+ name
117
+ end
118
+ end
119
+
120
+ # Argument description (nil if none).
121
+ def arg_description # :nodoc:
122
+ @arg_names ? "[#{arg_names.join(',')}]" : nil
123
+ end
124
+
125
+ # Name of arguments for this task.
126
+ def arg_names
127
+ @arg_names || []
128
+ end
129
+
130
+ # Reenable the task, allowing its tasks to be executed if the task
131
+ # is invoked again.
132
+ def reenable
133
+ @already_invoked = false
134
+ end
135
+
136
+ # Clear the existing prerequisites and actions of a rake task.
137
+ def clear
138
+ clear_prerequisites
139
+ clear_actions
140
+ clear_comments
141
+ self
142
+ end
143
+
144
+ # Clear the existing prerequisites of a rake task.
145
+ def clear_prerequisites
146
+ prerequisites.clear
147
+ self
148
+ end
149
+
150
+ # Clear the existing actions on a rake task.
151
+ def clear_actions
152
+ actions.clear
153
+ self
154
+ end
155
+
156
+ # Clear the existing comments on a rake task.
157
+ def clear_comments
158
+ @comments = []
159
+ self
160
+ end
161
+
162
+ # Invoke the task if it is needed. Prerequisites are invoked first.
163
+ def invoke(*args)
164
+ task_args = TaskArguments.new(arg_names, args)
165
+ invoke_with_call_chain(task_args, InvocationChain::EMPTY)
166
+ end
167
+
168
+ # Same as invoke, but explicitly pass a call chain to detect
169
+ # circular dependencies.
170
+ def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
171
+ new_chain = InvocationChain.append(self, invocation_chain)
172
+ @lock.synchronize do
173
+ if application.options.trace
174
+ application.trace "** Invoke #{name} #{format_trace_flags}"
175
+ end
176
+ return if @already_invoked
177
+ @already_invoked = true
178
+ invoke_prerequisites(task_args, new_chain)
179
+ execute(task_args) if needed?
180
+ end
181
+ rescue Exception => ex
182
+ add_chain_to(ex, new_chain)
183
+ raise ex
184
+ end
185
+ protected :invoke_with_call_chain
186
+
187
+ def add_chain_to(exception, new_chain) # :nodoc:
188
+ exception.extend(InvocationExceptionMixin) unless
189
+ exception.respond_to?(:chain)
190
+ exception.chain = new_chain if exception.chain.nil?
191
+ end
192
+ private :add_chain_to
193
+
194
+ # Invoke all the prerequisites of a task.
195
+ def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
196
+ if application.options.always_multitask
197
+ invoke_prerequisites_concurrently(task_args, invocation_chain)
198
+ else
199
+ prerequisite_tasks.each { |p|
200
+ prereq_args = task_args.new_scope(p.arg_names)
201
+ p.invoke_with_call_chain(prereq_args, invocation_chain)
202
+ }
203
+ end
204
+ end
205
+
206
+ # Invoke all the prerequisites of a task in parallel.
207
+ def invoke_prerequisites_concurrently(task_args, invocation_chain)# :nodoc:
208
+ futures = prerequisite_tasks.map do |p|
209
+ prereq_args = task_args.new_scope(p.arg_names)
210
+ application.thread_pool.future(p) do |r|
211
+ r.invoke_with_call_chain(prereq_args, invocation_chain)
212
+ end
213
+ end
214
+ futures.each { |f| f.value }
215
+ end
216
+
217
+ # Format the trace flags for display.
218
+ def format_trace_flags
219
+ flags = []
220
+ flags << "first_time" unless @already_invoked
221
+ flags << "not_needed" unless needed?
222
+ flags.empty? ? "" : "(" + flags.join(", ") + ")"
223
+ end
224
+ private :format_trace_flags
225
+
226
+ # Execute the actions associated with this task.
227
+ def execute(args=nil)
228
+ args ||= EMPTY_TASK_ARGS
229
+ if application.options.dryrun
230
+ application.trace "** Execute (dry run) #{name}"
231
+ return
232
+ end
233
+ application.trace "** Execute #{name}" if application.options.trace
234
+ application.enhance_with_matching_rule(name) if @actions.empty?
235
+ @actions.each do |act|
236
+ case act.arity
237
+ when 1
238
+ act.call(self)
239
+ else
240
+ act.call(self, args)
241
+ end
242
+ end
243
+ end
244
+
245
+ # Is this task needed?
246
+ def needed?
247
+ true
248
+ end
249
+
250
+ # Timestamp for this task. Basic tasks return the current time for their
251
+ # time stamp. Other tasks can be more sophisticated.
252
+ def timestamp
253
+ Time.now
254
+ end
255
+
256
+ # Add a description to the task. The description can consist of an option
257
+ # argument list (enclosed brackets) and an optional comment.
258
+ def add_description(description)
259
+ return unless description
260
+ comment = description.strip
261
+ add_comment(comment) if comment && ! comment.empty?
262
+ end
263
+
264
+ def comment=(comment) # :nodoc:
265
+ add_comment(comment)
266
+ end
267
+
268
+ def add_comment(comment) # :nodoc:
269
+ return if comment.nil?
270
+ @comments << comment unless @comments.include?(comment)
271
+ end
272
+ private :add_comment
273
+
274
+ # Full collection of comments. Multiple comments are separated by
275
+ # newlines.
276
+ def full_comment
277
+ transform_comments("\n")
278
+ end
279
+
280
+ # First line (or sentence) of all comments. Multiple comments are
281
+ # separated by a "/".
282
+ def comment
283
+ transform_comments(" / ") { |c| first_sentence(c) }
284
+ end
285
+
286
+ # Transform the list of comments as specified by the block and
287
+ # join with the separator.
288
+ def transform_comments(separator, &block)
289
+ if @comments.empty?
290
+ nil
291
+ else
292
+ block ||= lambda { |c| c }
293
+ @comments.map(&block).join(separator)
294
+ end
295
+ end
296
+ private :transform_comments
297
+
298
+ # Get the first sentence in a string. The sentence is terminated
299
+ # by the first period or the end of the line. Decimal points do
300
+ # not count as periods.
301
+ def first_sentence(string)
302
+ string.split(/\.[ \t]|\.$|\n/).first
303
+ end
304
+ private :first_sentence
305
+
306
+ # Set the names of the arguments for this task. +args+ should be
307
+ # an array of symbols, one for each argument name.
308
+ def set_arg_names(args)
309
+ @arg_names = args.map { |a| a.to_sym }
310
+ end
311
+
312
+ # Return a string describing the internal state of a task. Useful for
313
+ # debugging.
314
+ def investigation
315
+ result = "------------------------------\n"
316
+ result << "Investigating #{name}\n"
317
+ result << "class: #{self.class}\n"
318
+ result << "task needed: #{needed?}\n"
319
+ result << "timestamp: #{timestamp}\n"
320
+ result << "pre-requisites: \n"
321
+ prereqs = prerequisite_tasks
322
+ prereqs.sort! { |a, b| a.timestamp <=> b.timestamp }
323
+ prereqs.each do |p|
324
+ result << "--#{p.name} (#{p.timestamp})\n"
325
+ end
326
+ latest_prereq = prerequisite_tasks.map { |pre| pre.timestamp }.max
327
+ result << "latest-prerequisite time: #{latest_prereq}\n"
328
+ result << "................................\n\n"
329
+ return result
330
+ end
331
+
332
+ # ----------------------------------------------------------------
333
+ # Rake Module Methods
334
+ #
335
+ class << self
336
+
337
+ # Clear the task list. This cause rake to immediately forget all the
338
+ # tasks that have been assigned. (Normally used in the unit tests.)
339
+ def clear
340
+ Rake.application.clear
341
+ end
342
+
343
+ # List of all defined tasks.
344
+ def tasks
345
+ Rake.application.tasks
346
+ end
347
+
348
+ # Return a task with the given name. If the task is not currently
349
+ # known, try to synthesize one from the defined rules. If no rules are
350
+ # found, but an existing file matches the task name, assume it is a file
351
+ # task with no dependencies or actions.
352
+ def [](task_name)
353
+ Rake.application[task_name]
354
+ end
355
+
356
+ # TRUE if the task name is already defined.
357
+ def task_defined?(task_name)
358
+ Rake.application.lookup(task_name) != nil
359
+ end
360
+
361
+ # Define a task given +args+ and an option block. If a rule with the
362
+ # given name already exists, the prerequisites and actions are added to
363
+ # the existing task. Returns the defined task.
364
+ def define_task(*args, &block)
365
+ Rake.application.define_task(self, *args, &block)
366
+ end
367
+
368
+ # Define a rule for synthesizing tasks.
369
+ def create_rule(*args, &block)
370
+ Rake.application.create_rule(*args, &block)
371
+ end
372
+
373
+ # Apply the scope to the task name according to the rules for
374
+ # this kind of task. Generic tasks will accept the scope as
375
+ # part of the name.
376
+ def scope_name(scope, task_name)
377
+ # (scope + [task_name]).join(':')
378
+ scope.path_with_task_name(task_name)
379
+ end
380
+
381
+ end # class << Rake::Task
382
+ end # class Rake::Task
383
+ end
@@ -0,0 +1,7 @@
1
+ module Rake
2
+
3
+ # Error indicating an ill-formed task declaration.
4
+ class TaskArgumentError < ArgumentError
5
+ end
6
+
7
+ end
@@ -0,0 +1,98 @@
1
+ module Rake
2
+
3
+ ##
4
+ # TaskArguments manage the arguments passed to a task.
5
+ #
6
+ class TaskArguments
7
+ include Enumerable
8
+
9
+ # Argument names
10
+ attr_reader :names
11
+
12
+ # Create a TaskArgument object with a list of argument +names+ and a set
13
+ # of associated +values+. +parent+ is the parent argument object.
14
+ def initialize(names, values, parent=nil)
15
+ @names = names
16
+ @parent = parent
17
+ @hash = {}
18
+ @values = values
19
+ names.each_with_index { |name, i|
20
+ @hash[name.to_sym] = values[i] unless values[i].nil?
21
+ }
22
+ end
23
+
24
+ # Retrieve the complete array of sequential values
25
+ def to_a
26
+ @values.dup
27
+ end
28
+
29
+ # Retrieve the list of values not associated with named arguments
30
+ def extras
31
+ @values[@names.length..-1] || []
32
+ end
33
+
34
+ # Create a new argument scope using the prerequisite argument
35
+ # names.
36
+ def new_scope(names)
37
+ values = names.map { |n| self[n] }
38
+ self.class.new(names, values + extras, self)
39
+ end
40
+
41
+ # Find an argument value by name or index.
42
+ def [](index)
43
+ lookup(index.to_sym)
44
+ end
45
+
46
+ # Specify a hash of default values for task arguments. Use the
47
+ # defaults only if there is no specific value for the given
48
+ # argument.
49
+ def with_defaults(defaults)
50
+ @hash = defaults.merge(@hash)
51
+ end
52
+
53
+ # Enumerates the arguments and their values
54
+ def each(&block)
55
+ @hash.each(&block)
56
+ end
57
+
58
+ # Extracts the argument values at +keys+
59
+ def values_at(*keys)
60
+ keys.map { |k| lookup(k) }
61
+ end
62
+
63
+ # Returns the value of the given argument via method_missing
64
+ def method_missing(sym, *args)
65
+ lookup(sym.to_sym)
66
+ end
67
+
68
+ # Returns a Hash of arguments and their values
69
+ def to_hash
70
+ @hash
71
+ end
72
+
73
+ def to_s # :nodoc:
74
+ @hash.inspect
75
+ end
76
+
77
+ def inspect # :nodoc:
78
+ to_s
79
+ end
80
+
81
+ # Returns true if +key+ is one of the arguments
82
+ def has_key?(key)
83
+ @hash.has_key?(key)
84
+ end
85
+
86
+ protected
87
+
88
+ def lookup(name) # :nodoc:
89
+ if @hash.has_key?(name)
90
+ @hash[name]
91
+ elsif @parent
92
+ @parent.lookup(name)
93
+ end
94
+ end
95
+ end
96
+
97
+ EMPTY_TASK_ARGS = TaskArguments.new([], []) # :nodoc:
98
+ end