def add_application(name, type=nil, scale=nil, gear_profile='default', git_url=nil, region=nil)
if type.is_a?(Hash)
scale = type[:scale]
gear_profile = type[:gear_profile]
git_url = type[:initial_git_url]
tags = type[:tags]
region = type[:region]
type = Array(type[:cartridges] || type[:cartridge])
end
a = MockRestApplication.new(client, name, type, self, scale, gear_profile, git_url, nil, region)
builder = @applications.find{ |app| app.cartridges.map(&:name).any?{ |s| s =~ /^jenkins-[\d\.]+$/ } }
a.building_app = builder.name if builder
@applications << a
a.add_message("Success")
a
end