Class: Wassup::Panes::CircleCI::Workflows

Inherits:
Object
  • Object
show all
Defined in:
lib/wassup/panes/circleci.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vcs:, org:, repo:) ⇒ Workflows

Returns a new instance of Workflows.



9
10
11
12
13
# File 'lib/wassup/panes/circleci.rb', line 9

def initialize(vcs:, org:, repo:)
  @vcs = vcs
  @org = org
  @repo = repo
end

Instance Attribute Details

#orgObject

Returns the value of attribute org.



6
7
8
# File 'lib/wassup/panes/circleci.rb', line 6

def org
  @org
end

#repoObject

Returns the value of attribute repo.



7
8
9
# File 'lib/wassup/panes/circleci.rb', line 7

def repo
  @repo
end

#vcsObject

Returns the value of attribute vcs.



5
6
7
# File 'lib/wassup/panes/circleci.rb', line 5

def vcs
  @vcs
end

Instance Method Details

#configure(pane) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wassup/panes/circleci.rb', line 15

def configure(pane)
  pane.content do |content|
    workflows = Helpers::CircleCI.workflows(vcs: vcs, org: org, repo: repo, limit_days: 14)
    workflows.each do |workflow|
      display = Helpers::CircleCI::Formatter.workflow(workflow)
      content.add_row(display, workflow)
    end
  end
  pane.selection('enter', 'Open workflow in browser') do |workflow|
    slug = workflow["project_slug"]
    pipeline_number = workflow["pipeline_number"]
    workflow_id = workflow["id"]

    url = "https://app.circleci.com/pipelines/#{slug}/#{pipeline_number}/workflows/#{workflow_id}"
    `open #{url}`
  end
end