diff --git a/.travis.yml b/.travis.yml index fd7753df8..be605717e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: - rvm: 2.2.9 install: true # This skips 'bundle install' script: gem build github_changelog_generator && bundle install - gemfile: spec/install-gem-in-bundler.gemfile + gemfile: spec/install_gem_in_bundler.gemfile after_success: true # This skips 'codeclimate-test-reporter' - rvm: 2.3.6 - rvm: 2.4.3 diff --git a/lib/github_changelog_generator/generator/entry.rb b/lib/github_changelog_generator/generator/entry.rb index 27a54226e..f3d8a4985 100644 --- a/lib/github_changelog_generator/generator/entry.rb +++ b/lib/github_changelog_generator/generator/entry.rb @@ -123,7 +123,7 @@ def generate_body(pull_requests, issues) # @return [Array] Section objects. def default_sections [ - Section.new(name: "summary", prefix: @options[:summary_prefix], labels: @options[:summary_labels], options: @options, body_only:true), + Section.new(name: "summary", prefix: @options[:summary_prefix], labels: @options[:summary_labels], options: @options, body_only: true), Section.new(name: "breaking", prefix: @options[:breaking_prefix], labels: @options[:breaking_labels], options: @options), Section.new(name: "enhancements", prefix: @options[:enhancement_prefix], labels: @options[:enhancement_labels], options: @options), Section.new(name: "bugs", prefix: @options[:bug_prefix], labels: @options[:bug_labels], options: @options), diff --git a/lib/github_changelog_generator/generator/generator_fetcher.rb b/lib/github_changelog_generator/generator/generator_fetcher.rb index fabe6ef3b..726545351 100644 --- a/lib/github_changelog_generator/generator/generator_fetcher.rb +++ b/lib/github_changelog_generator/generator/generator_fetcher.rb @@ -88,6 +88,7 @@ def associate_tagged_prs(tags, prs, total) # weird like that apparently. Check for a rebased comment before erroring. no_events_pr = associate_rebase_comment_prs(tags, [pr], total) raise StandardError, "No merge sha found for PR #{pr['number']} via the GitHub API" unless no_events_pr.empty? + found = true i += 1 print("Associating PRs with tags: #{i}/#{total}\r") if @options[:verbose] diff --git a/lib/github_changelog_generator/generator/generator_processor.rb b/lib/github_changelog_generator/generator/generator_processor.rb index 0e7ad7e18..602525c8d 100644 --- a/lib/github_changelog_generator/generator/generator_processor.rb +++ b/lib/github_changelog_generator/generator/generator_processor.rb @@ -121,9 +121,11 @@ def delete_by_time(issues, hash_key = "actual_date", older_tag = nil, newer_tag def ensure_older_tag(older_tag, newer_tag) return older_tag if older_tag + idx = sorted_tags.index { |t| t["name"] == newer_tag["name"] } # skip if we are already at the oldest element return if idx == sorted_tags.size - 1 + sorted_tags[idx - 1] end diff --git a/lib/github_changelog_generator/generator/section.rb b/lib/github_changelog_generator/generator/section.rb index 905a49959..83b9e7224 100644 --- a/lib/github_changelog_generator/generator/section.rb +++ b/lib/github_changelog_generator/generator/section.rb @@ -57,6 +57,7 @@ def get_string_for_issue(issue) def issue_line_with_body(line, issue) return issue["body"] if @body_only && issue["body"].present? return line if !@options[:issue_line_body] || issue["body"].blank? + # get issue body till first line break body_paragraph = body_till_first_break(issue["body"]) # remove spaces from begining and end of the string diff --git a/lib/github_changelog_generator/octo_fetcher.rb b/lib/github_changelog_generator/octo_fetcher.rb index 857f39645..aa3a3c4d2 100644 --- a/lib/github_changelog_generator/octo_fetcher.rb +++ b/lib/github_changelog_generator/octo_fetcher.rb @@ -42,6 +42,7 @@ def initialize(options = {}) def prepare_cache return unless @http_cache + @cache_file = @options.fetch(:cache_file) { File.join(Dir.tmpdir, "github-changelog-http-cache") } @cache_log = @options.fetch(:cache_log) { File.join(Dir.tmpdir, "github-changelog-logger.log") } init_cache @@ -253,6 +254,7 @@ def fetch_compare(older, newer) unless @compares["#{older}...#{newer}"] compare_data = check_github_response { @client.compare(user_project, older, newer || "HEAD") } raise StandardError, "Sha #{older} and sha #{newer} are not related; please file a github-changelog-generator issues and describe how to replicate this issue." if compare_data["status"] == "diverged" + @compares["#{older}...#{newer}"] = stringify_keys_deep(compare_data.to_hash) end @compares["#{older}...#{newer}"] diff --git a/lib/github_changelog_generator/options.rb b/lib/github_changelog_generator/options.rb index ee192cce9..9be12de6a 100644 --- a/lib/github_changelog_generator/options.rb +++ b/lib/github_changelog_generator/options.rb @@ -106,6 +106,7 @@ def load_custom_ruby_files # Pretty-prints a censored options hash, if :verbose. def print_options return unless self[:verbose] + Helper.log.info "Using these options:" # For ruby 2.5.0+ censored_values.each do |key, value| diff --git a/lib/github_changelog_generator/parser_file.rb b/lib/github_changelog_generator/parser_file.rb index f6e91633d..61acf01b7 100644 --- a/lib/github_changelog_generator/parser_file.rb +++ b/lib/github_changelog_generator/parser_file.rb @@ -31,6 +31,7 @@ def initialize(options, file = open_settings_file) # Sets options using configuration file content def parse! return unless @file + @file.each_with_index { |line, i| parse_line!(line, i + 1) } @file.close end @@ -46,6 +47,7 @@ def open_settings_file def parse_line!(line, line_number) return if non_configuration_line?(line) + option_name, value = extract_pair(line) @options[option_key_for(option_name)] = convert_value(value, option_name) rescue StandardError diff --git a/spec/install-gem-in-bundler.gemfile b/spec/install_gem_in_bundler.gemfile similarity index 100% rename from spec/install-gem-in-bundler.gemfile rename to spec/install_gem_in_bundler.gemfile diff --git a/spec/unit/generator/entry_spec.rb b/spec/unit/generator/entry_spec.rb index 79023e5e1..5da720766 100644 --- a/spec/unit/generator/entry_spec.rb +++ b/spec/unit/generator/entry_spec.rb @@ -538,8 +538,9 @@ def default_sections subject { described_class.new(options) } - it "returns 8 sections" do - expect(entry_sections.size).to eq 8 + it "returns 9 sections" do + entry_sections.each { |sec| pp(sec.name) } + expect(entry_sections.size).to eq 9 end it "returns default sections" do @@ -722,8 +723,9 @@ def default_sections subject { described_class.new(options) } - it "returns 9 sections" do - expect(entry_sections.size).to eq 9 + it "returns 10 sections" do + entry_sections.each { |sec| pp(sec.name) } + expect(entry_sections.size).to eq 10 end it "returns default sections" do diff --git a/spec/unit/octo_fetcher_spec.rb b/spec/unit/octo_fetcher_spec.rb index 1ada89653..fedd6ae6e 100644 --- a/spec/unit/octo_fetcher_spec.rb +++ b/spec/unit/octo_fetcher_spec.rb @@ -498,7 +498,7 @@ "commit_url" => "https://api.github.com/repos/skywinder/changelog_test/commits/decfe840d1a1b86e0c28700de5362d3365a29555", "created_at" => "2015-07-16T12:21:16Z" } - commit = fetcher.fetch_commit(event) + commit = fetcher.fetch_commit(event["commit_id"]) expectations = [ %w[sha decfe840d1a1b86e0c28700de5362d3365a29555],