Class: GitPivotalTrackerIntegration::Command::Report

Inherits:
Base
  • Object
show all
Defined in:
lib/git-pivotal-tracker-integration/command/report.rb

Constant Summary collapse

V2GPTI_PROJECT_ID =
1067990

Instance Method Summary collapse

Methods inherited from Base

#check_version, #create_backlog_bug_story, #create_backlog_feature_story, #create_icebox_bug_story, #create_icebox_feature_story, #create_story, #estimated_seconds, #initialize, #logger_filename, #seconds_spent, #start_logging

Constructor Details

This class inherits a constructor from GitPivotalTrackerIntegration::Command::Base

Instance Method Details

#run(args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/git-pivotal-tracker-integration/command/report.rb', line 23

def run(args)
  owned_by = 611593   # hard coded to Jeff Wolski for now

  $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{Util::Git.branch_name}")
  bug_title = nil
  bug_title = args[0] if args.length == 1

  # puts bug_title
  abort "\nUsage example:\n\n git report \"Issue running deliver command\" \n" if bug_title.nil? || bug_title.empty?

  report_note = ""
  while (report_note.nil? || report_note.empty?)
    report_note = ask("Description of bug:")
  end

  current_user        = (Util::Shell.exec "git config user.name").chomp
  bug_title           = "User Reported - #{current_user} - #{bug_title}"
  current_user_email  = (Util::Shell.exec "git config user.email").chomp
  bug_description     = "#{@project.name}\n#{current_user_email}\n#{report_note}"

  project     = @client.project(V2GPTI_PROJECT_ID)
  attachment  = project.add_attachment(self.logger_filename, 'text/plain')

  story_params  = {
                    :owner_ids    => [owned_by],
                    :story_type   => "bug",
                    :name         => bug_title,
                    :description  => bug_description,
                    :labels       => ["userreported"]
                  }

  story = project.create_story story_params

  story.add_comment_with_attachment('Log file', attachment)
end