Add sample option on import rake task

This commit is contained in:
Gil Vandendriessche 2012-01-17 11:24:54 +01:00 committed by Mario Visic
parent 07ff99e135
commit d665a85591

View File

@ -31,7 +31,7 @@ namespace :locomotive do
desc 'Import a remote template described by its URL -- 2 options: SITE=name or id, RESET=by default false'
task :import => :environment do
url, site_name_or_id, reset = ENV['URL'], ENV['SITE'], Boolean.set(ENV['RESET']) || false
url, site_name_or_id, samples, reset = ENV['URL'], ENV['SITE'], (Boolean.set(ENV['SAMPLES']) || false), (Boolean.set(ENV['RESET']) || false)
if url.blank? || (url =~ /https?:\/\//).nil?
raise "URL is missing or it is not a valid http url."
@ -43,9 +43,10 @@ namespace :locomotive do
raise "No site found. Please give a correct value (name or id) for the SITE env variable."
end
::Locomotive::Import::Job.run!(url, site, { :samples => true, :reset => reset })
::Locomotive::Import::Job.run!(url, site, { :samples => samples, :reset => reset })
end
desc 'Add a new admin user (NOTE: currently only supports adding user to first site)'
task :add_admin => :environment do
name = ask('Display name: ') { |q| q.echo = true }