Skip to content

Commit

Permalink
Added support to specify sprint in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
chessbyte committed May 4, 2020
1 parent 8c98cb0 commit eb9f5c3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions prs_per_repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ def initialize(opts)

@output_file = opts[:output_file] || "prs_per_repo.csv"
@github_org = "ManageIQ"
@sprint = get_sprint(opts)
end

def find_sprint(sprint = nil)
def get_sprint(opts)
sprint_given = opts[:sprint_given] ? opts[:sprint] : config[:sprint]

return Sprint.prompt_for_sprint(3) unless sprint_given

sprint = (sprint_given == 'last') ? Sprint.last_completed : Sprint.create_by_sprint_number(sprint_given.to_i)
if sprint.nil?
Sprint.prompt_for_sprint(3)
elsif sprint == 'last'
Sprint.last_completed
else
Sprint.create_by_sprint_number(sprint.to_i)
end
STDERR.puts "invalid sprint <#{sprint_given}> specified"
exit
end
sprint
end

def github_api_token
Expand Down

0 comments on commit eb9f5c3

Please sign in to comment.