Class: GitHandler::Configuration
- Inherits:
-
Object
- Object
- GitHandler::Configuration
- Defined in:
- lib/git_handler/configuration.rb
Constant Summary collapse
- DEFAULT_USER =
'git'- DEFAULT_HOME =
'/home/git'
Instance Attribute Summary collapse
-
#home_path ⇒ String
readonly
Full path to home directory.
-
#log ⇒ Boolean
readonly
Log requests.
-
#log_path ⇒ String
readonly
Full path to log file.
-
#raise_errors ⇒ Boolean
readonly
Raise errors for home and repository path.
-
#repos_path ⇒ String
readonly
Full path to repositories directory.
-
#user ⇒ String
readonly
Git user name.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Configuration
constructor
Initialize a new Configuration instance with options hash.
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)
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/git_handler/configuration.rb', line 35 def initialize(={}) @user = [:user] || DEFAULT_USER @home_path = [:home_path] || DEFAULT_HOME @repos_path = [:repos_path] || File.join(@home_path, 'repositories') @log_path = [:log_path] || File.join(@home_path, 'access.log') @log = true @raise_errors = true @log = false if [:log] == false @raise_errors = false if [:raise_errors] == false end |
Instance Attribute Details
#home_path ⇒ String (readonly)
Returns Full path to home directory.
10 11 12 |
# File 'lib/git_handler/configuration.rb', line 10 def home_path @home_path end |
#log ⇒ Boolean (readonly)
Returns Log requests.
19 20 21 |
# File 'lib/git_handler/configuration.rb', line 19 def log @log end |
#log_path ⇒ String (readonly)
Returns Full path to log file.
16 17 18 |
# File 'lib/git_handler/configuration.rb', line 16 def log_path @log_path end |
#raise_errors ⇒ Boolean (readonly)
Returns 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_path ⇒ String (readonly)
Returns Full path to repositories directory.
13 14 15 |
# File 'lib/git_handler/configuration.rb', line 13 def repos_path @repos_path end |
#user ⇒ String (readonly)
Returns Git user name.
7 8 9 |
# File 'lib/git_handler/configuration.rb', line 7 def user @user end |