rake-version 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +4 -0
- data/VERSION +1 -1
- data/lib/rake-version.rb +22 -1
- data/lib/rake-version/context.rb +22 -0
- data/lib/rake-version/manager.rb +60 -0
- data/lib/rake-version/tasks.rb +50 -0
- data/lib/rake-version/version.rb +59 -0
- data/rake-version.gemspec +12 -3
- data/spec/context_spec.rb +50 -0
- data/spec/manager_spec.rb +92 -0
- data/spec/tasks_spec.rb +56 -0
- data/spec/version_spec.rb +73 -0
- metadata +28 -19
data/.rspec
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
active_support (3.0.0)
|
5
|
+
activesupport (= 3.0.0)
|
6
|
+
activesupport (3.0.0)
|
4
7
|
diff-lcs (1.1.3)
|
5
8
|
git (1.2.5)
|
6
9
|
jeweler (1.8.3)
|
@@ -33,6 +36,7 @@ PLATFORMS
|
|
33
36
|
ruby
|
34
37
|
|
35
38
|
DEPENDENCIES
|
39
|
+
active_support (>= 2)
|
36
40
|
bundler
|
37
41
|
jeweler (~> 1.8.3)
|
38
42
|
rake (~> 0.9.2)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
data/lib/rake-version.rb
CHANGED
@@ -4,6 +4,27 @@ require 'rake/tasklib'
|
|
4
4
|
module RakeVersion
|
5
5
|
VERSION = File.open(File.join(File.dirname(__FILE__), '..', 'VERSION'), 'r').read
|
6
6
|
|
7
|
-
class
|
7
|
+
class Error < StandardError; end
|
8
|
+
class BadVersionString < Error; end
|
9
|
+
class MissingContext < Error; end
|
10
|
+
class BadArgument < Error; end
|
11
|
+
class BadContext < BadArgument; end
|
12
|
+
class BadVersion < BadArgument; end
|
13
|
+
class BadBumpType < BadArgument; end
|
14
|
+
|
15
|
+
def self.check_context o
|
16
|
+
self.check_type o, RakeVersion::Context, BadContext
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.check_version o
|
20
|
+
self.check_type o, RakeVersion::Version, BadVersion
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.check_type o, expected_type, error_class = Error, name = nil
|
24
|
+
name ||= expected_type.to_s.sub(/.*::/, '')
|
25
|
+
name = name.downcase
|
26
|
+
raise error_class, "Expected #{name} to be a #{expected_type}." unless o.kind_of? expected_type
|
8
27
|
end
|
9
28
|
end
|
29
|
+
|
30
|
+
%w( context manager tasks version ).each{ |dep| require File.join(File.dirname(__FILE__), 'rake-version', dep) }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module RakeVersion
|
3
|
+
|
4
|
+
class Context
|
5
|
+
|
6
|
+
def initialize task
|
7
|
+
@task = task
|
8
|
+
end
|
9
|
+
|
10
|
+
def root
|
11
|
+
File.expand_path @task.application.original_dir
|
12
|
+
end
|
13
|
+
|
14
|
+
def read file
|
15
|
+
File.open(file, 'r').read
|
16
|
+
end
|
17
|
+
|
18
|
+
def write file, contents
|
19
|
+
File.open(file, 'w'){ |f| f.write contents }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
module RakeVersion
|
3
|
+
|
4
|
+
attr_accessor :namespace
|
5
|
+
attr_accessor :root
|
6
|
+
attr_accessor :version_filename
|
7
|
+
|
8
|
+
class Manager
|
9
|
+
|
10
|
+
def version
|
11
|
+
check_context
|
12
|
+
RakeVersion::Version.new.from_s read_version
|
13
|
+
end
|
14
|
+
|
15
|
+
def set version_string
|
16
|
+
check_context
|
17
|
+
save RakeVersion::Version.new.from_s(version_string)
|
18
|
+
end
|
19
|
+
|
20
|
+
def bump type
|
21
|
+
check_context
|
22
|
+
save version.bump(type)
|
23
|
+
end
|
24
|
+
|
25
|
+
def with_context context, &block
|
26
|
+
RakeVersion.check_context context
|
27
|
+
@context = context
|
28
|
+
yield self if block_given?
|
29
|
+
@context = nil
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def check_context
|
36
|
+
raise MissingContext, "A context must be given with :with_context." unless @context
|
37
|
+
end
|
38
|
+
|
39
|
+
def save version
|
40
|
+
RakeVersion.check_version version
|
41
|
+
write_version version
|
42
|
+
end
|
43
|
+
|
44
|
+
def read_version
|
45
|
+
@context.read version_file
|
46
|
+
end
|
47
|
+
|
48
|
+
def write_version version
|
49
|
+
version.tap{ |v| @context.write version_file, version.to_s }
|
50
|
+
end
|
51
|
+
|
52
|
+
def version_file
|
53
|
+
File.join @context.root, version_filename
|
54
|
+
end
|
55
|
+
|
56
|
+
def version_filename
|
57
|
+
@version_filename || 'VERSION'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
module RakeVersion
|
3
|
+
|
4
|
+
class Tasks < ::Rake::TaskLib
|
5
|
+
|
6
|
+
def initialize &block
|
7
|
+
@manager = RakeVersion::Manager.new
|
8
|
+
yield @manager if block_given?
|
9
|
+
define
|
10
|
+
end
|
11
|
+
|
12
|
+
def define
|
13
|
+
desc 'Show the current version'
|
14
|
+
task :version do |t|
|
15
|
+
puts @manager.version.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :version do
|
19
|
+
|
20
|
+
desc 'Set the version (e.g. rake version:set[1.2.3])'
|
21
|
+
task :set, :value do |t, args|
|
22
|
+
puts @manager.set(args.value.to_s)
|
23
|
+
end
|
24
|
+
|
25
|
+
namespace :bump do
|
26
|
+
|
27
|
+
[ :major, :minor, :patch ].each do |type|
|
28
|
+
task type do |t|
|
29
|
+
puts @manager.bump(type).to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def task *args, &block
|
37
|
+
super *args do |t, args|
|
38
|
+
@manager.with_context context(t) do |m|
|
39
|
+
yield t, args if block_given?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def context task
|
47
|
+
RakeVersion::Context.new task
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
module RakeVersion
|
3
|
+
|
4
|
+
class Version
|
5
|
+
REGEXP = /^(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?((?:\-[A-Za-z0-9]+)*)$/
|
6
|
+
|
7
|
+
attr_reader :major
|
8
|
+
attr_reader :minor
|
9
|
+
attr_reader :patch
|
10
|
+
attr_reader :build
|
11
|
+
attr_reader :tags
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@major = 0
|
15
|
+
@minor = 0
|
16
|
+
@patch = 0
|
17
|
+
@build = nil
|
18
|
+
@tags = []
|
19
|
+
# TODO: create methods to list, add and remove tags
|
20
|
+
end
|
21
|
+
|
22
|
+
def bump type
|
23
|
+
case type
|
24
|
+
when :major
|
25
|
+
@major += 1
|
26
|
+
@minor = 0
|
27
|
+
@patch = 0
|
28
|
+
when :minor
|
29
|
+
@minor += 1
|
30
|
+
@patch = 0
|
31
|
+
when :patch
|
32
|
+
@patch += 1
|
33
|
+
else
|
34
|
+
raise BadBumpType, "Unknown version bump type #{type.inspect}. Expecting :major, :minor or :patch."
|
35
|
+
end
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
39
|
+
def from_s s
|
40
|
+
s.to_s.match(REGEXP).tap do |m|
|
41
|
+
raise BadVersionString, "Version '#{s}' expected to have format MAJOR.MINOR.PATCH(.BUILD)(-TAG)." if m.nil?
|
42
|
+
@major = m[1].to_i
|
43
|
+
@minor = m[2].to_i
|
44
|
+
@patch = m[3].to_i
|
45
|
+
@build = m[4] ? m[4].to_i : nil
|
46
|
+
@tags = m[5] ? m[5].sub(/^\-/, '').split('-') : []
|
47
|
+
end
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_s
|
52
|
+
String.new.tap do |s|
|
53
|
+
s << "#{@major}.#{@minor}.#{@patch}"
|
54
|
+
s << ".#{@build}" if @build
|
55
|
+
s << tags.collect{ |tag| "-#{tag}" }.join('') unless tags.empty?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/rake-version.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rake-version"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["AlphaHydrae"]
|
12
|
-
s.date = "2012-02-
|
12
|
+
s.date = "2012-02-24"
|
13
13
|
s.description = "Rake tasks for version management."
|
14
14
|
s.email = "hydrae.alpha@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
+
".rspec",
|
21
22
|
".rvmrc",
|
22
23
|
"Gemfile",
|
23
24
|
"Gemfile.lock",
|
@@ -26,8 +27,16 @@ Gem::Specification.new do |s|
|
|
26
27
|
"Rakefile",
|
27
28
|
"VERSION",
|
28
29
|
"lib/rake-version.rb",
|
30
|
+
"lib/rake-version/context.rb",
|
31
|
+
"lib/rake-version/manager.rb",
|
32
|
+
"lib/rake-version/tasks.rb",
|
33
|
+
"lib/rake-version/version.rb",
|
29
34
|
"rake-version.gemspec",
|
30
|
-
"spec/
|
35
|
+
"spec/context_spec.rb",
|
36
|
+
"spec/helper.rb",
|
37
|
+
"spec/manager_spec.rb",
|
38
|
+
"spec/tasks_spec.rb",
|
39
|
+
"spec/version_spec.rb"
|
31
40
|
]
|
32
41
|
s.homepage = "http://github.com/AlphaHydrae/rake-version"
|
33
42
|
s.licenses = ["MIT"]
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe RakeVersion::Context do
|
4
|
+
CONTEXT_SAMPLE_ROOT = '/tmp'
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
|
8
|
+
@application = double('application')
|
9
|
+
@application.stub(:original_dir){ CONTEXT_SAMPLE_ROOT }
|
10
|
+
|
11
|
+
@task = double('task')
|
12
|
+
@task.stub(:application){ @application }
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should return the application directory for the given rake task" do
|
16
|
+
RakeVersion::Context.new(@task).root.should == CONTEXT_SAMPLE_ROOT
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should successfully read file contents" do
|
20
|
+
|
21
|
+
filename = 'foo'
|
22
|
+
contents = 'bar'
|
23
|
+
|
24
|
+
File.stub(:open) do |file,mode|
|
25
|
+
if mode == 'r' and file == filename
|
26
|
+
double('file').tap{ |f| f.stub(:read){ contents } }
|
27
|
+
else
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
RakeVersion::Context.new(@task).read(filename).should == contents
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should ask File to write file contents" do
|
36
|
+
|
37
|
+
filename = 'foo'
|
38
|
+
contents = 'bar'
|
39
|
+
|
40
|
+
file = double('file')
|
41
|
+
file.stub(:write)
|
42
|
+
|
43
|
+
File.stub(:open) do |f,mode|
|
44
|
+
raise 'bug' unless f == filename and mode == 'w'
|
45
|
+
end.and_yield file
|
46
|
+
|
47
|
+
file.should_receive(:write).with(contents)
|
48
|
+
RakeVersion::Context.new(@task).write(filename, contents)
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe RakeVersion::Manager do
|
4
|
+
MANAGER_SAMPLE_ROOT = '/tmp'
|
5
|
+
MANAGER_SAMPLE_VERSION = '1.2.3.456-beta-custom'
|
6
|
+
MANAGER_VERSION_FILE = File.join MANAGER_SAMPLE_ROOT, 'VERSION'
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
@manager = RakeVersion::Manager.new
|
10
|
+
|
11
|
+
@context = double('context')
|
12
|
+
@context.stub(:root){ MANAGER_SAMPLE_ROOT }
|
13
|
+
@context.stub(:read){ MANAGER_SAMPLE_VERSION }
|
14
|
+
@context.stub(:write){}
|
15
|
+
@context.stub(:kind_of?){ |type| type == RakeVersion::Context }
|
16
|
+
|
17
|
+
@version = double('version')
|
18
|
+
@version.stub(:to_s){ MANAGER_SAMPLE_VERSION }
|
19
|
+
@version.stub(:bump){ @version }
|
20
|
+
@version.stub(:kind_of?){ |type| type == RakeVersion::Version }
|
21
|
+
end
|
22
|
+
|
23
|
+
def with_context &block
|
24
|
+
@manager.with_context @context do |m|
|
25
|
+
yield m if block_given?
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return a version object" do
|
30
|
+
with_context do |m|
|
31
|
+
m.version.tap do |v|
|
32
|
+
v.should be_a_kind_of(RakeVersion::Version)
|
33
|
+
v.major.should == 1
|
34
|
+
v.minor.should == 2
|
35
|
+
v.patch.should == 3
|
36
|
+
v.build.should == 456
|
37
|
+
v.tags.should be_a_kind_of(Array)
|
38
|
+
v.tags.length.should == 2
|
39
|
+
v.tags[0].should == 'beta'
|
40
|
+
v.tags[1].should == 'custom'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should require a context for all operations" do
|
46
|
+
lambda{ @manager.version }.should raise_error(RakeVersion::MissingContext)
|
47
|
+
lambda{ @manager.set '1.2.3' }.should raise_error(RakeVersion::MissingContext)
|
48
|
+
lambda{ @manager.bump :minor }.should raise_error(RakeVersion::MissingContext)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should return the correct version" do
|
52
|
+
with_context{ |m| m.version.to_s.should == MANAGER_SAMPLE_VERSION }
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should set the correct version" do
|
56
|
+
with_context{ |m| m.set('1.2.3').to_s.should == '1.2.3' }
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should ask for the context root" do
|
60
|
+
@context.should_receive :root
|
61
|
+
with_context{ |m| m.version }
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should ask the version to bump itself" do
|
65
|
+
@manager.stub(:version){ @version }
|
66
|
+
[ :major, :minor, :patch ].each do |type|
|
67
|
+
@version.should_receive(:bump).with(type)
|
68
|
+
with_context{ |m| m.bump type }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should ask the context to read the version file" do
|
73
|
+
@context.should_receive(:read).with(MANAGER_VERSION_FILE)
|
74
|
+
with_context{ |m| m.version }
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should ask the context to write the version file when bumping the version" do
|
78
|
+
@context.should_receive(:write).with(MANAGER_VERSION_FILE, '1.3.0.456-beta-custom')
|
79
|
+
with_context{ |m| m.bump :minor }
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should ask the context to write the version file when setting the version" do
|
83
|
+
@context.should_receive(:write).with(MANAGER_VERSION_FILE, MANAGER_SAMPLE_VERSION)
|
84
|
+
with_context{ |m| m.set MANAGER_SAMPLE_VERSION }
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should only accept the right type of context" do
|
88
|
+
[ nil, true, false, 2, 'bad', :bad, [], {}, @version ].each do |invalid|
|
89
|
+
lambda{ @manager.with_context invalid }.should raise_error(RakeVersion::BadContext)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
data/spec/tasks_spec.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'active_support/core_ext/kernel/reporting'
|
3
|
+
|
4
|
+
describe RakeVersion::Tasks do
|
5
|
+
TASKS_SAMPLE_VERSION = '1.2.3'
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
|
9
|
+
@version = double('version')
|
10
|
+
@version.stub(:to_s){ TASKS_SAMPLE_VERSION }
|
11
|
+
|
12
|
+
@manager = double('manager')
|
13
|
+
@manager.stub(:version){ @version }
|
14
|
+
@manager.stub(:set){ @version }
|
15
|
+
@manager.stub(:bump){ @version }
|
16
|
+
@manager.stub(:with_context).and_yield(@manager)
|
17
|
+
|
18
|
+
RakeVersion::Manager.stub(:new){ @manager }
|
19
|
+
RakeVersion::Tasks.new
|
20
|
+
end
|
21
|
+
|
22
|
+
after :each do
|
23
|
+
Rake::Task.clear
|
24
|
+
end
|
25
|
+
|
26
|
+
def silence &block
|
27
|
+
silence_stream(STDOUT) do
|
28
|
+
silence_stream(STDERR) do
|
29
|
+
yield if block_given?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should define all tasks" do
|
35
|
+
%w( version version:set version:bump:major version:bump:minor version:bump:patch ).each do |name|
|
36
|
+
Rake::Task[name].should be_a_kind_of(Rake::Task)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should ask the manager to return the current version" do
|
41
|
+
@manager.should_receive(:version)
|
42
|
+
silence{ Rake::Task['version'].execute }
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should ask the manager to set the version" do
|
46
|
+
@manager.should_receive(:set).with(kind_of(String))
|
47
|
+
silence{ Rake::Task['version:set'].invoke TASKS_SAMPLE_VERSION }
|
48
|
+
end
|
49
|
+
|
50
|
+
[ :major, :minor, :patch ].each do |type|
|
51
|
+
it "should ask the manager to bump the #{type} version" do
|
52
|
+
@manager.should_receive(:bump).with(type)
|
53
|
+
silence{ Rake::Task["version:bump:#{type}"].execute }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe RakeVersion::Version do
|
4
|
+
|
5
|
+
it "should build a correct version object when initialized" do
|
6
|
+
RakeVersion::Version.new.tap do |v|
|
7
|
+
v.major.should == 0
|
8
|
+
v.minor.should == 0
|
9
|
+
v.patch.should == 0
|
10
|
+
v.build.should be_nil
|
11
|
+
v.tags.should be_a_kind_of(Array)
|
12
|
+
v.tags.length.should == 0
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should build a correct version object when built from a string" do
|
17
|
+
RakeVersion::Version.new.from_s('1.2.3.456-beta-custom').tap do |v|
|
18
|
+
v.major.should == 1
|
19
|
+
v.minor.should == 2
|
20
|
+
v.patch.should == 3
|
21
|
+
v.build.should == 456
|
22
|
+
v.tags.should be_a_kind_of(Array)
|
23
|
+
v.tags.length.should == 2
|
24
|
+
v.tags[0].should == 'beta'
|
25
|
+
v.tags[1].should == 'custom'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should build the correct version string when built from a string" do
|
30
|
+
[ '1.2.3', '2.3.4.567', '3.4.5.678-beta', '5.6.7.890-beta-custom' ].each do |v|
|
31
|
+
RakeVersion::Version.new.from_s(v).to_s.should == v
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should raise an error when built from invalid version strings" do
|
36
|
+
[ '1', '2.3', '4.5.6.7.8', 'asd', nil, true, false, [], {}, '' ].each do |invalid|
|
37
|
+
lambda{ RakeVersion::Version.new.from_s invalid }.should raise_error(RakeVersion::BadVersionString)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'Bumping' do
|
42
|
+
|
43
|
+
before :each do
|
44
|
+
@version1 = RakeVersion::Version.new.from_s '1.2.3.456-beta-custom'
|
45
|
+
@version2 = RakeVersion::Version.new.from_s '2.3.4.567-alpha-customer'
|
46
|
+
@version3 = RakeVersion::Version.new.from_s '3.4.5.678-gamma-prod'
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should correctly bump the major version" do
|
50
|
+
@version1.bump(:major).to_s.should == '2.0.0.456-beta-custom'
|
51
|
+
@version2.bump(:major).to_s.should == '3.0.0.567-alpha-customer'
|
52
|
+
@version3.bump(:major).to_s.should == '4.0.0.678-gamma-prod'
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should correctly bump the minor version" do
|
56
|
+
@version1.bump(:minor).to_s.should == '1.3.0.456-beta-custom'
|
57
|
+
@version2.bump(:minor).to_s.should == '2.4.0.567-alpha-customer'
|
58
|
+
@version3.bump(:minor).to_s.should == '3.5.0.678-gamma-prod'
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should correctly bump the patch version" do
|
62
|
+
@version1.bump(:patch).to_s.should == '1.2.4.456-beta-custom'
|
63
|
+
@version2.bump(:patch).to_s.should == '2.3.5.567-alpha-customer'
|
64
|
+
@version3.bump(:patch).to_s.should == '3.4.6.678-gamma-prod'
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should not accept unknown bump types" do
|
68
|
+
[ nil, true, false, '', 'asd', :build, :unknown, :Major, [], {} ].each do |invalid|
|
69
|
+
lambda{ @version1.bump invalid }.should raise_error(RakeVersion::BadBumpType)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156595400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156595400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156593880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.8.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156593880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: shoulda
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156591640 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.11.3
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156591640
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156455200 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156455200
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &2156453720 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.8.3
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2156453720
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &2156452260 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.5.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2156452260
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: yard
|
82
|
-
requirement: &
|
82
|
+
requirement: &2156450160 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.7.5
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2156450160
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rdiscount
|
93
|
-
requirement: &
|
93
|
+
requirement: &2156447840 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: 1.6.8
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2156447840
|
102
102
|
description: Rake tasks for version management.
|
103
103
|
email: hydrae.alpha@gmail.com
|
104
104
|
executables: []
|
@@ -108,6 +108,7 @@ extra_rdoc_files:
|
|
108
108
|
- README.md
|
109
109
|
files:
|
110
110
|
- .document
|
111
|
+
- .rspec
|
111
112
|
- .rvmrc
|
112
113
|
- Gemfile
|
113
114
|
- Gemfile.lock
|
@@ -116,8 +117,16 @@ files:
|
|
116
117
|
- Rakefile
|
117
118
|
- VERSION
|
118
119
|
- lib/rake-version.rb
|
120
|
+
- lib/rake-version/context.rb
|
121
|
+
- lib/rake-version/manager.rb
|
122
|
+
- lib/rake-version/tasks.rb
|
123
|
+
- lib/rake-version/version.rb
|
119
124
|
- rake-version.gemspec
|
125
|
+
- spec/context_spec.rb
|
120
126
|
- spec/helper.rb
|
127
|
+
- spec/manager_spec.rb
|
128
|
+
- spec/tasks_spec.rb
|
129
|
+
- spec/version_spec.rb
|
121
130
|
homepage: http://github.com/AlphaHydrae/rake-version
|
122
131
|
licenses:
|
123
132
|
- MIT
|
@@ -133,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
142
|
version: '0'
|
134
143
|
segments:
|
135
144
|
- 0
|
136
|
-
hash:
|
145
|
+
hash: 992759185416645503
|
137
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
147
|
none: false
|
139
148
|
requirements:
|