Skip to content

Instantly share code, notes, and snippets.

@NP-komplett
Created March 16, 2012 09:33
Show Gist options
  • Save NP-komplett/2049284 to your computer and use it in GitHub Desktop.
Save NP-komplett/2049284 to your computer and use it in GitHub Desktop.
namespace :deploy do
desc "create imagehandler dirs"
task :create_dirs, :roles => :app do
@config=YAML.load_file('config/imagehandler_config.yml')["production"]
@config.keys.each do |key|
val = @config[key]
if val.is_a?(Hash) && val.keys.include?(:image_sizes)
val[:image_sizes].each do |name,val|
topdir = sprintf("%s/%s/",@config[:dirs][:image_storage_top_level_dir] ,name.to_s)
run "for dir in {{a..f},{0..9}}{{a..f},{0..9}} ; do mkdir -p #{topdir}/$folder/$dir/{{a..f},{0..9}}{{a..f},{0..9}} ; done "
run "#{sudo} chmod -R 775 #{topdir}"
end
end
end
end
end
after "deploy:setup", "deploy:create_custom_dirs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment