lib/magic_recipes/assets.rb in magic_recipes-0.1.10 vs lib/magic_recipes/assets.rb in magic_recipes-0.1.11

- old
+ new

@@ -41,10 +41,11 @@ and getting a 404 file not found error. The assets cache is shared \ for efficiency. If you customize the assets path prefix, override the \ :assets_prefix variable to match. DESC task :symlink, :roles => assets_role, :except => { :no_release => true } do + # => sudo chown <username> . run <<-CMD #{sudo if use_sudo} rm -rf #{latest_release}/public/#{assets_prefix} && #{sudo if use_sudo} mkdir -p #{latest_release}/public && #{sudo if use_sudo} mkdir -p #{shared_path}/assets && #{sudo if use_sudo} ln -s #{shared_path}/assets #{latest_release}/public/#{assets_prefix} @@ -60,28 +61,38 @@ set :rake, "rake" set :rails_env, "production" set :asset_env, "RAILS_GROUPS=assets" DESC task :precompile, :roles => assets_role, :except => { :no_release => true } do - # run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile" if make_pulbic_folder_public chmod end if use_rvm run <<-CMD #{rvm_cmd} && cd #{latest_release} && - #{"#{sudo} -i -u #{user}" if use_sudo} #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile + #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile CMD else - run "cd #{latest_release} && #{"#{sudo} -i -u #{user}" if use_sudo} #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile" + run <<-CMD + cd #{latest_release} && + #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile + CMD end end desc "make the public folder public for all (777)" task :chmod, :roles => assets_role, :except => { :no_release => true } do - run "cd #{latest_release} && #{sudo} chmod -R 777 public/ && #{sudo} chmod -R 777 tmp/" + run <<-CMD + cd #{latest_release} && + #{sudo} chmod -R 777 public/ && + #{sudo} chmod -R 777 tmp/ + CMD + run <<-CMD + cd #{shared_path} && + #{sudo} chmod -R 777 assets/ + CMD end desc <<-DESC Run the asset clean rake task. Use with caution, this will delete \ all of your compiled assets. You can specify the full path \ @@ -92,10 +103,24 @@ set :rake, "rake" set :rails_env, "production" set :asset_env, "RAILS_GROUPS=assets" DESC task :clean, :roles => assets_role, :except => { :no_release => true } do - run "cd #{latest_release} && #{"#{sudo} -i -u #{user}" if use_sudo} #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:clean" + if make_pulbic_folder_public + chmod + end + if use_rvm + run <<-CMD + #{rvm_cmd} && + cd #{latest_release} && + #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:clean + CMD + else + run <<-CMD + cd #{latest_release} && + #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:clean + CMD + end end end end end \ No newline at end of file