Sha256: bc25a189744901cb8d98b3d061bec91e0e2c0f5a6c15c49650d281d540749069

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require "thor"

require_relative "../base"

module Neetob
  class CLI
    module Github
      module Issues
        class Create < Base
          attr_accessor :repos, :issue_title, :issue_description, :issue_assignee, :issue_labels, :sandbox

          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
          end

          def run
            matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
            matching_repos.each do |repo|
              ui.info("\n  Creating 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
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
neetob-0.3.1 lib/neetob/cli/github/issues/create.rb
neetob-0.3.0 lib/neetob/cli/github/issues/create.rb
neetob-0.2.7 lib/neetob/cli/github/issues/create.rb
neetob-0.2.6 lib/neetob/cli/github/issues/create.rb
neetob-0.2.5 lib/neetob/cli/github/issues/create.rb
neetob-0.2.4 lib/neetob/cli/github/issues/create.rb
neetob-0.2.3 lib/neetob/cli/github/issues/create.rb