Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Generate theme production assets & upload them to the server
- namespace :deploy do
- set :local_app_path, Pathname.new(Dir.pwd)
- set :local_theme_path, fetch(:local_app_path).join('web/app/themes/', fetch(:theme_dir))
- set :local_dist_path, fetch(:local_theme_path).join('dist')
- task :generate do
- run_locally do
- within fetch(:local_theme_path) do
- execute :yarn, 'build:production'
- end
- end
- end
- task :upload do
- on roles(:web) do
- set :theme_path, fetch(:release_path).join('web/app/themes/', fetch(:theme_dir))
- set :remote_dist_path, -> { release_path.join(fetch(:theme_path)).join('dist') }
- puts "Your local distribution path: #{fetch(:local_dist_path)} "
- puts "Your remote distribution path: #{fetch(:remote_dist_path)} "
- puts "Uploading files to remote "
- upload! fetch(:local_dist_path).to_s, fetch(:remote_dist_path), recursive: true
- end
- end
- task assets: %w(generate upload)
- end
- ## Runs the above task before the deploy is updated
- after 'deploy:updated', 'deploy:assets'
- ###
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement