Skip to content

How to prevent delete uploaded images(by paperclip) when depoly? #460

Description

@ChangJoo-Park

Hello I use mina with paperclip.

...
set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml')
set :shared_dirs, fetch(:shared_dirs, []).push('public/system')
...
desc "Deploys the current version to the server."
task :deploy do
  # uncomment this line to make sure you pushed your local branch to the remote origin
  # invoke :'git:ensure_pushed'
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'

    fetch(:shared_dirs, []).each do |linked_dir|
      command %{mkdir -p #{File.dirname("./#{linked_dir}")}}
      command %{rm -rf "./#{linked_dir}"}
      command %{ln -s "#{fetch(:shared_path)}/#{linked_dir}" "./#{linked_dir}"}
    end

    # Workaround for https://github.com/mina-deploy/mina/issues/452
    fetch(:shared_files, []).each do |linked_path|
      command %{rm -f "./#{linked_path}"}
    end

    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    on :launch do
      command "sudo service #{fetch(:user)} restart"
    end
  end

  # you can use `run :local` to run tasks on local machine before of after the deploy scripts
  # run :local { say 'done' }
end

...

this is my deploy.rb

How can I prevent from removing my uploaded images?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions