module Capistrano::PumaCommon
Constants
- PumaBind
Public Instance Methods
compiled_template_puma(from, role)
click to toggle source
# File lib/capistrano/puma.rb, line 31 def compiled_template_puma(from, role) @role = role file = [ "lib/capistrano/templates/#{from}-#{role.hostname}-#{fetch(:stage)}.rb", "lib/capistrano/templates/#{from}-#{role.hostname}.rb", "lib/capistrano/templates/#{from}-#{fetch(:stage)}.rb", "lib/capistrano/templates/#{from}.rb.erb", "lib/capistrano/templates/#{from}.rb", "lib/capistrano/templates/#{from}.erb", "config/deploy/templates/#{from}.rb.erb", "config/deploy/templates/#{from}.rb", "config/deploy/templates/#{from}.erb", File.expand_path("../templates/#{from}.erb", __FILE__), File.expand_path("../templates/#{from}.rb.erb", __FILE__) ].detect { |path| File.file?(path) } erb = File.read(file) StringIO.new(ERB.new(erb, nil, '-').result(binding)) end
puma_bind()
click to toggle source
# File lib/capistrano/puma.rb, line 25 def puma_bind Array(fetch(:puma_bind)).collect do |bind| "bind '#{bind}'" end.join("\n") end
puma_binds()
click to toggle source
# File lib/capistrano/puma.rb, line 86 def puma_binds Array(fetch(:puma_bind)).map do |m| etype, address = /(tcp|unix|ssl):\/{1,2}(.+)/.match(m).captures PumaBind.new(m, etype.to_sym, address) end end
puma_switch_user(role, &block)
click to toggle source
# File lib/capistrano/puma.rb, line 6 def puma_switch_user(role, &block) user = puma_user(role) if user == role.user block.call else backend.as user do block.call end end end
puma_user(role)
click to toggle source
# File lib/capistrano/puma.rb, line 17 def puma_user(role) properties = role.properties properties.fetch(:puma_user) || # local property for puma only fetch(:puma_user) || properties.fetch(:run_as) || # global property across multiple capistrano gems role.user end
template_puma(from, to, role)
click to toggle source
# File lib/capistrano/puma.rb, line 50 def template_puma(from, to, role) backend.upload! compiled_template_puma(from, role), to end