Skip to content

Commit 71a74a8

Browse files
author
Ernie Prabhakar
committed
Rename from version_task to rake-versioning
1 parent 6ed80c4 commit 71a74a8

18 files changed

+88
-106
lines changed

History.rdoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
* Version#prerelease? to determine if it's a prerelease version
2121
* Version#bump! now accepts symbolic indexes
2222
* Version#inspect has slightly friendlier output
23-
* VersionTask now correctly bumps prerelease versions
24-
* VersionTask has new version:bump:pre task
23+
* RakeVersioning now correctly bumps prerelease versions
24+
* RakeVersioning has new version:bump:pre task
2525
* now properly MIT-licensed
2626
* somewhat spec'd
2727

@@ -44,7 +44,7 @@
4444

4545
* enhancements
4646
* support for committing and tagging through git
47-
* see rdoc for Rake::VersionTask
47+
* see rdoc for Rake::RakeVersioning
4848

4949
=== Version 0.6.2 / 2010-02-05
5050

@@ -66,15 +66,15 @@
6666
* readme and history files
6767
* extended documentation
6868
* support for easy version-file management through rake
69-
* see rdoc for Rake::VersionTask
69+
* see rdoc for Rake::RakeVersioning
7070
* support auto-setting VERSION constant in classes
7171
* see rdoc for Class::Versioned()
72-
* eating own dogfood with Rake::VersionTask
72+
* eating own dogfood with Rake::RakeVersioning
7373
* make Version#to_hash exclude keys with nil values
7474

7575
* todo for 1.0.0
7676
* full suite of specs
77-
* remove duplication in Class::Version() and Rake::VersionTask
77+
* remove duplication in Class::Version() and Rake::RakeVersioning
7878
* get rid of gem task warnings
7979

8080
=== Version 0.5.0 / 2010-02-04

README.rdoc

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
= Version
1+
= Rake Versioning
22

3-
* http://github.com/stouset/version
4-
* http://rdoc.info/gems/version/
5-
* http://atlruby.org/stouset/posts/138-version-task
3+
* https://github.com/drernie/rake-versioning
4+
* FROM: http://github.com/stouset/version / http://rdoc.info/gems/version/ / http://atlruby.org/stouset/posts/138-version-task
65

76
== Description
87

9-
Version is a simple wrapper around the concept of version-numbering schemes.
8+
Rake Versioning is a simple wrapper around the concept of version-numbering schemes. It is forked from the "Version" gem as that name caused numerous complications in my environment.
109

1110
== Features
1211

13-
* Rake::VersionTask provides tasks for simple version bumping
14-
* Version smartly handles several versioning schemes, abstracting the details
12+
* Rake::VersioningTask provides tasks for simple version bumping
13+
* Rake Versioning smartly handles several versioning schemes, abstracting the details
1514

1615
== Examples
1716

1817
=== Screencast
1918

20-
For a quick introduction, watch the
21-
screencast[http://blip.tv/file/get/Tkadom-ATLRUGSteveTousetPresentingVersion277.mov]
19+
For a quick introduction to the original gem, watch the
20+
screencast[http://blip.tv/file/get/Tkadom-ATLRUGSteveTousetPresentingRake Versioning277.mov]
2221
of my presentation[http://atlruby.org/stouset/posts/138-version-task] at the
2322
{Atlanta Ruby Users' Group}[http://atlruby.org/].
2423

2524
=== Rake Tasks
2625

27-
Version comes with a Rake::VersionTask that lets you manage version numbering
26+
Rake Versioning comes with a Rake::Rake VersioningTask that lets you manage version numbering
2827
automatically. Place the following in a Rakefile:
2928

30-
require 'rake/version_task'
31-
Rake::VersionTask.new
32-
29+
require 'rake/rake_versioning'
30+
Rake::Rake VersioningTask.new
31+
3332
You're all set up.
3433

3534
$ rake version:create VERSION=0.1.0 # => 0.1.0
@@ -58,51 +57,51 @@ Now `rake -T version` will tell you what all you can do.
5857
$ rake version:bump:minor # => 1.1.0
5958
$ cat VERSION # => 1.1.0
6059

61-
The VersionTask can automatically manage git tagging for
60+
The Rake VersioningTask can automatically manage git tagging for
6261
you, too.
6362

64-
Rake::VersionTask.new do |task|
63+
Rake::Rake VersioningTask.new do |task|
6564
task.with_git_tag = true
6665
end
6766

68-
And if you want the VersionTask to automatically emit updated gemspecs on
67+
And if you want the Rake VersioningTask to automatically emit updated gemspecs on
6968
version-bumps, use the +with_gemspec+ flag.
7069

7170
spec = Gem::Specification.new do |s|
7271
...
7372
end
74-
75-
Rake::VersionTask.new do |task|
73+
74+
Rake::Rake VersioningTask.new do |task|
7675
task.with_gemspec = spec
7776
end
78-
79-
Version also supports a .yml VERSION file. See the VersionTask rdoc for
77+
78+
Rake Versioning also supports a .yml VERSION file. See the Rake VersioningTask rdoc for
8079
details.
8180

82-
=== Library Versioning
81+
=== Library Rake Versioninging
8382

84-
Version lets you automatically keep an in-class VERSION constant in sync with
85-
the contents of the version file on disk. Version also provides a class-level
83+
Rake Versioning lets you automatically keep an in-class VERSION constant in sync with
84+
the contents of the version file on disk. Rake Versioning also provides a class-level
8685
+current+ method which lets you get the current version without setting a
8786
class-level constant.
8887

8988
require 'version'
90-
91-
Version.current # => 1.0.1
92-
89+
90+
Rake Versioning.current # => 1.0.1
91+
9392
class Foo
9493
is_versioned
9594
end
96-
95+
9796
Foo::VERSION # => 1.0.1
98-
99-
The Version.current and Class::is_versioned methods both take a filename
97+
98+
The Rake Versioning.current and Class::is_versioned methods both take a filename
10099
parameter if you use a different location for the VERSION file. See the
101-
Version.current rdoc for details.
100+
Rake Versioning.current rdoc for details.
102101

103102
=== Manipulation in Code
104103

105-
All the above functionality is performed behind-the-scenes by the Version
104+
All the above functionality is performed behind-the-scenes by the Rake Versioning
106105
library. It's simple to use, but I'll be surprised if there's much point
107106
beyond doing the legwork for the Rake task and class versioning.
108107

@@ -113,7 +112,7 @@ beyond doing the legwork for the Rake task and class versioning.
113112
v.bump!(:minor, false, true) # => 2.1
114113
v.major = 3 # => 3.0
115114
v.to_a # => ['3', '0']
116-
115+
117116
== Install
118117

119118
[sudo] gem install version

Rakefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
$: << 'lib'
22

3-
require 'rake/version_task'
3+
require 'rake/rake_versioning'
44

55
require 'rubygems'
66
require 'rubygems/package_task'
77
require 'rdoc/task'
88
require 'spec/rake/spectask'
99

1010
spec = Gem::Specification.new do |s|
11-
s.name = 'version'
12-
s.version = VersionTask::Version.current or '0.0.0'
11+
s.name = 'rake-versioning'
12+
s.version = RakeVersioning::Version.current or '0.0.0'
1313
s.summary = 'simple version-number encapsulation'
1414

1515
s.author = 'Stephen Touset'
@@ -29,7 +29,7 @@ Gem::PackageTask.new(spec) do |gem|
2929
end
3030

3131
Rake::RDocTask.new do |doc|
32-
doc.title = "version #{VersionTask::Version.current}"
32+
doc.title = "version #{RakeVersioning::Version.current}"
3333
doc.rdoc_dir = 'doc'
3434
doc.main = 'README.rdoc'
3535
doc.rdoc_files.include('*.rdoc')
@@ -40,7 +40,7 @@ Spec::Rake::SpecTask.new(:spec) do |task|
4040
task.spec_files = FileList['spec/**/*_spec.rb']
4141
end
4242

43-
Rake::VersionTask.new do |v|
43+
Rake::RakeVersioning.new do |v|
4444
v.with_git_tag = true
4545
v.with_gemspec = spec
4646
end

TODO.rdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
* remove file parsing duplication between Version.current and
2-
Rake::VersionTask
2+
Rake::RakeVersioning
33
* get rid of gem task warnings
44
* improved pre-bumping (version:bump:major:pre?)

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/version_task.rb renamed to lib/rake-versioning.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
require 'version_task/ext/array'
2-
require 'version_task/ext/module'
3-
require 'version_task/ext/hash'
4-
require 'version_task/ext/string'
1+
require 'rake_versioning/ext/array'
2+
require 'rake_versioning/ext/module'
3+
require 'rake_versioning/ext/hash'
4+
require 'rake_versioning/ext/string'
55

66
require 'pathname'
77

88
#
99
# Encodes version-numbering logic into a convenient class.
1010
#
11-
module VersionTask
11+
module RakeVersioning
1212
class Version
1313
include Comparable
1414

15-
autoload :Component, 'version_task/component'
15+
autoload :Component, 'rake_versioning/component'
1616

1717
#
1818
# Searches through the parent directories of the calling method and looks
@@ -80,8 +80,8 @@ def []=(index, value)
8080
return self[self.length + index] = value if index < 0
8181

8282
length = self.length - index
83-
zeroes = Array.new length.abs, VersionTask::Version::Component.new('0')
84-
value = VersionTask::Version::Component.new(value.to_s)
83+
zeroes = Array.new length.abs, RakeVersioning::Version::Component.new('0')
84+
value = RakeVersioning::Version::Component.new(value.to_s)
8585

8686
if length >= 0
8787
self.components[index, length] = zeroes

lib/version_task/component.rb renamed to lib/rake-versioning/component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
require 'version_task'
1+
require 'rake_versioning'
22

3-
class VersionTask::Version::Component
3+
class RakeVersioning::Version::Component
44
attr_accessor :digits
55
attr_accessor :letter
66

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
require 'version_task'
1+
require 'rake_versioning'
22

33
class Array
44
#
55
# Converts the Array into a version number.
66
#
77
def to_version
8-
VersionTask::Version.new *self
8+
RakeVersioning::Version.new *self
99
end
1010
end

lib/rake-versioning/ext/hash.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require 'rake_versioning'
2+
3+
class Hash
4+
#
5+
# Converts the Hash into a version number.
6+
#
7+
def to_version
8+
RakeVersioning::Version.new *self.values_at(:major, :minor, :revision, :rest)
9+
end
10+
end

lib/rake-versioning/ext/module.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require 'rake_versioning'
2+
3+
class Module
4+
#
5+
# Automagically sets a VERSION constant in the current module according to
6+
# the results of RakeVersioning::Version.current.
7+
#
8+
def is_versioned
9+
const_set :VERSION, RakeVersioning::Version.current(File.dirname(caller.first))
10+
end
11+
end

0 commit comments

Comments
 (0)