🚨Fix Rubocop lint errors

This commit is contained in:
Pranav Raj S
2019-10-20 14:17:26 +05:30
committed by GitHub
parent dd018f3682
commit 94c6d6db6f
124 changed files with 774 additions and 914 deletions

View File

@@ -1,46 +1,46 @@
if ['application', 'sidekiq', 'whenever'].include? node[:opsworks][:instance][:layers].first
rails_env = new_resource.environment["RAILS_ENV"]
shared_path = "#{new_resource.deploy_to}/shared"
if %w[application sidekiq whenever].include? node[:opsworks][:instance][:layers].first
rails_env = new_resource.environment['RAILS_ENV']
shared_path = "#{new_resource.deploy_to}/shared"
# key is rails app path, value is shared directory path
directories = {
'public/assets' => 'assets',
'tmp/cache' => 'tmp/cache'
}
# key is rails app path, value is shared directory path
directories = {
'public/assets' => 'assets',
'tmp/cache' => 'tmp/cache'
}
# creating directories and symlinking
directories.each do |_release_path, _shared_path|
directory "#{shared_path}/#{_shared_path}" do
mode 0770
action :create
recursive true
not_if do
Dir.exists?("#{shared_path}/#{_shared_path}")
end
end
link "#{release_path}/#{_release_path}" do
to "#{shared_path}/#{_shared_path}"
# creating directories and symlinking
directories.each do |_release_path, _shared_path|
directory "#{shared_path}/#{_shared_path}" do
mode 0o770
action :create
recursive true
not_if do
Dir.exist?("#{shared_path}/#{_shared_path}")
end
end
if node[:opsworks][:instance][:layers].first.eql?('application')
# precompile assets into public/assets (which is symlinked to shared assets folder)
# execute "rake assets:precompile" do
# cwd release_path
# command "bundle exec rake assets:precompile --trace"
# environment 'RAILS_ENV' => rails_env
# end
link "#{release_path}/#{_release_path}" do
to "#{shared_path}/#{_shared_path}"
end
end
#migrations
master_node = node[:opsworks][:layers]["application"][:instances].keys.sort.first if node[:opsworks][:layers] && node[:opsworks][:layers]["application"] && node[:opsworks][:layers]["application"][:instances]
if master_node && node[:opsworks][:instance][:hostname].include?(master_node)
execute "rake db:migrate" do
cwd release_path
command "bundle exec rake db:migrate --trace"
environment 'RAILS_ENV' => rails_env
end
if node[:opsworks][:instance][:layers].first.eql?('application')
# precompile assets into public/assets (which is symlinked to shared assets folder)
# execute "rake assets:precompile" do
# cwd release_path
# command "bundle exec rake assets:precompile --trace"
# environment 'RAILS_ENV' => rails_env
# end
# migrations
master_node = node[:opsworks][:layers]['application'][:instances].keys.min if node[:opsworks][:layers] && node[:opsworks][:layers]['application'] && node[:opsworks][:layers]['application'][:instances]
if master_node && node[:opsworks][:instance][:hostname].include?(master_node)
execute 'rake db:migrate' do
cwd release_path
command 'bundle exec rake db:migrate --trace'
environment 'RAILS_ENV' => rails_env
end
end
end
end