sly 0.1.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmE3NTBkZDk2NjZmZDAyODdmZDUzMDRiMmZiZmY2MzdkYjIyYzY4MQ==
4
+ NDZiY2I1MTdmOWM5MjhhN2MzNTUyODIwODE1ZjYwY2QxOTIzZGJkYQ==
5
5
  data.tar.gz: !binary |-
6
- MDBhZTVkNWJmZDcwMjM0M2ZmYmM2Nzg1ZjI5OWM4NjJkMzU1ODEzMQ==
6
+ MjBhNWYzNGNjNmY4Zjc0MDhmZDQ0OWJhMDI1MWMwZjZkNDlhZDQyMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWY3NmM1ZjYzMTAxMTI5ZWY2NzVjOWUzMDFlY2I4MjA3NDcxNjkzMTA5ZGRm
10
- MTY2ODgzMjQ5OGJiYjk4NmE4ZWY3NWUyOTIwODEzMTViYWYxYzhiYzJlNzc2
11
- ZDk4NTEyYTQwZjYzNmYxMTBkN2FjMWJjNzA5ODFhNmM5MmU4MzE=
9
+ YTBlNDUyMDEzNjQ4YTU5OWQ0MjFkMTAwMmZmNDgxZWZkN2MzMjBiMTRlOTI2
10
+ OGU0NmYzYTE2YTQ3YmNjODRhNDRhMTAyZTg1MzIwODFjZjlkMjUzMzM5YTk2
11
+ ZTc4OTM0YmM3NWM0NjEyNjk0ZjM3MzljMzAwYjJlYmFjNjNiNWY=
12
12
  data.tar.gz: !binary |-
13
- MzQxNjQ4NDcxNTRlOGQ3MjE4MmM2OTk5NWNlZjNhMmRhZjZjOWRlNWM2ZThk
14
- ZmUxZWUwOGZmMDBhZWNlNzUxZmQ3OWVhNzJlMDI4NmQ2MDA1MTdhYWJlYTQ3
15
- NmE2MjYxODA0OGYyMDU0YzVjYjkzNDM5ZTNkZTJhNGIxNGUwNzE=
13
+ NGNkNDRhOTllYzA4ODViMDIzMGQwM2NlZmUwMzBmOTI5ZTlmN2EzY2IwZjll
14
+ ZWRjOTg2ZjBmZjRlMTdmYmNjMmNjYjQ3NWM0MzNiY2VjODQ5ZmRkMzAzYjM5
15
+ MTBmNGEyMjllZWM1M2ZjNmQ0YzllOTI3OGMwZDlkMjlkNTc0ZDg=
data/bin/sly CHANGED
@@ -39,7 +39,7 @@ desc 'shows the current backlog for the project.'
39
39
  command :backlog do |c|
40
40
  c.action do |global_options,options,args|
41
41
  project = Sly::Project.load(SLY_PROJECT)
42
- project.update
42
+ project.update("backlog")
43
43
  Sly::GUI.display_backlog(project)
44
44
  end
45
45
  end
@@ -48,11 +48,20 @@ desc 'shows the current in-progress for the project.'
48
48
  command :current do |c|
49
49
  c.action do |global_options,options,args|
50
50
  project = Sly::Project.load(SLY_PROJECT)
51
- project.update
51
+ project.update("in-progress")
52
52
  Sly::GUI.display_current(project)
53
53
  end
54
54
  end
55
55
 
56
+ desc 'shows the complete items for the project.'
57
+ command :complete do |c|
58
+ c.action do |global_options,options,args|
59
+ project = Sly::Project.load(SLY_PROJECT)
60
+ project.update("completed")
61
+ Sly::GUI.display_complete(project)
62
+ end
63
+ end
64
+
56
65
  arg_name 'id'
57
66
  desc 'Setup git branch for the target story id'
58
67
  long_desc %/
data/lib/sly/connector.rb CHANGED
@@ -30,8 +30,9 @@ class Sly::Connector
30
30
  perform_and_capture_response(request)
31
31
  end
32
32
 
33
- def items_for_product(id)
34
- request = authenticated_request(@api_url+"/products/#{id}/items.json")
33
+ def items_for_product(id, status = nil)
34
+ status_request = "?status=#{status}" if status
35
+ request = authenticated_request(@api_url+"/products/#{id}/items.json#{status_request}")
35
36
  perform_and_capture_response(request)
36
37
  end
37
38
 
data/lib/sly/gui.rb CHANGED
@@ -17,6 +17,10 @@ class Sly::GUI
17
17
  self.display_items("Current", project.current)
18
18
  end
19
19
 
20
+ def self.display_complete(project)
21
+ self.display_items("Complete", project.complete)
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def self.display_items(title, items)
data/lib/sly/item.rb CHANGED
@@ -5,7 +5,7 @@ class Sly::Item
5
5
  TYPE_COLOR = { task: :black, test: :blue, defect: :red, feature: :green }
6
6
  TYPES = { "task" => :task, "defect" => :defect, "story" => :feature, "test" => :test}
7
7
 
8
- attr_accessor :number, :archived, :title, :score, :tags, :status, :type
8
+ attr_accessor :number, :archived, :title, :score, :tags, :status, :type, :assigned_to
9
9
 
10
10
  def self.with_number(number)
11
11
  begin
@@ -22,18 +22,19 @@ class Sly::Item
22
22
  end
23
23
 
24
24
  def initialize(item_attributes = {})
25
- @number = item_attributes["number"]
26
- @archived = item_attributes["archived"]
27
- @title = item_attributes["title"]
28
- @score = item_attributes["score"]
29
- @tags = item_attributes["tags"]
30
- @status = item_attributes["status"]
31
- @type = TYPES[item_attributes["type"]].to_sym
25
+ @number = item_attributes["number"]
26
+ @archived = item_attributes["archived"]
27
+ @title = item_attributes["title"]
28
+ @score = item_attributes["score"]
29
+ @tags = item_attributes["tags"]
30
+ @status = item_attributes["status"]
31
+ @type = TYPES[item_attributes["type"]].to_sym
32
+ assign(item_attributes["assigned_to"])
32
33
  end
33
34
 
34
35
  def overview
35
- quick_ref = "##{@number} - ".color(type_colour) + " #{@score} ".background(type_colour).color(:white)
36
- self.prettify([quick_ref, @title.color(type_colour)].join("\n"), 44)+"\n"
36
+ quick_ref = "##{@number} - ".color(type_colour) + " #{@score} ".background(type_colour).color(:white) + " #{@assigned_to} ".color(type_colour)
37
+ self.prettify([quick_ref, @title.color(type_colour)].join("\n"), 64)+"\n"
37
38
  end
38
39
 
39
40
  alias_method :to_s, :overview
@@ -60,10 +61,14 @@ class Sly::Item
60
61
  "#{self.type}/" + self.slug.slice(0, 60) + "-#{self.number}"
61
62
  end
62
63
 
64
+ def assign(assigned_to)
65
+ @assigned_to = assigned_to ?
66
+ "#{assigned_to["first_name"]} #{assigned_to["last_name"][0]}." : "Unassigned"
67
+ end
68
+
63
69
  private
64
70
 
65
71
  def type_colour
66
72
  TYPE_COLOR[@type]
67
73
  end
68
-
69
74
  end
data/lib/sly/project.rb CHANGED
@@ -32,13 +32,14 @@ class Sly::Project
32
32
  end
33
33
  end
34
34
 
35
- def update
35
+ def update(status = nil)
36
36
  begin
37
- download_child_items
38
- save_child_items
39
- rescue Exception
37
+ download_child_items(status)
38
+ save_child_items(status)
39
+ rescue Exception => e
40
+ puts e
40
41
  puts " Failed to connect to the Sprint.ly service, using last known values. ".colour(:white).background(:red)
41
- load_child_items
42
+ load_child_items(status)
42
43
  end
43
44
  end
44
45
 
@@ -51,23 +52,23 @@ class Sly::Project
51
52
  end
52
53
 
53
54
  def complete
54
- @items.select { |item| item.status == "complete" }
55
+ @items.select { |item| item.status == "completed" }
55
56
  end
56
57
 
57
58
  private
58
59
 
59
- def download_child_items
60
- items = Sly::Connector.connect_with_defaults.items_for_product(@id)
60
+ def download_child_items(status)
61
+ items = Sly::Connector.connect_with_defaults.items_for_product(@id, status)
61
62
  items.each { |item| @items << Sly::Item.new(item) }
62
63
  end
63
64
 
64
- def save_child_items
65
- target_file = File.join(pwd, '.sly', 'items')
65
+ def save_child_items(status)
66
+ target_file = File.join(pwd, '.sly', "#{status}_items")
66
67
  File.open(target_file, 'w') { |file| file.write @items.to_yaml }
67
68
  end
68
69
 
69
- def load_child_items
70
- target_file = File.join(pwd, '.sly', 'items')
70
+ def load_child_items(status)
71
+ target_file = File.join(pwd, '.sly', "#{status}_items")
71
72
  @items = YAML::load(File.open(target_file))
72
73
  end
73
74
 
data/lib/sly/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Sly
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.3'
3
3
 
4
4
  class VersionChecker
5
5
  def self.run
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert White
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-01 00:00:00.000000000 Z
11
+ date: 2013-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb