lib/tap/generator/generators/file_task/templates/task.erb in tap-0.7.9 vs lib/tap/generator/generators/file_task/templates/task.erb in tap-0.8.0
- old
+ new
@@ -1,26 +1,33 @@
-# == Documentation
+# == Description
+# Replace with a description for <%= class_name_without_nesting %>
+# === Usage
+# Replace with usage instructions
#
-# === Command Line Usage
-# Replace with your command line usage instructions
-#
-class <%= class_name %> < Tap::FileTask
+class <%= class_name_without_nesting %> < Tap::FileTask
+ # uncomment to:
+ # - pass all inputs to process at once
+ # - define a task that takes no inputs
+
+ #do_not_iterate
+
+ # use config to set task configurations
+ # configs have accessors by default
+
+ #config :key, 'value' # config documentation
def process(input)
- # The process logic goes here. You don't have to use transform.
- # Do whatever works!
- output = infer_filepath(:data, input)
+ # The process logic goes here.
+ output = filepath(:data, input)
- make(output)
+ # prepare ensures the parent directory for
+ # output exists, and marks it for rollback
+ # in the event of an error
+ prepare(output)
File.open(input) do |source|
File.open(output, "w") do |target|
- target.write "<root>\n"
- while line = source.gets
- next unless line =~ /(\w+): (\w+)/
- target.write " <#{$1}>#{$2}</#{$1}>\n"
- end
- target.write "</root>"
+ # ... do something ...
end
end
end
end
\ No newline at end of file