Class: SmartCloud::User
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ User
constructor
A new instance of User.
Methods included from Logger
configure_logger_for, included, #logger, logger_for
Constructor Details
#initialize ⇒ User
Returns a new instance of User.
8 9 |
# File 'lib/smart_cloud/user.rb', line 8 def initialize end |
Class Method Details
.create_htpasswd_files ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/smart_cloud/user.rb', line 11 def self.create_htpasswd_files htpasswd_dirpath = "#{Dir.pwd}/grids/nginx/htpasswd" # Remove existing htpasswd_dirpath FileUtils.rm_r htpasswd_dirpath if Dir.exist?(htpasswd_dirpath) # Create new htpasswd_dirpath FileUtils.mkdir htpasswd_dirpath # Add hostfiles to htpasswd_dirpath self.get_users_from_file.each do |domainname, users| next unless users file_data = "" users.each do |user, password| file_data += "#{user}:#{BCrypt::Password.create(password)}\n" end File.open("#{Dir.pwd}/grids/nginx/htpasswd/#{domainname}", "w") { |file| file.write(file_data) } end end |