Add sample option on import rake task
This commit is contained in:
parent
07ff99e135
commit
d665a85591
@ -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'
|
desc 'Import a remote template described by its URL -- 2 options: SITE=name or id, RESET=by default false'
|
||||||
task :import => :environment do
|
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?
|
if url.blank? || (url =~ /https?:\/\//).nil?
|
||||||
raise "URL is missing or it is not a valid http url."
|
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."
|
raise "No site found. Please give a correct value (name or id) for the SITE env variable."
|
||||||
end
|
end
|
||||||
|
|
||||||
::Locomotive::Import::Job.run!(url, site, { :samples => true, :reset => reset })
|
::Locomotive::Import::Job.run!(url, site, { :samples => samples, :reset => reset })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
desc 'Add a new admin user (NOTE: currently only supports adding user to first site)'
|
desc 'Add a new admin user (NOTE: currently only supports adding user to first site)'
|
||||||
task :add_admin => :environment do
|
task :add_admin => :environment do
|
||||||
name = ask('Display name: ') { |q| q.echo = true }
|
name = ask('Display name: ') { |q| q.echo = true }
|
||||||
|
Loading…
Reference in New Issue
Block a user