Class: Semaph::Shells::Project::WorkflowsListCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/semaph/shells/project/workflows_list_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow_collection) ⇒ WorkflowsListCommand

Returns a new instance of WorkflowsListCommand.



9
10
11
12
13
# File 'lib/semaph/shells/project/workflows_list_command.rb', line 9

def initialize(workflow_collection)
  @workflow_collection = workflow_collection
  @usage = "<branch>"
  @help = "list available workflows"
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



7
8
9
# File 'lib/semaph/shells/project/workflows_list_command.rb', line 7

def help
  @help
end

#usageObject (readonly)

Returns the value of attribute usage.



7
8
9
# File 'lib/semaph/shells/project/workflows_list_command.rb', line 7

def usage
  @usage
end

Instance Method Details

#execute(branch) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/semaph/shells/project/workflows_list_command.rb', line 15

def execute(branch)
  @workflow_collection.reload
  @workflow_collection.all.slice(0..9).each_with_index do |workflow, index|
    next unless workflow.branch.include?(branch)

    pipelines = workflow.pipeline_collection.reload

    puts content(index, pipelines, workflow)
  end
end