Mina: Pas de cache pour le bundler

Créé le 24 sept. 2016  ·  3Commentaires  ·  Source: mina-deploy/mina

J'utilise ce script (il est mis à jour depuis mina 0.3)

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'

set :shared_dirs, %w(log public/uploads node_modules)
set :current_path, 'current'
set :term_mode, nil

task :environment do
  invoke :'rbenv:load'
end

task setup: :environment do
  command %[mkdir -p "#{fetch(:shared_path)}/log"]
  command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/log"]

  command %[mkdir -p "#{fetch(:shared_path)}/public/uploads"]
  command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/public/uploads"]
  command %[mkdir -p "#{fetch(:shared_path)}/node_modules"]
  command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/node_modules"]
end

desc 'Deploys the current version to the server.'
task deploy: :environment do
  deploy do
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'npm_install'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    on :launch do
      command "mkdir -p #{fetch(:current_path)}/tmp/"
      command "touch #{fetch(:current_path)}/tmp/restart.txt"
    end
  end
end

task :restart do
  command "touch #{fetch(:current_path)}/tmp/restart.txt"
end

task :logs do
  command 'echo "Contents of the log file are as follows:"'
  command "tail -f #{fetch(:current_path)}/log/#{fetch(:rails_env)}.log"
end

task :npm_install do
  command 'npm install --production'
end

Le problème est que - bundle install télécharge toutes les gemmes à partir de zéro à chaque fois que le déploiement est terminé. Cela fonctionnait bien sur la version 0.3.

Une idée de ce que je fais mal?

Commentaire le plus utile

Ok, j'ai découvert ce qui posait problème. Dans la version 1, nous devons ajouter à shared_dirs au lieu de créer une table entière. J'ai donc fait :

set :shared_dirs, fetch(:shared_dirs, []).push('log').push('public/uploads').push('node_modules')

et ça marche maintenant

Tous les 3 commentaires

Ok, j'ai découvert ce qui posait problème. Dans la version 1, nous devons ajouter à shared_dirs au lieu de créer une table entière. J'ai donc fait :

set :shared_dirs, fetch(:shared_dirs, []).push('log').push('public/uploads').push('node_modules')

et ça marche maintenant

Merci! J'avais le même problème !

Je ne veux pas ajouter à un fil fermé, mais vous pouvez également faire quelque chose comme ceci :

shared_dires = %w{log public/uploads node_modules}
set :shared_dirs, fetch(:shared_dirs, []).push(*shared_dirs)
Cette page vous a été utile?
0 / 5 - 0 notes