Class: Caterpillar::Task

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/caterpillar/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :usage, config = nil, tasks = :define_tasks) {|_self| ... } ⇒ Task

The main task. Reads the configuration file and launches appropriate tasks.

Yields:

  • (_self)

Yield Parameters:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/caterpillar/task.rb', line 36

def initialize(name = :usage, config = nil, tasks = :define_tasks)
  @name   = name

  @config = (name == 'rails' or name == 'version' ) ? Config.new(false) : Util.eval_configuration(config)
  @logger = @config.logger

  @xml_files = []

  if name == 'rails'
    @required_gems = %w(rails caterpillar jruby-jars warbler)
  else
    if not @config and not %w{generate version}.include?(name)
      Usage.show()
      exit 1
    end
  end

  yield self if block_given?
  send tasks
end

Instance Attribute Details

#configObject

Config



29
30
31
# File 'lib/caterpillar/task.rb', line 29

def config
  @config
end

#nameObject

Task name



26
27
28
# File 'lib/caterpillar/task.rb', line 26

def name
  @name
end

#portletsObject (readonly)

Portlets



32
33
34
# File 'lib/caterpillar/task.rb', line 32

def portlets
  @portlets
end