rake-dotnet 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Rakefile.rb +1 -1
- data/lib/rake_dotnet.rb +27 -4
- metadata +1 -1
data/History.txt
CHANGED
data/Rakefile.rb
CHANGED
@@ -5,7 +5,7 @@ require 'hoe'
|
|
5
5
|
require 'Pathname'
|
6
6
|
require 'rake/clean'
|
7
7
|
|
8
|
-
Hoe.new('rake-dotnet', '0.1.
|
8
|
+
Hoe.new('rake-dotnet', '0.1.8') do |p|
|
9
9
|
p.author = 'Peter Mounce'
|
10
10
|
p.description = 'Making a .NET build-automation dev\'s life easier, one angle-bracket at a time'
|
11
11
|
p.email = 'pete@neverrunwithscissors.com'
|
data/lib/rake_dotnet.rb
CHANGED
@@ -922,10 +922,11 @@ end
|
|
922
922
|
|
923
923
|
|
924
924
|
class Versioner
|
925
|
-
def initialize(template_file=nil)
|
925
|
+
def initialize(template_file=nil, opts={})
|
926
926
|
tf = template_file || 'version.template.txt'
|
927
927
|
file = Pathname.new(tf)
|
928
928
|
@maj_min = file.read.chomp
|
929
|
+
@bin_out = opts[:bin_out] || File.join(OUT_DIR, 'bin')
|
929
930
|
end
|
930
931
|
|
931
932
|
def get
|
@@ -933,18 +934,40 @@ class Versioner
|
|
933
934
|
end
|
934
935
|
|
935
936
|
def build
|
936
|
-
|
937
|
+
fl = FileList.new("#{@bin_out}*")
|
938
|
+
if ENV['TEAMCITY_BUILDCONF_NAME']
|
939
|
+
pb = get_from_previous_binaries('.*-v\d+\.\d+\.(\d+)\.\d+')
|
940
|
+
return pb unless pb.nil?# use a previous binaries-build if one exists
|
941
|
+
# otherwise use the current environment variable
|
942
|
+
bn = ENV['BUILD_NUMBER']
|
943
|
+
end
|
937
944
|
return 0 if bn == nil || !bn.match(/\d+/)
|
938
945
|
return bn
|
939
946
|
end
|
940
947
|
|
941
948
|
def revision
|
942
949
|
if (Pathname.new('.svn').exist?)
|
943
|
-
|
950
|
+
if ENV['TEAMCITY_BUILDCONF_NAME']
|
951
|
+
pb = get_from_previous_binaries('.*-v\d+\.\d+\.\d+\.(\d+)')
|
952
|
+
return pb unless pb.nil?
|
953
|
+
end
|
954
|
+
return SvnInfo.new(:path => '.').revision
|
944
955
|
else
|
945
|
-
|
956
|
+
return '0' # YYYYMMDD is actually invalid for a {revision} number.
|
946
957
|
end
|
947
958
|
end
|
959
|
+
|
960
|
+
def get_from_previous_binaries(regex)
|
961
|
+
fl = FileList.new("#{@bin_out}*")
|
962
|
+
fl.each do |e|
|
963
|
+
re = regexify(@bin_out)
|
964
|
+
unless e.match(/#{re}/).nil?
|
965
|
+
matches = e.match(/#{regex}/)
|
966
|
+
return matches[1] unless matches.nil?
|
967
|
+
end
|
968
|
+
end
|
969
|
+
return nil
|
970
|
+
end
|
948
971
|
end
|
949
972
|
|
950
973
|
|