Sha256: 92e170dab8bd5e67e01836dde5d5cc39671f85803fc3a87f8a7be26c0a0784a0
Contents?: true
Size: 1.4 KB
Versions: 7
Compression:
Stored size: 1.4 KB
Contents
module Assets class PrecompileLocalGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) argument :name, type: :string, default: "RaroCrud" def copy_initializer_file append_file 'config/deploy/production' do <<-RUBY namespace :deploy do task :restart, :roles => :app, :except => { :no_release => true } do run "cd #{current_path} && touch tmp/restart.txt" end namespace :assets do task :precompile, :roles => :web do from = source.next_revision(current_revision) run_locally("RAILS_ENV=production rake assets:clean && RAILS_ENV=production rake assets:precompile") run_locally "cd public && tar -jcf assets.tar.bz2 assets" top.upload "public/assets.tar.bz2", "#{shared_path}", :via => :scp run "rm -rf #{shared_path}/assets" run "cd #{shared_path} && tar -jxf assets.tar.bz2 && rm assets.tar.bz2" run_locally "rm public/assets.tar.bz2" run_locally("RAILS_ENV=production rake assets:clean") run_locally "rm -rf public/assets" run_locally "rm -rf tmp/cache/assets" end task :symlink, roles: :web do run ("rm -rf #{latest_release}/public/assets && mkdir -p #{latest_release}/public && mkdir -p #{shared_path}/assets && ln -s #{shared_path}/assets #{latest_release}/public/assets") end end end RUBY end end end end
Version data entries
7 entries across 7 versions & 1 rubygems