rake-dotnet 0.1.7 → 0.1.8

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.
Files changed (4) hide show
  1. data/History.txt +4 -0
  2. data/Rakefile.rb +1 -1
  3. data/lib/rake_dotnet.rb +27 -4
  4. metadata +1 -1
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.1.8 / 2009-06-30
2
+
3
+ FIX: When TeamCity build-configs are out-of-sync, number-wise, we cannot rely on RDNVERSION to be a sensible default.
4
+
1
5
  === 0.1.7 / 2009-06-30
2
6
 
3
7
  (Messed up release)
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.7') do |p|
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
- bn = ENV['BUILD_NUMBER']
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
- SvnInfo.new(:path => '.').revision
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
- '0' # YYYYMMDD is actually invalid for a {revision} number.
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-dotnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter MouncePeter Mounce