spline 0.0.11 → 0.0.12

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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/lib/spline/action_command.rb +21 -0
  4. data/lib/spline/install_command.rb +28 -0
  5. data/lib/spline/process_command.rb +20 -0
  6. data/lib/spline/spline_cli.rb +7 -19
  7. data/lib/spline/templates/action.tt +7 -0
  8. data/lib/spline/templates/my_first_action.tt +11 -0
  9. data/lib/spline/templates/my_process.tt +21 -0
  10. data/lib/spline/templates/my_second_action.tt +11 -0
  11. data/lib/spline/templates/process.tt +6 -0
  12. data/lib/spline/version.rb +1 -1
  13. data/spline.gemspec +0 -1
  14. metadata +9 -140
  15. data/vendor/bundle/ruby/2.1.0/bin/rake +0 -23
  16. data/vendor/bundle/ruby/2.1.0/bin/spline +0 -23
  17. data/vendor/bundle/ruby/2.1.0/build_info/rake-10.3.2.info +0 -1
  18. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.autotest +0 -7
  19. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.gemtest +0 -0
  20. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.rubocop.yml +0 -27
  21. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.togglerc +0 -7
  22. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/CONTRIBUTING.rdoc +0 -34
  23. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/History.rdoc +0 -609
  24. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/MIT-LICENSE +0 -21
  25. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/Manifest.txt +0 -162
  26. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/README.rdoc +0 -137
  27. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/Rakefile +0 -81
  28. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/bin/rake +0 -33
  29. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/alt_system.rb +0 -110
  30. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb +0 -783
  31. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/backtrace.rb +0 -23
  32. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/clean.rb +0 -76
  33. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cloneable.rb +0 -16
  34. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/.document +0 -0
  35. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/compositepublisher.rb +0 -21
  36. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/ftptools.rb +0 -137
  37. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/publisher.rb +0 -81
  38. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/rubyforgepublisher.rb +0 -18
  39. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sshpublisher.rb +0 -61
  40. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sys.rb +0 -4
  41. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cpu_counter.rb +0 -109
  42. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/default_loader.rb +0 -14
  43. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/dsl_definition.rb +0 -198
  44. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/early_time.rb +0 -21
  45. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/core.rb +0 -25
  46. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/module.rb +0 -1
  47. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/string.rb +0 -173
  48. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/time.rb +0 -15
  49. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_creation_task.rb +0 -24
  50. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_list.rb +0 -414
  51. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_task.rb +0 -46
  52. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils.rb +0 -116
  53. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils_ext.rb +0 -144
  54. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/gempackagetask.rb +0 -4
  55. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_chain.rb +0 -56
  56. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_exception_mixin.rb +0 -16
  57. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/linked_list.rb +0 -103
  58. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/loaders/makefile.rb +0 -40
  59. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/multi_task.rb +0 -13
  60. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/name_space.rb +0 -38
  61. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/packagetask.rb +0 -202
  62. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pathmap.rb +0 -3
  63. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/phony.rb +0 -15
  64. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/private_reader.rb +0 -20
  65. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/promise.rb +0 -99
  66. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pseudo_status.rb +0 -29
  67. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb +0 -38
  68. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_test_loader.rb +0 -22
  69. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rdoctask.rb +0 -4
  70. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ruby182_test_unit_fix.rb +0 -29
  71. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rule_recursion_overflow_error.rb +0 -20
  72. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/runtest.rb +0 -27
  73. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/scope.rb +0 -42
  74. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb +0 -383
  75. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_argument_error.rb +0 -7
  76. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_arguments.rb +0 -98
  77. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_manager.rb +0 -310
  78. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/tasklib.rb +0 -24
  79. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/testtask.rb +0 -212
  80. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_history_display.rb +0 -48
  81. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_pool.rb +0 -164
  82. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/trace_output.rb +0 -22
  83. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/version.rb +0 -7
  84. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/win32.rb +0 -56
  85. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake.rb +0 -78
  86. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/rakelib/publish.rake +0 -20
  87. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/rakelib/test_times.rake +0 -25
  88. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/file_creation.rb +0 -34
  89. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/helper.rb +0 -127
  90. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/support/rakefile_definitions.rb +0 -478
  91. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/support/ruby_runner.rb +0 -33
  92. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_private_reader.rb +0 -42
  93. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake.rb +0 -40
  94. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application.rb +0 -641
  95. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application_options.rb +0 -466
  96. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_backtrace.rb +0 -119
  97. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_clean.rb +0 -55
  98. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_cpu_counter.rb +0 -50
  99. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_definitions.rb +0 -79
  100. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_directory_task.rb +0 -63
  101. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_dsl.rb +0 -40
  102. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_early_time.rb +0 -31
  103. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_extension.rb +0 -59
  104. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_creation_task.rb +0 -56
  105. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list.rb +0 -627
  106. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list_path_map.rb +0 -8
  107. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_task.rb +0 -186
  108. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_utils.rb +0 -309
  109. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_ftp_file.rb +0 -74
  110. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_functional.rb +0 -482
  111. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_invocation_chain.rb +0 -64
  112. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_linked_list.rb +0 -84
  113. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_makefile_loader.rb +0 -46
  114. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_multi_task.rb +0 -58
  115. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_name_space.rb +0 -57
  116. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_package_task.rb +0 -79
  117. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map.rb +0 -168
  118. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_explode.rb +0 -34
  119. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_partial.rb +0 -18
  120. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_pseudo_status.rb +0 -21
  121. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rake_test_loader.rb +0 -20
  122. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_reduce_compat.rb +0 -26
  123. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_require.rb +0 -40
  124. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rules.rb +0 -388
  125. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_scope.rb +0 -44
  126. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task.rb +0 -392
  127. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_argument_parsing.rb +0 -109
  128. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_arguments.rb +0 -127
  129. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_lib.rb +0 -9
  130. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager.rb +0 -178
  131. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager_argument_resolution.rb +0 -19
  132. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_with_arguments.rb +0 -171
  133. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_test_task.rb +0 -141
  134. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_thread_pool.rb +0 -142
  135. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_top_level_functions.rb +0 -71
  136. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_win32.rb +0 -72
  137. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_thread_history_display.rb +0 -101
  138. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_trace_output.rb +0 -52
  139. data/vendor/bundle/ruby/2.1.0/specifications/rake-10.3.2.gemspec +0 -45
@@ -1,414 +0,0 @@
1
- require 'rake/cloneable'
2
- require 'rake/file_utils_ext'
3
- require 'rake/pathmap'
4
-
5
-
6
- module Rake
7
-
8
- ##
9
- # A FileList is essentially an array with a few helper methods defined to
10
- # make file manipulation a bit easier.
11
- #
12
- # FileLists are lazy. When given a list of glob patterns for possible files
13
- # to be included in the file list, instead of searching the file structures
14
- # to find the files, a FileList holds the pattern for latter use.
15
- #
16
- # This allows us to define a number of FileList to match any number of
17
- # files, but only search out the actual files when then FileList itself is
18
- # actually used. The key is that the first time an element of the
19
- # FileList/Array is requested, the pending patterns are resolved into a real
20
- # list of file names.
21
- #
22
- class FileList
23
-
24
- include Cloneable
25
-
26
- # == Method Delegation
27
- #
28
- # The lazy evaluation magic of FileLists happens by implementing all the
29
- # array specific methods to call +resolve+ before delegating the heavy
30
- # lifting to an embedded array object (@items).
31
- #
32
- # In addition, there are two kinds of delegation calls. The regular kind
33
- # delegates to the @items array and returns the result directly. Well,
34
- # almost directly. It checks if the returned value is the @items object
35
- # itself, and if so will return the FileList object instead.
36
- #
37
- # The second kind of delegation call is used in methods that normally
38
- # return a new Array object. We want to capture the return value of these
39
- # methods and wrap them in a new FileList object. We enumerate these
40
- # methods in the +SPECIAL_RETURN+ list below.
41
-
42
- # List of array methods (that are not in +Object+) that need to be
43
- # delegated.
44
- ARRAY_METHODS = (Array.instance_methods - Object.instance_methods).
45
- map { |n| n.to_s }
46
-
47
- # List of additional methods that must be delegated.
48
- MUST_DEFINE = %w[inspect <=>]
49
-
50
- # List of methods that should not be delegated here (we define special
51
- # versions of them explicitly below).
52
- MUST_NOT_DEFINE = %w[to_a to_ary partition *]
53
-
54
- # List of delegated methods that return new array values which need
55
- # wrapping.
56
- SPECIAL_RETURN = %w[
57
- map collect sort sort_by select find_all reject grep
58
- compact flatten uniq values_at
59
- + - & |
60
- ]
61
-
62
- DELEGATING_METHODS = (ARRAY_METHODS + MUST_DEFINE - MUST_NOT_DEFINE).
63
- map { |s| s.to_s }.sort.uniq
64
-
65
- # Now do the delegation.
66
- DELEGATING_METHODS.each do |sym|
67
- if SPECIAL_RETURN.include?(sym)
68
- ln = __LINE__ + 1
69
- class_eval %{
70
- def #{sym}(*args, &block)
71
- resolve
72
- result = @items.send(:#{sym}, *args, &block)
73
- FileList.new.import(result)
74
- end
75
- }, __FILE__, ln
76
- else
77
- ln = __LINE__ + 1
78
- class_eval %{
79
- def #{sym}(*args, &block)
80
- resolve
81
- result = @items.send(:#{sym}, *args, &block)
82
- result.object_id == @items.object_id ? self : result
83
- end
84
- }, __FILE__, ln
85
- end
86
- end
87
-
88
- # Create a file list from the globbable patterns given. If you wish to
89
- # perform multiple includes or excludes at object build time, use the
90
- # "yield self" pattern.
91
- #
92
- # Example:
93
- # file_list = FileList.new('lib/**/*.rb', 'test/test*.rb')
94
- #
95
- # pkg_files = FileList.new('lib/**/*') do |fl|
96
- # fl.exclude(/\bCVS\b/)
97
- # end
98
- #
99
- def initialize(*patterns)
100
- @pending_add = []
101
- @pending = false
102
- @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup
103
- @exclude_procs = DEFAULT_IGNORE_PROCS.dup
104
- @items = []
105
- patterns.each { |pattern| include(pattern) }
106
- yield self if block_given?
107
- end
108
-
109
- # Add file names defined by glob patterns to the file list. If an array
110
- # is given, add each element of the array.
111
- #
112
- # Example:
113
- # file_list.include("*.java", "*.cfg")
114
- # file_list.include %w( math.c lib.h *.o )
115
- #
116
- def include(*filenames)
117
- # TODO: check for pending
118
- filenames.each do |fn|
119
- if fn.respond_to? :to_ary
120
- include(*fn.to_ary)
121
- else
122
- @pending_add << fn
123
- end
124
- end
125
- @pending = true
126
- self
127
- end
128
- alias :add :include
129
-
130
- # Register a list of file name patterns that should be excluded from the
131
- # list. Patterns may be regular expressions, glob patterns or regular
132
- # strings. In addition, a block given to exclude will remove entries that
133
- # return true when given to the block.
134
- #
135
- # Note that glob patterns are expanded against the file system. If a file
136
- # is explicitly added to a file list, but does not exist in the file
137
- # system, then an glob pattern in the exclude list will not exclude the
138
- # file.
139
- #
140
- # Examples:
141
- # FileList['a.c', 'b.c'].exclude("a.c") => ['b.c']
142
- # FileList['a.c', 'b.c'].exclude(/^a/) => ['b.c']
143
- #
144
- # If "a.c" is a file, then ...
145
- # FileList['a.c', 'b.c'].exclude("a.*") => ['b.c']
146
- #
147
- # If "a.c" is not a file, then ...
148
- # FileList['a.c', 'b.c'].exclude("a.*") => ['a.c', 'b.c']
149
- #
150
- def exclude(*patterns, &block)
151
- patterns.each do |pat|
152
- @exclude_patterns << pat
153
- end
154
- @exclude_procs << block if block_given?
155
- resolve_exclude unless @pending
156
- self
157
- end
158
-
159
- # Clear all the exclude patterns so that we exclude nothing.
160
- def clear_exclude
161
- @exclude_patterns = []
162
- @exclude_procs = []
163
- self
164
- end
165
-
166
- # A FileList is equal through array equality.
167
- def ==(array)
168
- to_ary == array
169
- end
170
-
171
- # Return the internal array object.
172
- def to_a
173
- resolve
174
- @items
175
- end
176
-
177
- # Return the internal array object.
178
- def to_ary
179
- to_a
180
- end
181
-
182
- # Lie about our class.
183
- def is_a?(klass)
184
- klass == Array || super(klass)
185
- end
186
- alias kind_of? is_a?
187
-
188
- # Redefine * to return either a string or a new file list.
189
- def *(other)
190
- result = @items * other
191
- case result
192
- when Array
193
- FileList.new.import(result)
194
- else
195
- result
196
- end
197
- end
198
-
199
- # Resolve all the pending adds now.
200
- def resolve
201
- if @pending
202
- @pending = false
203
- @pending_add.each do |fn| resolve_add(fn) end
204
- @pending_add = []
205
- resolve_exclude
206
- end
207
- self
208
- end
209
-
210
- def resolve_add(fn) # :nodoc:
211
- case fn
212
- when %r{[*?\[\{]}
213
- add_matching(fn)
214
- else
215
- self << fn
216
- end
217
- end
218
- private :resolve_add
219
-
220
- def resolve_exclude # :nodoc:
221
- reject! { |fn| excluded_from_list?(fn) }
222
- self
223
- end
224
- private :resolve_exclude
225
-
226
- # Return a new FileList with the results of running +sub+ against each
227
- # element of the original list.
228
- #
229
- # Example:
230
- # FileList['a.c', 'b.c'].sub(/\.c$/, '.o') => ['a.o', 'b.o']
231
- #
232
- def sub(pat, rep)
233
- inject(FileList.new) { |res, fn| res << fn.sub(pat, rep) }
234
- end
235
-
236
- # Return a new FileList with the results of running +gsub+ against each
237
- # element of the original list.
238
- #
239
- # Example:
240
- # FileList['lib/test/file', 'x/y'].gsub(/\//, "\\")
241
- # => ['lib\\test\\file', 'x\\y']
242
- #
243
- def gsub(pat, rep)
244
- inject(FileList.new) { |res, fn| res << fn.gsub(pat, rep) }
245
- end
246
-
247
- # Same as +sub+ except that the original file list is modified.
248
- def sub!(pat, rep)
249
- each_with_index { |fn, i| self[i] = fn.sub(pat, rep) }
250
- self
251
- end
252
-
253
- # Same as +gsub+ except that the original file list is modified.
254
- def gsub!(pat, rep)
255
- each_with_index { |fn, i| self[i] = fn.gsub(pat, rep) }
256
- self
257
- end
258
-
259
- # Apply the pathmap spec to each of the included file names, returning a
260
- # new file list with the modified paths. (See String#pathmap for
261
- # details.)
262
- def pathmap(spec=nil)
263
- collect { |fn| fn.pathmap(spec) }
264
- end
265
-
266
- # Return a new FileList with <tt>String#ext</tt> method applied to
267
- # each member of the array.
268
- #
269
- # This method is a shortcut for:
270
- #
271
- # array.collect { |item| item.ext(newext) }
272
- #
273
- # +ext+ is a user added method for the Array class.
274
- def ext(newext='')
275
- collect { |fn| fn.ext(newext) }
276
- end
277
-
278
- # Grep each of the files in the filelist using the given pattern. If a
279
- # block is given, call the block on each matching line, passing the file
280
- # name, line number, and the matching line of text. If no block is given,
281
- # a standard emacs style file:linenumber:line message will be printed to
282
- # standard out. Returns the number of matched items.
283
- def egrep(pattern, *options)
284
- matched = 0
285
- each do |fn|
286
- begin
287
- open(fn, "r", *options) do |inf|
288
- count = 0
289
- inf.each do |line|
290
- count += 1
291
- if pattern.match(line)
292
- matched += 1
293
- if block_given?
294
- yield fn, count, line
295
- else
296
- puts "#{fn}:#{count}:#{line}"
297
- end
298
- end
299
- end
300
- end
301
- rescue StandardError => ex
302
- $stderr.puts "Error while processing '#{fn}': #{ex}"
303
- end
304
- end
305
- matched
306
- end
307
-
308
- # Return a new file list that only contains file names from the current
309
- # file list that exist on the file system.
310
- def existing
311
- select { |fn| File.exist?(fn) }
312
- end
313
-
314
- # Modify the current file list so that it contains only file name that
315
- # exist on the file system.
316
- def existing!
317
- resolve
318
- @items = @items.select { |fn| File.exist?(fn) }
319
- self
320
- end
321
-
322
- # FileList version of partition. Needed because the nested arrays should
323
- # be FileLists in this version.
324
- def partition(&block) # :nodoc:
325
- resolve
326
- result = @items.partition(&block)
327
- [
328
- FileList.new.import(result[0]),
329
- FileList.new.import(result[1]),
330
- ]
331
- end
332
-
333
- # Convert a FileList to a string by joining all elements with a space.
334
- def to_s
335
- resolve
336
- self.join(' ')
337
- end
338
-
339
- # Add matching glob patterns.
340
- def add_matching(pattern)
341
- FileList.glob(pattern).each do |fn|
342
- self << fn unless excluded_from_list?(fn)
343
- end
344
- end
345
- private :add_matching
346
-
347
- # Should the given file name be excluded from the list?
348
- #
349
- # NOTE: This method was formally named "exclude?", but Rails
350
- # introduced an exclude? method as an array method and setup a
351
- # conflict with file list. We renamed the method to avoid
352
- # confusion. If you were using "FileList#exclude?" in your user
353
- # code, you will need to update.
354
- def excluded_from_list?(fn)
355
- return true if @exclude_patterns.any? do |pat|
356
- case pat
357
- when Regexp
358
- fn =~ pat
359
- when /[*?]/
360
- File.fnmatch?(pat, fn, File::FNM_PATHNAME)
361
- else
362
- fn == pat
363
- end
364
- end
365
- @exclude_procs.any? { |p| p.call(fn) }
366
- end
367
-
368
- DEFAULT_IGNORE_PATTERNS = [
369
- /(^|[\/\\])CVS([\/\\]|$)/,
370
- /(^|[\/\\])\.svn([\/\\]|$)/,
371
- /\.bak$/,
372
- /~$/
373
- ]
374
- DEFAULT_IGNORE_PROCS = [
375
- proc { |fn| fn =~ /(^|[\/\\])core$/ && ! File.directory?(fn) }
376
- ]
377
-
378
- def import(array) # :nodoc:
379
- @items = array
380
- self
381
- end
382
-
383
- class << self
384
- # Create a new file list including the files listed. Similar to:
385
- #
386
- # FileList.new(*args)
387
- def [](*args)
388
- new(*args)
389
- end
390
-
391
- # Get a sorted list of files matching the pattern. This method
392
- # should be preferred to Dir[pattern] and Dir.glob(pattern) because
393
- # the files returned are guaranteed to be sorted.
394
- def glob(pattern, *args)
395
- Dir.glob(pattern, *args).sort
396
- end
397
- end
398
- end
399
- end
400
-
401
- module Rake
402
- class << self
403
-
404
- # Yield each file or directory component.
405
- def each_dir_parent(dir) # :nodoc:
406
- old_length = nil
407
- while dir != '.' && dir.length != old_length
408
- yield(dir)
409
- old_length = dir.length
410
- dir = File.dirname(dir)
411
- end
412
- end
413
- end
414
- end # module Rake
@@ -1,46 +0,0 @@
1
- require 'rake/task.rb'
2
- require 'rake/early_time'
3
-
4
- module Rake
5
-
6
- # A FileTask is a task that includes time based dependencies. If any of a
7
- # FileTask's prerequisites have a timestamp that is later than the file
8
- # represented by this task, then the file must be rebuilt (using the
9
- # supplied actions).
10
- #
11
- class FileTask < Task
12
-
13
- # Is this file task needed? Yes if it doesn't exist, or if its time stamp
14
- # is out of date.
15
- def needed?
16
- ! File.exist?(name) || out_of_date?(timestamp) || @application.options.build_all
17
- end
18
-
19
- # Time stamp for file task.
20
- def timestamp
21
- if File.exist?(name)
22
- File.mtime(name.to_s)
23
- else
24
- Rake::EARLY
25
- end
26
- end
27
-
28
- private
29
-
30
- # Are there any prerequisites with a later time than the given time stamp?
31
- def out_of_date?(stamp)
32
- @prerequisites.any? { |n| application[n, @scope].timestamp > stamp }
33
- end
34
-
35
- # ----------------------------------------------------------------
36
- # Task class methods.
37
- #
38
- class << self
39
- # Apply the scope to the task name according to the rules for this kind
40
- # of task. File based tasks ignore the scope when creating the name.
41
- def scope_name(scope, task_name)
42
- task_name
43
- end
44
- end
45
- end
46
- end
@@ -1,116 +0,0 @@
1
- require 'rbconfig'
2
- require 'fileutils'
3
-
4
- #--
5
- # This a FileUtils extension that defines several additional commands to be
6
- # added to the FileUtils utility functions.
7
- module FileUtils
8
- # Path to the currently running Ruby program
9
- RUBY = ENV['RUBY'] || File.join(
10
- RbConfig::CONFIG['bindir'],
11
- RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']).
12
- sub(/.*\s.*/m, '"\&"')
13
-
14
- OPT_TABLE['sh'] = %w(noop verbose)
15
- OPT_TABLE['ruby'] = %w(noop verbose)
16
-
17
- # Run the system command +cmd+. If multiple arguments are given the command
18
- # is not run with the shell (same semantics as Kernel::exec and
19
- # Kernel::system).
20
- #
21
- # Example:
22
- # sh %{ls -ltr}
23
- #
24
- # sh 'ls', 'file with spaces'
25
- #
26
- # # check exit status after command runs
27
- # sh %{grep pattern file} do |ok, res|
28
- # if ! ok
29
- # puts "pattern not found (status = #{res.exitstatus})"
30
- # end
31
- # end
32
- #
33
- def sh(*cmd, &block)
34
- options = (Hash === cmd.last) ? cmd.pop : {}
35
- shell_runner = block_given? ? block : create_shell_runner(cmd)
36
- set_verbose_option(options)
37
- options[:noop] ||= Rake::FileUtilsExt.nowrite_flag
38
- Rake.rake_check_options options, :noop, :verbose
39
- Rake.rake_output_message cmd.join(" ") if options[:verbose]
40
-
41
- unless options[:noop]
42
- res = rake_system(*cmd)
43
- status = $?
44
- status = Rake::PseudoStatus.new(1) if !res && status.nil?
45
- shell_runner.call(res, status)
46
- end
47
- end
48
-
49
- def create_shell_runner(cmd) # :nodoc:
50
- show_command = cmd.join(" ")
51
- show_command = show_command[0, 42] + "..." unless $trace
52
- lambda do |ok, status|
53
- ok or
54
- fail "Command failed with status (#{status.exitstatus}): " +
55
- "[#{show_command}]"
56
- end
57
- end
58
- private :create_shell_runner
59
-
60
- def set_verbose_option(options) # :nodoc:
61
- unless options.key? :verbose
62
- options[:verbose] =
63
- (Rake::FileUtilsExt.verbose_flag == Rake::FileUtilsExt::DEFAULT) ||
64
- Rake::FileUtilsExt.verbose_flag
65
- end
66
- end
67
- private :set_verbose_option
68
-
69
- def rake_system(*cmd) # :nodoc:
70
- Rake::AltSystem.system(*cmd)
71
- end
72
- private :rake_system
73
-
74
- # Run a Ruby interpreter with the given arguments.
75
- #
76
- # Example:
77
- # ruby %{-pe '$_.upcase!' <README}
78
- #
79
- def ruby(*args, &block)
80
- options = (Hash === args.last) ? args.pop : {}
81
- if args.length > 1
82
- sh(*([RUBY] + args + [options]), &block)
83
- else
84
- sh("#{RUBY} #{args.first}", options, &block)
85
- end
86
- end
87
-
88
- LN_SUPPORTED = [true]
89
-
90
- # Attempt to do a normal file link, but fall back to a copy if the link
91
- # fails.
92
- def safe_ln(*args)
93
- if ! LN_SUPPORTED[0]
94
- cp(*args)
95
- else
96
- begin
97
- ln(*args)
98
- rescue StandardError, NotImplementedError
99
- LN_SUPPORTED[0] = false
100
- cp(*args)
101
- end
102
- end
103
- end
104
-
105
- # Split a file path into individual directory names.
106
- #
107
- # Example:
108
- # split_all("a/b/c") => ['a', 'b', 'c']
109
- #
110
- def split_all(path)
111
- head, tail = File.split(path)
112
- return [tail] if head == '.' || tail == '/'
113
- return [head, tail] if head == '/'
114
- return split_all(head) + [tail]
115
- end
116
- end
@@ -1,144 +0,0 @@
1
- require 'rake/file_utils'
2
-
3
- module Rake
4
- #
5
- # FileUtilsExt provides a custom version of the FileUtils methods
6
- # that respond to the <tt>verbose</tt> and <tt>nowrite</tt>
7
- # commands.
8
- #
9
- module FileUtilsExt
10
- include FileUtils
11
-
12
- class << self
13
- attr_accessor :verbose_flag, :nowrite_flag
14
- end
15
-
16
- DEFAULT = Object.new
17
-
18
- FileUtilsExt.verbose_flag = DEFAULT
19
- FileUtilsExt.nowrite_flag = false
20
-
21
- FileUtils.commands.each do |name|
22
- opts = FileUtils.options_of name
23
- default_options = []
24
- if opts.include?("verbose")
25
- default_options << ':verbose => FileUtilsExt.verbose_flag'
26
- end
27
- if opts.include?("noop")
28
- default_options << ':noop => FileUtilsExt.nowrite_flag'
29
- end
30
-
31
- next if default_options.empty?
32
- module_eval(<<-EOS, __FILE__, __LINE__ + 1)
33
- def #{name}( *args, &block )
34
- super(
35
- *rake_merge_option(args,
36
- #{default_options.join(', ')}
37
- ), &block)
38
- end
39
- EOS
40
- end
41
-
42
- # Get/set the verbose flag controlling output from the FileUtils
43
- # utilities. If verbose is true, then the utility method is
44
- # echoed to standard output.
45
- #
46
- # Examples:
47
- # verbose # return the current value of the
48
- # # verbose flag
49
- # verbose(v) # set the verbose flag to _v_.
50
- # verbose(v) { code } # Execute code with the verbose flag set
51
- # # temporarily to _v_. Return to the
52
- # # original value when code is done.
53
- def verbose(value=nil)
54
- oldvalue = FileUtilsExt.verbose_flag
55
- FileUtilsExt.verbose_flag = value unless value.nil?
56
- if block_given?
57
- begin
58
- yield
59
- ensure
60
- FileUtilsExt.verbose_flag = oldvalue
61
- end
62
- end
63
- FileUtilsExt.verbose_flag
64
- end
65
-
66
- # Get/set the nowrite flag controlling output from the FileUtils
67
- # utilities. If verbose is true, then the utility method is
68
- # echoed to standard output.
69
- #
70
- # Examples:
71
- # nowrite # return the current value of the
72
- # # nowrite flag
73
- # nowrite(v) # set the nowrite flag to _v_.
74
- # nowrite(v) { code } # Execute code with the nowrite flag set
75
- # # temporarily to _v_. Return to the
76
- # # original value when code is done.
77
- def nowrite(value=nil)
78
- oldvalue = FileUtilsExt.nowrite_flag
79
- FileUtilsExt.nowrite_flag = value unless value.nil?
80
- if block_given?
81
- begin
82
- yield
83
- ensure
84
- FileUtilsExt.nowrite_flag = oldvalue
85
- end
86
- end
87
- oldvalue
88
- end
89
-
90
- # Use this function to prevent potentially destructive ruby code
91
- # from running when the :nowrite flag is set.
92
- #
93
- # Example:
94
- #
95
- # when_writing("Building Project") do
96
- # project.build
97
- # end
98
- #
99
- # The following code will build the project under normal
100
- # conditions. If the nowrite(true) flag is set, then the example
101
- # will print:
102
- #
103
- # DRYRUN: Building Project
104
- #
105
- # instead of actually building the project.
106
- #
107
- def when_writing(msg=nil)
108
- if FileUtilsExt.nowrite_flag
109
- $stderr.puts "DRYRUN: #{msg}" if msg
110
- else
111
- yield
112
- end
113
- end
114
-
115
- # Merge the given options with the default values.
116
- def rake_merge_option(args, defaults)
117
- if Hash === args.last
118
- defaults.update(args.last)
119
- args.pop
120
- end
121
- args.push defaults
122
- args
123
- end
124
-
125
- # Send the message to the default rake output (which is $stderr).
126
- def rake_output_message(message)
127
- $stderr.puts(message)
128
- end
129
-
130
- # Check that the options do not contain options not listed in
131
- # +optdecl+. An ArgumentError exception is thrown if non-declared
132
- # options are found.
133
- def rake_check_options(options, *optdecl)
134
- h = options.dup
135
- optdecl.each do |name|
136
- h.delete name
137
- end
138
- raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless
139
- h.empty?
140
- end
141
-
142
- extend self
143
- end
144
- end