-
-
Save dsandstrom/4e6d118b4ca22e0fc7d40d40c5a8f22d to your computer and use it in GitHub Desktop.
Revisions
-
dsandstrom revised this gist
Jun 8, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ desc 'Copy assets manifest' task copy_manifest: [:set_rails_env] do on roles(fetch(:assets_roles, [:web])) do remote_dir = "#{fetch(:ssh_options).fetch(:user)}@#{host.hostname}:#{shared_path}/public/assets/" run_locally do begin @@ -48,7 +48,7 @@ # rsync to each server on roles(fetch(:assets_roles, [:web])) do # this needs to be done outside run_locally in order for host to exist remote_dir = "#{fetch(:ssh_options).fetch(:user)}@#{host.hostname}:#{shared_path}/public/assets/" run_locally do execute "rsync -av #{local_dir} #{remote_dir}" -
dsandstrom revised this gist
May 27, 2016 . No changes.There are no files selected for viewing
-
dsandstrom revised this gist
May 27, 2016 . 1 changed file with 38 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,39 +1,62 @@ # Runs rake assets:clean # Defaults to nil (no asset cleanup is performed) # If you use Rails 4+ and you'd like to clean up old assets after each deploy, # set this to the number of versions to keep set :keep_assets, 2 # Clear existing task so we can replace it rather than "add" to it. Rake::Task["deploy:compile_assets"].clear namespace :deploy do desc 'Compile assets' task :compile_assets => [:set_rails_env] do # invoke 'deploy:assets:precompile' invoke 'deploy:assets:copy_manifest' invoke 'deploy:assets:precompile_local' invoke 'deploy:assets:backup_manifest' end namespace :assets do local_dir = "./public/assets/" # Download the asset manifest file so a new one isn't generated. This makes # the app use the latest assets and gives Sprockets a complete manifest so # it knows which files to delete when it cleans up. desc 'Copy assets manifest' task copy_manifest: [:set_rails_env] do on roles(fetch(:assets_roles, [:web])) do remote_dir = "#{fetch(:user)}@#{host.hostname}:#{shared_path}/public/assets/" run_locally do begin execute "mkdir #{local_dir}" execute "scp '#{remote_dir}.sprockets-manifest-*' #{local_dir}" rescue # no manifest yet end end end end desc "Precompile assets locally and then rsync to web servers" task :precompile_local do # compile assets locally run_locally do execute "RAILS_ENV=#{fetch(:stage)} bundle exec rake assets:precompile" end # rsync to each server on roles(fetch(:assets_roles, [:web])) do # this needs to be done outside run_locally in order for host to exist remote_dir = "#{fetch(:user)}@#{host.hostname}:#{shared_path}/public/assets/" run_locally do execute "rsync -av #{local_dir} #{remote_dir}" end end # clean up run_locally { execute "rm -rf #{local_dir}" } end end end -
twetzel revised this gist
Sep 1, 2014 . 1 changed file with 31 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,39 @@ # Clear existing task so we can replace it rather than "add" to it. Rake::Task["deploy:compile_assets"].clear namespace :deploy do desc 'Compile assets' task :compile_assets => [:set_rails_env] do # invoke 'deploy:assets:precompile' invoke 'deploy:assets:precompile_local' invoke 'deploy:assets:backup_manifest' end namespace :assets do desc "Precompile assets locally and then rsync to web servers" task :precompile_local do # compile assets locally run_locally do execute "RAILS_ENV=#{fetch(:stage)} bundle exec rake assets:precompile" end # rsync to each server local_dir = "./public/assets/" on roles( fetch(:assets_roles, [:web]) ) do # this needs to be done outside run_locally in order for host to exist remote_dir = "#{host.user}@#{host.hostname}:#{release_path}/public/assets/" run_locally { execute "rsync -av --delete #{local_dir} #{remote_dir}" } end # clean up run_locally { execute "rm -rf #{local_dir}" } end end end -
Jesús Burgos Maciá revised this gist
Jul 30, 2014 . 1 changed file with 23 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,24 @@ # Clear existing task so we can replace it rather than "add" to it. Rake::Task["deploy:compile_assets"].clear desc "Precompile assets locally and then rsync to web servers" task :compile_assets do # compile assets locally run_locally do with rails_env: fetch(:stage) do execute :bundle, "exec rake assets:precompile" end end # rsync to each server local_dir = "./public/assets/" on roles(:web) do # this needs to be done outside run_locally in order for host to exist remote_dir = "#{host.user}@#{host.hostname}:#{shared_path}/public/assets/" run_locally { execute "rsync -av --delete #{local_dir} #{remote_dir}" } end # clean up run_locally { execute "rm -rf #{local_dir}" } end -
buntine renamed this gist
Jul 14, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
buntine created this gist
Jul 14, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ # Clear existing task so we can replace it rather than "add" to it. Rake::Task["deploy:compile_assets"].clear desc "Precompile assets locally and then rsync to web servers" task :compile_assets do on roles(:web) do rsync_host = host.to_s run_locally do with rails_env: :production do ## Set your env accordingly. execute :bundle, "exec rake assets:precompile" end execute "rsync -av --delete ./public/assets/ #{fetch(:user)}@#{rsync_host}:#{shared_path}/public/assets/" execute "rm -rf public/assets" # execute "rm -rf tmp/cache/assets" # in case you are not seeing changes end end end