0
# used Cap as a model for this - thanks Jamis
0
puts just('TicId', 10) + ': ' + t.ticket_id
0
puts just('Assigned', 10) + ': ' + t.assigned.to_s
0
+ puts just('Reporter', 10) + ': ' + t.reporter.to_s
0
puts just('Opened', 10) + ': ' + t.opened.to_s + ' (' + days_ago + ' days)'
0
puts just('State', 10) + ': ' + t.state.upcase
0
message_file = Tempfile.new('ticgit_message').path
0
File.open(message_file, 'w') do |f|
0
- f.puts "# first line will be the title of the tic, the rest will be the first comment"
0
- f.puts "# if you would like to add initial tags, put them on the 'tags:' line, comma delim"
0
+#Put your tags after 'tags: ' in comma delimited form
0
+#put your comment here. remember to indent it
0
if message = get_editor_message(message_file)
0
+ issue_info = YAML.load(File.open(message))
0
+ if issue_info.kind_of? String
0
+ puts "I couldn't parse that. Make sure that colons " +
0
+ "followed by space and your comments are indented"
0
+ title = issue_info['title']
0
if title && title.chomp.length > 0
0
- if message.last[0, 5] == 'tags:'
0
- tags = tags.gsub('tags:', '')
0
- tags = tags.split(',').map { |t| t.strip }
0
- comment = message.join("")
0
- ticket_show(@tic.ticket_new(title, :comment => comment, :tags => tags))
0
+ tags = issue_info['tags']
0
+ tags = tags.split(',').map { |t| t.strip }
0
+ comment = issue_info['comments']
0
+ ticket_show(@tic.ticket_new(title, :comment => comment, :tags => tags, :reporter => issue_info['reporter']))
0
-
puts "You need to at least enter a title"
0
+
puts "You need to at least enter a title"
0
- puts "It seems you wrote nothing"
0
def get_editor_message(message_file = nil)
0
message_file = Tempfile.new('ticgit_message').path if !message_file
0
editor = ENV["EDITOR"] || 'vim'
0
system("#{editor} #{message_file}");
0
- message = File.readlines(message_file)
0
- message = message.select { |line| line[0, 1] != '#' } # removing comments
0
def parse_options! #:nodoc:
Comments
this is an interesting idea, but why as a ‘reporter:’ string in the message rather than grabbing the current git user settings?