Class: Gakubuchi::Task
- Inherits:
-
Object
- Object
- Gakubuchi::Task
- Defined in:
- lib/gakubuchi/task.rb
Instance Attribute Summary collapse
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(templates) ⇒ Task
constructor
A new instance of Task.
- #leave_digest_named_templates? ⇒ Boolean
Constructor Details
#initialize(templates) ⇒ Task
Returns a new instance of Task.
5 6 7 |
# File 'lib/gakubuchi/task.rb', line 5 def initialize(templates) @templates = Array(templates) end |
Instance Attribute Details
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
3 4 5 |
# File 'lib/gakubuchi/task.rb', line 3 def templates @templates end |
Instance Method Details
#execute! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gakubuchi/task.rb', line 9 def execute! templates.each do |template| src = template.digest_path next if src.nil? dest = template.destination_path FileUtils.copy_p(src, dest) FileUtils.remove([src, *::Dir.glob("#{src}.gz")]) unless leave_digest_named_templates? end end |
#leave_digest_named_templates? ⇒ Boolean
21 22 23 |
# File 'lib/gakubuchi/task.rb', line 21 def leave_digest_named_templates? !!::Gakubuchi.configuration.leave_digest_named_templates end |