Sha256: 86a2d45c8dd0c71c3698198518cced91947b7946e123392749b56a2655de930c

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

module VersionInfo
  # Version data is stored in a ruby file into the project top module :

  # module MyProject
  #   VERSION = "0.0.1"
  #   VERSION.author = "jcangas"
  #   VERSION.email = "jorge.cangas@gmail.com"
  # end
  #
  # The convenion is to name this file "version.rb"

  class ModuleStorage < Storage

    def default_file_name
      'version.rb'
    end

    def load_from(io)
      self
    end

    def save      
      content = File.read(file_name)
      content.gsub!(/(\s*VERSION\s*=\s*)('|").*('|")/, "\\1\\2#{data.tag}\\3")
	    File.open(file_name, 'w' ) {|out| out.print content}
	    self
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
version_info-1.8.5 lib/version_info/module_storage.rb
version_info-1.8.2 lib/version_info/module_storage.rb
version_info-1.8.0 lib/version_info/module_storage.rb