allow serialno pinning of jamblaster artifacts
This commit is contained in:
parent
edcd297092
commit
c43b6cb1b9
|
|
@ -30,11 +30,17 @@ ActiveAdmin.register JamRuby::SaleLineItem, :as => 'Sale Line Items' do
|
|||
end
|
||||
end
|
||||
column 'Source' do |oo|
|
||||
oo.sale.source
|
||||
if oo.sale.source == JamRuby::Sale::SOURCE_PAYPAL
|
||||
link_to(oo.sale.source, 'https://history.paypal.com/webscr?cmd=_history-details-from-hub&id=' + oo.sale.recurly_invoice_id)
|
||||
else
|
||||
oo.sale.source
|
||||
end
|
||||
end
|
||||
column 'When' do |oo|
|
||||
oo.created_at
|
||||
end
|
||||
column 'Link' do |oo|
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -4,23 +4,36 @@ class ArtifactsController < ApiController
|
|||
|
||||
# retrieve all available client downloads
|
||||
def client_downloads
|
||||
clients = ArtifactUpdate.where("product like '%JamClient%' and environment = '#{ArtifactUpdate::DEFAULT_ENVIRONMENT}'").order(:product)
|
||||
|
||||
if params[:type]
|
||||
clients = clients.where("product ilike 'JamClient/#{params[:type]}'")
|
||||
# jamblaster specifies this params[:type]
|
||||
is_jamblaster = params[:type] && params[:serialno]
|
||||
|
||||
if params[:serialno]
|
||||
Jamblaster.bootstrap(params[:serialno])
|
||||
if is_jamblaster
|
||||
# check and see if there is a build just for this JB
|
||||
clients = ArtifactUpdate.where('product = ? and environment = ?', "JamClient/#{params[:type]}", params[:serialno]).order(:product)
|
||||
if clients.count == 0
|
||||
# if not, then fine, give back the default environment
|
||||
clients = ArtifactUpdate.where('product = ? and environment = ?', "JamClient/#{params[:type]}", ArtifactUpdate::DEFAULT_ENVIRONMENT).order(:product)
|
||||
end
|
||||
else
|
||||
clients = ArtifactUpdate.where("product like '%JamClient%' and environment = '#{ArtifactUpdate::DEFAULT_ENVIRONMENT}'").order(:product)
|
||||
end
|
||||
|
||||
if is_jamblaster && params[:serialno]
|
||||
Jamblaster.bootstrap(params[:serialno])
|
||||
end
|
||||
|
||||
|
||||
#Parameters: {"serialno"=>"NCA-001-160602-00084", "version"=>"dev-20161120-153542", "type"=>"jamblaster"}
|
||||
#Parameters: {"serialno"=>"NCA-001-160602-00084", "version"=>"dev-20161120-153542", "type"=>"jamblasterclient"}
|
||||
|
||||
result = {}
|
||||
|
||||
clients.each do |client|
|
||||
url = client.determine_url
|
||||
if params[:type]
|
||||
|
||||
# jamblaster specifies this params[:type]
|
||||
if is_jamblaster
|
||||
result[params[:type]] = { :uri => url, :size => client.size, :version => client.version, :md5 => client.sha1}
|
||||
else
|
||||
result[client.product] = { :uri => url, :size => client.size, :version => client.version, :md5 => client.sha1}
|
||||
|
|
|
|||
Loading…
Reference in New Issue