Skip to content

Instantly share code, notes, and snippets.

@MrPink
Created June 8, 2011 14:57
Show Gist options
  • Save MrPink/1014587 to your computer and use it in GitHub Desktop.
Save MrPink/1014587 to your computer and use it in GitHub Desktop.
Nagios2Jira
require 'rubygems'
require 'jira4r'
jira = Jira4R::JiraTool.new(2, "http://ourjira.onjira.com")
jira.login("user", "password")
# create the issue.
options = {}
OptionParser.new do |opts|
opts.on("-s", "--summary summary text") do |s|
issue = Jira4R::V2::RemoteIssue.new
issue.project = "SA"
@summary = s
issue.summary = @summary
opts.on("-d", "--description text") do |d|
@description = d
issue.description = @description
opts.on("-a", "--assignee username") do |a|
@assignee = a
issue.assignee = @assignee
issue.type = "3"
jira.createIssue(issue)
end
end
end
end.parse!
@MrPink
Copy link
Author

MrPink commented Jun 8, 2011

I know its awful but it works, can I reduce the amount of opts.on?

@rentalcustard
Copy link

I'm trolling. It fits within 30 lines, anything goes within those bounds. :)

@MrPink
Copy link
Author

MrPink commented Jun 9, 2011

tl;dr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment