Class: Pechkin::Command::AddAuth

Inherits:
Base
  • Object
show all
Defined in:
lib/pechkin/command/add_auth.rb

Overview

Read user:password combination and write it to htpasswd file. If file already contains user then record will be replaced

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#configuration, #handler, #initialize, #puts, #warn

Constructor Details

This class inherits a constructor from Pechkin::Command::Base

Instance Method Details

#executeObject



10
11
12
13
14
# File 'lib/pechkin/command/add_auth.rb', line 10

def execute
  user, password = options.add_auth.split(':')
  Pechkin::Auth::Manager.new(options.htpasswd).add(user, password)
  puts IO.read(options.htpasswd)
end

#matches?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/pechkin/command/add_auth.rb', line 6

def matches?
  options.add_auth
end