class Nginx::Builder::Site

Public Class Methods

new(user, *server_blocks, domain: nil) click to toggle source
Calls superclass method Nginx::Builder::Base::new
# File lib/shared_infrastructure/nginx/builder.rb, line 103
def initialize(user, *server_blocks, domain: nil)
  super(*server_blocks, domain: domain)
  @user = user
end

Public Instance Methods

save() click to toggle source
Calls superclass method Nginx::Builder::Base#save
# File lib/shared_infrastructure/nginx/builder.rb, line 108
def save
  domain_root = SharedInfrastructure::Output.file_name(domain.root)
  FileUtils.mkdir_p(domain_root)
  if Process.uid.zero?
    FileUtils.chown(user,
      "www-data",
      domain_root)
  end
  # Set the directory gid bit, so files created inside inherit the group.
  File.chmod(File.stat(domain_root).mode | 0o2000, domain_root)
  super
end
user() click to toggle source
# File lib/shared_infrastructure/nginx/builder.rb, line 121
def user
  @user ||= Etc.getlogin
end