class VersionManager::VersionWriter

Public Instance Methods

call(version) click to toggle source
# File lib/version_manager/version_writer.rb, line 6
def call version
  File.write version_file, updated_version_file(version)
  File.write history_file, updated_history_file(version) if File.exist?(history_file)
  VersionTagger.new.call version
end
updated_history_file(new_version) click to toggle source
# File lib/version_manager/version_writer.rb, line 16
def updated_history_file new_version
  current_history = File.read history_file
  date = Date.today.strftime("%d %B %Y")
  "== #{new_version.to_tag} (#{date})\n\n#{current_history}"
end
updated_version_file(new_version) click to toggle source
# File lib/version_manager/version_writer.rb, line 12
def updated_version_file new_version
  File.read(version_file).gsub(new_version.starting_version, new_version.to_s)
end

Private Instance Methods

history_file() click to toggle source
# File lib/version_manager/version_writer.rb, line 24
def history_file
  VersionManager.configuration.history_file
end
version_file() click to toggle source
# File lib/version_manager/version_writer.rb, line 28
def version_file
  VersionManager.configuration.version_file
end