Class: IronHammer::Projects::AssemblyInfo
- Inherits:
-
Object
- Object
- IronHammer::Projects::AssemblyInfo
- Defined in:
- lib/iron_hammer/projects/assembly_info.rb
Instance Method Summary collapse
-
#initialize(filename) ⇒ AssemblyInfo
constructor
A new instance of AssemblyInfo.
- #version ⇒ Object
- #version=(new_version) ⇒ Object
Constructor Details
#initialize(filename) ⇒ AssemblyInfo
Returns a new instance of AssemblyInfo.
6 7 8 |
# File 'lib/iron_hammer/projects/assembly_info.rb', line 6 def initialize filename @filename = filename end |
Instance Method Details
#version ⇒ Object
10 11 12 13 |
# File 'lib/iron_hammer/projects/assembly_info.rb', line 10 def version matches = file.match /^\[assembly: AssemblyVersion\("(.*)"\)\]$/ matches[1] if matches end |
#version=(new_version) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/iron_hammer/projects/assembly_info.rb', line 15 def version= new_version content = file File.open(@filename, 'w') do |f| content.each_line do |line| line.gsub!(/^(\[assembly: Assembly(File)?Version\(").*("\)\])$/) do |match| "#{$1}#{new_version}#{$3}" end f << line end end end |