keepthechange 0.2.0 → 0.3.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: a3e4fbae1102437bd07a076aa61af0e3e185db57
4
- data.tar.gz: ec732ac579541c5518a96468fe19f4c2067bb342
3
+ metadata.gz: 50bc3138eb33c8e8715b307f25adfc35511c945b
4
+ data.tar.gz: ea475fbd0f6dfa0662291a44b42661ca98b833fa
5
5
  SHA512:
6
- metadata.gz: 57c1d313403f0e214baad21b139d02c51251785bea2b600ec6a93c46505f4e3118eb13a5b8dcb2e4b9771c8ff2b6797e4357e686b107a16cfc4bf4b2da61364e
7
- data.tar.gz: f9c96f859cc755f55b3b03e2ae404a74c2ecdce1064dca297f2e655dcff032f74865f0539e6664e416ddb8a01a2b46e81f4de77dd9c7ed171d84f3c98f10adf0
6
+ metadata.gz: e2a659dfd0eb02f7604332325c1532c5249bcb6a2153fd3144eb81904602cd747b5114e3c6f164879bae34a5036d9d10047c3a82018ef54841525e7d812a5ec7
7
+ data.tar.gz: 4dfe0846bfa8f95380cd05257853d73dde47900a0b632e4be96ceb802cc6ae0cbf418ed4b2453acbcc9d5faf85179b42cbf0b56bed61bcd2be99d55209537950
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.3.0] - 2017-09-27
8
+ ### Added
9
+ - `Parser#delta_changes` method.
10
+
7
11
  ## [0.2.0] - 2017-09-27
8
12
  ### Added
9
13
  - `print_header` parameter for `Parser#combine_changes` method.
@@ -87,6 +87,36 @@ module KeepTheChange
87
87
  output << "\n"
88
88
  end
89
89
 
90
+ # Combine changes for multiple versions. The `since_version` is your `current` version.
91
+ # This means that changes will start combining from the next version up.
92
+ #
93
+ # @param [String] since_version Version to start parsing from. Changes for this version won't be included.
94
+ # @param [String] to_version Version to stop parsing at.
95
+ def delta_changes(since_version, to_version = nil)
96
+ parse if @changelog_hash.empty?
97
+
98
+ filtered_changes = Marshal.load(Marshal.dump(@changelog_hash))
99
+ if to_version
100
+ filtered_changes.delete_if do |key, _|
101
+ SemVersion.new(key) <= SemVersion.new(since_version) ||
102
+ SemVersion.new(key) > SemVersion.new(to_version)
103
+ end
104
+ else
105
+ filtered_changes.delete_if { |key, _| SemVersion.new(key) <= SemVersion.new(since_version) }
106
+ end
107
+
108
+ output = ''
109
+ filtered_changes.each do |version, changeset|
110
+ output << "## #{version}\n"
111
+ changeset.each do |section, changes|
112
+ output << "### #{section}\n"
113
+ output << changes << "\n\n"
114
+ end
115
+ end
116
+
117
+ output
118
+ end
119
+
90
120
  private
91
121
 
92
122
  # Parse a changeset for a specific version and return a hash of different kinds of changes.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keepthechange
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Piven