lib/capistrano/local_precompile.rb in capistrano-local-precompile-0.0.2 vs lib/capistrano/local_precompile.rb in capistrano-local-precompile-0.0.3

- old
+ new

@@ -4,12 +4,12 @@ module LocalPrecompile def self.load_into(configuration) configuration.load do - set(:precompile_cmd) { "#{fetch(:bundle_cmd, "bundle")} exec rake assets:precompile" } - set(:cleanexpired_cmd) { "#{fetch(:bundle_cmd, "bundle")} exec rake assets:clean_expired" } + set(:precompile_cmd) { "RAILS_ENV=#{rails_env.to_s.shellescape} #{asset_env} #{rake} assets:precompile" } + set(:cleanexpired_cmd) { "RAILS_ENV=#{rails_env.to_s.shellescape} #{asset_env} #{rake} assets:clean_expired" } set(:assets_dir) { "public/assets" } set(:turbosprockets_enabled) { false } set(:turbosprockets_backup_dir) { "public/.assets" } set(:rsync_cmd) { "rsync -av" } @@ -37,15 +37,19 @@ run_locally "#{fetch(:precompile_cmd)}" end desc "Precompile assets locally and then rsync to app servers" task :precompile, :only => { :primary => true }, :on_no_matching_servers => :continue do + + local_manifest_path = run_locally "ls #{assets_dir}/manifest*" + local_manifest_path.strip! + servers = find_servers :roles => assets_role, :except => { :no_release => true } servers.each do |srvr| run_locally "#{fetch(:rsync_cmd)} ./#{fetch(:assets_dir)}/ #{user}@#{srvr}:#{release_path}/#{fetch(:assets_dir)}/" + run_locally "#{fetch(:rsync_cmd)} ./#{local_manifest_path} #{user}@#{srvr}:#{release_path}/assets_manifest#{File.extname(local_manifest_path)}" end end - end end end end