github_changelog_generator 1.13.2 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/github_changelog_generator.rb +6 -1
- data/lib/github_changelog_generator/generator/generator.rb +28 -28
- data/lib/github_changelog_generator/generator/generator_fetcher.rb +23 -20
- data/lib/github_changelog_generator/generator/generator_generation.rb +40 -53
- data/lib/github_changelog_generator/generator/generator_processor.rb +32 -22
- data/lib/github_changelog_generator/generator/generator_tags.rb +77 -46
- data/lib/github_changelog_generator/octo_fetcher.rb +363 -0
- data/lib/github_changelog_generator/options.rb +92 -0
- data/lib/github_changelog_generator/parser.rb +21 -5
- data/lib/github_changelog_generator/parser_file.rb +2 -2
- data/lib/github_changelog_generator/version.rb +1 -1
- data/man/git-generate-changelog.1 +44 -2
- data/man/git-generate-changelog.1.html +290 -0
- data/man/git-generate-changelog.md +29 -1
- data/spec/spec_helper.rb +21 -0
- data/spec/unit/generator/generator_processor_spec.rb +4 -4
- data/spec/unit/generator/generator_tags_spec.rb +43 -40
- data/spec/unit/octo_fetcher_spec.rb +528 -0
- data/spec/unit/options_spec.rb +42 -0
- data/spec/unit/reader_spec.rb +0 -4
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issue_with_proper_key/values.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issues.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issues_with_labels.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_pull_request_with_proper_key/values.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_pull_requests_with_labels.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid/returns_correct_pull_request_keys.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid/returns_pull_requests.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_commit/when_API_call_is_valid.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_commit/when_API_call_is_valid/returns_commit.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_date_of_tag/when_API_call_is_valid.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_date_of_tag/when_API_call_is_valid/returns_date.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_events_async/when_API_call_is_valid.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_events_async/when_API_call_is_valid/populates_issues.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid/should_return_tags.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid/should_return_tags_count.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_wrong_token_provided.json +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_wrong_token_provided/should_raise_Unauthorized_error.json +1 -0
- metadata +97 -12
- data/lib/CHANGELOG.md +0 -58
- data/lib/github_changelog_generator/fetcher.rb +0 -226
- data/spec/unit/fetcher_spec.rb +0 -60
data/spec/unit/fetcher_spec.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
VALID_TOKEN = "0123456789abcdef"
|
3
|
-
INVALID_TOKEN = "0000000000000000"
|
4
|
-
|
5
|
-
DEFAULT_OPTIONS = { user: "skywinder",
|
6
|
-
project: "changelog_test" }
|
7
|
-
|
8
|
-
def options_with_invalid_token
|
9
|
-
options = DEFAULT_OPTIONS
|
10
|
-
options[:token] = INVALID_TOKEN
|
11
|
-
options
|
12
|
-
end
|
13
|
-
|
14
|
-
describe GitHubChangelogGenerator::Fetcher do
|
15
|
-
before(:all) do
|
16
|
-
@fetcher = GitHubChangelogGenerator::Fetcher.new
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#fetch_github_token" do
|
20
|
-
token = GitHubChangelogGenerator::Fetcher::CHANGELOG_GITHUB_TOKEN
|
21
|
-
context "when token in ENV exist" do
|
22
|
-
before { stub_const("ENV", ENV.to_hash.merge(token => VALID_TOKEN)) }
|
23
|
-
subject { @fetcher.fetch_github_token }
|
24
|
-
it { is_expected.to eq(VALID_TOKEN) }
|
25
|
-
end
|
26
|
-
context "when token in ENV is nil" do
|
27
|
-
before { stub_const("ENV", ENV.to_hash.merge(token => nil)) }
|
28
|
-
subject { @fetcher.fetch_github_token }
|
29
|
-
it { is_expected.to be_nil }
|
30
|
-
end
|
31
|
-
context "when token in options and ENV is nil" do
|
32
|
-
before do
|
33
|
-
stub_const("ENV", ENV.to_hash.merge(token => nil))
|
34
|
-
@fetcher = GitHubChangelogGenerator::Fetcher.new(token: VALID_TOKEN)
|
35
|
-
end
|
36
|
-
subject { @fetcher.fetch_github_token }
|
37
|
-
it { is_expected.to eq(VALID_TOKEN) }
|
38
|
-
end
|
39
|
-
context "when token in options and ENV specified" do
|
40
|
-
before do
|
41
|
-
stub_const("ENV", ENV.to_hash.merge(token => "no_matter_what"))
|
42
|
-
@fetcher = GitHubChangelogGenerator::Fetcher.new(token: VALID_TOKEN)
|
43
|
-
end
|
44
|
-
subject { @fetcher.fetch_github_token }
|
45
|
-
it { is_expected.to eq(VALID_TOKEN) }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe "#github_fetch_tags" do
|
50
|
-
context "when wrong token provided" do
|
51
|
-
before do
|
52
|
-
options = options_with_invalid_token
|
53
|
-
@fetcher = GitHubChangelogGenerator::Fetcher.new(options)
|
54
|
-
end
|
55
|
-
it "should raise Unauthorized error" do
|
56
|
-
expect { @fetcher.github_fetch_tags }.to raise_error Github::Error::Unauthorized
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|