Skip to content

Commit c1db0cc

Browse files
committed
Corrigido erro para quando não tem nenhuma instancia InService
1 parent 83bd959 commit c1db0cc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/tasks/aws_deploy.rake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ namespace :aws_deploy do
4646
aws_inform "Verificando se o deploy possui novas migrations..."
4747

4848
instance = AwsDeploy::Instance.new(credentials).find_all_in_service.first
49-
remote_migrations_count = `ssh #{instance[:dns_name]} "ls -1 #{app_path}db/migrate/*.rb | wc -l"`.strip
50-
local_migrations_count = `ls -1 #{Rails.root}/db/migrate/*.rb | wc -l`.strip
49+
unless instance.nil?
50+
remote_migrations_count = `ssh #{instance[:dns_name]} "ls -1 #{app_path}db/migrate/*.rb | wc -l"`.strip
51+
local_migrations_count = `ls -1 #{Rails.root}/db/migrate/*.rb | wc -l`.strip
5152

52-
if remote_migrations_count != local_migrations_count
53-
raise "O deploy possui novas migrations, você não pode usar a opção 'fast'!"
53+
if remote_migrations_count != local_migrations_count
54+
raise "O deploy possui novas migrations, você não pode usar a opção 'fast'!"
55+
end
5456
end
5557
end
5658

0 commit comments

Comments
 (0)