Skip to content

Commit

Permalink
Going to stop releasing "builds" because it seems unnecessary after all.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael van Rooijen committed Mar 12, 2011
1 parent 304a143 commit c7b07f0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 59 deletions.
6 changes: 0 additions & 6 deletions README.md
Expand Up @@ -17,12 +17,6 @@ To get the latest stable version

gem install backup

To get the latest *build* of the latest stable version

gem install backup --pre

Builds **aim** to be stable, but cannot guarantee it. Builds tend to be released a lot more frequent than the stable versions. So if you want to live on the edge and want the latest improvements, install the build gems.

You can view the list of released versions over at [RubyGems.org (Backup)](https://rubygems.org/gems/backup/versions)


Expand Down
2 changes: 1 addition & 1 deletion backup.gemspec
Expand Up @@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
##
# General configuration / information
gem.name = 'backup'
gem.version = Backup::Version.gemspec
gem.version = Backup::Version.current
gem.platform = Gem::Platform::RUBY
gem.authors = 'Michael van Rooijen'
gem.email = 'meskyanichi@gmail.com'
Expand Down
43 changes: 7 additions & 36 deletions lib/backup/version.rb
@@ -1,32 +1,19 @@
# encoding: utf-8

module Backup

##
# Usage:
#
# # Returns the current backup version based on the defined constants
# Backup::Version.current
#
# # Returns a gemspec compatible version number based on the defined constants
# Backup::Version.gemspec
#
class Version

##
# Change the MAJOR, MINOR and PATCH constants below
# to adjust the version of the Backup gem
#
# MAJOR:
# Defines the major version
# MINOR:
# Defines the minor version
# PATCH:
# Defines the patch version
# BUILD:
# Defines the build version ( use 'false' if no build )
MAJOR, MINOR, PATCH, BUILD = 3, 0, 3, false

# ========================================================= #
# ADJUST THE CONSTANTS ABOVE TO CHANGE THE BACKUP VERSION #
# ========================================================= #
MAJOR, MINOR, PATCH = 3, 0, 3

##
# Returns the major version ( big release based off of multiple minor releases )
Expand All @@ -41,31 +28,15 @@ def self.minor
end

##
# Returns the patch version ( updates, features and (crucial) bug fixes based off of multiple builds )
# Returns the patch version ( updates, features and (crucial) bug fixes )
def self.patch
PATCH
end

##
# Returns the build version ( improvements, small additions, frequent releases )
def self.build
BUILD
end

##
# Returns the current version ( not for gemspec / rubygems )
# Returns the current version of the Backup gem ( qualified for the gemspec )
def self.current
"#{major}.#{minor}.#{patch} / build #{build or 0}"
end

##
# Returns the (gemspec qualified) current version
def self.gemspec
if build.eql?(false)
"#{major}.#{minor}.#{patch}"
else
"#{major}.#{minor}.#{patch}.build.#{build}"
end
"#{major}.#{minor}.#{patch}"
end

end
Expand Down
21 changes: 5 additions & 16 deletions spec/version_spec.rb
Expand Up @@ -2,31 +2,20 @@

require File.dirname(__FILE__) + '/spec_helper'

def set_version(major, minor, patch, build)
def set_version(major, minor, patch)
Backup::Version.stubs(:major).returns(major)
Backup::Version.stubs(:minor).returns(minor)
Backup::Version.stubs(:patch).returns(patch)
Backup::Version.stubs(:build).returns(build)
end

describe Backup::Version do
it 'should return a valid gemspec version' do
set_version(1,2,3,false)
Backup::Version.gemspec.should == '1.2.3'
end

it 'should return a valid gemspec version with a build' do
set_version(4,5,6,615)
Backup::Version.gemspec.should == '4.5.6.build.615'
end

it 'should return a nicer gemspec output' do
set_version(1,2,3,false)
Backup::Version.current.should == '1.2.3 / build 0'
set_version(1,2,3)
Backup::Version.current.should == '1.2.3'
end

it 'should return a nicer gemspec output with build' do
set_version(4,5,6,615)
Backup::Version.current.should == '4.5.6 / build 615'
set_version(4,5,6)
Backup::Version.current.should == '4.5.6'
end
end

0 comments on commit c7b07f0

Please sign in to comment.