From d665a855912a77e676955cb411b05c6f48bed2e7 Mon Sep 17 00:00:00 2001 From: Gil Vandendriessche Date: Tue, 17 Jan 2012 11:24:54 +0100 Subject: [PATCH] Add sample option on import rake task --- lib/tasks/locomotive.rake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tasks/locomotive.rake b/lib/tasks/locomotive.rake index a36f5a70..2182ec2c 100644 --- a/lib/tasks/locomotive.rake +++ b/lib/tasks/locomotive.rake @@ -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 }