From fc1198dae67a9441975c238039d1a5aedc1847fa Mon Sep 17 00:00:00 2001 From: Antony Male Date: Tue, 8 Sep 2015 22:10:11 +0100 Subject: [PATCH] Add version task --- Rakefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Rakefile b/Rakefile index 4eb9521..2b8ff97 100644 --- a/Rakefile +++ b/Rakefile @@ -13,6 +13,8 @@ COVERAGE_FILE = File.join(COVERAGE_DIR, 'coverage.xml') GITLINK_REMOTE = 'https://github.com/canton7/stylet' NUSPEC = 'NuGet/Stylet.nuspec' +ASSEMBLY_INFO = 'Stylet/Properties/AssemblyInfo.cs' + directory COVERAGE_DIR desc "Build Stylet.sln using the current CONFIG (or Debug)" @@ -108,6 +110,22 @@ task :package do end end +desc "Bump version number" +task :version, [:version] do |t, args| + parts = args[:version].split('.') + parts << '0' if parts.length == 3 + version = parts.join('.') + + content = IO.read(ASSEMBLY_INFO) + content[/^\[assembly: AssemblyVersion\(\"(.+?)\"\)\]/, 1] = version + content[/^\[assembly: AssemblyFileVersion\(\"(.+?)\"\)\]/, 1] = version + File.open(ASSEMBLY_INFO, 'w'){ |f| f.write(content) } + + content = IO.read(NUSPEC) + content[/(.+?)<\/version>/, 1] = args[:version] + File.open(NUSPEC, 'w'){ |f| f.write(content) } +end + desc "Extract StyletIoC as a standalone file" task :"extract-stylet-ioc" do filenames = Dir['Stylet/StyletIoC/**/*.cs'] @@ -151,3 +169,4 @@ task :"extract-stylet-ioc" do # puts merged_contents end +