diy_rails 0.1.0 → 0.1.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.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/lib/diy_rails/version.rb +1 -1
  3. data/lib/diy_rails.rb +7 -3
  4. metadata +12 -151
  5. data/vendor/bundle/ruby/3.0.0/bin/rackup +0 -29
  6. data/vendor/bundle/ruby/3.0.0/bin/rake +0 -29
  7. data/vendor/bundle/ruby/3.0.0/cache/rack-2.2.4.gem +0 -0
  8. data/vendor/bundle/ruby/3.0.0/cache/rake-13.0.6.gem +0 -0
  9. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/CHANGELOG.md +0 -708
  10. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/CONTRIBUTING.md +0 -136
  11. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/MIT-LICENSE +0 -20
  12. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/README.rdoc +0 -306
  13. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/Rakefile +0 -130
  14. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/SPEC.rdoc +0 -288
  15. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/bin/rackup +0 -5
  16. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/contrib/rack.png +0 -0
  17. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/contrib/rack.svg +0 -150
  18. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/contrib/rack_logo.svg +0 -164
  19. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/contrib/rdoc.css +0 -412
  20. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/example/lobster.ru +0 -6
  21. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/example/protectedlobster.rb +0 -16
  22. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/example/protectedlobster.ru +0 -10
  23. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/auth/abstract/handler.rb +0 -39
  24. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/auth/abstract/request.rb +0 -47
  25. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/auth/basic.rb +0 -61
  26. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/auth/digest/md5.rb +0 -131
  27. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/auth/digest/nonce.rb +0 -54
  28. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/auth/digest/params.rb +0 -54
  29. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/auth/digest/request.rb +0 -43
  30. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/body_proxy.rb +0 -45
  31. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/builder.rb +0 -257
  32. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/cascade.rb +0 -68
  33. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/chunked.rb +0 -117
  34. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/common_logger.rb +0 -83
  35. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/conditional_get.rb +0 -83
  36. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/config.rb +0 -22
  37. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/content_length.rb +0 -38
  38. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/content_type.rb +0 -30
  39. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/core_ext/regexp.rb +0 -14
  40. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/deflater.rb +0 -144
  41. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/directory.rb +0 -199
  42. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/etag.rb +0 -77
  43. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/events.rb +0 -153
  44. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/file.rb +0 -7
  45. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/files.rb +0 -218
  46. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/handler/cgi.rb +0 -59
  47. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/handler/fastcgi.rb +0 -100
  48. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/handler/lsws.rb +0 -61
  49. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/handler/scgi.rb +0 -71
  50. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/handler/thin.rb +0 -36
  51. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/handler/webrick.rb +0 -129
  52. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/handler.rb +0 -104
  53. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/head.rb +0 -25
  54. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/lint.rb +0 -806
  55. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/lobster.rb +0 -70
  56. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/lock.rb +0 -32
  57. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/logger.rb +0 -20
  58. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/media_type.rb +0 -43
  59. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/method_override.rb +0 -52
  60. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/mime.rb +0 -685
  61. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/mock.rb +0 -273
  62. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/multipart/generator.rb +0 -97
  63. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/multipart/parser.rb +0 -365
  64. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/multipart/uploaded_file.rb +0 -41
  65. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/multipart.rb +0 -64
  66. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/null_logger.rb +0 -39
  67. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/query_parser.rb +0 -221
  68. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/recursive.rb +0 -64
  69. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/reloader.rb +0 -114
  70. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/request.rb +0 -659
  71. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/response.rb +0 -318
  72. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/rewindable_input.rb +0 -94
  73. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/runtime.rb +0 -34
  74. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/sendfile.rb +0 -162
  75. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/server.rb +0 -466
  76. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb +0 -523
  77. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/session/cookie.rb +0 -203
  78. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/session/memcache.rb +0 -10
  79. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/session/pool.rb +0 -85
  80. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/show_exceptions.rb +0 -390
  81. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/show_status.rb +0 -113
  82. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/static.rb +0 -187
  83. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb +0 -22
  84. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/urlmap.rb +0 -97
  85. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/utils.rb +0 -616
  86. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/version.rb +0 -29
  87. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack.rb +0 -141
  88. data/vendor/bundle/ruby/3.0.0/gems/rack-2.2.4/rack.gemspec +0 -46
  89. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/History.rdoc +0 -2403
  90. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/MIT-LICENSE +0 -21
  91. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/README.rdoc +0 -155
  92. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/command_line_usage.rdoc +0 -158
  93. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/example/Rakefile1 +0 -38
  94. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/example/Rakefile2 +0 -35
  95. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/example/a.c +0 -6
  96. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/example/b.c +0 -6
  97. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/example/main.c +0 -11
  98. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/glossary.rdoc +0 -42
  99. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/jamis.rb +0 -592
  100. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/proto_rake.rdoc +0 -127
  101. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/rake.1 +0 -156
  102. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/rakefile.rdoc +0 -622
  103. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/doc/rational.rdoc +0 -151
  104. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake +0 -27
  105. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb +0 -831
  106. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/backtrace.rb +0 -24
  107. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/clean.rb +0 -78
  108. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/cloneable.rb +0 -17
  109. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/cpu_counter.rb +0 -107
  110. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/default_loader.rb +0 -15
  111. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/dsl_definition.rb +0 -195
  112. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/early_time.rb +0 -22
  113. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/ext/core.rb +0 -26
  114. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/ext/string.rb +0 -176
  115. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/file_creation_task.rb +0 -25
  116. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/file_list.rb +0 -435
  117. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/file_task.rb +0 -54
  118. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/file_utils.rb +0 -134
  119. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/file_utils_ext.rb +0 -134
  120. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/invocation_chain.rb +0 -57
  121. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/invocation_exception_mixin.rb +0 -17
  122. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/late_time.rb +0 -18
  123. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/linked_list.rb +0 -112
  124. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/loaders/makefile.rb +0 -54
  125. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/multi_task.rb +0 -14
  126. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/name_space.rb +0 -38
  127. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/packagetask.rb +0 -222
  128. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/phony.rb +0 -16
  129. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/private_reader.rb +0 -21
  130. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/promise.rb +0 -100
  131. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/pseudo_status.rb +0 -30
  132. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rake_module.rb +0 -67
  133. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb +0 -27
  134. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rule_recursion_overflow_error.rb +0 -20
  135. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/scope.rb +0 -43
  136. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb +0 -434
  137. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task_argument_error.rb +0 -8
  138. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task_arguments.rb +0 -109
  139. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task_manager.rb +0 -331
  140. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/tasklib.rb +0 -12
  141. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/testtask.rb +0 -189
  142. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb +0 -49
  143. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/thread_pool.rb +0 -163
  144. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/trace_output.rb +0 -23
  145. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/version.rb +0 -10
  146. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/win32.rb +0 -51
  147. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake.rb +0 -71
  148. data/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/rake.gemspec +0 -100
  149. data/vendor/bundle/ruby/3.0.0/specifications/rack-2.2.4.gemspec +0 -41
  150. data/vendor/bundle/ruby/3.0.0/specifications/rake-13.0.6.gemspec +0 -26
@@ -1,434 +0,0 @@
1
- # frozen_string_literal: true
2
- require "rake/invocation_exception_mixin"
3
-
4
- module Rake
5
-
6
- ##
7
- # A Task is the basic unit of work in a Rakefile. Tasks have associated
8
- # actions (possibly more than one) and a list of prerequisites. When
9
- # invoked, a task will first ensure that all of its prerequisites have an
10
- # opportunity to run and then it will execute its own actions.
11
- #
12
- # Tasks are not usually created directly using the new method, but rather
13
- # use the +file+ and +task+ convenience methods.
14
- #
15
- class Task
16
- # List of prerequisites for a task.
17
- attr_reader :prerequisites
18
- alias prereqs prerequisites
19
-
20
- # List of order only prerequisites for a task.
21
- attr_reader :order_only_prerequisites
22
-
23
- # List of actions attached to a task.
24
- attr_reader :actions
25
-
26
- # Application owning this task.
27
- attr_accessor :application
28
-
29
- # Array of nested namespaces names used for task lookup by this task.
30
- attr_reader :scope
31
-
32
- # File/Line locations of each of the task definitions for this
33
- # task (only valid if the task was defined with the detect
34
- # location option set).
35
- attr_reader :locations
36
-
37
- # Has this task already been invoked? Already invoked tasks
38
- # will be skipped unless you reenable them.
39
- attr_reader :already_invoked
40
-
41
- # Return task name
42
- def to_s
43
- name
44
- end
45
-
46
- def inspect # :nodoc:
47
- "<#{self.class} #{name} => [#{prerequisites.join(', ')}]>"
48
- end
49
-
50
- # List of sources for task.
51
- attr_writer :sources
52
- def sources
53
- if defined?(@sources)
54
- @sources
55
- else
56
- prerequisites
57
- end
58
- end
59
-
60
- # List of prerequisite tasks
61
- def prerequisite_tasks
62
- (prerequisites + order_only_prerequisites).map { |pre| lookup_prerequisite(pre) }
63
- end
64
-
65
- def lookup_prerequisite(prerequisite_name) # :nodoc:
66
- scoped_prerequisite_task = application[prerequisite_name, @scope]
67
- if scoped_prerequisite_task == self
68
- unscoped_prerequisite_task = application[prerequisite_name]
69
- end
70
- unscoped_prerequisite_task || scoped_prerequisite_task
71
- end
72
- private :lookup_prerequisite
73
-
74
- # List of all unique prerequisite tasks including prerequisite tasks'
75
- # prerequisites.
76
- # Includes self when cyclic dependencies are found.
77
- def all_prerequisite_tasks
78
- seen = {}
79
- collect_prerequisites(seen)
80
- seen.values
81
- end
82
-
83
- def collect_prerequisites(seen) # :nodoc:
84
- prerequisite_tasks.each do |pre|
85
- next if seen[pre.name]
86
- seen[pre.name] = pre
87
- pre.collect_prerequisites(seen)
88
- end
89
- end
90
- protected :collect_prerequisites
91
-
92
- # First source from a rule (nil if no sources)
93
- def source
94
- sources.first
95
- end
96
-
97
- # Create a task named +task_name+ with no actions or prerequisites. Use
98
- # +enhance+ to add actions and prerequisites.
99
- def initialize(task_name, app)
100
- @name = task_name.to_s
101
- @prerequisites = []
102
- @actions = []
103
- @already_invoked = false
104
- @comments = []
105
- @lock = Monitor.new
106
- @application = app
107
- @scope = app.current_scope
108
- @arg_names = nil
109
- @locations = []
110
- @invocation_exception = nil
111
- @order_only_prerequisites = []
112
- end
113
-
114
- # Enhance a task with prerequisites or actions. Returns self.
115
- def enhance(deps=nil, &block)
116
- @prerequisites |= deps if deps
117
- @actions << block if block_given?
118
- self
119
- end
120
-
121
- # Name of the task, including any namespace qualifiers.
122
- def name
123
- @name.to_s
124
- end
125
-
126
- # Name of task with argument list description.
127
- def name_with_args # :nodoc:
128
- if arg_description
129
- "#{name}#{arg_description}"
130
- else
131
- name
132
- end
133
- end
134
-
135
- # Argument description (nil if none).
136
- def arg_description # :nodoc:
137
- @arg_names ? "[#{arg_names.join(',')}]" : nil
138
- end
139
-
140
- # Name of arguments for this task.
141
- def arg_names
142
- @arg_names || []
143
- end
144
-
145
- # Reenable the task, allowing its tasks to be executed if the task
146
- # is invoked again.
147
- def reenable
148
- @already_invoked = false
149
- @invocation_exception = nil
150
- end
151
-
152
- # Clear the existing prerequisites, actions, comments, and arguments of a rake task.
153
- def clear
154
- clear_prerequisites
155
- clear_actions
156
- clear_comments
157
- clear_args
158
- self
159
- end
160
-
161
- # Clear the existing prerequisites of a rake task.
162
- def clear_prerequisites
163
- prerequisites.clear
164
- self
165
- end
166
-
167
- # Clear the existing actions on a rake task.
168
- def clear_actions
169
- actions.clear
170
- self
171
- end
172
-
173
- # Clear the existing comments on a rake task.
174
- def clear_comments
175
- @comments = []
176
- self
177
- end
178
-
179
- # Clear the existing arguments on a rake task.
180
- def clear_args
181
- @arg_names = nil
182
- self
183
- end
184
-
185
- # Invoke the task if it is needed. Prerequisites are invoked first.
186
- def invoke(*args)
187
- task_args = TaskArguments.new(arg_names, args)
188
- invoke_with_call_chain(task_args, InvocationChain::EMPTY)
189
- end
190
-
191
- # Same as invoke, but explicitly pass a call chain to detect
192
- # circular dependencies.
193
- #
194
- # If multiple tasks depend on this
195
- # one in parallel, they will all fail if the first execution of
196
- # this task fails.
197
- def invoke_with_call_chain(task_args, invocation_chain)
198
- new_chain = Rake::InvocationChain.append(self, invocation_chain)
199
- @lock.synchronize do
200
- begin
201
- if application.options.trace
202
- application.trace "** Invoke #{name} #{format_trace_flags}"
203
- end
204
-
205
- if @already_invoked
206
- if @invocation_exception
207
- if application.options.trace
208
- application.trace "** Previous invocation of #{name} failed #{format_trace_flags}"
209
- end
210
- raise @invocation_exception
211
- else
212
- return
213
- end
214
- end
215
-
216
- @already_invoked = true
217
-
218
- invoke_prerequisites(task_args, new_chain)
219
- execute(task_args) if needed?
220
- rescue Exception => ex
221
- add_chain_to(ex, new_chain)
222
- @invocation_exception = ex
223
- raise ex
224
- end
225
- end
226
- end
227
- protected :invoke_with_call_chain
228
-
229
- def add_chain_to(exception, new_chain) # :nodoc:
230
- exception.extend(InvocationExceptionMixin) unless
231
- exception.respond_to?(:chain)
232
- exception.chain = new_chain if exception.chain.nil?
233
- end
234
- private :add_chain_to
235
-
236
- # Invoke all the prerequisites of a task.
237
- def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
238
- if application.options.always_multitask
239
- invoke_prerequisites_concurrently(task_args, invocation_chain)
240
- else
241
- prerequisite_tasks.each { |p|
242
- prereq_args = task_args.new_scope(p.arg_names)
243
- p.invoke_with_call_chain(prereq_args, invocation_chain)
244
- }
245
- end
246
- end
247
-
248
- # Invoke all the prerequisites of a task in parallel.
249
- def invoke_prerequisites_concurrently(task_args, invocation_chain)# :nodoc:
250
- futures = prerequisite_tasks.map do |p|
251
- prereq_args = task_args.new_scope(p.arg_names)
252
- application.thread_pool.future(p) do |r|
253
- r.invoke_with_call_chain(prereq_args, invocation_chain)
254
- end
255
- end
256
- # Iterate in reverse to improve performance related to thread waiting and switching
257
- futures.reverse_each(&:value)
258
- end
259
-
260
- # Format the trace flags for display.
261
- def format_trace_flags
262
- flags = []
263
- flags << "first_time" unless @already_invoked
264
- flags << "not_needed" unless needed?
265
- flags.empty? ? "" : "(" + flags.join(", ") + ")"
266
- end
267
- private :format_trace_flags
268
-
269
- # Execute the actions associated with this task.
270
- def execute(args=nil)
271
- args ||= EMPTY_TASK_ARGS
272
- if application.options.dryrun
273
- application.trace "** Execute (dry run) #{name}"
274
- return
275
- end
276
- application.trace "** Execute #{name}" if application.options.trace
277
- application.enhance_with_matching_rule(name) if @actions.empty?
278
- if opts = Hash.try_convert(args) and !opts.empty?
279
- @actions.each { |act| act.call(self, args, **opts)}
280
- else
281
- @actions.each { |act| act.call(self, args)}
282
- end
283
- end
284
-
285
- # Is this task needed?
286
- def needed?
287
- true
288
- end
289
-
290
- # Timestamp for this task. Basic tasks return the current time for their
291
- # time stamp. Other tasks can be more sophisticated.
292
- def timestamp
293
- Time.now
294
- end
295
-
296
- # Add a description to the task. The description can consist of an option
297
- # argument list (enclosed brackets) and an optional comment.
298
- def add_description(description)
299
- return unless description
300
- comment = description.strip
301
- add_comment(comment) if comment && !comment.empty?
302
- end
303
-
304
- def comment=(comment) # :nodoc:
305
- add_comment(comment)
306
- end
307
-
308
- def add_comment(comment) # :nodoc:
309
- return if comment.nil?
310
- @comments << comment unless @comments.include?(comment)
311
- end
312
- private :add_comment
313
-
314
- # Full collection of comments. Multiple comments are separated by
315
- # newlines.
316
- def full_comment
317
- transform_comments("\n")
318
- end
319
-
320
- # First line (or sentence) of all comments. Multiple comments are
321
- # separated by a "/".
322
- def comment
323
- transform_comments(" / ") { |c| first_sentence(c) }
324
- end
325
-
326
- # Transform the list of comments as specified by the block and
327
- # join with the separator.
328
- def transform_comments(separator, &block)
329
- if @comments.empty?
330
- nil
331
- else
332
- block ||= lambda { |c| c }
333
- @comments.map(&block).join(separator)
334
- end
335
- end
336
- private :transform_comments
337
-
338
- # Get the first sentence in a string. The sentence is terminated
339
- # by the first period, exclamation mark, or the end of the line.
340
- # Decimal points do not count as periods.
341
- def first_sentence(string)
342
- string.split(/(?<=\w)(\.|!)[ \t]|(\.$|!)|\n/).first
343
- end
344
- private :first_sentence
345
-
346
- # Set the names of the arguments for this task. +args+ should be
347
- # an array of symbols, one for each argument name.
348
- def set_arg_names(args)
349
- @arg_names = args.map(&:to_sym)
350
- end
351
-
352
- # Return a string describing the internal state of a task. Useful for
353
- # debugging.
354
- def investigation
355
- result = "------------------------------\n".dup
356
- result << "Investigating #{name}\n"
357
- result << "class: #{self.class}\n"
358
- result << "task needed: #{needed?}\n"
359
- result << "timestamp: #{timestamp}\n"
360
- result << "pre-requisites: \n"
361
- prereqs = prerequisite_tasks
362
- prereqs.sort! { |a, b| a.timestamp <=> b.timestamp }
363
- prereqs.each do |p|
364
- result << "--#{p.name} (#{p.timestamp})\n"
365
- end
366
- latest_prereq = prerequisite_tasks.map(&:timestamp).max
367
- result << "latest-prerequisite time: #{latest_prereq}\n"
368
- result << "................................\n\n"
369
- return result
370
- end
371
-
372
- # Format dependencies parameter to pass to task.
373
- def self.format_deps(deps)
374
- deps = [deps] unless deps.respond_to?(:to_ary)
375
- deps.map { |d| Rake.from_pathname(d).to_s }
376
- end
377
-
378
- # Add order only dependencies.
379
- def |(deps)
380
- @order_only_prerequisites |= Task.format_deps(deps) - @prerequisites
381
- self
382
- end
383
-
384
- # ----------------------------------------------------------------
385
- # Rake Module Methods
386
- #
387
- class << self
388
-
389
- # Clear the task list. This cause rake to immediately forget all the
390
- # tasks that have been assigned. (Normally used in the unit tests.)
391
- def clear
392
- Rake.application.clear
393
- end
394
-
395
- # List of all defined tasks.
396
- def tasks
397
- Rake.application.tasks
398
- end
399
-
400
- # Return a task with the given name. If the task is not currently
401
- # known, try to synthesize one from the defined rules. If no rules are
402
- # found, but an existing file matches the task name, assume it is a file
403
- # task with no dependencies or actions.
404
- def [](task_name)
405
- Rake.application[task_name]
406
- end
407
-
408
- # TRUE if the task name is already defined.
409
- def task_defined?(task_name)
410
- Rake.application.lookup(task_name) != nil
411
- end
412
-
413
- # Define a task given +args+ and an option block. If a rule with the
414
- # given name already exists, the prerequisites and actions are added to
415
- # the existing task. Returns the defined task.
416
- def define_task(*args, &block)
417
- Rake.application.define_task(self, *args, &block)
418
- end
419
-
420
- # Define a rule for synthesizing tasks.
421
- def create_rule(*args, &block)
422
- Rake.application.create_rule(*args, &block)
423
- end
424
-
425
- # Apply the scope to the task name according to the rules for
426
- # this kind of task. Generic tasks will accept the scope as
427
- # part of the name.
428
- def scope_name(scope, task_name)
429
- scope.path_with_task_name(task_name)
430
- end
431
-
432
- end # class << Rake::Task
433
- end # class Rake::Task
434
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
- module Rake
3
-
4
- # Error indicating an ill-formed task declaration.
5
- class TaskArgumentError < ArgumentError
6
- end
7
-
8
- end
@@ -1,109 +0,0 @@
1
- # frozen_string_literal: true
2
- module Rake
3
-
4
- ##
5
- # TaskArguments manage the arguments passed to a task.
6
- #
7
- class TaskArguments
8
- include Enumerable
9
-
10
- # Argument names
11
- attr_reader :names
12
-
13
- # Create a TaskArgument object with a list of argument +names+ and a set
14
- # of associated +values+. +parent+ is the parent argument object.
15
- def initialize(names, values, parent=nil)
16
- @names = names
17
- @parent = parent
18
- @hash = {}
19
- @values = values
20
- names.each_with_index { |name, i|
21
- next if values[i].nil? || values[i] == ""
22
- @hash[name.to_sym] = values[i]
23
- }
24
- end
25
-
26
- # Retrieve the complete array of sequential values
27
- def to_a
28
- @values.dup
29
- end
30
-
31
- # Retrieve the list of values not associated with named arguments
32
- def extras
33
- @values[@names.length..-1] || []
34
- end
35
-
36
- # Create a new argument scope using the prerequisite argument
37
- # names.
38
- def new_scope(names)
39
- values = names.map { |n| self[n] }
40
- self.class.new(names, values + extras, self)
41
- end
42
-
43
- # Find an argument value by name or index.
44
- def [](index)
45
- lookup(index.to_sym)
46
- end
47
-
48
- # Specify a hash of default values for task arguments. Use the
49
- # defaults only if there is no specific value for the given
50
- # argument.
51
- def with_defaults(defaults)
52
- @hash = defaults.merge(@hash)
53
- end
54
-
55
- # Enumerates the arguments and their values
56
- def each(&block)
57
- @hash.each(&block)
58
- end
59
-
60
- # Extracts the argument values at +keys+
61
- def values_at(*keys)
62
- keys.map { |k| lookup(k) }
63
- end
64
-
65
- # Returns the value of the given argument via method_missing
66
- def method_missing(sym, *args)
67
- lookup(sym.to_sym)
68
- end
69
-
70
- # Returns a Hash of arguments and their values
71
- def to_hash
72
- @hash.dup
73
- end
74
-
75
- def to_s # :nodoc:
76
- inspect
77
- end
78
-
79
- def inspect # :nodoc:
80
- inspection = @hash.map do |k,v|
81
- "#{k.to_s}: #{v.to_s}"
82
- end.join(", ")
83
-
84
- "#<#{self.class} #{inspection}>"
85
- end
86
-
87
- # Returns true if +key+ is one of the arguments
88
- def has_key?(key)
89
- @hash.has_key?(key)
90
- end
91
- alias key? has_key?
92
-
93
- def fetch(*args, &block)
94
- @hash.fetch(*args, &block)
95
- end
96
-
97
- protected
98
-
99
- def lookup(name) # :nodoc:
100
- if @hash.has_key?(name)
101
- @hash[name]
102
- elsif @parent
103
- @parent.lookup(name)
104
- end
105
- end
106
- end
107
-
108
- EMPTY_TASK_ARGS = TaskArguments.new([], []) # :nodoc:
109
- end