Sha256: 1378d88d66f92a5d7e054263089debba532ac7a2b1126e54399d4c2338859f9e

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

module AutoTagVersion

  def self.tag tag = nil
    @tag = @tag || tag
  end

  def self.content
    content = "module #{app}; VERSION = '#{tag}'; end\n"
    content += "# This file is created automatically by auto_tag_version gem\n"
    content += "# Documentation at https://github.com/rafaelbiriba/auto_tag_version"
  end

  def self.app
    Rails.application.class.parent_name
  end

  def self.version_file
    File.join("config", "initializers", "app_version.rb")
  end

  def self.create_version_file
    File.open(version_file, "w") { |f| f.write(content) }
  end

  def self.commit_and_create_tag
    `git add #{version_file} && git commit -m "Bumping version #{tag}" && git tag #{tag}`
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
auto_tag_version-0.0.1 lib/auto_tag_version/utils.rb