Class: CapExtWebistrano::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/cap_ext_webistrano/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task, config) ⇒ Task

Returns a new instance of Task.



9
10
11
12
# File 'lib/cap_ext_webistrano/task.rb', line 9

def initialize(task, config)
  @task = task
  @config = config
end

Instance Attribute Details

#taskObject

Returns the value of attribute task.



7
8
9
# File 'lib/cap_ext_webistrano/task.rb', line 7

def task
  @task
end

Instance Method Details

#runObject



20
21
22
23
24
25
# File 'lib/cap_ext_webistrano/task.rb', line 20

def run
  set_access_data
  project = Project.find_by_name(@config[:application])
  stage = project.find_stage(@config[:stage])
  Deployment.create(:task => task, :stage_id => stage.id, :project_id => project.id)
end

#set_access_dataObject



14
15
16
17
18
# File 'lib/cap_ext_webistrano/task.rb', line 14

def set_access_data
  [Project, Stage, Deployment].each do |klazz|
    klazz.configure(@config)
  end
end