Class: GitHandler::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/git_handler/configuration.rb

Constant Summary collapse

DEFAULT_USER =
'git'
DEFAULT_HOME =
'/home/git'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Configuration

Initialize a new Configuration instance with options hash

Valid options:

:user         - Git user (git)
:home_path    - Git user home path (/home/git)
:repos_path   - Path to repositories (/home/git/repositories)
:log          - Log requests (true)
:log_path     - Git access log path (/home/git/access.log)
:raise_errors - Raise errors (true)

Parameters:

  • options (Hash) (defaults to: {})

    options hash



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/git_handler/configuration.rb', line 35

def initialize(options={})
  @user         = options[:user]         || DEFAULT_USER
  @home_path    = options[:home_path]    || DEFAULT_HOME
  @repos_path   = options[:repos_path]   || File.join(@home_path, 'repositories')
  @log_path     = options[:log_path]     || File.join(@home_path, 'access.log')

  @log = true
  @raise_errors = true

  @log = false if options[:log] == false
  @raise_errors = false if options[:raise_errors] == false
end

Instance Attribute Details

#home_pathString (readonly)

Returns Full path to home directory.

Returns:

  • (String)

    Full path to home directory



10
11
12
# File 'lib/git_handler/configuration.rb', line 10

def home_path
  @home_path
end

#logBoolean (readonly)

Returns Log requests.

Returns:

  • (Boolean)

    Log requests



19
20
21
# File 'lib/git_handler/configuration.rb', line 19

def log
  @log
end

#log_pathString (readonly)

Returns Full path to log file.

Returns:

  • (String)

    Full path to log file



16
17
18
# File 'lib/git_handler/configuration.rb', line 16

def log_path
  @log_path
end

#raise_errorsBoolean (readonly)

Returns Raise errors for home and repository path.

Returns:

  • (Boolean)

    Raise errors for home and repository path



22
23
24
# File 'lib/git_handler/configuration.rb', line 22

def raise_errors
  @raise_errors
end

#repos_pathString (readonly)

Returns Full path to repositories directory.

Returns:

  • (String)

    Full path to repositories directory



13
14
15
# File 'lib/git_handler/configuration.rb', line 13

def repos_path
  @repos_path
end

#userString (readonly)

Returns Git user name.

Returns:

  • (String)

    Git user name



7
8
9
# File 'lib/git_handler/configuration.rb', line 7

def user
  @user
end