class Omnibus::Command::ChangeLog

Public Instance Methods

generate(start_ref = nil, end_ref = nil) click to toggle source
# File lib/omnibus/cli/changelog.rb, line 71
def generate(start_ref = nil, end_ref = nil)
  @start_ref = start_ref
  @end_ref = end_ref
  diff = if @options[:skip_components]
           Omnibus::EmptyManifestDiff.new
         else
           Omnibus::ManifestDiff.new(old_manifest, new_manifest)
         end

  Omnibus::ChangeLogPrinter.new(ChangeLog.new(starting_revision, ending_revision),
    diff,
    @options[:source_path]).print(new_version)
end

Private Instance Methods

ending_revision() click to toggle source

ending_revision is taken from:

  • value passed as the first argument

  • value found in the ending manifest

  • HEAD in the current git repository

# File lib/omnibus/cli/changelog.rb, line 141
def ending_revision
  @end_ref ||= if @options[:ending_manifest]
                 new_manifest.build_git_revision
               else
                 "HEAD"
               end
end
local_git_repo() click to toggle source
# File lib/omnibus/cli/changelog.rb, line 87
def local_git_repo
  GitRepository.new
end
manifest_for_revision(rev) click to toggle source
# File lib/omnibus/cli/changelog.rb, line 107
def manifest_for_revision(rev)
  Omnibus::Manifest.from_hash(FFI_Yajl::Parser.parse(local_git_repo.file_at_revision("version-manifest.json", rev)))
end
new_manifest() click to toggle source
# File lib/omnibus/cli/changelog.rb, line 99
def new_manifest
  @new_manifest ||= if @options[:ending_manifest]
                      Omnibus::Manifest.from_file(@options[:ending_manifest])
                    else
                      manifest_for_revision(ending_revision)
                    end
end
new_version() click to toggle source
# File lib/omnibus/cli/changelog.rb, line 111
def new_version
  if @options[:version]
    @options[:version]
  elsif @options[:patch]
    Omnibus::SemanticVersion.new(local_git_repo.latest_tag).next_patch.to_s
  elsif @options[:minor] && !@options[:major] # minor is the default so it will always be true
    Omnibus::SemanticVersion.new(local_git_repo.latest_tag).next_minor.to_s
  elsif @options[:major]
    Omnibus::SemanticVersion.new(local_git_repo.latest_tag).next_major.to_s
  elsif @options[:ending_manifest]
    new_manifest.build_version
  end
end
old_manifest() click to toggle source
# File lib/omnibus/cli/changelog.rb, line 91
def old_manifest
  @old_manifest ||= if @options[:starting_manifest]
                      Omnibus::Manifest.from_file(@options[:starting_manifest])
                    else
                      manifest_for_revision(starting_revision)
                    end
end
starting_revision() click to toggle source

starting_revision is taken from:

  • value passed as the first argument

  • value found in the starting manifest

  • the latest git tag in the local repository

# File lib/omnibus/cli/changelog.rb, line 129
def starting_revision
  @start_ref ||= if @options[:starting_manifest]
                   old_manifest.build_git_revision
                 else
                   local_git_repo.latest_tag
                 end
end