changelogerator 0.0.8 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/changelogerator.rb +7 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 400a2661d78f9c51ff0a2c4dacc852d464a9997f29c8017df1f5d585318504ff
4
- data.tar.gz: 1c32b784170d2eb50a1edea3aaee8e2b3d30321c5539209606913ea788ece2a3
3
+ metadata.gz: 3e44086f68d767a710aef577aa660002855118836df3ceffd5e30709913a2b88
4
+ data.tar.gz: 270dc478077bf3513c8fa855bd9ac6b052d30ea59280c041b6272cc6836712ba
5
5
  SHA512:
6
- metadata.gz: 538053876b3075cf839b80812a108854ff54a172683bd4c155cc7f4e17d52b6036746817742c0b956744a91861af870466a9873bba11db11866bacfb2086810f
7
- data.tar.gz: 79dd9b05c967834aa77b76ef08a83f0eccaaae33364743eb1512c2992ef49ab128dacae9c3303c85e647ed5126a62818ed66d633338eaedb889d5a424f51675c
6
+ metadata.gz: bd3863d0b58860acb3cb837fd14e7718db5125af49570ab64b899a039065885759de2eafd0bd5c1f6ecd3a86931789244b7dcdcdba078cc8a0951ea2d6c09747
7
+ data.tar.gz: cca5542837bc8d13985e3223a122b54d4d08403e988d8e3a1da5c42582c5e9bfd89fd2804565b2d0bcf4ab950d9550152153b8c59c5e7cc22d1aede2296b32d5
@@ -52,7 +52,7 @@ class Changelog
52
52
 
53
53
  def self.changes_with_label(changes, label)
54
54
  changes.select do |change|
55
- change.labels.any? { |c| c[:name] == label } == true
55
+ change[:labels].any? { |c| c[:name] == label } == true
56
56
  end
57
57
  end
58
58
 
@@ -81,7 +81,7 @@ class Changelog
81
81
  access_token: token
82
82
  )
83
83
  @prefix = prefix
84
- @changes = prs_from_ids(pr_ids_from_git_diff(from, to))
84
+ @changes = prs_from_ids(pr_ids_from_git_diff(from, to)).map(&:to_hash)
85
85
  # add priority to each change
86
86
  @changes.map { |c| apply_priority_to_change(c) }
87
87
  end
@@ -95,20 +95,22 @@ class Changelog
95
95
  end
96
96
 
97
97
  def add(change)
98
- changes.prepend(apply_priority_to_change(change))
98
+ changes.prepend(prettify_title(apply_priority_to_change(change)))
99
99
  end
100
100
 
101
101
  def add_from_id(id)
102
102
  pull = @gh.pull_request(@repo, id)
103
- add(prettify_title(pull))
103
+ add pull
104
104
  end
105
105
 
106
106
  private
107
107
 
108
108
  def apply_priority_to_change(change)
109
109
  @priorities.each do |p|
110
- change[:priority] = p if change.labels.any? { |l| l[:name] == p[:label] }
110
+ change[:priority] = p if change[:labels].any? { |l| l[:name] == p[:label] }
111
111
  end
112
+ # Failsafe: add lowest priority if none detected
113
+ change[:priority] ||= @priorities[0]
112
114
  change
113
115
  end
114
116
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: changelogerator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Pugh
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  requirements: []
67
- rubygems_version: 3.0.3
67
+ rubygems_version: 3.1.2
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: Changelog generation/management