gh_issues 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf02659189c36d6d254d8f17a4c8c8a9317ce680
4
- data.tar.gz: bdd781cc04295e1a98c3da7ac5a217b0fdd29dba
3
+ metadata.gz: 6ad1ed5d7e6d72ee1c8469e1ef8ca5ba602fbcfa
4
+ data.tar.gz: 796e498c41ea17b423fdd1a911ed52118ed138d3
5
5
  SHA512:
6
- metadata.gz: fc6060f03712036ad821afb5b3e4b30bd92a01ab41a437ec9fe326bd8641faccdf829d725a67a65ce702b6301b8dfb02b8697c267241aeea54f0efecee7bcce2
7
- data.tar.gz: d0b8028979657cebc004935355455bf1d1421d2c39896a073dd4c645728975433babe3280bbdeadacc5c0f82f6335b7471d76731f7b7edad0ed72079ebd2b481
6
+ metadata.gz: d510ec7b346315a7860b0c22104afe8c33485414a65ae035fb1c4af68bb747c12d0c0a062f2018000871ce13c514a64e3f3ffa5673919d37eee01956515b9351
7
+ data.tar.gz: c8a2d80a571863ac9f2f1ca3f84580163eb4877e4c26acc39b9d503325291d702479687d7d29a89ab30245d0bdada211c581b56ad90fd9ce90a379a81f2be3a9
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Build Status](https://travis-ci.org/vigo/gh-issues.svg?branch=master)](https://travis-ci.org/vigo/gh-issues)
2
- ![Version](https://img.shields.io/badge/version-0.3.2-yellow.svg)
2
+ ![Version](https://img.shields.io/badge/version-0.4.0-yellow.svg)
3
3
 
4
4
  # GitHub Issues
5
5
 
data/lib/gh_issues/cli.rb CHANGED
@@ -117,6 +117,7 @@ module GhIssues
117
117
  puts "Listing current GitHub repo: #{repo}" if repo == current_repo
118
118
 
119
119
  if issue_number > 0
120
+ markdown = Redcarpet::Markdown.new(GhIssues::TextRenderer)
120
121
  issue = GhIssues.get_issue(repo, issue_number)
121
122
  table = Terminal::Table.new do |t|
122
123
  t.add_row [colorize("Repo/Issue", :yellow), colorize("#{repo}/#{issue_number}", :white)]
@@ -135,14 +136,26 @@ module GhIssues
135
136
  created_at_diff = TimeDifference.between(now, issue[:created_at]).in_days.to_i
136
137
  updated_at_diff = TimeDifference.between(now, issue[:updated_at]).in_days.to_i
137
138
 
138
- t.add_row [colorize("Created at", :yellow), "#{created_at} (#{created_at_diff} days ago)"]
139
- t.add_row [colorize("Updated at", :yellow), "#{updated_at} (#{updated_at_diff} days ago)"]
139
+ t.add_row [colorize("Created at", :yellow), "#{created_at} (#{created_at_diff} #{pluralize("day", "days", created_at_diff)} ago)"]
140
+ t.add_row [colorize("Updated at", :yellow), "#{updated_at} (#{updated_at_diff} #{pluralize("day", "days", updated_at_diff)} ago)"]
140
141
  if issue[:body].length > 0
141
- markdown = Redcarpet::Markdown.new(GhIssues::TextRenderer)
142
142
  body_text = markdown.render(issue[:body])
143
143
  t.add_separator
144
144
  t.add_row [colorize("Body", :yellow), wrap(body_text, WRAP_TEXT_AT)]
145
145
  end
146
+
147
+ if issue[:comments].length > 0
148
+ t.add_separator
149
+ t.add_row [{value: "#{colorize(pluralize('Comment', 'Comments', issue[:comments].length), :yellow)} (#{issue[:comments].length})", colspan: 2, alignment: :center}]
150
+ t.add_separator
151
+ issue[:comments].each do |comment|
152
+ comment_created_at = comment[:created_at].strftime(DEFAULT_DATE_FORMAT)
153
+ comment_created_at_diff = TimeDifference.between(now, comment[:created_at]).in_days.to_i
154
+ comment_text = "#{markdown.render(comment[:body])}\n---\n#{comment_created_at} (#{comment_created_at_diff} #{pluralize("day", "days", comment_created_at_diff)} ago)"
155
+ t.add_row [colorize(comment[:user], :green), wrap(comment_text, WRAP_TEXT_AT)]
156
+ t.add_separator
157
+ end
158
+ end
146
159
  end
147
160
  puts table
148
161
  else
@@ -1,3 +1,3 @@
1
1
  module GhIssues
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/gh_issues.rb CHANGED
@@ -76,7 +76,7 @@ module GhIssues
76
76
  if ::GhIssues.ghi_access_available?
77
77
  begin
78
78
  issue = @@client.issue(repo, issue_number)
79
- {
79
+ out = {
80
80
  number: issue[:number],
81
81
  title: issue[:title],
82
82
  user: issue[:user][:login],
@@ -91,6 +91,22 @@ module GhIssues
91
91
  exit
92
92
  end
93
93
 
94
+ out[:comments] = []
95
+
96
+ begin
97
+ comments = @@client.issue_comments(repo, issue_number)
98
+ comments.each do |comment|
99
+ out[:comments] << {
100
+ user: comment[:user][:login],
101
+ body: comment[:body],
102
+ created_at: comment[:created_at],
103
+ updated_at: comment[:updated_at],
104
+ }
105
+ end
106
+ rescue Octokit::NotFound => error_message
107
+ end
108
+
109
+ out
94
110
  end
95
111
  end
96
112
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh_issues
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uğur Özyılmazel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-02 00:00:00.000000000 Z
11
+ date: 2016-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler