keepthechange 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5c4bf13b78872db6e1dd16909a9b2987dc1f4aa
4
- data.tar.gz: a4058b6c35f0f5f3a8d6c5b6e6da04d7a4327d09
3
+ metadata.gz: a3e4fbae1102437bd07a076aa61af0e3e185db57
4
+ data.tar.gz: ec732ac579541c5518a96468fe19f4c2067bb342
5
5
  SHA512:
6
- metadata.gz: 1a36c78283dc6bd121c8ec99eafa89da7cc4739cc1bb5dc7c5a2288afd80650bc2935c53f66bfa5b656b87ac804d30d25e1babc9533a5027daae0c40fa29ba80
7
- data.tar.gz: 7fa9da2fa58e31efc1aa842c115b93c18b68a50d12fab375d2ec5bd5ca8cd4b2ac07a7456440054b5397ba4de1c76597ec5b62000de11bbe27bc9b313fa503b9
6
+ metadata.gz: 57c1d313403f0e214baad21b139d02c51251785bea2b600ec6a93c46505f4e3118eb13a5b8dcb2e4b9771c8ff2b6797e4357e686b107a16cfc4bf4b2da61364e
7
+ data.tar.gz: f9c96f859cc755f55b3b03e2ae404a74c2ecdce1064dca297f2e655dcff032f74865f0539e6664e416ddb8a01a2b46e81f4de77dd9c7ed171d84f3c98f10adf0
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ 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
- ## [Unreleased]
7
+ ## [0.2.0] - 2017-09-27
8
+ ### Added
9
+ - `print_header` parameter for `Parser#combine_changes` method.
10
+
11
+ ### Fixed
12
+ - `Parser#combine_changes` no longer modifies the original `@changelog_hash`.
13
+
14
+ ## [0.1.0] - 2017-08-22
8
15
  ### Added
9
16
  - Initial release.
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # KeepTheChange
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/keepthechange.svg)](https://badge.fury.io/rb/keepthechange)
3
4
  [![Build Status](https://travis-ci.org/pegasd/keepthechange.svg?branch=master)](https://travis-ci.org/pegasd/keepthechange)
4
5
  [![Coverage Status](https://coveralls.io/repos/github/pegasd/keepthechange/badge.svg)](https://coveralls.io/github/pegasd/keepthechange)
5
6
 
@@ -31,22 +32,39 @@ $ gem install keepthechange
31
32
 
32
33
  ## Usage
33
34
 
35
+ ### Parsed Changes Hash
36
+
34
37
  ```ruby
35
- changes_hash = KeepTheChange::Parser.new(changelog: File.read('CHANGELOG.md')).parse
38
+ parser = KeepTheChange::Parser.new(changelog: File.read('CHANGELOG.md'))
39
+ changes_hash = parser.parse
36
40
  ```
37
41
 
38
42
  This will produce a hash where keys are version numbers (e.g. `0.1.0`, `1.0.3`) and values are hashes themselves.
39
43
  Those will have headers as keys (e.g. `Added`, `Fixed`) and changesets as corresponding values.
40
44
 
45
+ ### Combine Multiple Changesets
46
+
47
+ If you only provide one argument to `combine_changes()`, the resulting output will contain changes since that
48
+ version.
49
+
50
+ ```ruby
51
+ File.write('SINCE_0.1.7.md', parser.combine_changes('0.1.7'))
52
+ ```
53
+
54
+ > `0.1.7` itself won't be included in the resulting file.
55
+
56
+ Specify both the lower and upper bound (again - lower bound is exclusive) to produce output with changes between the versions.
57
+
58
+ ```ruby
59
+ File.write('0.1.7-1.0.3.md', parser.combine_changes('0.1.7', '1.0.3'))
60
+ ```
41
61
 
42
62
  ## Development
43
63
 
44
64
  After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also
45
- run `bin/simple_test` after putting a `CHANGELOG.md` into the repo directory for a basic parsing test.
65
+ run `bin/simple_test` after putting a `TEST_CHANGELOG.md` into the repo directory for a basic parsing test.
46
66
 
47
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in
48
- `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push
49
- the `.gem` file to [rubygems.org](https://rubygems.org).
67
+ To install this gem onto your local machine, run `bundle exec rake install`.
50
68
 
51
69
  ## Contributing
52
70
 
@@ -47,11 +47,11 @@ module KeepTheChange
47
47
  #
48
48
  # @param [String] since_version Version to start parsing from. Changes for this version won't be included.
49
49
  # @param [String] to_version Version to stop parsing at.
50
- def combine_changes(since_version, to_version = nil)
50
+ def combine_changes(since_version, to_version = nil, print_header = true)
51
51
  parse if @changelog_hash.empty?
52
52
 
53
53
  combined_changes = {}
54
- filtered_changes = @changelog_hash
54
+ filtered_changes = Marshal.load(Marshal.dump(@changelog_hash))
55
55
  if to_version
56
56
  filtered_changes.delete_if do |key, _|
57
57
  SemVersion.new(key) <= SemVersion.new(since_version) ||
@@ -71,11 +71,16 @@ module KeepTheChange
71
71
  end
72
72
  end
73
73
 
74
- output = "## Changes since [#{since_version}]"
75
- output << " (and up to [#{to_version}])" if to_version
74
+ if print_header
75
+ output = "## Changes since [#{since_version}]"
76
+ output << " (and up to [#{to_version}])" if to_version
77
+ else
78
+ output = ''
79
+ end
76
80
 
77
81
  combined_changes.each do |section, changes_list|
78
- output << "\n\n### #{section}"
82
+ output << "\n\n" unless output.empty?
83
+ output << "### #{section}"
79
84
  output << "\n#{changes_list}"
80
85
  end
81
86
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keepthechange
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Piven
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-21 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sem_version
@@ -74,8 +74,6 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - CHANGELOG.md
77
- - CODE_OF_CONDUCT.md
78
- - LICENSE
79
77
  - README.md
80
78
  - lib/keepthechange.rb
81
79
  - lib/keepthechange/parser.rb
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at thepegasd@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Eugene Piven
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.