lib/tasks/setup.rb in dev-2.0.164 vs lib/tasks/setup.rb in dev-2.0.165
- old
+ new
@@ -50,13 +50,27 @@
end
if(defined?(VERSION))
#Text.replace_in_file('HelloLibrary.nuspec',/<version>[\d.]+<\/version>/,"<version>#{VERSION}</version>")
Dir.glob('*.nuspec').each{|nuspec|
- add "<%Text.replace_in_file('#{nuspec}',/<version>[\d.]+<\/version>/,'<version>#{VERSION}</version>%>'"
+ #published_version = `gem list -r #{spec.name}`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
+ current_version=IO.read(nuspec).scan(/<version>[\d.]+<\/version>/)[0][0]
+ if(current_version.include?('<version>'))
+ target_version="<version>#{VERSION}</version>"
+ if(current_version != target_version)
+ add "<%Text.replace_in_file('#{nuspec}','#{current_version}','#{target_version}')%>"
+ end
+ end
+ #add "<%Text.replace_in_file('#{nuspec}',/<version>[\d.]+<\/version>/,'<version>#{VERSION}</version>%>'"
}
Dir.glob('**/AssemblyInfo.cs').each{|assemblyInfo|
- add "<%Text.replace_in_file('#{assemblyInfo}',Version\(\"[\d.]+\"\),'Version(\"#{VERSION}\")'"
+ current_version=IO.read(assemblyInfo).scan(/Version\(\"[\d.]+\"\)/)[0][0]
+ if(current_version.include?('Version('))
+ target_version="Version(\"#{VERSION}\")"
+ if(current_version != target_version)
+ add "<%Text.replace_in_file('#{assemblyInfo}','#{current_version}','#{target_version}'%>"
+ end
+ end
}
end
end
end
\ No newline at end of file