Class: RevealCK::Builders::CreationTask

Inherits:
Object
  • Object
show all
Includes:
RakeAware, Retrieve
Defined in:
lib/reveal-ck/builders/creation_task.rb

Overview

Works within the context of Rake to setup a task for a given name

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RakeAware

#copy_file, #create_directory, #task

Methods included from Retrieve

included, #retrieve

Constructor Details

#initialize(args) ⇒ CreationTask

Returns a new instance of CreationTask.



10
11
12
13
# File 'lib/reveal-ck/builders/creation_task.rb', line 10

def initialize(args)
  @application = retrieve(:application, args)
  @things_to_create = Set.new
end

Instance Attribute Details

#applicationObject (readonly)

Returns the value of attribute application.



8
9
10
# File 'lib/reveal-ck/builders/creation_task.rb', line 8

def application
  @application
end

#things_to_createObject (readonly)

Returns the value of attribute things_to_create.



8
9
10
# File 'lib/reveal-ck/builders/creation_task.rb', line 8

def things_to_create
  @things_to_create
end

Instance Method Details

#nameObject



19
20
21
22
23
24
25
# File 'lib/reveal-ck/builders/creation_task.rb', line 19

def name
  full_class_name = self.class.to_s
  class_name = full_class_name.gsub(/.*::/, '')
  add_underscores = class_name.gsub(/([A-Z])/, '_\1')
  trim_first_underscore = add_underscores[1..add_underscores.size]
  trim_first_underscore.downcase
end

#prepareObject



27
28
29
30
31
# File 'lib/reveal-ck/builders/creation_task.rb', line 27

def prepare
  setup
  task(name => things_to_create.to_a)
  name
end

#setupObject



15
16
17
# File 'lib/reveal-ck/builders/creation_task.rb', line 15

def setup
  raise('setup must be implemented by subclasses')
end