github_changes 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/changelog_generator/cli.rb +9 -2
- data/lib/changelog_generator/generator.rb +13 -16
- data/lib/changelog_generator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 271f7ac2411a473f933f57f6abd6e15bc7a1915a
|
4
|
+
data.tar.gz: 8c9d02ba79d7903207688464906477dcb7c9e193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e13751f86e772d8dc7c7a3dc072cea73817f68445d2b4cf4515da0f6175c88281b2f2546de920f179c0afcba528a3a1bad782224baa31df5ef93174d41c73d0
|
7
|
+
data.tar.gz: 587767b2d9f9be65232b0ba416706ab0196b40f2b6a55540e236b8f2bb890c61a7188d6e9a7989d78be1363eafe55725f51a06fff58475bae788c35287aad461
|
@@ -3,6 +3,10 @@ $thor_runner = false
|
|
3
3
|
|
4
4
|
module ChangelogGenerator
|
5
5
|
class CLI < Thor
|
6
|
+
def self.exit_on_failure?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
6
10
|
desc "hello NAME", "This will greet you"
|
7
11
|
long_desc <<-EOS
|
8
12
|
`hello NAME` will print out a message to the person of your choosing.
|
@@ -26,12 +30,15 @@ module ChangelogGenerator
|
|
26
30
|
method_option :label_filter, :aliases => "-l", :type => :string
|
27
31
|
def generate()
|
28
32
|
generator = Generator.new(options[:user], options[:repo], options[:from_ref], options[:to_ref], options[:label_filter])
|
29
|
-
puts generator.description
|
30
33
|
begin
|
31
|
-
|
34
|
+
output = generator.description + "\n\n"
|
35
|
+
output << generator.changelog
|
36
|
+
puts output
|
32
37
|
rescue Exception => e
|
38
|
+
puts e.message
|
33
39
|
STDERR.puts "#{e}"
|
34
40
|
STDERR.puts e.backtrace
|
41
|
+
throw e
|
35
42
|
end
|
36
43
|
end
|
37
44
|
end
|
@@ -20,9 +20,9 @@ module ChangelogGenerator
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def description
|
23
|
-
description = "Changes for
|
23
|
+
description = "Changes for `#{user}/#{repo_name}` from `#{from_ref}` to `#{to_ref}`"
|
24
24
|
if label_filter
|
25
|
-
description << " with label
|
25
|
+
description << " with label `#{label_filter}`"
|
26
26
|
end
|
27
27
|
description
|
28
28
|
end
|
@@ -37,13 +37,13 @@ module ChangelogGenerator
|
|
37
37
|
start_date, end_date = *date_range_for_references(start_ref, end_ref)
|
38
38
|
# puts "Start: #{start_ref}, End: #{end_ref}"
|
39
39
|
unless start_date && end_date
|
40
|
-
|
40
|
+
abort "Failed to acquire date range from references"
|
41
41
|
end
|
42
42
|
pulls = pull_requests_for_date_range(start_date, end_date)
|
43
43
|
pull_nums = pulls.map { |p| p['number'] }
|
44
44
|
|
45
45
|
if pull_nums.empty?
|
46
|
-
|
46
|
+
abort "No PRs found matching criteria"
|
47
47
|
else
|
48
48
|
# puts " PRs: #{pull_nums}"
|
49
49
|
# puts
|
@@ -61,7 +61,7 @@ module ChangelogGenerator
|
|
61
61
|
end
|
62
62
|
|
63
63
|
if pull_nums.empty?
|
64
|
-
|
64
|
+
abort "No PRs found matching criteria"
|
65
65
|
end
|
66
66
|
|
67
67
|
pulls = pull_nums.map { |p| github.pull_requests.get(user, repo, p) }
|
@@ -83,20 +83,17 @@ module ChangelogGenerator
|
|
83
83
|
logs = pulls.map { |p| p.changelog_text }
|
84
84
|
logs = logs.reject(&:empty?)
|
85
85
|
|
86
|
-
string = "
|
87
|
-
string << logs.join("\n")
|
88
|
-
string << "\n```"
|
89
|
-
string << "\n\n"
|
86
|
+
string = logs.join("\n") << "\n\n"
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
show_prs = commits.count <= 20
|
89
|
+
show_issues = show_prs && (connected_issue_nums.count > 0)
|
90
|
+
show_both = show_prs && show_issues && (commits.count + connected_issue_nums.count <= 20)
|
94
91
|
|
95
|
-
string << "
|
96
|
-
string << "
|
97
|
-
string << "
|
92
|
+
string << "<https://github.com/#{user}/#{repo}/pulls?q=is%3Apr+#{commits.join("+")}|PRs>" if show_prs
|
93
|
+
string << " | <https://github.com/#{user}/#{repo}/issues?q=is%3Aissue+#{connected_issue_nums.join("+")}|Issues>" if show_issues
|
94
|
+
string << " | <https://github.com/#{user}/#{repo}/issues?q=#{commits.join("+")}+#{connected_issue_nums.join("+")}|Both>" if show_both
|
98
95
|
|
99
|
-
string
|
96
|
+
string
|
100
97
|
end
|
101
98
|
|
102
99
|
def github
|
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.
|
4
|
+
version: 0.1.2
|
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-02-
|
11
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|