Class: Bozo::Preparers::CommonAssemblyInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/bozo/preparers/common_assembly_info.rb

Instance Method Summary collapse

Instance Method Details

#company_name(name) ⇒ Object



5
6
7
# File 'lib/bozo/preparers/common_assembly_info.rb', line 5

def company_name(name)
  @company_name = name
end

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bozo/preparers/common_assembly_info.rb', line 9

def execute
  log_info 'Generating common assembly info'

  git_hash = env['GIT_HASH_FULL']
  computer_name = env['COMPUTERNAME']
  trademark = computer_name ? "#{computer_name} #{git_hash}" : git_hash
  path = File.expand_path(File.join('build', 'CommonAssemblyInfo.cs'))
  build_version = env['BUILD_VERSION']
  build_version_full = env['BUILD_VERSION_FULL']

  log_debug "Version: #{version}"
  log_debug "Information Version: #{build_version}"
  log_debug "Commit hash: #{git_hash}"
  log_debug "Computer name: #{computer_name}" if computer_name
  log_debug "Path: #{path}"

  File.open(path, 'w+') do |f|
    f << "using System.Reflection;\n"
    f << "\n"
    f << "[assembly: AssemblyCompany(\"#{@company_name}\")]\n"
    f << "[assembly: AssemblyVersion(\"#{build_version}\")]\n"
    f << "[assembly: AssemblyFileVersion(\"#{build_version}\")]\n"
    f << "[assembly: AssemblyInformationalVersion(\"#{build_version_full}\")]\n"
    f << "[assembly: AssemblyTrademark(\"#{trademark}\")]"
  end
end