version_info 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +1 -2
- data/Rakefile +1 -1
- data/lib/version_info/tasks.rb +39 -2
- data/lib/version_info/version_info.yml +2 -2
- data/lib/version_info.rb +3 -2
- data/spec/version_info/version_info_spec.rb +8 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,8 +4,7 @@
|
|
4
4
|
|
5
5
|
VersionIinfo is a powerful and very lightweight gem to manage version data in your Ruby projects or other gems.
|
6
6
|
VersionIinfo can manage a serie of predefined segments to build your version tag with the tipical structure X.X.X.X.
|
7
|
-
The values are stored in a yaml file, and supports custom values. Also, rake tasks are
|
8
|
-
creation and updates.
|
7
|
+
The values are stored in a yaml file, and supports custom values. Also, rake & thor tasks are avaiable to simplify yaml file creation and update.
|
9
8
|
|
10
9
|
Feel free to contact me about bugs/features
|
11
10
|
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ require 'version_info'
|
|
8
8
|
require 'version_info/version'
|
9
9
|
|
10
10
|
|
11
|
-
VersionInfo::
|
11
|
+
VersionInfo::RakeTasks.install(:class => VersionInfo)
|
12
12
|
# now we have VersionInfo::VERSION defined, can load this
|
13
13
|
Bundler::GemHelper.install_tasks
|
14
14
|
|
data/lib/version_info/tasks.rb
CHANGED
@@ -1,5 +1,41 @@
|
|
1
1
|
module VersionInfo
|
2
|
-
|
2
|
+
module ThorTasks
|
3
|
+
def self.install(opts = {})
|
4
|
+
Class.new(::Thor) do
|
5
|
+
@target = opts[:class]
|
6
|
+
class << self
|
7
|
+
attr_reader :target
|
8
|
+
end
|
9
|
+
namespace :vinfo
|
10
|
+
|
11
|
+
desc 'show', "Show version tag and create version_info.yml if missing"
|
12
|
+
def show
|
13
|
+
puts target::VERSION.tag
|
14
|
+
target::VERSION.save unless File.exist?(target::VERSION.file_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "inspect", "Show complete version info"
|
18
|
+
def inspect
|
19
|
+
puts target::VERSION.inspect
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "bump SEGMENT=patch", "bumps segment: [#{VersionInfo.segments.join(', ')}]"
|
23
|
+
def bump(sgm = :patch)
|
24
|
+
target::VERSION.bump(sgm)
|
25
|
+
puts "version changed to #{target::VERSION}"
|
26
|
+
target::VERSION.save
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
def target
|
31
|
+
self.class.target
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class RakeTasks
|
38
|
+
|
3
39
|
def self.install(opts = {})
|
4
40
|
#dir = caller.find{|c| /Rakefile:/}[/^(.*?)\/Rakefile:/, 1]
|
5
41
|
dir = File.dirname(Rake.application.rakefile_location)
|
@@ -17,7 +53,7 @@ module VersionInfo
|
|
17
53
|
def install
|
18
54
|
namespace :vinfo do
|
19
55
|
|
20
|
-
desc "
|
56
|
+
desc "Show complete version info"
|
21
57
|
task :inspect do
|
22
58
|
puts target::VERSION.inspect
|
23
59
|
end
|
@@ -40,3 +76,4 @@ module VersionInfo
|
|
40
76
|
end
|
41
77
|
end
|
42
78
|
end
|
79
|
+
|
data/lib/version_info.rb
CHANGED
@@ -4,7 +4,7 @@ module VersionInfo
|
|
4
4
|
|
5
5
|
|
6
6
|
def self.segments
|
7
|
-
[:major, :minor, :patch, :
|
7
|
+
[:major, :minor, :patch, :state, :build]
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.included(other)
|
@@ -13,7 +13,8 @@ module VersionInfo
|
|
13
13
|
other.const_set('VERSION', data.new)
|
14
14
|
end
|
15
15
|
|
16
|
-
autoload :
|
16
|
+
autoload :RakeTasks, 'version_info/tasks'
|
17
|
+
autoload :ThorTasks, 'version_info/tasks'
|
17
18
|
|
18
19
|
end
|
19
20
|
|
@@ -8,6 +8,14 @@ describe "VersionInfo" do
|
|
8
8
|
include VersionInfo # force new VERSION data
|
9
9
|
end
|
10
10
|
end
|
11
|
+
after :each do
|
12
|
+
module TestFile
|
13
|
+
remove_const :VERSION
|
14
|
+
remove_const :Version
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
11
19
|
|
12
20
|
it "is initalized" do
|
13
21
|
TestFile::VERSION.marshal_dump.should == {:major => 0, :minor => 0, :patch => 0 }
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 7
|
8
|
+
- 0
|
9
|
+
version: 0.7.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jorge L. Cangas
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-23 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|