version 0.9.0 → 0.9.1
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/History.rdoc +5 -0
- data/README.rdoc +18 -0
- data/Rakefile +11 -5
- data/VERSION +1 -1
- data/lib/rake/version_task.rb +14 -0
- data/spec/version_spec.rb +28 -1
- metadata +9 -6
data/History.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -43,6 +43,24 @@ You're all set up.
|
|
43
43
|
$ rake version:bump:major # => 1.0.0
|
44
44
|
$ rake version:bump:minor # => 1.0.1
|
45
45
|
$ cat VERSION # => 1.0.1
|
46
|
+
|
47
|
+
The VersionTask can automatically manage git tagging for
|
48
|
+
you, too.
|
49
|
+
|
50
|
+
Rake::VersionTask.new do |task|
|
51
|
+
task.with_git_tag = true
|
52
|
+
end
|
53
|
+
|
54
|
+
And if you want the VersionTask to automatically emit updated gemspecs on
|
55
|
+
version-bumps, use the +with_gemspec+ flag.
|
56
|
+
|
57
|
+
spec = Gem::Specification.new do |s|
|
58
|
+
...
|
59
|
+
end
|
60
|
+
|
61
|
+
Rake::VersionTask.new do |task|
|
62
|
+
task.with_gemspec = spec
|
63
|
+
end
|
46
64
|
|
47
65
|
Version also supports a .yml VERSION file. See the VersionTask rdoc for
|
48
66
|
details.
|
data/Rakefile
CHANGED
@@ -9,11 +9,16 @@ require 'spec/rake/spectask'
|
|
9
9
|
|
10
10
|
spec = Gem::Specification.new do |s|
|
11
11
|
s.name = 'version'
|
12
|
+
s.version = Version.current
|
13
|
+
s.summary = 'simple version-number encapsulation'
|
14
|
+
|
12
15
|
s.author = 'Stephen Touset'
|
13
16
|
s.email = 'stephen@touset.org'
|
14
|
-
|
15
|
-
s.
|
16
|
-
|
17
|
+
|
18
|
+
s.files = Dir['[A-Z]*', 'lib/**/*.rb', 'spec/**/*']
|
19
|
+
|
20
|
+
s.extra_rdoc_files = Dir['*.rdoc']
|
21
|
+
s.rdoc_options = %w{ --main README.rdoc }
|
17
22
|
|
18
23
|
s.add_development_dependency 'rspec'
|
19
24
|
end
|
@@ -30,12 +35,13 @@ Rake::RDocTask.new do |doc|
|
|
30
35
|
doc.rdoc_files.include('lib/**/*.rb')
|
31
36
|
end
|
32
37
|
|
33
|
-
Spec::Rake::SpecTask.new(:spec) do |
|
34
|
-
|
38
|
+
Spec::Rake::SpecTask.new(:spec) do |task|
|
39
|
+
task.spec_files = FileList['spec/**/*_spec.rb']
|
35
40
|
end
|
36
41
|
|
37
42
|
Rake::VersionTask.new do |v|
|
38
43
|
v.with_git_tag = true
|
44
|
+
v.with_gemspec = spec
|
39
45
|
end
|
40
46
|
|
41
47
|
task :default => :spec
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.1
|
data/lib/rake/version_task.rb
CHANGED
@@ -13,6 +13,10 @@ class Rake::VersionTask < Rake::TaskLib
|
|
13
13
|
# when true, tags version bumps automatically (default: false)
|
14
14
|
attr_accessor :with_git_tag
|
15
15
|
|
16
|
+
# when set with a Gem::Specification, automatically emits an updated
|
17
|
+
# gemspec on version bumps
|
18
|
+
attr_accessor :with_gemspec
|
19
|
+
|
16
20
|
#
|
17
21
|
# Creates a new VersionTask with the given +filename+. Attempts to
|
18
22
|
# autodetect the +filetype+ and whether or not git is present.
|
@@ -34,6 +38,10 @@ class Rake::VersionTask < Rake::TaskLib
|
|
34
38
|
@filetype || self.path.extname[1..-1]
|
35
39
|
end
|
36
40
|
|
41
|
+
def gemspec
|
42
|
+
Pathname("#{with_gemspec.name}.gemspec") if with_gemspec
|
43
|
+
end
|
44
|
+
|
37
45
|
protected
|
38
46
|
|
39
47
|
#
|
@@ -105,8 +113,14 @@ class Rake::VersionTask < Rake::TaskLib
|
|
105
113
|
end
|
106
114
|
end
|
107
115
|
|
116
|
+
if self.with_gemspec
|
117
|
+
with_gemspec.version = version
|
118
|
+
gemspec.open('w') {|io| io << with_gemspec.to_ruby }
|
119
|
+
end
|
120
|
+
|
108
121
|
if self.with_git
|
109
122
|
`git add #{self.filename}`
|
123
|
+
`git add #{self.gemspec}` if self.with_gemspec
|
110
124
|
`git commit -m "Version bump to #{version}"`
|
111
125
|
`git tag #{version}` if self.with_git_tag
|
112
126
|
end
|
data/spec/version_spec.rb
CHANGED
@@ -13,7 +13,34 @@ end
|
|
13
13
|
describe Version do
|
14
14
|
include ImplicitVersion
|
15
15
|
|
16
|
-
subject {
|
16
|
+
subject { v2_9 }
|
17
|
+
|
18
|
+
its(:major) { should == '2' }
|
19
|
+
its(:minor) { should == '9' }
|
20
|
+
its(:revision) { should be_nil }
|
21
|
+
its(:prerelease?) { should be_false }
|
22
|
+
|
23
|
+
it 'should major-bump to 3.0' do
|
24
|
+
subject.bump!(:major).should == v3_0
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should minor-bump to 2.10' do
|
28
|
+
subject.bump!(:minor).should == v2_10
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should revision-bump to 2.9.1' do
|
32
|
+
subject.bump!(:revision).should == v2_9_1
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should prerelease-bump to 2.10a' do
|
36
|
+
subject.bump!(:pre).should == v2_10a
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe Version, 'with a prerelease version' do
|
41
|
+
include ImplicitVersion
|
42
|
+
|
43
|
+
subject { v1_6_3a }
|
17
44
|
|
18
45
|
its(:major) { should == '1' }
|
19
46
|
its(:minor) { should == '6' }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Touset
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-17 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -28,8 +28,10 @@ executables: []
|
|
28
28
|
|
29
29
|
extensions: []
|
30
30
|
|
31
|
-
extra_rdoc_files:
|
32
|
-
|
31
|
+
extra_rdoc_files:
|
32
|
+
- History.rdoc
|
33
|
+
- README.rdoc
|
34
|
+
- TODO.rdoc
|
33
35
|
files:
|
34
36
|
- History.rdoc
|
35
37
|
- License.txt
|
@@ -52,8 +54,9 @@ homepage:
|
|
52
54
|
licenses: []
|
53
55
|
|
54
56
|
post_install_message:
|
55
|
-
rdoc_options:
|
56
|
-
|
57
|
+
rdoc_options:
|
58
|
+
- --main
|
59
|
+
- README.rdoc
|
57
60
|
require_paths:
|
58
61
|
- lib
|
59
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|