Add version task

This commit is contained in:
Antony Male 2015-09-08 22:10:11 +01:00
parent a90f1d3c2f
commit fc1198dae6
1 changed files with 19 additions and 0 deletions

View File

@ -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>(.+?)<\/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