create_changelog 1.3.2 → 1.4.1

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.
@@ -1,51 +0,0 @@
1
- @announce
2
- Feature: Creating changelog including recent changes only.
3
-
4
- Scenario: Repository with identical changelog lines only in commit messages
5
- Given an empty Git repository
6
- When 2 commits with standard changelog line are added
7
- And I successfully run `ccl --recent`
8
- Then the stdout should contain 1 line starting with "- "
9
-
10
- Scenario: Repository with multiple changelog lines only in commit messages
11
- Given an empty Git repository
12
- When 3 commits with unique changelog line are added
13
- And I successfully run `ccl --recent`
14
- Then the stdout should contain 3 lines starting with "- "
15
-
16
- Scenario: Changelog lines in commit messages and tag without changelog line
17
- Given an empty Git repository
18
- When 3 commits with unique changelog line are added
19
- And a tag without changelog line is added
20
- And I successfully run `ccl --recent`
21
- Then the stdout should not contain anything
22
-
23
- Scenario: Changelog lines in commit messages and tag with different changelog line
24
- Given an empty Git repository
25
- When 3 commits with unique changelog line are added
26
- And a tag with unique changelog line is added
27
- And I successfully run `ccl --recent`
28
- Then the stdout should not contain anything
29
-
30
- Scenario: Changelog lines in commit messages and tag with same changelog line
31
- Given an empty Git repository
32
- When 3 commits with standard changelog line are added
33
- And a tag with standard changelog line is added
34
- And I successfully run `ccl --recent`
35
- Then the stdout should not contain anything
36
-
37
- Scenario: Unique changelog lines in commit messages, tag, and recent commits
38
- Given an empty Git repository
39
- When 3 commits with unique changelog line are added
40
- And a tag with unique changelog line is added
41
- And 2 commits with unique changelog line are added
42
- And I successfully run `ccl --recent`
43
- Then the stdout should contain 2 lines starting with "- "
44
-
45
- Scenario: Same changelog lines in commit messages, tag, and recent commits
46
- Given an empty Git repository
47
- When 3 commits with standard changelog line are added
48
- And a tag with standard changelog line is added
49
- And 2 commits with standard changelog line are added
50
- And I successfully run `ccl --recent`
51
- Then the stdout should contain 1 line starting with "- "
@@ -1,50 +0,0 @@
1
- Feature: Create a changelog that does not contain recent changes.
2
-
3
- Scenario: Repository with identical changelog lines only in commit messages
4
- Given an empty Git repository
5
- When 2 commits with standard changelog line are added
6
- And I successfully run `ccl --no-recent`
7
- Then the stdout should not contain anything
8
-
9
- Scenario: Repository with multiple changelog lines only in commit messages
10
- Given an empty Git repository
11
- When 3 commits with unique changelog line are added
12
- And I successfully run `ccl --no-recent`
13
- Then the stdout should not contain anything
14
-
15
- Scenario: Changelog lines in commit messages and tag without changelog line
16
- Given an empty Git repository
17
- When 3 commits with unique changelog line are added
18
- And a tag without changelog line is added
19
- And I successfully run `ccl --no-recent`
20
- Then the stdout should contain 3 lines starting with "- "
21
-
22
- Scenario: Changelog lines in commit messages and tag with different changelog line
23
- Given an empty Git repository
24
- When 3 commits with unique changelog line are added
25
- And a tag with unique changelog line is added
26
- And I successfully run `ccl --no-recent`
27
- Then the stdout should contain 4 lines starting with "- "
28
-
29
- Scenario: Changelog lines in commit messages and tag with same changelog line
30
- Given an empty Git repository
31
- When 3 commits with standard changelog line are added
32
- And a tag with standard changelog line is added
33
- And I successfully run `ccl --no-recent`
34
- Then the stdout should contain 1 line starting with "- "
35
-
36
- Scenario: Unique changelog lines in commit messages, tag, and recent commits
37
- Given an empty Git repository
38
- When 3 commits with unique changelog line are added
39
- And a tag with unique changelog line is added
40
- And 2 commits with unique changelog line are added
41
- And I successfully run `ccl --no-recent`
42
- Then the stdout should contain 4 lines starting with "- "
43
-
44
- Scenario: Same changelog lines in commit messages, tag, and recent commits
45
- Given an empty Git repository
46
- When 3 commits with standard changelog line are added
47
- And a tag with standard changelog line is added
48
- And 2 commits with standard changelog line are added
49
- And I successfully run `ccl --no-recent`
50
- Then the stdout should contain 1 line starting with "- "
@@ -1,21 +0,0 @@
1
- @announce
2
- Feature: Command line switches
3
- Scenario: Combining -r and -n switches is not allowed
4
- Given an empty Git repository
5
- When I run `ccl -r -n`
6
- Then the exit status should not be 0
7
-
8
- Scenario: Combining -r and -v switches is not allowed
9
- Given an empty Git repository
10
- When I run `ccl -r -v`
11
- Then the exit status should not be 0
12
-
13
- Scenario: Combining -n and -v switches is not allowed
14
- Given an empty Git repository
15
- When I run `ccl -n -v`
16
- Then the exit status should not be 0
17
-
18
- Scenario: Attempt to work with non-existent directory
19
- When I run `ccl -d /this/does/not/exist`
20
- Then the exit status should not be 0
21
- And the stderr should contain "FATAL: Directory does not exist"
@@ -1,51 +0,0 @@
1
- @announce
2
- Feature: Creating a complete, decorated changelog.
3
-
4
- Scenario: Repository with identical changelog lines only in commit messages
5
- Given an empty Git repository
6
- When 2 commits with standard changelog line are added
7
- And I successfully run `ccl`
8
- Then the stdout should contain 1 line starting with "- "
9
-
10
- Scenario: Repository with multiple changelog lines only in commit messages
11
- Given an empty Git repository
12
- When 3 commits with unique changelog line are added
13
- And I successfully run `ccl`
14
- Then the stdout should contain 3 lines starting with "- "
15
-
16
- Scenario: Changelog lines in commit messages and tag without changelog line
17
- Given an empty Git repository
18
- When 3 commits with unique changelog line are added
19
- And a tag without changelog line is added
20
- And I successfully run `ccl`
21
- Then the stdout should contain 3 lines starting with "- "
22
-
23
- Scenario: Changelog lines in commit messages and tag with different changelog line
24
- Given an empty Git repository
25
- When 3 commits with unique changelog line are added
26
- And a tag with unique changelog line is added
27
- And I successfully run `ccl`
28
- Then the stdout should contain 4 lines starting with "- "
29
-
30
- Scenario: Changelog lines in commit messages and tag with same changelog line
31
- Given an empty Git repository
32
- When 3 commits with standard changelog line are added
33
- And a tag with standard changelog line is added
34
- And I successfully run `ccl`
35
- Then the stdout should contain 1 line starting with "- "
36
-
37
- Scenario: Unique changelog lines in commit messages, tag, and recent commits
38
- Given an empty Git repository
39
- When 3 commits with unique changelog line are added
40
- And a tag with unique changelog line is added
41
- And 2 commits with unique changelog line are added
42
- And I successfully run `ccl`
43
- Then the stdout should contain 6 lines starting with "- "
44
-
45
- Scenario: Same changelog lines in commit messages, tag, and recent commits
46
- Given an empty Git repository
47
- When 3 commits with standard changelog line are added
48
- And a tag with standard changelog line is added
49
- And 2 commits with standard changelog line are added
50
- And I successfully run `ccl`
51
- Then the stdout should contain 2 lines starting with "- "
@@ -1,19 +0,0 @@
1
- Feature: Creating a complete, decorated changelog
2
-
3
- Scenario: Repository with identical changelog lines only in commit messages
4
- Given an empty Git repository
5
- When 2 commits with identical changelog lines are added
6
- And I successfully run `ccl`
7
- Then the stdout should contain 1 line starting with "- "
8
-
9
- Scenario: Log lines only in commit messages, generate without recent
10
- Given an empty Git repository
11
- When 2 commits with identical changelog lines are added
12
- When I successfully run `ccl --no-recent`
13
- Then the stdout should not contain anything
14
-
15
- Scenario: Repository with multiple changelog lines only in commit messages
16
- Given an empty Git repository
17
- When 3 commits with unique changelog lines are added
18
- And I successfully run `ccl`
19
- Then the stdout should contain 3 line starting with "- "
@@ -1,30 +0,0 @@
1
- @announce
2
- Feature: Output may be decorated
3
-
4
- Scenario: Creating complete changelog
5
- Given an empty Git repository
6
- When 2 commits with standard changelog line are added
7
- And I successfully run `ccl`
8
- Then the stdout should contain "====="
9
- And the stdout should contain "* * *
10
-
11
- Scenario: Creating changelog without recent changes
12
- Given an empty Git repository
13
- When 2 commits with standard changelog line are added
14
- And I successfully run `ccl --no-recent`
15
- Then the stdout should not contain anything
16
-
17
- Scenario: Creating changelog with recent changes only
18
- Given an empty Git repository
19
- When 2 commits with standard changelog line are added
20
- And I successfully run `ccl --recent`
21
- Then the stdout should not contain "====="
22
- And the stdout should not contain "* * *"
23
-
24
- Scenario: Creating changelog with custom 'recent' heading
25
- Given an empty Git repository
26
- When 2 commits with standard changelog line are added
27
- And I successfully run `ccl TEST_VERSION`
28
- Then the stdout should contain "TEST_VERSION"
29
- And the stdout should contain "====="
30
- And the stdout should contain "* * *"
@@ -1,26 +0,0 @@
1
- Feature: Prepare-release workflow
2
-
3
- Scenario: Prepare-release fails if current branch is not release branch
4
- Given an empty Git repository
5
- When I run `ccl --prepare-release 1.0.0`
6
- Then the exit status should not be 0
7
-
8
- Scenario: Prepare-release requires tag name on the command line
9
- Given an empty Git repository
10
- And a new branch "release-1.0.0"
11
- When I run `ccl --prepare-release`
12
- Then the exit status should not be 0
13
- And the stderr should contain "FATAL: Missing argument: TAG"
14
-
15
- Scenario: Prepare-release aborts if annotation is empty
16
- Given an empty Git repository
17
- And a new branch "release-1.0.0"
18
- When I run `ccl --prepare-release`
19
- Then the stdout should contain "aborted"
20
- And the current branch should be "release-1.0.0"
21
-
22
- Scenario: Prepare-release checks out master branch and tags it
23
- Given an empty Git repository
24
- And a new branch "release-1.0.0"
25
- When I run `ccl --prepare-release 1.0.0`
26
-
@@ -1,74 +0,0 @@
1
- require 'fileutils'
2
- require 'securerandom'
3
- require '../lib/git.rb'
4
-
5
- Given(/^an empty Git repository$/) do
6
- in_current_dir do
7
- `git init`
8
- end
9
- end
10
-
11
- When(/^(\d+) commits with standard changelog line are added$/) do |n|
12
- in_current_dir do
13
- n.to_i.times do
14
- alter_dummy_file
15
- `git add -A`
16
- `git commit -m 'heading' -m '#{standard_log_entry}'`
17
- end
18
- end
19
- end
20
-
21
- When(/^(\d+) commits with unique changelog line are added$/) do |n|
22
- in_current_dir do
23
- n.to_i.times do
24
- alter_dummy_file
25
- `git add -A`
26
- `git commit -m 'heading' -m '#{random_log_entry}'`
27
- end
28
- end
29
- end
30
-
31
- When(/a tag without changelog line is added/) do
32
- in_current_dir do
33
- `git tag -a some-tag -m "Some tag"`
34
- end
35
- end
36
-
37
- When(/a tag with unique changelog line is added/) do
38
- in_current_dir do
39
- `git tag -a some-tag -m "Some tag" -m '#{random_log_entry}'`
40
- end
41
- end
42
-
43
- When(/a tag with standard changelog line is added/) do
44
- in_current_dir do
45
- `git tag -a some-tag -m "Some tag" -m '#{standard_log_entry}'`
46
- end
47
- end
48
-
49
- Given(/a new branch "([^"]+)"/) do |branch|
50
- in_current_dir do
51
- Git.new_branch branch
52
- end
53
- end
54
-
55
- Then(/the current branch should be "([^"]+)"/) do |branch|
56
- in_current_dir do
57
- Git.current_branch == branch
58
- end
59
- end
60
-
61
- def alter_dummy_file
62
- open 'dummy_file_for_commits.txt', 'a' do |f|
63
- f.puts 'some text'
64
- end
65
- end
66
-
67
- def standard_log_entry
68
- "- INFO: This is a standard log entry for testing"
69
- end
70
-
71
- def random_log_entry
72
- # ('a'..'z').to_a.shuffle[0,8].join
73
- "- INFO: This is a unique log entry for testing - #{SecureRandom.hex}"
74
- end
@@ -1,10 +0,0 @@
1
- Then(/^the stdout should contain 1 line starting with "([^"]*)"$/) do |s|
2
- expected = "(^#{s}.*\n){1}"
3
- assert_matching_output(expected, all_output)
4
- end
5
-
6
- Then(/^the stdout should contain (\d+) lines starting with "([^"]*)"$/) do |n, s|
7
- # expected = "(^#{s}.*\n){#{n}}"
8
- # assert_matching_output(expected, all_output)
9
- assert_lines_starting_with all_stdout, n, s
10
- end
@@ -1,7 +0,0 @@
1
- # Checks whether a mult-line text contains a specific number
2
- # of lines that start with a given sequence.
3
- def assert_lines_starting_with(text, number, start_with)
4
- number = number.to_i if number.is_a(String)
5
- count = text.split("\n").count { |line| line.start_with? start_with }
6
- expect(count).to eq number
7
- end
@@ -1,6 +0,0 @@
1
- require 'aruba/cucumber'
2
-
3
- Before do
4
- set_env 'GIT_WORK_TREE', File.expand_path(current_dir)
5
- set_env 'GIT_DIR', ".git"
6
- end
@@ -1,18 +0,0 @@
1
- # Removes common indentation from an array of strings
2
- class Array
3
- def remove_indent
4
- lines_with_indent = self.select do |line|
5
- line.size > 0
6
- end
7
- indents = lines_with_indent.map do |line|
8
- match = line.match(/^( +)([^ ]|$)+/)
9
- match ? match[1].size : 0
10
- end
11
- indent = indents.min
12
- self.map do |line|
13
- line[indent..-1]
14
- end
15
- end
16
- end
17
-
18
- # vim: nospell
@@ -1,124 +0,0 @@
1
- # changelog.rb, part of Create-changelog
2
- # Copyright 2015 Daniel Kraus
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- require_relative './commit_changelog.rb'
15
- require_relative './tag_list.rb'
16
- require_relative './tag.rb'
17
-
18
- # Central class that puts together the changelog.
19
- class Changelog
20
-
21
- # Heading for the most recent changes.
22
- attr_writer :recent_changes_heading
23
-
24
- def initialize
25
- @recent_changes_heading = "Unpublished changes"
26
- end
27
-
28
- @@tags = nil
29
-
30
- # Generates a decorated changelog for the entire commit history.
31
- #
32
- # @param [bool] exclude_recent
33
- # Indicates whether to exclude recent changelog lines that were
34
- # added since the last tag.
35
- #
36
- # @return [String]
37
- # Decorated changelog, or nil if no lines were found.
38
- #
39
- def generate(exclude_recent = false)
40
- # Traverse tags
41
- @@tags = TagList.new(!exclude_recent)
42
- output = String.new
43
- @@tags.list.each_cons(2) do |current_tag, previous_tag|
44
- output << generate_for(current_tag, previous_tag)
45
- end
46
- output.length > 0 ? output : nil
47
- end
48
-
49
- # Generates a simple, undecorated list of changelog entries
50
- # since the most recent tag.
51
- #
52
- # @return [Array]
53
- # Array of changelog lines, or nil if no lines were found.
54
- #
55
- def generate_recent
56
- @@tags = TagList.new
57
- log = CommitChangelog.new(@@tags.list[0], @@tags.list[1])
58
- # Explicitly add initial commit if there is no tag yet
59
- # This is necessary because HEAD..OTHER_COMMIT does not include
60
- # OTHER_COMMIT's message, which is the desired behavior if
61
- # OTHER_COMMIT is a tag for a previous version, but undesired
62
- # if OTHER_COMMIT is the initial commit of the repository.
63
- log.add_commit @@tags.list[1] if @@tags.list.length == 2
64
- log.changelog
65
- end
66
-
67
- private
68
-
69
- # Generates decorated changelog information including the current_tag's
70
- # annotation and all changelog lines written in commit messages since the
71
- # previous_tag. Note that this will exclude previous_tag's annotation,
72
- # except if previous_tag is not a tag, but the initial commit in the
73
- # repository.
74
- #
75
- # @param [String] current_tag
76
- # Version tag for which to collect changelog information.
77
- #
78
- # @param [String] previous_tag
79
- # Previous version tag whose changelog information does not belong to
80
- # the current version's changelog information. However, if previous_tag
81
- # is the Sha-1 hash of the initial commit, its changelog lines _will_ be
82
- # included.
83
- #
84
- # @return [String]
85
- # Changelog decorated with markdown formatting, or empty string.
86
- #
87
- def generate_for(current_tag, previous_tag)
88
- tag = Tag.new(current_tag)
89
- commit_changelog = CommitChangelog.new(current_tag, previous_tag)
90
-
91
- # If previous_tag is the initial commit, make sure to include its message
92
- commit_changelog.add_commit previous_tag if previous_tag == @@tags.list[-1]
93
-
94
- # Combine changelog entries from tag annotation and commit messages
95
- if tag.changelog
96
- combined_changelog = tag.changelog.concat(commit_changelog.changelog)
97
- else
98
- combined_changelog = commit_changelog.changelog
99
- end
100
- combined_changelog.uniq! if combined_changelog
101
-
102
- output = String.new
103
- tag.heading = @recent_changes_heading unless tag.heading
104
- if tag.heading and (tag.text or combined_changelog)
105
- output << tag.heading + " (#{tag.date})\n"
106
- output << "=" * 72 + "\n"
107
- end
108
- output << tag.text.join("\n") if tag.text
109
- output << "\n" if tag.heading or tag.text
110
- output << combined_changelog.join("\n") + "\n" if combined_changelog
111
- output << end_separator if tag.text or combined_changelog
112
- output
113
- end
114
-
115
- # Markdown-compatible horizontal 'ruler'.
116
- #
117
- # @return [String]
118
- #
119
- def end_separator
120
- "\n" + ("* " * 36) +"\n\n\n"
121
- end
122
- end
123
-
124
- # vim: nospell