Class: Neetob::CLI::Github::Issues::Create

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/github/issues/create.rb

Constant Summary

Constants inherited from Base

Base::NEETO_APPS_LIST_LINK

Instance Attribute Summary collapse

Attributes inherited from Base

#client

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods included from Utils

#camel_case_to_slug, #is_upper?, #symbolize_keys

Constructor Details

#initialize(repos, issue_title, issue_description = "", issue_assignee = "", issue_labels = "", sandbox = false) ⇒ Create

Returns a new instance of Create.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/neetob/cli/github/issues/create.rb', line 14

def initialize(repos, issue_title, issue_description = "", issue_assignee = "", issue_labels = "",
sandbox = false)
  super()
  @repos = repos
  @issue_title = issue_title
  @issue_description = issue_description
  @issue_assignee = issue_assignee
  @issue_labels = issue_labels
  @sandbox = sandbox
  get_issue_title_or_description_and_confirm_data
end

Instance Attribute Details

#issue_assigneeObject

Returns the value of attribute issue_assignee.



12
13
14
# File 'lib/neetob/cli/github/issues/create.rb', line 12

def issue_assignee
  @issue_assignee
end

#issue_descriptionObject

Returns the value of attribute issue_description.



12
13
14
# File 'lib/neetob/cli/github/issues/create.rb', line 12

def issue_description
  @issue_description
end

#issue_labelsObject

Returns the value of attribute issue_labels.



12
13
14
# File 'lib/neetob/cli/github/issues/create.rb', line 12

def issue_labels
  @issue_labels
end

#issue_titleObject

Returns the value of attribute issue_title.



12
13
14
# File 'lib/neetob/cli/github/issues/create.rb', line 12

def issue_title
  @issue_title
end

#reposObject

Returns the value of attribute repos.



12
13
14
# File 'lib/neetob/cli/github/issues/create.rb', line 12

def repos
  @repos
end

#sandboxObject

Returns the value of attribute sandbox.



12
13
14
# File 'lib/neetob/cli/github/issues/create.rb', line 12

def sandbox
  @sandbox
end

Instance Method Details

#runObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/neetob/cli/github/issues/create.rb', line 26

def run
  matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
  matching_repos.each do |repo|
    ui.info("\nCreating issue in \"#{repo}\"  \n")
    begin
      issue_options = { assignee: issue_assignee, labels: issue_labels }
      issue = client.create_issue(repo, issue_title, issue_description, issue_options)
      ui.success("Created the issue successfully \nLink: #{issue[:html_url]}")
    rescue StandardError => e
      ExceptionHandler.new(e).process
    end
  end
end