Class: AsProject::EnvTask

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/env_task.rb

Direct Known Subclasses

MXMLC

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :env_task) {|_self| ... } ⇒ EnvTask

Returns a new instance of EnvTask.

Yields:

  • (_self)

Yield Parameters:



9
10
11
12
13
# File 'lib/tasks/env_task.rb', line 9

def initialize(name=:env_task)
  @name = name
  yield self if block_given?
  define
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/tasks/env_task.rb', line 6

def name
  @name
end

#targetObject

Returns the value of attribute target.



6
7
8
# File 'lib/tasks/env_task.rb', line 6

def target
  @target
end

Instance Method Details

#defineObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/tasks/env_task.rb', line 15

def define
  if(target.nil?)
    raise EnvTaskError.new('EnvTask requires a task target to execute')
  end
  begin
    sh(target)
  rescue NoMethodError => e
    target_not_found
  rescue RuntimeError => e
  end
end

#target_not_foundObject

Raises:



27
28
29
# File 'lib/tasks/env_task.rb', line 27

def target_not_found
  raise EnvTaskError.new("EnvTask was unable to find the target: #{target}")
end