version_info 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/lib/version_info/tasks.rb +9 -7
- data/lib/version_info/version_info.yml +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -7,7 +7,8 @@ $LOAD_PATH.unshift File.expand_path('./lib', File.dirname(__FILE__))
|
|
7
7
|
require 'version_info'
|
8
8
|
require 'version_info/version'
|
9
9
|
|
10
|
-
|
10
|
+
|
11
|
+
VersionInfo::Tasks.install(:class => VersionInfo)
|
11
12
|
# now we have VersionInfo::VERSION defined, can load this
|
12
13
|
Bundler::GemHelper.install_tasks
|
13
14
|
|
data/lib/version_info/tasks.rb
CHANGED
@@ -1,31 +1,33 @@
|
|
1
1
|
module VersionInfo
|
2
2
|
class Tasks
|
3
|
-
def self.install(opts =
|
3
|
+
def self.install(opts = {})
|
4
4
|
#dir = caller.find{|c| /Rakefile:/}[/^(.*?)\/Rakefile:/, 1]
|
5
5
|
dir = File.dirname(Rake.application.rakefile_location)
|
6
|
-
self.new(dir).install
|
6
|
+
self.new(dir, opts).install
|
7
7
|
end
|
8
8
|
|
9
9
|
attr_reader :root_path
|
10
|
+
attr_reader :target
|
10
11
|
|
11
|
-
def initialize(root_path)
|
12
|
+
def initialize(root_path, opts)
|
12
13
|
@root_path = root_path
|
14
|
+
@target = opts[:class]
|
13
15
|
end
|
14
16
|
|
15
17
|
def install
|
16
18
|
namespace :vinfo do
|
17
19
|
desc "Show current version tag and create version_info.yml if missing"
|
18
20
|
task :show do
|
19
|
-
puts VERSION.tag
|
20
|
-
VERSION.save unless File.exist?(VERSION.class.file_name)
|
21
|
+
puts target::VERSION.tag
|
22
|
+
target::VERSION.save unless File.exist?(target::VERSION.class.file_name)
|
21
23
|
end
|
22
24
|
|
23
25
|
VersionInfo.segments.each do |sgm|
|
24
26
|
desc "Bumps version segment #{sgm.to_s.upcase}"
|
25
27
|
task sgm.to_sym do
|
26
|
-
VERSION.bump(sgm)
|
28
|
+
target::VERSION.bump(sgm)
|
27
29
|
puts "version changed to #{VERSION.tag}"
|
28
|
-
VERSION.save
|
30
|
+
target::VERSION.save
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|