Class: Reap::TemplateTask

Inherits:
Task
  • Object
show all
Defined in:
lib/reap/tasks/template-task.rb

Constant Summary

Constants inherited from Task

Reap::Task::DEFAULT_INCLUDE, Reap::Task::MUST_EXCLUDE, Reap::Task::RUBY

Instance Attribute Summary

Attributes inherited from Task

#config, #section

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Task

#[], inherited, #initialize, #package_name, registry, #ruby, #sh, tasks

Constructor Details

This class inherits a constructor from Reap::Task

Class Method Details

.descObject



10
# File 'lib/reap/tasks/template-task.rb', line 10

def self.desc ; "Create template configuration file in current directory." ; end

.taskObject



8
# File 'lib/reap/tasks/template-task.rb', line 8

def self.task ; :template ; end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/reap/tasks/template-task.rb', line 16

def run
  dir = File.dirname(File.dirname(__FILE__))
  tmpf = File.join( dir, 'template.rb' )
  unless File.file?( tmpf )
    puts tmpf
    raise "Tempfile is missing."
  end
  
  if File.directory?("Reapfile")
    puts "Why is Reapfile a directory? Cannot comply."
    return
  elsif File.file?("Reapfile")
    puts "Reapfile already exists."
    return      
  end
  # copy tmpf to Reapfile
  FileUtils.cp( tmpf, "Reapfile" )
  puts "Reapfile create. You'll need to fill it out."
end

#set(section) ⇒ Object



13
14
# File 'lib/reap/tasks/template-task.rb', line 13

def set( section )
end