Commit 8665c70d by Tensho Committed by Andrew Babichev

Move monit template render and upload method to monit.rake file

parent ffab78c8
......@@ -63,5 +63,24 @@ namespace :sneakers do
def sudo_if_needed(command)
fetch(:sneakers_monit_use_sudo) ? sudo(command) : execute(command)
end
def template_sneakers(from, to, role)
[
File.join('lib', 'capistrano', 'templates', "#{from}-#{role.hostname}-#{fetch(:stage)}.rb"),
File.join('lib', 'capistrano', 'templates', "#{from}-#{role.hostname}.rb"),
File.join('lib', 'capistrano', 'templates', "#{from}-#{fetch(:stage)}.rb"),
File.join('lib', 'capistrano', 'templates', "#{from}.rb.erb"),
File.join('lib', 'capistrano', 'templates', "#{from}.rb"),
File.join('lib', 'capistrano', 'templates', "#{from}.erb"),
File.expand_path("../../templates/#{from}.rb.erb", __FILE__),
File.expand_path("../../templates/#{from}.erb", __FILE__)
].each do |path|
if File.file?(path)
erb = File.read(path)
upload! StringIO.new(ERB.new(erb).result(binding)), to
break
end
end
end
end
end
......@@ -252,23 +252,4 @@ namespace :sneakers do
end
end
end
def template_sneakers(from, to, role)
[
File.join('lib', 'capistrano', 'templates', "#{from}-#{role.hostname}-#{fetch(:stage)}.rb"),
File.join('lib', 'capistrano', 'templates', "#{from}-#{role.hostname}.rb"),
File.join('lib', 'capistrano', 'templates', "#{from}-#{fetch(:stage)}.rb"),
File.join('lib', 'capistrano', 'templates', "#{from}.rb.erb"),
File.join('lib', 'capistrano', 'templates', "#{from}.rb"),
File.join('lib', 'capistrano', 'templates', "#{from}.erb"),
File.expand_path("../../templates/#{from}.rb.erb", __FILE__),
File.expand_path("../../templates/#{from}.erb", __FILE__)
].each do |path|
if File.file?(path)
erb = File.read(path)
upload! StringIO.new(ERB.new(erb).result(binding)), to
break
end
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment