pivotal-slacker 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/pivotal-slacker +12 -6
  2. data/lib/formatter.rb +4 -0
  3. metadata +1 -1
data/bin/pivotal-slacker CHANGED
@@ -57,7 +57,7 @@ def get_first_story opts={:project => nil, :group => "icebox"}
57
57
  response = Net::HTTP.start(resource_uri.host, resource_uri.port) do |http|
58
58
  http.get(resource_uri.path, {"X-TrackerToken" => $config.api_key})
59
59
  end
60
-
60
+
61
61
  xml = Nokogiri.XML(response.body)
62
62
  target_story_id = xml.xpath("//story").xpath("./id").first.content.strip.to_i
63
63
 
@@ -101,6 +101,9 @@ def output_story_list opts={:project => nil, :states => [], :owned_by => nil, :m
101
101
  created_at = Formatter.time_ago(story.created_at)
102
102
  story_type = Formatter.story_type(story.story_type)
103
103
 
104
+ labels = Formatter.label(story.labels.gsub(/,/, ", ")) if not story.labels.nil?
105
+ labels = " #{labels}" if labels != ""
106
+
104
107
  menu_output = nil
105
108
  if opts[:menu]
106
109
  $menu_story_mapping[menu_number] = story.id
@@ -109,7 +112,7 @@ def output_story_list opts={:project => nil, :states => [], :owned_by => nil, :m
109
112
  menu_number += 1
110
113
  end
111
114
 
112
- puts "#{menu_output}[#{id}] #{name} ~ #{state} #{story_type}, from #{requested_by}, created #{created_at}"
115
+ puts "#{menu_output}[#{id}] #{name}#{labels} ~ #{state} #{story_type}, from #{requested_by}, created #{created_at}"
113
116
  end
114
117
  end
115
118
 
@@ -193,9 +196,12 @@ def define_commands
193
196
  created_at = Formatter.time_ago("created #{story.created_at}")
194
197
  story_type = Formatter.story_type(story.story_type)
195
198
 
199
+ labels = Formatter.label(story.labels.gsub(/,/, ", ")) if not story.labels.nil?
200
+ labels = "#{labels} ~ " if labels != ""
201
+
196
202
  puts ""
197
203
  puts "[#{id}] #{Formatter.story_name(story.name, :heading => true)}"
198
- puts "#{state} #{story_type}, from #{requested_by}, #{created_at}"
204
+ puts "#{labels}#{state} #{story_type}, from #{requested_by}, #{created_at}"
199
205
  puts "☛ #{story.url.color('#0066CC').underline}"
200
206
  puts ""
201
207
  puts Formatter.description(story.description)
@@ -329,7 +335,7 @@ def define_commands
329
335
  puts "#{Formatter.attr_descriptor('owned by', Formatter.owner(options.owner))}"
330
336
  puts "#{Formatter.attr_descriptor('description is', Formatter.description(options.description))}"
331
337
  if iteration
332
- puts "#{Formatter.attr_descriptor('iteration is', Formatter.iteration(iteration))}"
338
+ puts "#{Formatter.attr_descriptor('iteration is', Formatter.iteration(iteration))}"
333
339
  end
334
340
  puts ""
335
341
 
@@ -341,13 +347,13 @@ def define_commands
341
347
  :requested_by => $config.user,
342
348
  :owned_by => options.owner
343
349
  )
344
-
350
+
345
351
  # If asked to, put the story at the top of the backlog.
346
352
  if options.backlog
347
353
  first_backlog_story = get_first_story :project => $project, :group => "backlog"
348
354
  story.move(:before, first_backlog_story)
349
355
  end
350
-
356
+
351
357
  puts Formatter.story_action("Created", story.id, story.name)
352
358
  else
353
359
  puts "Didn't create story."
data/lib/formatter.rb CHANGED
@@ -67,6 +67,10 @@ class Formatter
67
67
  "#{iteration}".color('#cccc00')
68
68
  end
69
69
 
70
+ def self.label label
71
+ "#{label}".color('#003366')
72
+ end
73
+
70
74
  # Format error messages.
71
75
  def self.err errmsg
72
76
  errmsg.background('#990000').color(:white)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-slacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: