<commit_before>require File.join(File.dirname(__FILE__), 'libs/albacore/albacore.rb')

def get_version_from_file
	file = File.new('VERSION','r')
	return file.gets.chomp
end

BASE_VERSION = get_version_from_file

CONFIGURATION			= :Release

ROOT_DIR				= File.dirname(__FILE__) + "/"
SRC_PATH				= ROOT_DIR + "src/"
LIBS_PATH				= ROOT_DIR + "libs/"
OUTPUT_PATH				= ROOT_DIR + "bin/"
DIST_PATH				= ROOT_DIR + "dist/"
TEST_OUTPUT_PATH		= ROOT_DIR + "bin/Tests/"
XUNIT32_CONSOLE_PATH	= LIBS_PATH + "xunit-1.6.1/xunit.console.clr4.x86.exe"
DOTNET_VERSION			= :net40
CI_BUILD_NUMBER_PARAM_NAME = 'BUILD_NUMBER'

begin
	gitcommit = `git log -1 --pretty=format:%H`
rescue
	gitcommit = "nogit"
end

NIGHTLY = ENV['NIGHTLY'].nil? ? 'true' : ENV['NIGHTLY']

CI_BUILD_NUMBER = ENV[CI_BUILD_NUMBER_PARAM_NAME] || 0

if ENV[CI_BUILD_NUMBER_PARAM_NAME] == nil || NIGHTLY.downcase == 'true' then
	# if we are not running under teamcity or someother CI like hudson.
	# or if nightly is true.
	# generate the version number based on VERSION file.
	VERSION_NO = "#{BASE_VERSION}.#{CI_BUILD_NUMBER}"
else
	# if we are running inside teamcity, then it passes the full version
	# so ignore the VERSION file and overwrite the VERSION_NO and VERSION_LONG
	VERSION_NO = ENV['BUILD_NUMBER']
end

if NIGHTLY then
	VERSION_LONG = "#{VERSION_NO}-nightly-#{gitcommit[0..5]}" 
else
	VERSION_LONG = "#{VERSION_NO}-#{gitcommit[0..5]}" 
end

puts
puts "Base Version: #{BASE_VERSION}"
puts "Version Number: #{VERSION_NO}   :  #{VERSION_LONG} "
print "CI Build Number: "
print CI_BUILD_NUMBER
print " (not running under CI mode)" if CI_BUILD_NUMBER == 0
puts
puts "Git Commit Hash: #{gitcommit}"
puts

task :default => :full

task :full => [:build_release,:test,:precompile_samples_webapplication,:package_binaries]

desc "Run Tests"
task :test => [:main_test]

desc "Prepare build"<commit_msg>* rakefile nightly<commit_after>require File.join(File.dirname(__FILE__), 'libs/albacore/albacore.rb')

def get_version_from_file
	file = File.new('VERSION','r')
	return file.gets.chomp
end

BASE_VERSION = get_version_from_file

CONFIGURATION			= :Release

ROOT_DIR				= File.dirname(__FILE__) + "/"
SRC_PATH				= ROOT_DIR + "src/"
LIBS_PATH				= ROOT_DIR + "libs/"
OUTPUT_PATH				= ROOT_DIR + "bin/"
DIST_PATH				= ROOT_DIR + "dist/"
TEST_OUTPUT_PATH		= ROOT_DIR + "bin/Tests/"
XUNIT32_CONSOLE_PATH	= LIBS_PATH + "xunit-1.6.1/xunit.console.clr4.x86.exe"
DOTNET_VERSION			= :net40
CI_BUILD_NUMBER_PARAM_NAME = 'BUILD_NUMBER'

begin
	gitcommit = `git log -1 --pretty=format:%H`
rescue
	gitcommit = "nogit"
end

NIGHTLY = ENV['NIGHTLY'].nil? ? 'true' : ENV['NIGHTLY'].downcase

CI_BUILD_NUMBER = ENV[CI_BUILD_NUMBER_PARAM_NAME] || 0

if ENV[CI_BUILD_NUMBER_PARAM_NAME] == nil || NIGHTLY == 'true' then
	# if we are not running under teamcity or someother CI like hudson.
	# or if nightly is true.
	# generate the version number based on VERSION file.
	VERSION_NO = "#{BASE_VERSION}.#{CI_BUILD_NUMBER}"
else
	# if we are running inside teamcity, then it passes the full version
	# so ignore the VERSION file and overwrite the VERSION_NO and VERSION_LONG
	VERSION_NO = ENV['BUILD_NUMBER']
end

if NIGHTLY == 'true' then
	VERSION_LONG = "#{VERSION_NO}-nightly-#{gitcommit[0..5]}" 
else
	VERSION_LONG = "#{VERSION_NO}-#{gitcommit[0..5]}" 
end

puts
puts "Base Version: #{BASE_VERSION}"
puts "Version Number: #{VERSION_NO}   :  #{VERSION_LONG} "
print "CI Build Number: "
print CI_BUILD_NUMBER
print " (not running under CI mode)" if CI_BUILD_NUMBER == 0
puts
puts "Git Commit Hash: #{gitcommit}"
puts

task :default => :full

task :full => [:build_release,:test,:precompile_samples_webapplication,:package_binaries]

desc "Run Tests"
task :test => [:main_test]

desc "Prepare build"
{'fraction_non_alphanumeric': 0.12603692801712604, 'fraction_numerical': 0.009098207118009098, 'mean_word_length': 5.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1112707', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1420, 'n_words': 344}