Class: GitPivotalTrackerIntegration::Command::Report

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

Constant Summary

Constants inherited from Base

Base::TIMER_TOKENS

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, #finish_toggle, #initialize, #logger_filename, #parameters, #seconds_spent, #start_logging

Constructor Details

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

Instance Method Details

#run(args) ⇒ Object



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
58
59
60
61
# File 'lib/git-pivotal-tracker-integration/command/report.rb', line 26

def run(args)

  owned_by = "Jeff Wolski" # hard coded to Jeff Wolski for now


  $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
  bug_title = nil
  if args.length == 1
    bug_title = args[0]
  end
  # puts bug_title
  if bug_title.nil? || bug_title.empty?
    abort "\nUsage example:\n\n git report \"Issue running deliver command\" \n"
  end

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

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

  bug_story = PivotalTracker::Story.new
  bug_story.project_id    = "1067990"
  bug_story.owned_by      = owned_by
  bug_story.story_type    = "bug"
  bug_story.name          = bug_title
  bug_story.description   = bug_description
  bug_story.labels        = "userreported"
  uploaded_story          = bug_story.create

  uploaded_story.upload_attachment(self.logger_filename)
end