github_changes 0.1.6 → 0.1.7

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: c7eed4d44163ee873a8bd9f54545c684bf198e0f
4
- data.tar.gz: 906288c0ad3c375f17600004a0ad4fa03beac063
3
+ metadata.gz: 4538692d38079992fb83cdd6298a6eb3ec957bf8
4
+ data.tar.gz: d5c164b8b758c30849ff72f1bce55762f996dbb5
5
5
  SHA512:
6
- metadata.gz: 4f31590bde945802712fe14e6e6d9034bf2bfac72f0733bf371940f595ca222c437b12cfe9c65aaa97a324077a238cb66c36e2a4b4f7684c858b2ed94d9de7b9
7
- data.tar.gz: 3d3d0c25c8b89f3bd800416c1448084af4459c0c1aed78a95b53d2f4376bd33a7563dd70af7e5b8dfb49545e6e65c8a4f2715fdaed8f3174ded879191b1a38f7
6
+ metadata.gz: 83622b430339bf958ee60d1f1c91e655ec6ce3545ac408f2ee33999492fc047fe5e6ef4dd2870c401faed086993c6ed56e330878b09ef7c635d80a2fcffe8eca
7
+ data.tar.gz: 19eb80202cbc5805beeb04b1123fb56c97a50a3bd9d5ee094e8a29cfc7ecf6ccfd3db157beff608322025edb0d8900012d84d70c05b2334a4cb543886247774f
@@ -28,8 +28,10 @@ module ChangelogGenerator
28
28
  method_option :from_ref, :aliases => "-f", :type => :string, :required => true
29
29
  method_option :to_ref, :aliases => "-t", :type => :string, :default => "master"
30
30
  method_option :label_filter, :aliases => "-l", :type => :string
31
+ method_option :include_pr_links, :type => :boolean
32
+ method_option :include_issue_links, :type => :boolean
31
33
  def generate()
32
- generator = Generator.new(options[:user], options[:repo], options[:from_ref], options[:to_ref], options[:label_filter])
34
+ generator = Generator.new(options[:user], options[:repo], options[:from_ref], options[:to_ref], options[:label_filter], options.include_pr_links?, options.include_issue_links?)
33
35
  begin
34
36
  output = generator.description + "\n\n"
35
37
  output << generator.changelog
@@ -10,13 +10,17 @@ module ChangelogGenerator
10
10
  attr_accessor :from_ref
11
11
  attr_accessor :to_ref
12
12
  attr_accessor :label_filter
13
+ attr_accessor :include_pr_links
14
+ attr_accessor :include_issue_links
13
15
 
14
- def initialize(user, repo, from_ref, to_ref, label_filter = nil)
16
+ def initialize(user, repo, from_ref, to_ref, label_filter = nil, include_pr_links = false, include_issue_links = false)
15
17
  self.user = user
16
18
  self.repo_name = repo
17
19
  self.from_ref = from_ref
18
20
  self.to_ref = to_ref || "now"
19
21
  self.label_filter = label_filter
22
+ self.include_pr_links = include_pr_links
23
+ self.include_issue_links = include_issue_links
20
24
  end
21
25
 
22
26
  def description
@@ -54,15 +58,23 @@ module ChangelogGenerator
54
58
  pull.issues = issues.compact
55
59
  end
56
60
 
57
- commits = pulls.map { |p| p.head_sha[0..7] }
61
+ string = pulls.reduce("") do |memo, pull|
62
+ memo << "<https://github.com/#{user}/#{repo}/pull/#{pull.number}|#{pull.number}> " if include_pr_links
63
+ memo << pull.changelog_text
58
64
 
59
- connected_issue_nums = pulls.map(&:issues).flatten.map(&:number)
65
+ if include_issue_links
66
+ pull.issues.each do |issue|
67
+ memo << " <https://github.com/#{user}/#{repo}/issues/#{issue.number}|#{issue.number}>"
68
+ end
69
+ end
60
70
 
61
- logs = pulls.map { |p| p.changelog_text }
62
- logs = logs.reject(&:empty?)
63
-
64
- string = logs.join("\n") << "\n\n"
71
+ memo << "\n"
72
+ end
73
+
74
+ string << "\n\n"
65
75
 
76
+ commits = pulls.map { |p| p.head_sha[0..7] }
77
+ connected_issue_nums = pulls.map(&:issues).flatten.map(&:number)
66
78
  show_prs = commits.count <= 20
67
79
  show_issues = show_prs && (connected_issue_nums.count > 0)
68
80
  show_both = show_prs && show_issues && (commits.count + connected_issue_nums.count <= 20)
@@ -1,3 +1,3 @@
1
1
  module ChangelogGenerator
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_changes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Rayment
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-02 00:00:00.000000000 Z
11
+ date: 2016-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor