class ChefCLI::Policyfile::ReadCookbookForCompatModeUpload

def cookbook_version

def cookbook_version
  @cookbook_version ||=
    begin
      cookbook_version = loader.cookbook_version
      # TODO: don't do this for non-compat mode
      cookbook_version.version = version_override
      # TODO: don't do this either
      # Fixup manifest.
      # What happens is, the 'manifest' representation of cookbook
      # version is created, it has a "name" field like foo-1.0.0, then we
      # change the version to 1234.5678.9876 but the manifest is not
      # regenerated so erchef rejects our upload b/c the name field
      # doesn't match the expected `$cookbook_name-$version` based on the
      # other fields.
      cookbook_version.manifest[:name] = "#{cookbook_version.name}-#{version_override}"
      cookbook_version.freeze_version
      cookbook_version
    end
end