Merge pull request #2950 from betagouv/remove-dev-tasks

Remove the dev tasks, they’re now in ds-cli
This commit is contained in:
LeSim 2018-11-05 17:54:56 +01:00 committed by GitHub
commit d9b978c322
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,32 +0,0 @@
namespace :dev do
def run_and_stop_if_error(cmd)
sh cmd do |ok, res|
if !ok
abort "#{cmd} failed with result : #{res.exitstatus}"
end
end
end
task :import_db do
filename = "tps_prod_#{1.day.ago.strftime("%d-%m-%Y")}.sql"
local_file = "/tmp/#{filename}"
if !File.exist?(local_file)
run_and_stop_if_error "scp -C db1:/data/backup/#{filename} #{local_file}"
end
dev_env_param = "RAILS_ENV=development"
Rake::Task["db:drop"].invoke(dev_env_param)
Rake::Task["db:create"].invoke(dev_env_param)
run_and_stop_if_error "psql tps_development -f #{local_file}"
Rake::Task["db:migrate"].invoke(dev_env_param)
Rake::Task["db:environment:set"].invoke(dev_env_param)
Rake::Task["db:test:prepare"].invoke
end
task :console do
exec("ssh tps@sgmap_production1 -t 'source /etc/profile && cd current && bundle exec rails c -e production'")
end
end