Skip to content

Commit

Permalink
Official build versions are based on the teamcity.codebetter.com buil…
Browse files Browse the repository at this point in the history
…d number

- Major/minor/revision components stored in VERSION.txt
  • Loading branch information
joshuaflanagan committed Mar 15, 2011
1 parent 280e204 commit e66c7e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 32 deletions.
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BUILD_VERSION = "0.4.0"
44 changes: 12 additions & 32 deletions rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,37 @@

include FileTest
require 'albacore'
load "VERSION.txt"

RESULTS_DIR = "results"
BUILD_NUMBER_BASE = "0.4.0"
PRODUCT = "FubuMVC"
COPYRIGHT = 'Copyright 2008-2010 Chad Myers, Jeremy D. Miller, Joshua Flanagan, et al. All rights reserved.';
COMMON_ASSEMBLY_INFO = 'src/CommonAssemblyInfo.cs';
CLR_TOOLS_VERSION = "v4.0.30319"

props = { :stage => File.expand_path("build"), :artifacts => File.expand_path("artifacts") }

desc "Displays a list of tasks"
task :help do
taskHash = Hash[*(`rake.bat -T`.split(/\n/).collect { |l| l.match(/rake (\S+)\s+\#\s(.+)/).to_a }.collect { |l| [l[1], l[2]] }).flatten]

indent = " "

puts "rake #{indent}#Runs the 'default' task"

taskHash.each_pair do |key, value|
if key.nil?
next
end
puts "rake #{key}#{indent.slice(0, indent.length - key.length)}##{value}"
end
end
tc_build_number = ENV["BUILD_NUMBER"]
build_revision = tc_build_number || Time.new.strftime('5%H%M')
build_number = "#{BUILD_VERSION}.#{build_revision}"

desc "Compiles, unit tests, generates the database"
task :all => [:default]
props = { :stage => File.expand_path("build"), :artifacts => File.expand_path("artifacts") }

desc "**Default**, compiles and runs tests"
task :default => [:compile, :unit_test]

desc "Target used for the CI server"
task :ci => [:default,:package,:nuget]

desc "Update the version information for the build"
assemblyinfo :version do |asm|
asm_version = BUILD_NUMBER_BASE + ".0"
asm_version = BUILD_VERSION + ".0"

begin
commit = `git log -1 --pretty=format:%H`
rescue
commit = "git unavailable"
end
build_number = getBuildNumber
tc_build_number = ENV["BUILD_NUMBER"]
puts "##teamcity[buildNumber '#{build_number}-#{tc_build_number}']" unless tc_build_number.nil?
puts "##teamcity[buildNumber '#{build_number}']" unless tc_build_number.nil?
puts "Version: #{build_number}" if tc_build_number.nil?
asm.trademark = commit
asm.product_name = PRODUCT
asm.description = build_number
Expand All @@ -56,10 +43,6 @@
asm.copyright = COPYRIGHT
asm.output_file = COMMON_ASSEMBLY_INFO
end

def getBuildNumber
"#{BUILD_NUMBER_BASE}.#{Date.today.strftime('%y%j')}"
end

desc "Prepares the working directory for a new build"
task :clean do
Expand Down Expand Up @@ -131,9 +114,6 @@ def copyOutputFiles(fromDir, filePattern, outDir)
sh "src/fubu/bin/#{COMPILE_TARGET}/fubu.exe createvdir src/FubuMVC.HelloSpark hellospark"
end

desc "Target used for the CI server"
task :ci => [:default,:package,:nuget]

desc "ZIPs up the build results"
zip :package do |zip|
zip.directories_to_zip = [props[:stage]]
Expand All @@ -144,5 +124,5 @@ def copyOutputFiles(fromDir, filePattern, outDir)

desc "Build the nuget package"
task :nuget do
sh "lib/nuget.exe pack packaging/nuget/fubumvc.nuspec -o artifacts -Version #{getBuildNumber}"
sh "lib/nuget.exe pack packaging/nuget/fubumvc.nuspec -o #{props[:artifacts]} -Version #{build_number}"
end

0 comments on commit e66c7e9

Please sign in to comment.