mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
rake task for refreshing thumbnails
This commit is contained in:
parent
88503191bd
commit
2368ec2b89
1 changed files with 17 additions and 0 deletions
17
Rakefile
17
Rakefile
|
@ -183,6 +183,23 @@ task :update_screenshots => [:environment] do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'rebuild_thumbnails'
|
||||||
|
task :rebuild_thumbnails => [:environment] do
|
||||||
|
dirs = Dir[Site::SITE_FILES_ROOT+'/**/*'].collect {|s| s.sub(Site::SITE_FILES_ROOT, '')}.collect {|s| s.sub('/', '')}
|
||||||
|
dirs.each do |d|
|
||||||
|
next if File.directory?(d)
|
||||||
|
|
||||||
|
full_path = d.split('/')
|
||||||
|
|
||||||
|
username = full_path.first
|
||||||
|
path = '/'+full_path[1..full_path.length].join('/')
|
||||||
|
|
||||||
|
if Pathname(path).extname.gsub('.', '').match Site::IMAGE_REGEX
|
||||||
|
ThumbnailWorker.new.perform username, path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
desc 'prime_space_used'
|
desc 'prime_space_used'
|
||||||
task :prime_space_used => [:environment] do
|
task :prime_space_used => [:environment] do
|
||||||
Site.select(:id,:username,:space_used).all.each do |s|
|
Site.select(:id,:username,:space_used).all.each do |s|
|
||||||
|
|
Loading…
Add table
Reference in a new issue